2016-06-29 11:56:42 +02:00
|
|
|
;*******************************************************************************
|
|
|
|
;* SIMD-optimized IDCT functions for HEVC decoding
|
|
|
|
;* Copyright (c) 2014 Pierre-Edouard LEPERE
|
|
|
|
;* Copyright (c) 2014 James Almer
|
|
|
|
;*
|
2017-01-31 17:50:21 +02:00
|
|
|
;* This file is part of FFmpeg.
|
2016-06-29 11:56:42 +02:00
|
|
|
;*
|
2017-01-31 17:50:21 +02:00
|
|
|
;* FFmpeg is free software; you can redistribute it and/or
|
2016-06-29 11:56:42 +02:00
|
|
|
;* modify it under the terms of the GNU Lesser General Public
|
|
|
|
;* License as published by the Free Software Foundation; either
|
|
|
|
;* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
;*
|
2017-01-31 17:50:21 +02:00
|
|
|
;* FFmpeg is distributed in the hope that it will be useful,
|
2016-06-29 11:56:42 +02:00
|
|
|
;* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
;* Lesser General Public License for more details.
|
|
|
|
;*
|
|
|
|
;* You should have received a copy of the GNU Lesser General Public
|
2017-01-31 17:50:21 +02:00
|
|
|
;* License along with FFmpeg; if not, write to the Free Software
|
2016-06-29 11:56:42 +02:00
|
|
|
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
;******************************************************************************
|
|
|
|
|
2014-06-13 14:29:17 +03:00
|
|
|
%include "libavutil/x86/x86util.asm"
|
|
|
|
|
2015-05-27 21:38:14 +02:00
|
|
|
SECTION .text
|
2014-06-13 14:29:17 +03:00
|
|
|
|
2017-01-31 17:50:21 +02:00
|
|
|
; void ff_hevc_idct_HxW_dc_{8,10}_<opt>(int16_t *coeffs)
|
2014-07-26 10:47:14 +03:00
|
|
|
; %1 = HxW
|
|
|
|
; %2 = number of loops
|
|
|
|
; %3 = bitdepth
|
|
|
|
%macro IDCT_DC 3
|
2016-06-29 11:56:42 +02:00
|
|
|
cglobal hevc_idct_%1x%1_dc_%3, 1, 2, 1, coeff, tmp
|
|
|
|
movsx tmpd, word [coeffq]
|
|
|
|
add tmpd, (1 << (14 - %3)) + 1
|
|
|
|
sar tmpd, (15 - %3)
|
2014-07-26 10:47:14 +03:00
|
|
|
movd xm0, tmpd
|
|
|
|
SPLATW m0, xm0
|
|
|
|
DEFINE_ARGS coeff, cnt
|
|
|
|
mov cntd, %2
|
2014-07-28 22:17:34 +03:00
|
|
|
.loop:
|
2014-07-26 10:47:14 +03:00
|
|
|
mova [coeffq+mmsize*0], m0
|
|
|
|
mova [coeffq+mmsize*1], m0
|
|
|
|
mova [coeffq+mmsize*2], m0
|
|
|
|
mova [coeffq+mmsize*3], m0
|
|
|
|
add coeffq, mmsize*8
|
2016-06-29 11:56:42 +02:00
|
|
|
mova [coeffq+mmsize*-4], m0
|
|
|
|
mova [coeffq+mmsize*-3], m0
|
|
|
|
mova [coeffq+mmsize*-2], m0
|
|
|
|
mova [coeffq+mmsize*-1], m0
|
2014-07-26 10:47:14 +03:00
|
|
|
dec cntd
|
|
|
|
jg .loop
|
|
|
|
RET
|
2014-06-16 15:47:21 +03:00
|
|
|
%endmacro
|
|
|
|
|
2014-07-26 10:47:14 +03:00
|
|
|
; %1 = HxW
|
|
|
|
; %2 = bitdepth
|
|
|
|
%macro IDCT_DC_NL 2 ; No loop
|
2016-06-29 11:56:42 +02:00
|
|
|
cglobal hevc_idct_%1x%1_dc_%2, 1, 2, 1, coeff, tmp
|
|
|
|
movsx tmpd, word [coeffq]
|
|
|
|
add tmpd, (1 << (14 - %2)) + 1
|
|
|
|
sar tmpd, (15 - %2)
|
2014-07-26 10:47:14 +03:00
|
|
|
movd m0, tmpd
|
|
|
|
SPLATW m0, xm0
|
|
|
|
mova [coeffq+mmsize*0], m0
|
|
|
|
mova [coeffq+mmsize*1], m0
|
|
|
|
mova [coeffq+mmsize*2], m0
|
|
|
|
mova [coeffq+mmsize*3], m0
|
|
|
|
%if mmsize == 16
|
|
|
|
mova [coeffq+mmsize*4], m0
|
|
|
|
mova [coeffq+mmsize*5], m0
|
|
|
|
mova [coeffq+mmsize*6], m0
|
|
|
|
mova [coeffq+mmsize*7], m0
|
|
|
|
%endif
|
|
|
|
RET
|
2014-06-13 14:29:17 +03:00
|
|
|
%endmacro
|
|
|
|
|
2014-07-26 10:47:14 +03:00
|
|
|
; 8-bit
|
2014-06-13 14:29:17 +03:00
|
|
|
INIT_MMX mmxext
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC_NL 4, 8
|
|
|
|
IDCT_DC 8, 2, 8
|
2014-06-13 14:29:17 +03:00
|
|
|
|
|
|
|
INIT_XMM sse2
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC_NL 8, 8
|
|
|
|
IDCT_DC 16, 4, 8
|
|
|
|
IDCT_DC 32, 16, 8
|
2014-06-13 14:29:17 +03:00
|
|
|
|
2014-06-16 15:47:21 +03:00
|
|
|
%if HAVE_AVX2_EXTERNAL
|
|
|
|
INIT_YMM avx2
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC 16, 2, 8
|
|
|
|
IDCT_DC 32, 8, 8
|
2014-06-16 15:47:21 +03:00
|
|
|
%endif ;HAVE_AVX2_EXTERNAL
|
2014-06-13 14:29:17 +03:00
|
|
|
|
2014-07-26 10:47:14 +03:00
|
|
|
; 10-bit
|
2014-06-13 14:29:17 +03:00
|
|
|
INIT_MMX mmxext
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC_NL 4, 10
|
|
|
|
IDCT_DC 8, 2, 10
|
2014-06-13 14:29:17 +03:00
|
|
|
|
|
|
|
INIT_XMM sse2
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC_NL 8, 10
|
|
|
|
IDCT_DC 16, 4, 10
|
|
|
|
IDCT_DC 32, 16, 10
|
2014-06-16 15:47:21 +03:00
|
|
|
|
|
|
|
%if HAVE_AVX2_EXTERNAL
|
|
|
|
INIT_YMM avx2
|
2014-07-26 10:47:14 +03:00
|
|
|
IDCT_DC 16, 2, 10
|
|
|
|
IDCT_DC 32, 8, 10
|
|
|
|
%endif ;HAVE_AVX2_EXTERNAL
|
2014-07-26 21:08:51 +03:00
|
|
|
|
|
|
|
; 12-bit
|
|
|
|
INIT_MMX mmxext
|
|
|
|
IDCT_DC_NL 4, 12
|
|
|
|
IDCT_DC 8, 2, 12
|
|
|
|
|
|
|
|
INIT_XMM sse2
|
|
|
|
IDCT_DC_NL 8, 12
|
|
|
|
IDCT_DC 16, 4, 12
|
|
|
|
IDCT_DC 32, 16, 12
|
|
|
|
|
|
|
|
%if HAVE_AVX2_EXTERNAL
|
|
|
|
INIT_YMM avx2
|
|
|
|
IDCT_DC 16, 2, 12
|
|
|
|
IDCT_DC 32, 8, 12
|
|
|
|
%endif ;HAVE_AVX2_EXTERNAL
|