Opened 11 years ago
Closed 11 years ago
#2943 closed defect (fixed)
libopenjpeg: black output
Reported by: | ami_stuff | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | libopenjpeg j2k |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
attached file decoded in the past with libopenjpeg, now there is only black output
C:\>ffmpeg -vcodec libopenjpeg -i lossy_gray_decomp_levels_5_bitslice_layers_7.jp2 out.bmp ffmpeg version N-56060-gbcd1c20 Copyright (c) 2000-2013 the FFmpeg developers built on Sep 6 2013 00:42:37 with gcc 4.7.3 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo- amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs -- enable-libxvid --enable-zlib libavutil 52. 43.100 / 52. 43.100 libavcodec 55. 31.101 / 55. 31.101 libavformat 55. 16.101 / 55. 16.101 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 83.104 / 3. 83.104 libswscale 2. 5.100 / 2. 5.100 libswresample 0. 17.103 / 0. 17.103 libpostproc 52. 3.100 / 52. 3.100 [jpeg2000 @ 029e4fe0] extra cblk styles 1 [jpeg2000 @ 029e4fe0] nonzerobits -1 invalid Input #0, image2, from 'lossy_gray_decomp_levels_5_bitslice_layers_7.jp2': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0:0: Video: jpeg2000 (JPEG 2000 codestream restriction 0), gray16le, 999x767, 25 tbr, 25 tbn, 25 tbc File 'out.bmp' already exists. Overwrite ? [y/N] y Output #0, image2, to 'out.bmp': Metadata: encoder : Lavf55.16.101 Stream #0:0: Video: bmp, gray, 999x767, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (libopenjpeg -> bmp) Press [q] to stop, [?] for help frame= 1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A video:750kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.002864%
Attachments (2)
Change History (8)
by , 11 years ago
Attachment: | lossy_gray_decomp_levels_5_bitslice_layers_7.jp2 added |
---|
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Please provide version (or even better console output) of a working binary.
Looks like 12bpc to me.
comment:3 by , 11 years ago
this seems to work:
C:\>ffmpeg -i lossy_gray_decomp_levels_5_bitslice_layers_7.jp2 out.bmp ffmpeg version N-31762-g6e19cfb, Copyright (c) 2000-2011 the FFmpeg developers built on Aug 5 2011 00:29:07 with gcc 4.6.1 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable- runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm -- enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl e-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 11. 1 / 51. 11. 1 libavcodec 53. 9. 1 / 53. 9. 1 libavformat 53. 6. 0 / 53. 6. 0 libavdevice 53. 2. 0 / 53. 2. 0 libavfilter 2. 27. 5 / 2. 27. 5 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, image2, from 'lossy_gray_decomp_levels_5_bitslice_layers_7.jp2': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0.0: Video: libopenjpeg, gray, 999x767, 25 tbr, 25 tbn, 25 tbc [buffer @ 0207AC80] w:999 h:767 pixfmt:gray tb:1/1000000 sar:0/1 sws_param: Output #0, image2, to 'out.bmp': Metadata: encoder : Lavf53.6.0 Stream #0.0: Video: bmp, gray, 999x767, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help frame= 1 fps= 0 q=0.0 Lsize= -0kB time=00:00:00.04 bitrate= -4.4kbits/ s video:750kB audio:0kB global headers:0kB muxing overhead -100.002864%
by , 11 years ago
Attachment: | patchlibopenjpegy16.diff added |
---|
follow-up: 5 comment:4 by , 11 years ago
Component: | undetermined → avcodec |
---|---|
Keywords: | libopenjpeg j2k added |
Reproduced by developer: | set |
Status: | new → open |
Version: | unspecified → git-master |
Possible patch attached, there may be another solution.
comment:5 by , 11 years ago
Replying to cehoyos:
Possible patch attached, there may be another solution.
The right solution is the one you mentioned off list: adding adjust[]
to libopenjpeg_copyto16()
. I've tested with following diff and it works. Without this, other pixel formats with bpp >8 and < 16 might turn out black too.
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index c331b59..27fb56e 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -207,12 +207,16 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) { int *comp_data; uint16_t *img_ptr; int index, x, y; + int adjust[4]; + for (x = 0; x < image->numcomps; x++) + adjust[x] = FFMAX(FFMIN(16 - image->comps[x].prec, 8), 0); + for (index = 0; index < image->numcomps; index++) { comp_data = image->comps[index].data; for (y = 0; y < image->comps[index].h; y++) { img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]); for (x = 0; x < image->comps[index].w; x++) { - *img_ptr = *comp_data; + *img_ptr = *comp_data << adjust[index]; img_ptr++; comp_data++; }
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
The patch was merged in 7412a4a.
probably gray16le is the problem (should be gray8)