• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef VPX_VP8_COMMON_LOOPFILTER_H_
12 #define VPX_VP8_COMMON_LOOPFILTER_H_
13 
14 #include "vpx_ports/mem.h"
15 #include "vpx_config.h"
16 #include "vp8_rtcd.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define MAX_LOOP_FILTER 63
23 /* fraction of total macroblock rows to be used in fast filter level picking */
24 /* has to be > 2 */
25 #define PARTIAL_FRAME_FRACTION 8
26 
27 typedef enum { NORMAL_LOOPFILTER = 0, SIMPLE_LOOPFILTER = 1 } LOOPFILTERTYPE;
28 
29 #if ARCH_ARM
30 #define SIMD_WIDTH 1
31 #else
32 #define SIMD_WIDTH 16
33 #endif
34 
35 /* Need to align this structure so when it is declared and
36  * passed it can be loaded into vector registers.
37  */
38 typedef struct {
39   DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
40                   mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
41   DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
42                   blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
43   DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
44                   lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
45   DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]);
46   unsigned char lvl[4][4][4];
47   unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1];
48   unsigned char mode_lf_lut[10];
49 } loop_filter_info_n;
50 
51 typedef struct loop_filter_info {
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 typedef void loop_filter_uvfunction(unsigned char *u, /* source pointer */
59                                     int p,            /* pitch */
60                                     const unsigned char *blimit,
61                                     const unsigned char *limit,
62                                     const unsigned char *thresh,
63                                     unsigned char *v);
64 
65 /* assorted loopfilter functions which get used elsewhere */
66 struct VP8Common;
67 struct macroblockd;
68 struct modeinfo;
69 
70 void vp8_loop_filter_init(struct VP8Common *cm);
71 
72 void vp8_loop_filter_frame_init(struct VP8Common *cm, struct macroblockd *mbd,
73                                 int default_filt_lvl);
74 
75 void vp8_loop_filter_frame(struct VP8Common *cm, struct macroblockd *mbd,
76                            int frame_type);
77 
78 void vp8_loop_filter_partial_frame(struct VP8Common *cm,
79                                    struct macroblockd *mbd,
80                                    int default_filt_lvl);
81 
82 void vp8_loop_filter_frame_yonly(struct VP8Common *cm, struct macroblockd *mbd,
83                                  int default_filt_lvl);
84 
85 void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi,
86                                       int sharpness_lvl);
87 
88 void vp8_loop_filter_row_normal(struct VP8Common *cm,
89                                 struct modeinfo *mode_info_context, int mb_row,
90                                 int post_ystride, int post_uvstride,
91                                 unsigned char *y_ptr, unsigned char *u_ptr,
92                                 unsigned char *v_ptr);
93 
94 void vp8_loop_filter_row_simple(struct VP8Common *cm,
95                                 struct modeinfo *mode_info_context, int mb_row,
96                                 int post_ystride, int post_uvstride,
97                                 unsigned char *y_ptr, unsigned char *u_ptr,
98                                 unsigned char *v_ptr);
99 #ifdef __cplusplus
100 }  // extern "C"
101 #endif
102 
103 #endif  // VPX_VP8_COMMON_LOOPFILTER_H_
104