[FFmpeg-devel] [PATCH v12 01/14] lavc/mjpegdec: Decode Huffman-coded lossless JPEGs embedded in DNGs

Nick Renieris velocityra at gmail.com
Sat Aug 10 17:00:38 EEST 2019


I assume you're talking about the "if (!s->bayer || mb_x) {"... code.

1) The special case there happens for the first line, not row like the
code you mentioned.
2) The loop is "width*height*component" in this order, so I'm not sure
how I would something for the first line outside.
3) It depends on mjpeg_decode_dc being called for the first-line case,
I'm not sure how I'd handle that either (even just to take it outside
the "component" loop).

Στις Σάβ, 10 Αυγ 2019 στις 3:30 μ.μ., ο/η Michael Niedermayer
<michael at niedermayer.cc> έγραψε:
>
> On Fri, Aug 09, 2019 at 07:29:46PM +0300, Nick Renieris wrote:
> > From: Nick Renieris <velocityra at 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 <velocityra at 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
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list