diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2024-06-07 21:26:54 +0200 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2024-06-28 14:48:23 +0200 |
commit | a8e2714d824552ed210118d1ce48c770db3d8c56 (patch) | |
tree | d9d014e1d83269bf198c575283a56e43e245bfe8 /libavcodec | |
parent | 539d2e989d7ce3556a549d59ee9c5125ae7d7b6b (diff) | |
download | ffmpeg-a8e2714d824552ed210118d1ce48c770db3d8c56.tar.gz |
libavcodec/mjpeg: preserve unclipped last_dc value
Perform av_clip_int16(val) _after_ copying the value to last_dc.
This change ensures that clipping is applied only within the context of
the current block, preventing the propagation of clipped values to
subsequent DC components.
Related commits: c28f648b19d and dffae122d0f
Related ticket: 4683
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mjpegdec.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 1481a7f285..7daec649bc 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -843,9 +843,8 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, return AVERROR_INVALIDDATA; } val = val * (unsigned)quant_matrix[0] + s->last_dc[component]; - val = av_clip_int16(val); s->last_dc[component] = val; - block[0] = val; + block[0] = av_clip_int16(val); /* AC coefs */ i = 0; {OPEN_READER(re, &s->gb); |