2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
15 #include "vpx_ports/mem.h"
16 #include "vpx_config.h"
18 #define MAX_LOOP_FILTER 63
22 NORMAL_LOOPFILTER = 0,
32 /* Need to align this structure so when it is declared and
33 * passed it can be loaded into vector registers.
37 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
38 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
39 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
40 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
41 unsigned char lvl[4][4][4];
42 unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
43 unsigned char mode_lf_lut[10];
48 const unsigned char * mblim;
49 const unsigned char * blim;
50 const unsigned char * lim;
51 const unsigned char * hev_thr;
55 #define prototype_loopfilter(sym) \
56 void sym(unsigned char *src, int pitch, const unsigned char *blimit,\
57 const unsigned char *limit, const unsigned char *thresh, int count)
59 #define prototype_loopfilter_block(sym) \
60 void sym(unsigned char *y, unsigned char *u, unsigned char *v, \
61 int ystride, int uv_stride, loop_filter_info *lfi)
63 #define prototype_simple_loopfilter(sym) \
64 void sym(unsigned char *y, int ystride, const unsigned char *blimit)
66 #if ARCH_X86 || ARCH_X86_64
67 #include "x86/loopfilter_x86.h"
71 #include "arm/loopfilter_arm.h"
74 #ifndef vp8_lf_normal_mb_v
75 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c
77 extern prototype_loopfilter_block(vp8_lf_normal_mb_v);
79 #ifndef vp8_lf_normal_b_v
80 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c
82 extern prototype_loopfilter_block(vp8_lf_normal_b_v);
84 #ifndef vp8_lf_normal_mb_h
85 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c
87 extern prototype_loopfilter_block(vp8_lf_normal_mb_h);
89 #ifndef vp8_lf_normal_b_h
90 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c
92 extern prototype_loopfilter_block(vp8_lf_normal_b_h);
94 #ifndef vp8_lf_simple_mb_v
95 #define vp8_lf_simple_mb_v vp8_loop_filter_simple_vertical_edge_c
97 extern prototype_simple_loopfilter(vp8_lf_simple_mb_v);
99 #ifndef vp8_lf_simple_b_v
100 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c
102 extern prototype_simple_loopfilter(vp8_lf_simple_b_v);
104 #ifndef vp8_lf_simple_mb_h
105 #define vp8_lf_simple_mb_h vp8_loop_filter_simple_horizontal_edge_c
107 extern prototype_simple_loopfilter(vp8_lf_simple_mb_h);
109 #ifndef vp8_lf_simple_b_h
110 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c
112 extern prototype_simple_loopfilter(vp8_lf_simple_b_h);
114 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t));
115 typedef prototype_simple_loopfilter((*vp8_slf_block_fn_t));
119 vp8_lf_block_fn_t normal_mb_v;
120 vp8_lf_block_fn_t normal_b_v;
121 vp8_lf_block_fn_t normal_mb_h;
122 vp8_lf_block_fn_t normal_b_h;
123 vp8_slf_block_fn_t simple_mb_v;
124 vp8_slf_block_fn_t simple_b_v;
125 vp8_slf_block_fn_t simple_mb_h;
126 vp8_slf_block_fn_t simple_b_h;
127 } vp8_loopfilter_rtcd_vtable_t;
129 #if CONFIG_RUNTIME_CPU_DETECT
130 #define LF_INVOKE(ctx,fn) (ctx)->fn
132 #define LF_INVOKE(ctx,fn) vp8_lf_##fn
135 typedef void loop_filter_uvfunction
137 unsigned char *u, /* source pointer */
139 const unsigned char *blimit,
140 const unsigned char *limit,
141 const unsigned char *thresh,