[x265] [PATCH] 16bpp: assembly code for intra_pred_dc4
dnyaneshwar at multicorewareinc.com
dnyaneshwar at multicorewareinc.com
Wed Dec 4 11:15:48 CET 2013
# HG changeset patch
# User Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
# Date 1386151818 -19800
# Wed Dec 04 15:40:18 2013 +0530
# Node ID dfde78a1d1eaad7385823831dd5a121861e0d82d
# Parent 759a5eee46d38ffa0205fc1551291653086208c9
16bpp: assembly code for intra_pred_dc4
diff -r 759a5eee46d3 -r dfde78a1d1ea source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt Wed Dec 04 12:24:59 2013 +0530
+++ b/source/common/CMakeLists.txt Wed Dec 04 15:40:18 2013 +0530
@@ -119,12 +119,12 @@
if(ENABLE_PRIMITIVES_ASM)
set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h)
set(A_SRCS pixel-a.asm const-a.asm cpu-a.asm ssd-a.asm mc-a.asm
- mc-a2.asm ipfilter8.asm pixel-util8.asm blockcopy8.asm intrapred8.asm
+ mc-a2.asm ipfilter8.asm pixel-util8.asm blockcopy8.asm
pixeladd8.asm dct8.asm)
if(HIGH_BIT_DEPTH)
- set(A_SRCS ${A_SRCS} sad16-a.asm)
+ set(A_SRCS ${A_SRCS} sad16-a.asm intrapred16.asm)
else()
- set(A_SRCS ${A_SRCS} sad-a.asm)
+ set(A_SRCS ${A_SRCS} sad-a.asm intrapred8.asm)
endif()
if (NOT X64)
diff -r 759a5eee46d3 -r dfde78a1d1ea source/common/x86/asm-primitives.cpp
--- a/source/common/x86/asm-primitives.cpp Wed Dec 04 12:24:59 2013 +0530
+++ b/source/common/x86/asm-primitives.cpp Wed Dec 04 15:40:18 2013 +0530
@@ -563,6 +563,7 @@
}
if (cpuMask & X265_CPU_SSE4)
{
+ p.intra_pred_dc[BLOCK_4x4] = x265_intra_pred_dc4_sse4;
}
if (cpuMask & X265_CPU_XOP)
{
diff -r 759a5eee46d3 -r dfde78a1d1ea source/common/x86/const-a.asm
--- a/source/common/x86/const-a.asm Wed Dec 04 12:24:59 2013 +0530
+++ b/source/common/x86/const-a.asm Wed Dec 04 15:40:18 2013 +0530
@@ -36,6 +36,7 @@
const pw_32, times 16 dw 32
const pw_512, times 16 dw 512
const pw_1024, times 16 dw 1024
+const pw_4096, times 16 dw 4096
const pw_00ff, times 16 dw 0x00ff
const pw_pixel_max,times 16 dw ((1 << BIT_DEPTH)-1)
const pd_1, times 8 dd 1
diff -r 759a5eee46d3 -r dfde78a1d1ea source/common/x86/intrapred16.asm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/common/x86/intrapred16.asm Wed Dec 04 15:40:18 2013 +0530
@@ -0,0 +1,117 @@
+;*****************************************************************************
+;* Copyright (C) 2013 x265 project
+;*
+;* Authors: Dnyaneshwar Gorade <dnyaneshwar at multicorewareinc.com>
+;*
+;* This program is free software; you can redistribute it and/or modify
+;* it under the terms of the GNU General Public License as published by
+;* the Free Software Foundation; either version 2 of the License, or
+;* (at your option) any later version.
+;*
+;* This program is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;* GNU General Public License for more details.
+;*
+;* You should have received a copy of the GNU General Public License
+;* along with this program; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
+;*
+;* This program is also available under a commercial proprietary license.
+;* For more information, contact us at licensing at multicorewareinc.com.
+;*****************************************************************************/
+
+%include "x86inc.asm"
+%include "x86util.asm"
+
+SECTION_RODATA 32
+
+SECTION .text
+
+cextern pw_8
+cextern pw_4096
+cextern multiH
+cextern multiH2
+cextern multiH3
+cextern multi_2Row
+
+;-----------------------------------------------------------------------------
+; void intra_pred_dc(pixel* above, pixel* left, pixel* dst, intptr_t dstStride, int filter)
+;-----------------------------------------------------------------------------
+INIT_XMM sse4
+cglobal intra_pred_dc4, 5,6,3
+ pxor m0, m0
+ movh m1, [r0] ; sumAbove
+ movh m2, [r1] ; sumLeft
+
+ paddw m1, m2
+ pshufd m2, m1, 1
+ paddw m1, m2
+ phaddw m1, m1 ; m1 = sum
+
+ test r4d, r4d
+
+ pmulhrsw m1, [pw_4096] ; m1 = (sum + 4) / 8
+ movd r4d, m1 ; r4d = dc_val
+ movzx r4d, r4w
+ pshuflw m1, m1, 0 ; m1 = word [dc_val ...]
+
+ ; store DC 4x4
+ movh [r2], m1
+ movh [r2 + r3 * 2], m1
+ lea r5, [r2 + r3 * 4]
+ movh [r5], m1
+ movh [r5 + r3 * 2], m1
+
+ ; do DC filter
+ jz .end
+ lea r5d, [r4d * 2 + 2] ; r5d = DC * 2 + 2
+ add r4d, r5d ; r4d = DC * 3 + 2
+ movd m1, r4d
+ pshuflw m1, m1, 0 ; m1 = pixDCx3
+
+ ; filter top
+ movu m2, [r0]
+ paddw m2, m1
+ psraw m2, 2
+ movh [r2], m2 ; overwrite top-left pixel, we will update it later
+
+ ; filter top-left
+ movzx r0d, word [r0]
+ add r5d, r0d
+ movzx r0d, word [r1]
+ add r0d, r5d
+ shr r0d, 2
+ mov [r2], r0w
+
+ ; filter left
+ lea r2, [r2 + r3 * 2]
+ movu m2, [r1 + 2]
+ paddw m2, m1
+ psraw m2, 2
+ movd r0d, m2
+ mov [r2], r0w
+ shr r0d, 16
+ mov [r2 + 2 * r3], r0w
+ pextrw [r2 + r3 * 4], m2, 2
+
+.end:
+
+ RET
+
+;-----------------------------------------------------------------------------
+; void intraPredAng(pixel* dst, intptr_t dstStride, pixel *refLeft, pixel *refAbove, int dirMode, int bFilter)
+;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal intra_pred_ang4_2, 3,3,4
+
+ RET
+
+
+;-----------------------------------------------------------------------------
+; void intraPredAng(pixel* dst, intptr_t dstStride, pixel *refLeft, pixel *refAbove, int dirMode, int bFilter)
+;-----------------------------------------------------------------------------
+INIT_XMM ssse3
+cglobal intra_pred_ang4_3, 3,3,4
+
+ RET
More information about the x265-devel
mailing list