Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#196 closed defect (fixed)

tiff decoder fails for monob if horizontal resolution is not a multiple of 8

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: tif
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

The resulting file out.tif is correctly displayed with ImageMagick, FFmpeg fails to decode it correctly (out.bmp is broken): Copy went out of bounds
This is the second problem mentioned in ticket 155.

$ ./ffmpeg -i tests/lena.pnm -s 249x256 -pix_fmt monob out.tif
ffmpeg version git-N-29871-g410ca3b, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 13 2011 12:23:10 with gcc 4.5.2
  configuration: --cc='/usr/local/gcc-4.5.2/bin/gcc -m32' --enable-gpl
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  5. 0 / 53.  5. 0
  libavformat  53.  0. 3 / 53.  0. 3
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  5. 0 /  2.  5. 0
  libswscale    0. 14. 0 /  0. 14. 0
Input #0, image2, from 'tests/lena.pnm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x8c8a3a0] w:256 h:256 pixfmt:rgb24 tb:1/1000000 sar:0/1
[scale @ 0x8c8ad00] w:256 h:256 fmt:rgb24 -> w:249 h:256 fmt:monob flags:0xa0000004
Output #0, image2, to 'out.tif':
  Metadata:
    encoder         : Lavf53.0.3
    Stream #0.0: Video: tiff, monob, 249x256, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=0.04 bitrate=  -4.4kbits/s
video:6kB audio:0kB global headers:0kB muxing overhead -100.360065%
$ ./ffmpeg -i out.tif out.bmp
ffmpeg version git-N-29871-g410ca3b, Copyright (c) 2000-2011 the FFmpeg developers
  built on May 13 2011 12:23:10 with gcc 4.5.2
  configuration: --cc='/usr/local/gcc-4.5.2/bin/gcc -m32' --enable-gpl
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  5. 0 / 53.  5. 0
  libavformat  53.  0. 3 / 53.  0. 3
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  5. 0 /  2.  5. 0
  libswscale    0. 14. 0 /  0. 14. 0
[tiff @ 0x8c9cce0] Copy went out of bounds
Input #0, image2, from 'out.tif':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: tiff, monob, 249x256, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x8c9cbc0] w:249 h:256 pixfmt:monob tb:1/1000000 sar:0/1
Output #0, image2, to 'out.bmp':
  Metadata:
    encoder         : Lavf53.0.3
    Stream #0.0: Video: bmp, monob, 249x256, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
[tiff @ 0x8c9cce0] Copy went out of bounds
frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=0.04 bitrate=  -4.4kbits/s
video:8kB audio:0kB global headers:0kB muxing overhead -100.266537%

Change History (3)

comment:1 by Carl Eugen Hoyos, 13 years ago

This is the second problem mentioned in ticket #193 (not 155).

comment:2 by Stefano Sabatini, 13 years ago

Analyzed by developer: set
Resolution: fixed
Status: newclosed

It was a problem in the encoder, fixed in commit:

commit 4d15f194b48ad1d92cca2559b6b0db3f0f234528
Author: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date: Fri May 13 02:07:09 2011 +0200

tiffenc: set bpp table for monow/monob formats


Also makes the bpp_tab non static const, as it needs to be changed in
this case.


Fix encoding of monow/monob images, fix trac issue #193.

comment:3 by Carl Eugen Hoyos, 12 years ago

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