Merge "asm_*_offsets to define variables as constants"
[profile/ivi/libvpx.git] / vp8 / common / loopfilter.h
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
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.
9  */
10
11
12 #ifndef loopfilter_h
13 #define loopfilter_h
14
15 #include "vpx_ports/mem.h"
16 #include "vpx_config.h"
17 #include "vpx_rtcd.h"
18
19 #define MAX_LOOP_FILTER             63
20 /* fraction of total macroblock rows to be used in fast filter level picking */
21 /* has to be > 2 */
22 #define PARTIAL_FRAME_FRACTION      8
23
24 typedef enum
25 {
26     NORMAL_LOOPFILTER = 0,
27     SIMPLE_LOOPFILTER = 1
28 } LOOPFILTERTYPE;
29
30 #if ARCH_ARM
31 #define SIMD_WIDTH 1
32 #else
33 #define SIMD_WIDTH 16
34 #endif
35
36 /* Need to align this structure so when it is declared and
37  * passed it can be loaded into vector registers.
38  */
39 typedef struct
40 {
41     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
42     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
43     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
44     DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
45     unsigned char lvl[4][4][4];
46     unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
47     unsigned char mode_lf_lut[10];
48 } loop_filter_info_n;
49
50 typedef struct loop_filter_info
51 {
52     const unsigned char * mblim;
53     const unsigned char * blim;
54     const unsigned char * lim;
55     const unsigned char * hev_thr;
56 } loop_filter_info;
57
58
59 typedef void loop_filter_uvfunction
60 (
61     unsigned char *u,   /* source pointer */
62     int p,              /* pitch */
63     const unsigned char *blimit,
64     const unsigned char *limit,
65     const unsigned char *thresh,
66     unsigned char *v
67 );
68
69 /* assorted loopfilter functions which get used elsewhere */
70 struct VP8Common;
71 struct macroblockd;
72
73 void vp8_loop_filter_init(struct VP8Common *cm);
74
75 void vp8_loop_filter_frame_init(struct VP8Common *cm,
76                                 struct macroblockd *mbd,
77                                 int default_filt_lvl);
78
79 void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd);
80
81 void vp8_loop_filter_partial_frame(struct VP8Common *cm,
82                                    struct macroblockd *mbd,
83                                    int default_filt_lvl);
84
85 void vp8_loop_filter_frame_yonly(struct VP8Common *cm,
86                                  struct macroblockd *mbd,
87                                  int default_filt_lvl);
88
89 void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
90                                       int sharpness_lvl);
91
92 #endif