Commit 7b3b537d55 for ffmpeg
commit 7b3b537d55128c5fa14df73cd216701e0ea79c41
Author: Martin Mirchev <mmirchev@comp.nus.edu.sg>
Date: Tue Oct 27 11:45:20 2026 +0800
avcodec/vp3: fix quantizer matrix update with frame threading
vp3_update_thread_context() compared every s->qps[i] with s1->qps[1]
instead of s1->qps[i]. When a thread's previous qps[i] happened to
equal the new qps[1], qmat[i] was not copied while qps[] still was, so
the next frame with the same quantizers was dequantized with a stale
matrix and the output depended on the number of threads.
This only affects Theora streams that use more than one quantizer per
frame.
Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index ca468b047c..9b6b9901d8 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2517,7 +2517,7 @@ static int vp3_update_thread_context(AVCodecContext *dst, const AVCodecContext *
if (s != s1) {
// copy qscale data if necessary
for (int i = 0; i < 3; i++) {
- if (s->qps[i] != s1->qps[1]) {
+ if (s->qps[i] != s1->qps[i]) {
qps_changed = 1;
memcpy(&s->qmat[i], &s1->qmat[i], sizeof(s->qmat[i]));
}