x86/utvideodsp: make restore_rgb_planes functions work on x86_32

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-06-30 00:40:16 -03:00
parent c07af72098
commit 440285474b
2 changed files with 15 additions and 7 deletions

View File

@ -21,8 +21,6 @@
%include "libavutil/x86/x86util.asm"
%if ARCH_X86_64
SECTION_RODATA
pb_128: times 16 db 128
@ -36,12 +34,18 @@ INIT_XMM sse2
; void restore_rgb_planes(uint8_t *src_r, uint8_t *src_g, uint8_t *src_b,
; ptrdiff_t linesize_r, ptrdiff_t linesize_g, ptrdiff_t linesize_b,
; int width, int height)
cglobal restore_rgb_planes, 8,9,4, src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, w, h, x
cglobal restore_rgb_planes, 7 + ARCH_X86_64, 7 + ARCH_X86_64 * 2, 4, src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, w, h, x
movsxdifnidn wq, wd
add src_rq, wq
add src_gq, wq
add src_bq, wq
neg wq
%if ARCH_X86_64 == 0
mov wm, wq
DEFINE_ARGS src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, x
%define wq r6m
%define hd r7mp
%endif
mova m3, [pb_128]
.nextrow:
mov xq, wq
@ -65,7 +69,7 @@ cglobal restore_rgb_planes, 8,9,4, src_r, src_g, src_b, linesize_r, linesize_g,
jg .nextrow
REP_RET
cglobal restore_rgb_planes10, 8,9,5, src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, w, h, x
cglobal restore_rgb_planes10, 7 + ARCH_X86_64, 7 + ARCH_X86_64 * 2, 5, src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, w, h, x
shl wd, 1
shl linesize_rq, 1
shl linesize_gq, 1
@ -76,6 +80,12 @@ cglobal restore_rgb_planes10, 8,9,5, src_r, src_g, src_b, linesize_r, linesize_g
mova m3, [pw_512]
mova m4, [pw_1023]
neg wq
%if ARCH_X86_64 == 0
mov wm, wq
DEFINE_ARGS src_r, src_g, src_b, linesize_r, linesize_g, linesize_b, x
%define wq r6m
%define hd r7mp
%endif
.nextrow:
mov xq, wq
@ -99,5 +109,3 @@ cglobal restore_rgb_planes10, 8,9,5, src_r, src_g, src_b, linesize_r, linesize_g
sub hd, 1
jg .nextrow
REP_RET
%endif

View File

@ -36,7 +36,7 @@ av_cold void ff_utvideodsp_init_x86(UTVideoDSPContext *c)
{
int cpu_flags = av_get_cpu_flags();
if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
if (EXTERNAL_SSE2(cpu_flags)) {
c->restore_rgb_planes = ff_restore_rgb_planes_sse2;
c->restore_rgb_planes10 = ff_restore_rgb_planes10_sse2;
}