[FFmpeg-devel] [PATCH 6/6] avcodec/x86: allow 8-bit simple_idct to use slightly different coefficients
James Darnley
jdarnley at obe.tv
Mon Jun 12 16:36:09 EEST 2017
This makes it exact to the old MMX one, as reported by libavcodec/tests/dct.
---
libavcodec/x86/proresdsp.asm | 18 +++++++++--------
libavcodec/x86/simple_idct10.asm | 33 ++++++++++++++++++++++---------
libavcodec/x86/simple_idct10_template.asm | 19 ++++++++++++++++++
3 files changed, 53 insertions(+), 17 deletions(-)
diff --git a/libavcodec/x86/proresdsp.asm b/libavcodec/x86/proresdsp.asm
index 3be0ff7757..65c9fad51c 100644
--- a/libavcodec/x86/proresdsp.asm
+++ b/libavcodec/x86/proresdsp.asm
@@ -33,14 +33,14 @@ cextern pw_1
cextern pw_4
cextern pw_1019
; Below are defined in simple_idct10.asm built from selecting idctdsp
-cextern w4_plus_w2
-cextern w4_min_w2
-cextern w4_plus_w6
-cextern w4_min_w6
-cextern w1_plus_w3
-cextern w3_min_w1
-cextern w7_plus_w3
-cextern w3_min_w7
+cextern w4_plus_w2_hi
+cextern w4_min_w2_hi
+cextern w4_plus_w6_hi
+cextern w4_min_w6_hi
+cextern w1_plus_w3_hi
+cextern w3_min_w1_hi
+cextern w7_plus_w3_hi
+cextern w3_min_w7_hi
cextern w1_plus_w5
cextern w5_min_w1
cextern w5_plus_w7
@@ -50,6 +50,8 @@ cextern w7_min_w5
SECTION .text
+define_constants _hi
+
%macro idct_fn 0
cglobal prores_idct_put_10, 4, 4, 15, pixels, lsize, block, qmat
IDCT_FN pw_1, 15, pw_88, 18, "put", pw_4, pw_1019, r3
diff --git a/libavcodec/x86/simple_idct10.asm b/libavcodec/x86/simple_idct10.asm
index 29e18fe6a6..5ec1e6b23d 100644
--- a/libavcodec/x86/simple_idct10.asm
+++ b/libavcodec/x86/simple_idct10.asm
@@ -48,24 +48,34 @@ times 4 dw %2, %3
%define W2sh2 21407 ; W2 = 85627 = 21407<<2 - 1
%define W3sh2 19265 ; W3 = 77062 = 19265<<2 + 2
%define W4sh2 16384 ; W4 = 65535 = 16384<<2 - 1
+%define W3sh2_lo 19266
+%define W4sh2_lo 16383
%define W5sh2 12873 ; W5 = 51491 = 12873<<2 - 1
%define W6sh2 8867 ; W6 = 35468 = 8867<<2
%define W7sh2 4520 ; W7 = 18081 = 4520<<2 + 1
-pw_round_20_div_w4: times 8 dw ((1 << (20 - 1)) / W4sh2)
+pw_round_20_div_w4: times 8 dw ((1 << (20 - 1)) / W4sh2_lo)
-CONST_DEC w4_plus_w2, W4sh2, +W2sh2
-CONST_DEC w4_min_w2, W4sh2, -W2sh2
-CONST_DEC w4_plus_w6, W4sh2, +W6sh2
-CONST_DEC w4_min_w6, W4sh2, -W6sh2
-CONST_DEC w1_plus_w3, W1sh2, +W3sh2
-CONST_DEC w3_min_w1, W3sh2, -W1sh2
-CONST_DEC w7_plus_w3, W7sh2, +W3sh2
-CONST_DEC w3_min_w7, W3sh2, -W7sh2
+CONST_DEC w4_plus_w2_hi, W4sh2, +W2sh2
+CONST_DEC w4_min_w2_hi, W4sh2, -W2sh2
+CONST_DEC w4_plus_w6_hi, W4sh2, +W6sh2
+CONST_DEC w4_min_w6_hi, W4sh2, -W6sh2
+CONST_DEC w1_plus_w3_hi, W1sh2, +W3sh2
+CONST_DEC w3_min_w1_hi, W3sh2, -W1sh2
+CONST_DEC w7_plus_w3_hi, W7sh2, +W3sh2
+CONST_DEC w3_min_w7_hi, W3sh2, -W7sh2
CONST_DEC w1_plus_w5, W1sh2, +W5sh2
CONST_DEC w5_min_w1, W5sh2, -W1sh2
CONST_DEC w5_plus_w7, W5sh2, +W7sh2
CONST_DEC w7_min_w5, W7sh2, -W5sh2
+CONST_DEC w4_plus_w2_lo, W4sh2_lo, +W2sh2
+CONST_DEC w4_min_w2_lo, W4sh2_lo, -W2sh2
+CONST_DEC w4_plus_w6_lo, W4sh2_lo, +W6sh2
+CONST_DEC w4_min_w6_lo, W4sh2_lo, -W6sh2
+CONST_DEC w1_plus_w3_lo, W1sh2, +W3sh2_lo
+CONST_DEC w3_min_w1_lo, W3sh2_lo, -W1sh2
+CONST_DEC w7_plus_w3_lo, W7sh2, +W3sh2_lo
+CONST_DEC w3_min_w7_lo, W3sh2_lo, -W7sh2
%include "libavcodec/x86/simple_idct10_template.asm"
@@ -108,6 +118,9 @@ SECTION .text
[base], [base + stride], [base + 2*stride], [base + stride3]
%macro idct_fn 0
+
+define_constants _lo
+
cglobal simple_idct8, 1, 1, 16, block
IDCT_FN "", 11, pw_round_20_div_w4, 20, "store"
RET
@@ -160,6 +173,8 @@ cglobal simple_idct8_add, 3, 4, 16, pixels, lsize, block
STORE_HI_LO PASS8ROWS(pixelsq, r3, lsizeq, r2), m8, m1, m4, m9
RET
+define_constants _hi
+
cglobal simple_idct10, 1, 1, 16, block
IDCT_FN "", 12, "", 19, "store"
RET
diff --git a/libavcodec/x86/simple_idct10_template.asm b/libavcodec/x86/simple_idct10_template.asm
index 8367011dfd..d8ea0bcc6b 100644
--- a/libavcodec/x86/simple_idct10_template.asm
+++ b/libavcodec/x86/simple_idct10_template.asm
@@ -26,6 +26,25 @@
%if ARCH_X86_64
+%macro define_constants 1
+ %undef w4_plus_w2
+ %undef w4_min_w2
+ %undef w4_plus_w6
+ %undef w4_min_w6
+ %undef w1_plus_w3
+ %undef w3_min_w1
+ %undef w7_plus_w3
+ %undef w3_min_w7
+ %define w4_plus_w2 w4_plus_w2%1
+ %define w4_min_w2 w4_min_w2%1
+ %define w4_plus_w6 w4_plus_w6%1
+ %define w4_min_w6 w4_min_w6%1
+ %define w1_plus_w3 w1_plus_w3%1
+ %define w3_min_w1 w3_min_w1%1
+ %define w7_plus_w3 w7_plus_w3%1
+ %define w3_min_w7 w3_min_w7%1
+%endmacro
+
; interleave data while maintaining source
; %1=type, %2=dstlo, %3=dsthi, %4=src, %5=interleave
%macro SBUTTERFLY3 5
--
2.13.0
More information about the ffmpeg-devel
mailing list