1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

swresample/x86/resample: write only int16 in the int16 resampler

The resample asm code as it is currently handles 1 sample at a time

The asm code should be redesigned and handle more than 1 sample at a
time. That is the whole purpose of SIMD. There is also multiple samples
available that need identical handling like from several channels or
similar handling from other points in time.

Such redesign would make the resampler faster and would change the
requirements of padding and maybe memory layout. So it seems simpler
to just avoid overwriting in the asm as it is today than to have
the allocation handle specific overallocation for asm code that
ideally should be redesigned

Fixes writing 16bits over the end of the array

This is an alternative fix for https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23053

Found-by: Ivan Grigorev <ivangrigoriev@meta.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 4171581953)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-06-10 17:48:42 +02:00
parent 793d445fcd
commit 57853d1fcc
+4 -2
View File
@@ -198,7 +198,8 @@ cglobal resample_common_%1, 1, 7, 2, ctx, phase_count, dst, frac, \
add fracd, dst_incr_modd
packssdw m0, m0
add indexd, dst_incr_divd
movd [dstq], m0
movd filterd, m0
mov [dstq], filterw
%else ; float/double
; horizontal sum & store
%if mmsize == 32
@@ -478,7 +479,8 @@ cglobal resample_linear_%1, 1, 7, 5, ctx, min_filter_length_x4, filter2, \
paddd m0, m1
psrad m0, 15
packssdw m0, m0
movd [dstq], m0
movd eax, m0
mov [dstq], ax
; note that for imul/idiv, I need to move filter to edx/eax for each:
; - 32bit: eax=r0[filter1], edx=r2[filter2]