[FFmpeg-devel] [PATCH] libopenjpegdec: fix rgb24 decoding regression from commit eb511ef6

Alex Zhukov zhukov.alex at gmail.com
Wed Dec 21 21:26:45 CET 2011


from the top of my head: copyto8 expects the 8bit precision therefore no
">>adjust" should be needed
can you provide an example video where this is not the case?

On Wed, Dec 21, 2011 at 5:33 AM, Jean First <jeanfirst at gmail.com> wrote:

> Hi,
>
> attached patch fixes a regression introduced with commit eb511ef6.
> maybe libopenjpeg_copyto8 and libopenjpeg_copyto16 need this fix too.
>  Alex Zhukov, can you please check this ?
>
> Jean
>
> ---
>  libavcodec/libopenjpegdec.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
> index baa516b..713effe 100644
> --- a/libavcodec/libopenjpegdec.c
> +++ b/libavcodec/libopenjpegdec.c
> @@ -96,12 +96,16 @@ static inline int libopenjpeg_ispacked(enum
> PixelFormat pix_fmt) {
>  static inline void libopenjpeg_copy_to_packed8(AVFrame *picture,
> opj_image_t *image) {
>     uint8_t *img_ptr;
>     int index, x, y, c;
> +    int adjust[4];
> +    for(x = 0; x < image->numcomps; x++) {
> +        adjust[x] = FFMAX(image->comps[x].prec - 8, 0);
> +    }
>     for(y = 0; y < picture->height; y++) {
>         index = y*picture->width;
>         img_ptr = picture->data[0] + y*picture->linesize[0];
>         for(x = 0; x < picture->width; x++, index++) {
>             for(c = 0; c < image->numcomps; c++) {
> -                *img_ptr++ = image->comps[c].data[index];
> +                *img_ptr++ = image->comps[c].data[index] >> adjust[c];
>             }
>         }
>     }
> --
> 1.7.6.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list