ref: 36ee29037b3ebc36e848561392c05bbf2cb4cab8
parent: 659ff14af50bc184bac74dd058010143cf9e5734
author: Sindre Aamås <saamas@cisco.com>
date: Tue Mar 7 09:22:32 EST 2017
[Encoder/x86] Simplify sample_sc X86_32_PICASM handling Utilize program counter-relative offsets to simplify X86_32_PICASM code. In order for this to work with nasm, data constants are placed in the text segment.
--- a/codec/encoder/core/x86/sample_sc.asm
+++ b/codec/encoder/core/x86/sample_sc.asm
@@ -34,7 +34,11 @@
;***********************************************************************
; Local Data (Read Only)
;***********************************************************************
+%ifdef X86_32_PICASM
+SECTION .text align=16
+%else
SECTION .rodata align=16
+%endif
ALIGN 16
mv_x_inc_x4 dw 0x10, 0x10, 0x10, 0x10
@@ -696,26 +700,12 @@
mov ebx, [height]
mov [i_height], ebx
-%ifdef X86_32_PICASM
- push r0
- mov r0, esp
- and esp, 0xfffffff0
- push 0x00100010 ;mv_x_inc_x4
- push 0x00100010
- push 0x00040004 ;mv_y_inc_x4
- push 0x00040004
- push 0x000c0008 ;mx_x_offset_x4
- push 0x00040000
- movq xmm7, [esp+16] ; x_qpel inc
- movq xmm6, [esp+8] ; y_qpel inc
- movq xmm5, [esp] ; x_qpel vector
- mov esp, r0
- pop r0
-%else
- movq xmm7, [mv_x_inc_x4] ; x_qpel inc
- movq xmm6, [mv_y_inc_x4] ; y_qpel inc
- movq xmm5, [mx_x_offset_x4] ; x_qpel vector
-%endif
+ %assign push_num 5
+ INIT_X86_32_PIC_NOPRESERVE ecx
+ movq xmm7, [pic(mv_x_inc_x4)] ; x_qpel inc
+ movq xmm6, [pic(mv_y_inc_x4)] ; y_qpel inc
+ movq xmm5, [pic(mx_x_offset_x4)] ; x_qpel vector
+ DEINIT_X86_32_PIC
pxor xmm4, xmm4
pxor xmm3, xmm3 ; y_qpel vector
HASH_HEIGHT_LOOP_SSE2:
@@ -1415,24 +1405,9 @@
push r13
mov r12, r2
-%ifdef X86_32_PICASM
- push r0
- mov r0, esp
- and esp, 0xfffffff0
- push 0x00100010 ;mv_x_inc_x4
- push 0x00100010
- push 0x00040004 ;mv_y_inc_x4
- push 0x00040004
- push 0x000c0008 ;mx_x_offset_x4
- push 0x00040000
- movq xmm7, [esp+16] ; x_qpel inc
- movq xmm6, [esp+8] ; y_qpel inc
- movq xmm5, [esp] ; x_qpel vector
-%else
movq xmm7, [mv_x_inc_x4] ; x_qpel inc
movq xmm6, [mv_y_inc_x4] ; y_qpel inc
movq xmm5, [mx_x_offset_x4] ; x_qpel vector
-%endif
pxor xmm4, xmm4
pxor xmm3, xmm3 ; y_qpel vector
HASH_HEIGHT_LOOP_SSE2: