On Fri, Aug 09, 2019 at 07:29:46PM +0300, Nick Renieris wrote:
> From: Nick Renieris <velocit...@gmail.com>
> 
> Main image data in DNGs is usually comprised of tiles, each of which is a 
> Huffman-encoded lossless JPEG.
> 
> Tested for ljpeg regressions with:
> `ffmpeg -f lavfi -i testsrc=d=1 -vcodec ljpeg test.avi`
> `ffmpeg test.avi out.avi`
> The modified code in ljpeg_decode_rgb_scan runs without issues.
> 
> Signed-off-by: Nick Renieris <velocit...@gmail.com>
> ---
>  libavcodec/mjpegdec.c | 52 +++++++++++++++++++++++++++++++++++++------
>  libavcodec/mjpegdec.h |  1 +
>  2 files changed, 46 insertions(+), 7 deletions(-)
[...]

> @@ -1102,12 +1128,19 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext 
> *s, int nb_components, int p
>                  topleft[i] = top[i];
>                  top[i]     = buffer[mb_x][i];
>  
> -                PREDICT(pred, topleft[i], top[i], left[i], 
> modified_predictor);
> -
>                  dc = mjpeg_decode_dc(s, s->dc_index[i]);
>                  if(dc == 0xFFFFF)
>                      return -1;
>  
> +                if (!s->bayer || mb_x) {
> +                    pred = left[i];
> +                } else { /* This path runs only for the first line in bayer 
> images */
> +                    vpred[i] += dc;
> +                    pred = vpred[i] - dc;
> +                }
> +
> +                PREDICT(pred, topleft[i], top[i], pred, modified_predictor);
> +
>                  left[i] = buffer[mb_x][i] =
>                      mask & (pred + (unsigned)(dc * (1 << point_transform)));
>              }

This should be done outside the width*height sample loop
The special handling of the left pixel for other ljpeg is also done
outside that loop

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to