[FFmpeg-devel] [PATCH v12 01/14] lavc/mjpegdec: Decode Huffman-coded lossless JPEGs embedded in DNGs
Michael Niedermayer
michael at niedermayer.cc
Sat Aug 10 15:30:45 EEST 2019
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190810/e05935ac/attachment.sig>
More information about the ffmpeg-devel
mailing list