[FFmpeg-devel] [PATCH]Fix libopenjpeg adjust for 8<bpp<16

Michael Bradshaw mjbshaw at gmail.com
Fri Jan 10 05:48:48 CET 2014


> diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
> index 0543e3a..78a75a0 100644
> --- a/libavcodec/libopenjpegdec.c
> +++ b/libavcodec/libopenjpegdec.c
> @@ -173,7 +173,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;
> @@ -210,7 +210,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;

Seems ok, but I can't test the sample from #3284, as it fails to decode
with libopenjpeg (opj_decode_with_info fails).


More information about the ffmpeg-devel mailing list