Commit 5c82fa1952 for ffmpeg
commit 5c82fa19520bc051b1888f12a3c83283076f6d54
Author: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Mon Nov 30 14:23:23 2026 +0100
avcodec/x86/proresdsp: Fix DC-only rows with DC == INT16_MAX
(dc+1)>>1 can't be naively calculated in 16 bits in this case.
Reviewed-by: Marcos Ashton Iglesias <marcosashiglesias@gmail.com>
Reviewed-by: Kyle Swanson <k@ylo.ph>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
diff --git a/libavcodec/x86/proresdsp.asm b/libavcodec/x86/proresdsp.asm
index 9e955fcdce..2bb9644489 100644
--- a/libavcodec/x86/proresdsp.asm
+++ b/libavcodec/x86/proresdsp.asm
@@ -68,6 +68,7 @@ pd_round_row12: times 8 dd 1<<(16-1)
pw_col_bias_12: times 8 dw 8192
pd_col_round12: times 8 dd 2
pw_4091: times 8 dw 4091
+pw_16384: times 8 dw 16384
%endif
SECTION .text
@@ -232,8 +233,7 @@ cglobal prores_idct_put_12, 4, 5, 16, 32, pixels, lsize, block, qmat
por xm14, xm14, xm7
pxor xm9, xm9
pcmpeqw xm14, xm9
- paddw xm15, xm0, [pw_1]
- psraw xm15, 1
+ pmulhrsw xm15, xm0, [pw_16384]
mova [rsp+0], xm14
mova [rsp+16], xm15