diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-01-10 10:57:43 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-01-10 14:07:36 +0100 |
commit | 6ce835d77f764577d2e4e6ac69b343aaa289dda2 (patch) | |
tree | d21f945185248965cb40aafbfec7ca63fc3448e8 | |
parent | d45a724192d889a8ac192424d5210c3772c2e59f (diff) | |
download | ffmpeg-6ce835d77f764577d2e4e6ac69b343aaa289dda2.tar.gz |
Fix libopenjpeg colour range adjust for 8<bpp<16.
Fixes ticket #3284.
Reviewed-by: Michael Bradshaw
(cherry picked from commit 8298b54179c92fc3293ea312c4fcf153917bca0a)
-rw-r--r-- | libavcodec/libopenjpegdec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 734b54faed..e1ebccf552 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -172,7 +172,7 @@ static inline void libopenjpeg_copy_to_packed16(AVFrame *picture, opj_image_t *i int index, x, y, c; int adjust[4]; for (x = 0; x < image->numcomps; x++) - adjust[x] = FFMAX(FFMIN(16 - image->comps[x].prec, 8), 0); + adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0); for (y = 0; y < picture->height; y++) { index = y*picture->width; @@ -209,7 +209,7 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) { 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); + adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0); for (index = 0; index < image->numcomps; index++) { comp_data = image->comps[index].data; |