[FFmpeg-cvslog] Allow decoding of j2k images with bpp<8 and 8<bpp<16 with libopenjpeg.
Carl Eugen Hoyos
git at videolan.org
Fri May 11 17:53:09 CEST 2012
ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Fri May 11 17:50:28 2012 +0200| [6d376346ebdcbe1ad8b265b2eb7d0de59d24bb1a] | committer: Carl Eugen Hoyos
Allow decoding of j2k images with bpp<8 and 8<bpp<16 with libopenjpeg.
Fixes one of several problems described in ticket #1279.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d376346ebdcbe1ad8b265b2eb7d0de59d24bb1a
---
libavcodec/libopenjpegdec.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 4d91f41..008d8ba 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -35,6 +35,8 @@
#define JP2_SIG_TYPE 0x6A502020
#define JP2_SIG_VALUE 0x0D0A870A
+// pix_fmts with lower bpp have to be listed before
+// similar pix_fmts with higher bpp.
#define RGB_PIXEL_FORMATS PIX_FMT_RGB24,PIX_FMT_RGBA,PIX_FMT_RGB48,PIX_FMT_RGBA64
#define GRAY_PIXEL_FORMATS PIX_FMT_GRAY8,PIX_FMT_GRAY8A,PIX_FMT_GRAY16
#define YUV_PIXEL_FORMATS PIX_FMT_YUV420P,PIX_FMT_YUV422P,PIX_FMT_YUVA420P, \
@@ -62,16 +64,16 @@ static inline int libopenjpeg_matches_pix_fmt(const opj_image_t *image, enum Pix
}
switch (descriptor.nb_components) {
- case 4: match = match && descriptor.comp[3].depth_minus1 + 1 == image->comps[3].prec &&
+ case 4: match = match && descriptor.comp[3].depth_minus1 + 1 >= image->comps[3].prec &&
1 << descriptor.log2_chroma_w == image->comps[3].dx &&
1 << descriptor.log2_chroma_h == image->comps[3].dy;
- case 3: match = match && descriptor.comp[2].depth_minus1 + 1 == image->comps[2].prec &&
+ case 3: match = match && descriptor.comp[2].depth_minus1 + 1 >= image->comps[2].prec &&
1 << descriptor.log2_chroma_w == image->comps[2].dx &&
1 << descriptor.log2_chroma_h == image->comps[2].dy;
- case 2: match = match && descriptor.comp[1].depth_minus1 + 1 == image->comps[1].prec &&
+ case 2: match = match && descriptor.comp[1].depth_minus1 + 1 >= image->comps[1].prec &&
1 << descriptor.log2_chroma_w == image->comps[1].dx &&
1 << descriptor.log2_chroma_h == image->comps[1].dy;
- case 1: match = match && descriptor.comp[0].depth_minus1 + 1 == image->comps[0].prec &&
+ case 1: match = match && descriptor.comp[0].depth_minus1 + 1 >= image->comps[0].prec &&
1 == image->comps[0].dx &&
1 == image->comps[0].dy;
default:
More information about the ffmpeg-cvslog
mailing list