Initial WebM release
[platform/upstream/libvpx.git] / vp8 / common / loopfilter.h
1 /*
2  *  Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license and patent
5  *  grant that can be found in the LICENSE file in the root of the source
6  *  tree. All contributing project authors may be found in the AUTHORS
7  *  file in the root of the source tree.
8  */
9
10
11 #ifndef loopfilter_h
12 #define loopfilter_h
13
14 #include "vpx_ports/mem.h"
15
16 #define MAX_LOOP_FILTER 63
17
18 typedef enum
19 {
20     NORMAL_LOOPFILTER = 0,
21     SIMPLE_LOOPFILTER = 1
22 } LOOPFILTERTYPE;
23
24 // FRK
25 // Need to align this structure so when it is declared and
26 // passed it can be loaded into vector registers.
27 // FRK
28 typedef struct
29 {
30     DECLARE_ALIGNED(16, signed char, lim[16]);
31     DECLARE_ALIGNED(16, signed char, flim[16]);
32     DECLARE_ALIGNED(16, signed char, thr[16]);
33     DECLARE_ALIGNED(16, signed char, mbflim[16]);
34     DECLARE_ALIGNED(16, signed char, mbthr[16]);
35     DECLARE_ALIGNED(16, signed char, uvlim[16]);
36     DECLARE_ALIGNED(16, signed char, uvflim[16]);
37     DECLARE_ALIGNED(16, signed char, uvthr[16]);
38     DECLARE_ALIGNED(16, signed char, uvmbflim[16]);
39     DECLARE_ALIGNED(16, signed char, uvmbthr[16]);
40 } loop_filter_info;
41
42
43 #define prototype_loopfilter(sym) \
44     void sym(unsigned char *src, int pitch, const signed char *flimit,\
45              const signed char *limit, const signed char *thresh, int count)
46
47 #define prototype_loopfilter_block(sym) \
48     void sym(unsigned char *y, unsigned char *u, unsigned char *v,\
49              int ystride, int uv_stride, loop_filter_info *lfi, int simpler)
50
51 #if ARCH_X86 || ARCH_X86_64
52 #include "x86/loopfilter_x86.h"
53 #endif
54
55 #if ARCH_ARM
56 #include "arm/loopfilter_arm.h"
57 #endif
58
59 #ifndef vp8_lf_normal_mb_v
60 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c
61 #endif
62 extern prototype_loopfilter_block(vp8_lf_normal_mb_v);
63
64 #ifndef vp8_lf_normal_b_v
65 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c
66 #endif
67 extern prototype_loopfilter_block(vp8_lf_normal_b_v);
68
69 #ifndef vp8_lf_normal_mb_h
70 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c
71 #endif
72 extern prototype_loopfilter_block(vp8_lf_normal_mb_h);
73
74 #ifndef vp8_lf_normal_b_h
75 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c
76 #endif
77 extern prototype_loopfilter_block(vp8_lf_normal_b_h);
78
79
80 #ifndef vp8_lf_simple_mb_v
81 #define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_c
82 #endif
83 extern prototype_loopfilter_block(vp8_lf_simple_mb_v);
84
85 #ifndef vp8_lf_simple_b_v
86 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c
87 #endif
88 extern prototype_loopfilter_block(vp8_lf_simple_b_v);
89
90 #ifndef vp8_lf_simple_mb_h
91 #define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_c
92 #endif
93 extern prototype_loopfilter_block(vp8_lf_simple_mb_h);
94
95 #ifndef vp8_lf_simple_b_h
96 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c
97 #endif
98 extern prototype_loopfilter_block(vp8_lf_simple_b_h);
99
100 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t));
101 typedef struct
102 {
103     vp8_lf_block_fn_t  normal_mb_v;
104     vp8_lf_block_fn_t  normal_b_v;
105     vp8_lf_block_fn_t  normal_mb_h;
106     vp8_lf_block_fn_t  normal_b_h;
107     vp8_lf_block_fn_t  simple_mb_v;
108     vp8_lf_block_fn_t  simple_b_v;
109     vp8_lf_block_fn_t  simple_mb_h;
110     vp8_lf_block_fn_t  simple_b_h;
111 } vp8_loopfilter_rtcd_vtable_t;
112
113 #if CONFIG_RUNTIME_CPU_DETECT
114 #define LF_INVOKE(ctx,fn) (ctx)->fn
115 #else
116 #define LF_INVOKE(ctx,fn) vp8_lf_##fn
117 #endif
118
119
120 #endif