This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 87e413a32cd207879ca9b6ca816e37cfaba95535
Author:     Baptiste Coudurier <[email protected]>
AuthorDate: Sat Nov 21 12:12:41 2026 -0800
Commit:     Baptiste Coudurier <[email protected]>
CommitDate: Sun Nov 22 00:03:51 2026 +0000

    avcodec/mpegvideo_enc: reconstruct 4:4:4 intra chroma blocks
    
    The 4:2:2 path wrote only four chroma blocks at the wrong stride,
    corrupting not yet encoded input when +psnr was set.
    
    Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavcodec/mpegvideo_enc.c             | 11 +++++++++++
 tests/fate/ffmpeg.mak                  |  3 +++
 tests/ref/fate/ffmpeg-speedhq-444-psnr |  6 ++++++
 3 files changed, 20 insertions(+)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index dd2cb487a2..476579d1ae 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1200,6 +1200,17 @@ static void mpv_reconstruct_mb(MPVEncContext *const s, 
int16_t block[12][64])
                 if (s->c.chroma_y_shift) {
                     put_dct(s, block[4], 4, dest_cb, uvlinesize, 
s->c.chroma_qscale);
                     put_dct(s, block[5], 5, dest_cr, uvlinesize, 
s->c.chroma_qscale);
+                } else if (!s->c.chroma_x_shift) {
+                    const int uv_dct_linesize = uvlinesize << 
s->c.interlaced_dct;
+                    const int uv_dct_offset   = s->c.interlaced_dct ? 
uvlinesize : uvlinesize * block_size;
+                    put_dct(s, block[ 4],  4, dest_cb,                         
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[ 5],  5, dest_cr,                         
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[ 6],  6, dest_cb + block_size,            
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[ 7],  7, dest_cr + block_size,            
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[ 8],  8, dest_cb + uv_dct_offset,         
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[ 9],  9, dest_cr + uv_dct_offset,         
     uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[10], 10, dest_cb + uv_dct_offset + 
block_size, uv_dct_linesize, s->c.chroma_qscale);
+                    put_dct(s, block[11], 11, dest_cr + uv_dct_offset + 
block_size, uv_dct_linesize, s->c.chroma_qscale);
                 } else {
                     dct_offset   >>= 1;
                     dct_linesize >>= 1;
diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index e665b08bb9..b1ca9e1caa 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -19,6 +19,9 @@ fate-ffmpeg-lavfi: CMD = framecrc -lavfi color=d=1:r=5 
-fflags +bitexact
 FATE_FFMPEG-$(call FILTERFRAMECRC, TESTSRC2 FORMAT SETPARAMS SCALE, 
LAVFI_INDEV WRAPPED_AVFRAME_DECODER MPEG2VIDEO_ENCODER) += 
fate-ffmpeg-chroma-location
 fate-ffmpeg-chroma-location: CMD = framecrc -auto_conversion_filters -f lavfi 
-i testsrc2=s=64x64:r=25:d=1,format=yuv420p,setparams=chroma_location=topleft 
-sws_flags +accurate_rnd+bitexact -flags +bitexact -idct simple -dct fastint 
-threads 1 -c:v mpeg2video -qscale:v 2 -frames:v 1
 
+FATE_FFMPEG-$(call FILTERFRAMECRC, TESTSRC2 FORMAT, LAVFI_INDEV 
WRAPPED_AVFRAME_DECODER SPEEDHQ_ENCODER) += fate-ffmpeg-speedhq-444-psnr
+fate-ffmpeg-speedhq-444-psnr: CMD = framecrc -f lavfi -i 
testsrc2=s=128x64:r=25:d=1,format=yuv444p -flags +bitexact+psnr -idct simple 
-dct fastint -threads 1 -c:v speedhq -qscale:v 3 -frames:v 1
+
 FATE_FFMPEG-$(if $(CONFIG_SMALL),no,$(call ALLYES, TESTSRC2_FILTER 
SCALE_FILTER FORMAT_FILTER LAVFI_INDEV WRAPPED_AVFRAME_DECODER RAWVIDEO_ENCODER 
NULL_MUXER)) += fate-ffmpeg-print-graphs-compact
 fate-ffmpeg-print-graphs-compact: CMD = ffmpeg -f lavfi -i 
testsrc2=s=64x64:r=25:d=0.08 -filter_complex 
"[0:v]scale=32:32,format=yuv420p[v]" -map "[v]" -c:v rawvideo 
-print_graphs_file - -print_graphs_format compact -f null -
 
diff --git a/tests/ref/fate/ffmpeg-speedhq-444-psnr 
b/tests/ref/fate/ffmpeg-speedhq-444-psnr
new file mode 100644
index 0000000000..aa6b14733e
--- /dev/null
+++ b/tests/ref/fate/ffmpeg-speedhq-444-psnr
@@ -0,0 +1,6 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: speedhq
+#dimensions 0: 128x64
+#sar 0: 1/1
+0,          0,          0,        1,     5728, 0xc7b9b093, S=1, Quality stats, 
      32, 0x4df20471

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to