<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 19, 2014 at 1:04 AM, <span dir="ltr"><<a href="mailto:dnyaneshwar@multicorewareinc.com" target="_blank">dnyaneshwar@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""># HG changeset patch<br>
# User Dnyaneshwar G <<a href="mailto:dnyaneshwar@multicorewareinc.com">dnyaneshwar@multicorewareinc.com</a>><br>
</div># Date 1392792673 -19800<br>
# Wed Feb 19 12:21:13 2014 +0530<br>
# Node ID 6150985c3d535f0ea7a1dc0b8f3c69e65e30d25b<br>
# Parent 1a0d5b456b19e8f187290c662425080cfc870492<br>
<div class="">asm: added 16bpp support for dct[4x4, 8x8], idct4x4, dst4x4 and idst4x4 primitives<br></div></blockquote><div><br></div><div>pushed</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">
<br>
</div>diff -r 1a0d5b456b19 -r 6150985c3d53 source/common/x86/asm-primitives.cpp<br>
--- a/source/common/x86/asm-primitives.cpp Tue Feb 18 14:46:51 2014 -0600<br>
+++ b/source/common/x86/asm-primitives.cpp Wed Feb 19 12:21:13 2014 +0530<br>
@@ -808,6 +808,10 @@<br>
<div class=""> p.calcrecon[BLOCK_8x8] = x265_calcRecons8_sse2;<br>
p.calcrecon[BLOCK_16x16] = x265_calcRecons16_sse2;<br>
p.calcrecon[BLOCK_32x32] = x265_calcRecons32_sse2;<br>
+<br>
+ p.dct[DCT_4x4] = x265_dct4_sse2;<br>
+ p.idct[IDCT_4x4] = x265_idct4_sse2;<br>
+ p.idct[IDST_4x4] = x265_idst4_sse2;<br>
}<br>
if (cpuMask & X265_CPU_SSSE3)<br>
{<br>
</div>@@ -822,10 +826,12 @@<br>
<div class=""><br>
SETUP_INTRA_ANG32(2, 2, ssse3);<br>
SETUP_INTRA_ANG32(34, 2, ssse3);<br>
+<br>
+ p.dct[DST_4x4] = x265_dst4_ssse3;<br>
}<br>
if (cpuMask & X265_CPU_SSE4)<br>
{<br>
-<br>
+ p.dct[DCT_8x8] = x265_dct8_sse4;<br>
</div> p.quant = x265_quant_sse4;<br>
p.dequant_normal = x265_dequant_normal_sse4;<br>
p.cvt16to32_shl = x265_cvt16to32_shl_sse4;<br>
diff -r 1a0d5b456b19 -r 6150985c3d53 source/common/x86/const-a.asm<br>
--- a/source/common/x86/const-a.asm Tue Feb 18 14:46:51 2014 -0600<br>
+++ b/source/common/x86/const-a.asm Wed Feb 19 12:21:13 2014 +0530<br>
@@ -69,9 +69,10 @@<br>
const pw_ppmmppmm, dw 1,1,-1,-1,1,1,-1,-1<br>
const pw_pmpmpmpm, dw 1,-1,1,-1,1,-1,1,-1<br>
const pw_pmmpzzzz, dw 1,-1,-1,1,0,0,0,0<br>
<div class="">-<br>
const pd_1, times 4 dd 1<br>
const pd_2, times 4 dd 2<br>
+const pd_4, times 4 dd 4<br>
+const pd_8, times 4 dd 8<br>
const pd_16, times 4 dd 16<br>
const pd_32, times 4 dd 32<br>
const pd_64, times 4 dd 64<br>
</div>diff -r 1a0d5b456b19 -r 6150985c3d53 source/common/x86/dct8.asm<br>
--- a/source/common/x86/dct8.asm Tue Feb 18 14:46:51 2014 -0600<br>
+++ b/source/common/x86/dct8.asm Wed Feb 19 12:21:13 2014 +0530<br>
@@ -64,9 +64,12 @@<br>
pb_unpackhlw1: db 0,1,8,9,2,3,10,11,4,5,12,13,6,7,14,15<br>
<br>
SECTION .text<br>
<div class="">-<br>
cextern pd_1<br>
cextern pd_2<br>
+cextern pd_4<br>
+cextern pd_8<br>
+cextern pd_16<br>
+cextern pd_32<br>
cextern pd_64<br>
cextern pd_128<br>
cextern pd_256<br>
</div>@@ -79,16 +82,21 @@<br>
<div class=""> ;------------------------------------------------------<br>
INIT_XMM sse2<br>
cglobal dct4, 3, 4, 8<br>
-<br>
+%if BIT_DEPTH == 10<br>
+ %define DCT_SHIFT 3<br>
+ mova m7, [pd_4]<br>
</div>+%elif BIT_DEPTH == 8<br>
<div class="">+ %define DCT_SHIFT 1<br>
+ mova m7, [pd_1]<br>
+%else<br>
+ %error Unsupported BIT_DEPTH!<br>
+%endif<br>
add r2d, r2d<br>
lea r3, [tab_dct4]<br>
<br>
</div> mova m4, [r3 + 0 * 16]<br>
<div class=""> mova m5, [r3 + 1 * 16]<br>
mova m6, [r3 + 2 * 16]<br>
-<br>
- mova m7, [pd_1]<br>
-<br>
movh m0, [r0 + 0 * r2]<br>
movh m1, [r0 + 1 * r2]<br>
punpcklqdq m0, m1<br>
</div>@@ -107,27 +115,21 @@<br>
<br>
paddw m1, m2, m0<br>
psubw m2, m0<br>
<div class="">-<br>
pmaddwd m0, m1, m4<br>
paddd m0, m7<br>
- psrad m0, 1<br>
-<br>
+ psrad m0, DCT_SHIFT<br>
pmaddwd m3, m2, m5<br>
paddd m3, m7<br>
- psrad m3, 1<br>
-<br>
+ psrad m3, DCT_SHIFT<br>
packssdw m0, m3<br>
pshufd m0, m0, 0xD8<br>
</div> pshufhw m0, m0, 0xB1<br>
<div class="">-<br>
pmaddwd m1, m6<br>
paddd m1, m7<br>
- psrad m1, 1<br>
-<br>
+ psrad m1, DCT_SHIFT<br>
pmaddwd m2, [r3 + 3 * 16]<br>
paddd m2, m7<br>
- psrad m2, 1<br>
-<br>
+ psrad m2, DCT_SHIFT<br>
packssdw m1, m2<br>
pshufd m1, m1, 0xD8<br>
</div> pshufhw m1, m1, 0xB1<br>
@@ -179,7 +181,7 @@<br>
<div class=""> %define IDCT4_OFFSET [pd_512]<br>
%define IDCT4_SHIFT 10<br>
%else<br>
- %error Unsupport BIT_DEPTH!<br>
+ %error Unsupported BIT_DEPTH!<br>
%endif<br>
add r2d, r2d<br>
lea r3, [tab_dct4]<br>
</div>@@ -268,67 +270,60 @@<br>
<div class=""> INIT_XMM ssse3<br>
%if ARCH_X86_64<br>
cglobal dst4, 3, 4, 8+2<br>
+ %define coef2 m8<br>
+ %define coef3 m9<br>
%else ; ARCH_X86_64 = 0<br>
cglobal dst4, 3, 4, 8<br>
+ %define coef2 [r3 + 2 * 16]<br>
+ %define coef3 [r3 + 3 * 16]<br>
%endif ; ARCH_X86_64<br>
</div><div class="">+%define coef0 m6<br>
+%define coef1 m7<br>
<br>
</div><div class="">- %define coef0 m6<br>
- %define coef1 m7<br>
-%if ARCH_X86_64<br>
- %define coef2 m8<br>
- %define coef3 m9<br>
-%else<br>
- %define coef2 [r3 + 2 * 16]<br>
- %define coef3 [r3 + 3 * 16]<br>
</div><div class="">+%if BIT_DEPTH == 8<br>
+ %define DST_SHIFT 1<br>
+ mova m5, [pd_1]<br>
</div>+%elif BIT_DEPTH == 10<br>
<div class="">+ %define DST_SHIFT 3<br>
+ mova m5, [pd_4]<br>
</div> %endif<br>
<div class="">-<br>
add r2d, r2d<br>
lea r3, [tab_dst4]<br>
-<br>
- mova m5, [pd_1]<br>
-<br>
mova coef0, [r3 + 0 * 16]<br>
mova coef1, [r3 + 1 * 16]<br>
%if ARCH_X86_64<br>
</div> mova coef2, [r3 + 2 * 16]<br>
<div class=""> mova coef3, [r3 + 3 * 16]<br>
%endif<br>
-<br>
- movh m0, [r0 + 0 * r2] ;load<br>
+ movh m0, [r0 + 0 * r2] ; load<br>
movh m1, [r0 + 1 * r2]<br>
punpcklqdq m0, m1<br>
</div>-<br>
lea r0, [r0 + 2 * r2]<br>
movh m1, [r0]<br>
<div><div class="h5"> movh m2, [r0 + r2]<br>
punpcklqdq m1, m2<br>
-<br>
- pmaddwd m2, m0, coef0 ;DST1<br>
+ pmaddwd m2, m0, coef0 ; DST1<br>
pmaddwd m3, m1, coef0<br>
phaddd m2, m3<br>
paddd m2, m5<br>
- psrad m2, 1<br>
-<br>
+ psrad m2, DST_SHIFT<br>
pmaddwd m3, m0, coef1<br>
pmaddwd m4, m1, coef1<br>
phaddd m3, m4<br>
paddd m3, m5<br>
- psrad m3, 1<br>
+ psrad m3, DST_SHIFT<br>
packssdw m2, m3 ; m2 = T70<br>
-<br>
pmaddwd m3, m0, coef2<br>
pmaddwd m4, m1, coef2<br>
phaddd m3, m4<br>
paddd m3, m5<br>
- psrad m3, 1<br>
-<br>
+ psrad m3, DST_SHIFT<br>
pmaddwd m0, coef3<br>
pmaddwd m1, coef3<br>
phaddd m0, m1<br>
paddd m0, m5<br>
- psrad m0, 1<br>
+ psrad m0, DST_SHIFT<br>
packssdw m3, m0 ; m3 = T71<br>
</div></div>-<br>
mova m5, [pd_128]<br>
<br>
pmaddwd m0, m2, coef0 ; DST2<br>
@@ -365,11 +360,18 @@<br>
<div class=""> ;void idst4(int32_t *src, int16_t *dst, intptr_t stride)<br>
;-------------------------------------------------------<br>
INIT_XMM sse2<br>
-cglobal idst4, 3, 4, 6<br>
-<br>
+cglobal idst4, 3, 4, 7<br>
+%if BIT_DEPTH == 8<br>
+ %define m6 [pd_2048]<br>
+ %define IDCT4_SHIFT 12<br>
+%elif BIT_DEPTH == 10<br>
+ %define m6 [pd_512]<br>
+ %define IDCT4_SHIFT 10<br>
+%else<br>
+ %error Unsupported BIT_DEPTH!<br>
+%endif<br>
add r2d, r2d<br>
lea r3, [tab_idst4]<br>
</div>-<br>
mova m5, [pd_64]<br>
<br>
movu m0, [r0 + 0 * 16]<br>
@@ -414,38 +416,30 @@<br>
<div><div class="h5"><br>
punpcklwd m2, m0, m1<br>
punpckhwd m0, m1<br>
-<br>
- mova m5, [pd_2048]<br>
-<br>
punpcklwd m1, m2, m0<br>
punpckhwd m2, m0<br>
-<br>
pmaddwd m0, m1, [r3 + 0 * 16]<br>
pmaddwd m3, m2, [r3 + 1 * 16]<br>
paddd m0, m3<br>
- paddd m0, m5<br>
- psrad m0, 12 ; m1 = S0<br>
-<br>
+ paddd m0, m6<br>
+ psrad m0, IDCT4_SHIFT ; m0 = S0<br>
pmaddwd m3, m1, [r3 + 2 * 16]<br>
pmaddwd m4, m2, [r3 + 3 * 16]<br>
paddd m3, m4<br>
- paddd m3, m5<br>
- psrad m3, 12 ; m3 = S8<br>
+ paddd m3, m6<br>
+ psrad m3, IDCT4_SHIFT ; m3 = S8<br>
packssdw m0, m3 ; m0 = m128iA<br>
-<br>
pmaddwd m3, m1, [r3 + 4 * 16]<br>
pmaddwd m4, m2, [r3 + 5 * 16]<br>
paddd m3, m4<br>
- paddd m3, m5<br>
- psrad m3, 12 ; m3 = S0<br>
-<br>
+ paddd m3, m6<br>
+ psrad m3, IDCT4_SHIFT ; m3 = S0<br>
pmaddwd m1, [r3 + 6 * 16]<br>
pmaddwd m2, [r3 + 7 * 16]<br>
paddd m1, m2<br>
- paddd m1, m5<br>
- psrad m1, 12 ; m1 = S8<br>
+ paddd m1, m6<br>
+ psrad m1, IDCT4_SHIFT ; m1 = S8<br>
packssdw m3, m1 ; m3 = m128iD<br>
</div></div>-<br>
punpcklwd m1, m0, m3<br>
punpckhwd m0, m3<br>
<br>
@@ -475,12 +469,19 @@<br>
; ...<br>
<div class=""> ; Row6[4-7] Row7[4-7]<br>
;------------------------<br>
+%if BIT_DEPTH == 10<br>
+ %define DCT_SHIFT 4<br>
+ mova m6, [pd_8]<br>
</div>+%elif BIT_DEPTH == 8<br>
<div class="">+ %define DCT_SHIFT 2<br>
+ mova m6, [pd_2]<br>
+%else<br>
+ %error Unsupported BIT_DEPTH!<br>
+%endif<br>
<br>
</div><div class=""> add r2, r2<br>
lea r3, [r2 * 3]<br>
mov r5, rsp<br>
-<br>
- mova m6, [pd_2]<br>
%assign x 0<br>
%rep 2<br>
movu m0, [r0]<br>
</div>@@ -518,7 +519,7 @@<br>
<div class=""> pmaddwd m5, m0, [r4 + 0*16]<br>
phaddd m1, m5<br>
paddd m1, m6<br>
- psrad m1, 2<br>
+ psrad m1, DCT_SHIFT<br>
%if x == 1<br>
pshufd m1, m1, 0x1B<br>
%endif<br>
</div>@@ -528,7 +529,7 @@<br>
<div class=""> pmaddwd m5, m0, [r4 + 1*16]<br>
phaddd m1, m5<br>
paddd m1, m6<br>
- psrad m1, 2<br>
+ psrad m1, DCT_SHIFT<br>
%if x == 1<br>
pshufd m1, m1, 0x1B<br>
%endif<br>
</div>@@ -538,7 +539,7 @@<br>
<div class=""> pmaddwd m5, m0, [r4 + 2*16]<br>
phaddd m1, m5<br>
paddd m1, m6<br>
- psrad m1, 2<br>
+ psrad m1, DCT_SHIFT<br>
%if x == 1<br>
pshufd m1, m1, 0x1B<br>
%endif<br>
</div>@@ -548,7 +549,7 @@<br>
<div class=""> pmaddwd m0, [r4 + 3*16]<br>
phaddd m4, m0<br>
paddd m4, m6<br>
- psrad m4, 2<br>
+ psrad m4, DCT_SHIFT<br>
%if x == 1<br>
pshufd m4, m4, 0x1B<br>
%endif<br>
</div>@@ -561,34 +562,30 @@<br>
psubw m2, m3 ; m2 = [EO1 EO0]<br>
psignw m2, [pw_ppppmmmm]<br>
pshufb m2, [pb_unpackhlw1]<br>
<div class="">-<br>
pmaddwd m3, m0, [r4 + 0*16]<br>
paddd m3, m6<br>
- psrad m3, 2<br>
+ psrad m3, DCT_SHIFT<br>
%if x == 1<br>
pshufd m3, m3, 0x1B<br>
%endif<br>
</div> mova [r5 + 0*2*mmsize], m3 ; Row 0<br>
<div class="">-<br>
pmaddwd m0, [r4 + 2*16]<br>
paddd m0, m6<br>
- psrad m0, 2<br>
+ psrad m0, DCT_SHIFT<br>
%if x == 1<br>
pshufd m0, m0, 0x1B<br>
%endif<br>
</div> mova [r5 + 4*2*mmsize], m0 ; Row 4<br>
<div class="">-<br>
pmaddwd m3, m2, [r4 + 1*16]<br>
paddd m3, m6<br>
- psrad m3, 2<br>
+ psrad m3, DCT_SHIFT<br>
%if x == 1<br>
pshufd m3, m3, 0x1B<br>
%endif<br>
</div> mova [r5 + 2*2*mmsize], m3 ; Row 2<br>
<div class="">-<br>
pmaddwd m2, [r4 + 3*16]<br>
paddd m2, m6<br>
- psrad m2, 2<br>
+ psrad m2, DCT_SHIFT<br>
%if x == 1<br>
pshufd m2, m2, 0x1B<br>
%endif<br>
</div>diff -r 1a0d5b456b19 -r 6150985c3d53 source/test/mbdstharness.cpp<br>
--- a/source/test/mbdstharness.cpp Tue Feb 18 14:46:51 2014 -0600<br>
+++ b/source/test/mbdstharness.cpp Wed Feb 19 12:21:13 2014 +0530<br>
@@ -169,12 +169,14 @@<br>
X265_FREE(int_test_buff);<br>
X265_FREE(int_idct_test_buff);<br>
<div class=""> }<br>
-<br>
bool MBDstHarness::check_dct_primitive(dct_t ref, dct_t opt, int width)<br>
{<br>
+#if HIGH_BIT_DEPTH<br>
+ int old_depth = X265_DEPTH;<br>
+ X265_DEPTH = 10;<br>
+#endif<br>
int j = 0;<br>
int cmp_size = sizeof(int) * width * width;<br>
</div>-<br>
for (int i = 0; i <= 100; i++)<br>
{<br>
int index = rand() % TEST_CASES;<br>
@@ -188,24 +190,34 @@<br>
<div class=""> ref(short_test_buff[index] + j, mintbuf3, width);<br>
opt(short_test_buff[index] + j, mintbuf4, width);<br>
#endif<br>
+<br>
+#if HIGH_BIT_DEPTH<br>
+ X265_DEPTH = old_depth;<br>
+#endif<br>
+<br>
return false;<br>
}<br>
</div>-<br>
j += 16;<br>
#if _DEBUG<br>
memset(mbuf2, 0xCD, mem_cmp_size);<br>
memset(mbuf3, 0xCD, mem_cmp_size);<br>
<div class=""> #endif<br>
}<br>
+#if HIGH_BIT_DEPTH<br>
+ X265_DEPTH = old_depth;<br>
+#endif<br>
<br>
return true;<br>
}<br>
</div><div class="">-<br>
bool MBDstHarness::check_idct_primitive(idct_t ref, idct_t opt, int width)<br>
{<br>
+#if HIGH_BIT_DEPTH<br>
+ int old_depth = X265_DEPTH;<br>
+ X265_DEPTH = 10;<br>
+#endif<br>
+<br>
int j = 0;<br>
int cmp_size = sizeof(int16_t) * width * width;<br>
</div>-<br>
for (int i = 0; i <= 100; i++)<br>
{<br>
int index = rand() % TEST_CASES;<br>
@@ -218,16 +230,22 @@<br>
ref(int_idct_test_buff[index] + j, mbuf2, width);<br>
opt(int_idct_test_buff[index] + j, mbuf3, width);<br>
<div class=""> #endif<br>
+<br>
+#if HIGH_BIT_DEPTH<br>
+ X265_DEPTH = old_depth;<br>
+#endif<br>
+<br>
return false;<br>
}<br>
</div>-<br>
j += 16;<br>
#if _DEBUG<br>
memset(mbuf2, 0xCD, mem_cmp_size);<br>
memset(mbuf3, 0xCD, mem_cmp_size);<br>
#endif<br>
<div class="im HOEnZb"> }<br>
-<br>
+#if HIGH_BIT_DEPTH<br>
+ X265_DEPTH = old_depth;<br>
+#endif<br>
return true;<br>
}<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>