Commit 04b70ea5 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Add vertical loopfilter AVX2 SIMD

parent a146437d
......@@ -347,8 +347,8 @@ void dav1d_calc_eih(Av1FilterLUT *const lim_lut, const int filter_sharpness) {
int level;
// set E/I/H values from loopfilter level
const int sharp = filter_sharpness;
for (level = 0; level < 64; level++) {
const int sharp = filter_sharpness;
int limit = level;
if (sharp > 0) {
......@@ -360,6 +360,8 @@ void dav1d_calc_eih(Av1FilterLUT *const lim_lut, const int filter_sharpness) {
lim_lut->i[level] = limit;
lim_lut->e[level] = 2 * (level + 2) + limit;
}
lim_lut->sharp[0] = (sharp + 3) >> 2;
lim_lut->sharp[1] = sharp ? 9 - sharp : 0xff;
}
static void dav1d_calc_lf_value(uint8_t (*const lflvl_values)[2],
......
......@@ -36,6 +36,7 @@
typedef struct Av1FilterLUT {
uint8_t e[64];
uint8_t i[64];
uint64_t sharp[2];
} Av1FilterLUT;
typedef struct Av1RestorationUnit {
......
......@@ -231,4 +231,8 @@ void bitfn(dav1d_loop_filter_dsp_init)(Dav1dLoopFilterDSPContext *const c) {
c->loop_filter_sb128y = loop_filter_v_sb128y_c;
c->loop_filter_sb128uv = loop_filter_v_sb128uv_c;
#if HAVE_ASM && ARCH_X86
bitfn(dav1d_loop_filter_dsp_init_x86)(c);
#endif
}
......@@ -62,4 +62,7 @@ typedef struct Dav1dLoopFilterDSPContext {
void dav1d_loop_filter_dsp_init_8bpc(Dav1dLoopFilterDSPContext *c);
void dav1d_loop_filter_dsp_init_10bpc(Dav1dLoopFilterDSPContext *c);
void dav1d_loop_filter_dsp_init_x86_8bpc(Dav1dLoopFilterDSPContext *c);
void dav1d_loop_filter_dsp_init_x86_10bpc(Dav1dLoopFilterDSPContext *c);
#endif /* __DAV1D_SRC_LOOPFILTER_H__ */
......@@ -99,6 +99,7 @@ if is_asm_enabled
libdav1d_tmpl_sources += files(
'x86/itx_init.c',
'x86/loopfilter_init.c',
'x86/mc_init.c',
)
......@@ -106,6 +107,7 @@ if is_asm_enabled
libdav1d_sources_asm = files(
'x86/cpuid.asm',
'x86/itx.asm',
'x86/loopfilter.asm',
'x86/mc.asm',
)
......
This diff is collapsed.
/*
* Copyright © 2018, VideoLAN and dav1d authors
* Copyright © 2018, Two Orioles, LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "src/cpu.h"
#include "src/loopfilter.h"
decl_loopfilter_sb_fn(dav1d_lpf_v_sb128y_avx2);
decl_loopfilter_sb_fn(dav1d_lpf_v_sb128uv_avx2);
void bitfn(dav1d_loop_filter_dsp_init_x86)(Dav1dLoopFilterDSPContext *const c) {
const unsigned flags = dav1d_get_cpu_flags();
if (!(flags & DAV1D_X86_CPU_FLAG_AVX2)) return;
#if BITDEPTH == 8 && ARCH_X86_64
c->loop_filter_sb128y = dav1d_lpf_v_sb128y_avx2;
c->loop_filter_sb128uv = dav1d_lpf_v_sb128uv_avx2;
#endif
}
......@@ -115,12 +115,14 @@ static void check_lpf_sb(loopfilter_sb_fn fn, const char *const name,
lut.i[level] = limit;
lut.e[level] = 2 * (level + 2) + limit;
}
lut.sharp[0] = (sharp + 3) >> 2;
lut.sharp[1] = sharp ? 9 - sharp : 0xff;
for (int i = 0; i < n_strengths; i++) {
if (check_func(fn, "%s_w%d_%dbpc", name,
n_strengths == 3 ? 4 << i : 4 * 2 * i, BITDEPTH))
{
uint32_t vmask[3] = { 0 };
uint32_t vmask[4] = { 0 };
uint8_t l[32 * 2][4];
for (int j = 0; j < n_blks; j++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment