1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

x86/vf_limiter: make limiter functions work on x86_32

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-07-08 11:33:54 -03:00
parent 6f205a42d7
commit 5688fd77b5
2 changed files with 14 additions and 18 deletions

View File

@ -20,23 +20,21 @@
%include "libavutil/x86/x86util.asm"
%if ARCH_X86_64
SECTION_RODATA
pb_0: times 16 db 0
SECTION .text
INIT_XMM sse2
cglobal limiter_8bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, max, x
cglobal limiter_8bit, 6, 7, 3, src, dst, slinesize, dlinesize, w, h, x
movsxdifnidn wq, wd
add srcq, wq
add dstq, wq
neg wq
SPLATB_REG m1, min, [pb_0]
SPLATB_REG m2, max, [pb_0]
movd m1, r6m
punpcklbw m1, m1
SPLATW m1, m1
movd m2, r7m
punpcklbw m2, m2
SPLATW m2, m2
.nextrow:
mov xq, wq
@ -51,18 +49,18 @@ cglobal limiter_8bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, max, x
add dstq, dlinesizeq
sub hd, 1
jg .nextrow
ret
RET
INIT_XMM sse4
cglobal limiter_16bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, max, x
cglobal limiter_16bit, 6, 7, 3, src, dst, slinesize, dlinesize, w, h, x
shl wd, 1
add srcq, wq
add dstq, wq
neg wq
movd m1, mind
movd m1, r6m
SPLATW m1, m1
movd m2, maxd
movd m2, r7m
SPLATW m2, m2
.nextrow:
mov xq, wq
@ -79,6 +77,4 @@ cglobal limiter_16bit, 8, 9, 3, src, dst, slinesize, dlinesize, w, h, min, max,
add dstq, dlinesizeq
sub hd, 1
jg .nextrow
ret
%endif
RET

View File

@ -31,12 +31,12 @@ void ff_limiter_init_x86(LimiterDSPContext *dsp, int bpp)
{
int cpu_flags = av_get_cpu_flags();
if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
if (EXTERNAL_SSE2(cpu_flags)) {
if (bpp <= 8) {
dsp->limiter = ff_limiter_8bit_sse2;
}
}
if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags)) {
if (EXTERNAL_SSE4(cpu_flags)) {
if (bpp > 8) {
dsp->limiter = ff_limiter_16bit_sse4;
}