Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#172 closed defect (fixed)

PNG 1bpp grayscale image decodes incorrectly

Reported by: ami_stuff Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: png roundup
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Issue 1416

Author: ami_stuff 	Date: 2009-09-25.23:20:46 	

Attached PNG image is 1bpp grayscale and decodes incorrectly.

This color mode (1bpp grayscale) seems to to be supported by FFmpeg.

pngdec.c:
"else if (s->bit_depth == 1 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = PIX_FMT_MONOBLACK;"

PS. I have also PNG 4bpp color/grayscale images which decodes incorrectly. If
there is a need I can upload.

--------

C:\>ffmpeg -i Test_1bpp_grayscale.png
FFmpeg version SVN-r19926, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-ming
w32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --e
nable-avisynth --enable-gpl --enable-zlib --enable-bzlib --enable-libgsm --enabl
e-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libsp
eex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroe
dinger --enable-libx264
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.35. 0 / 52.35. 0
  libavformat   52.38. 0 / 52.38. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Sep 20 2009 04:03:00, gcc: 4.2.4
Input #0, image2, from 'Test_1bpp_grayscale.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: png, pal8, 1024x768, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified
Author: kostya 	Date: 2009-09-28.05:57:15 	

quite probably PNG file says "palettized data with 1 bit per entry" 
and lavc PNG decoder still treats it as 8 bit per entry, so that 
condition you cited is not triggered because of different s-
>color_type

Attachments (1)

Test_1bpp_grayscale.png (65.6 KB ) - added by ami_stuff 14 years ago.

Download all attachments as: .zip

Change History (4)

by ami_stuff, 14 years ago

Attachment: Test_1bpp_grayscale.png added

comment:1 by Stefano Sabatini, 14 years ago

Analyzed by developer: set
Component: undeterminedavcodec
Reproduced by developer: set
Resolution: fixed
Status: newclosed

Fixed in commit:

commit 68bed67d2eaabcfa7eaf00442312055f7d953b69
Author: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date: Mon May 16 01:51:04 2011 +0200

pngdec: relax condition for setting monoblack pixel format


Ignore color_type information for setting the monoblack pixel format,
only rely on bit_depth.


In particular: fix Test_1bpp_grayscale.png from issue #172.


This may work fine for some broken encoder, and not for others.

comment:2 by Carl Eugen Hoyos, 13 years ago

Keywords: png added

comment:3 by Carl Eugen Hoyos, 12 years ago

Keywords: roundup added
Note: See TracTickets for help on using tickets.