vp9_loopfilter.h 3.58 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
 */

11
12
#ifndef VP9_COMMON_VP9_LOOPFILTER_H_
#define VP9_COMMON_VP9_LOOPFILTER_H_
John Koleszar's avatar
John Koleszar committed
13
14

#include "vpx_ports/mem.h"
Attila Nagy's avatar
Attila Nagy committed
15
#include "vpx_config.h"
16
#include "vp9/common/vp9_blockd.h"
John Koleszar's avatar
John Koleszar committed
17
18

#define MAX_LOOP_FILTER 63
Attila Nagy's avatar
Attila Nagy committed
19
20
21
#define SIMD_WIDTH 16

/* Need to align this structure so when it is declared and
22
23
 * passed it can be loaded into vector registers.
 */
John Koleszar's avatar
John Koleszar committed
24
typedef struct {
25
26
27
28
29
30
31
32
  DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
                  mblim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
  DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
                  blim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
  DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
                  lim[MAX_LOOP_FILTER + 1][SIMD_WIDTH]);
  DECLARE_ALIGNED(SIMD_WIDTH, unsigned char,
                  hev_thr[4][SIMD_WIDTH]);
33
  unsigned char lvl[MAX_MB_SEGMENTS][4][4];
John Koleszar's avatar
John Koleszar committed
34
  unsigned char mode_lf_lut[MB_MODE_COUNT];
Attila Nagy's avatar
Attila Nagy committed
35
36
} loop_filter_info_n;

37
struct loop_filter_info {
John Koleszar's avatar
John Koleszar committed
38
39
40
41
  const unsigned char *mblim;
  const unsigned char *blim;
  const unsigned char *lim;
  const unsigned char *hev_thr;
42
};
John Koleszar's avatar
John Koleszar committed
43
44

#define prototype_loopfilter(sym) \
45
  void sym(uint8_t *src, int pitch, const unsigned char *blimit, \
John Koleszar's avatar
John Koleszar committed
46
           const unsigned char *limit, const unsigned char *thresh, int count)
John Koleszar's avatar
John Koleszar committed
47
48

#define prototype_loopfilter_block(sym) \
49
  void sym(uint8_t *y, uint8_t *u, uint8_t *v, \
50
           int ystride, int uv_stride, struct loop_filter_info *lfi)
John Koleszar's avatar
John Koleszar committed
51
52

#if ARCH_X86 || ARCH_X86_64
53
#include "x86/vp9_loopfilter_x86.h"
John Koleszar's avatar
John Koleszar committed
54
55
#endif

56
typedef void loop_filter_uvfunction(uint8_t *u,   /* source pointer */
57
58
59
60
                                    int p,              /* pitch */
                                    const unsigned char *blimit,
                                    const unsigned char *limit,
                                    const unsigned char *thresh,
61
                                    uint8_t *v);
John Koleszar's avatar
John Koleszar committed
62

Johann's avatar
Johann committed
63
/* assorted loopfilter functions which get used elsewhere */
64
struct VP9Common;
Jim Bankoski's avatar
Jim Bankoski committed
65
struct macroblockd;
Johann's avatar
Johann committed
66

67
void vp9_loop_filter_init(struct VP9Common *cm);
Johann's avatar
Johann committed
68

69
void vp9_loop_filter_frame_init(struct VP9Common *cm,
Jim Bankoski's avatar
Jim Bankoski committed
70
                                struct macroblockd *mbd,
Johann's avatar
Johann committed
71
72
                                int default_filt_lvl);

73
74
75
void vp9_loop_filter_frame(struct VP9Common *cm,
                           struct macroblockd *mbd,
                           int filter_level,
76
77
                           int y_only,
                           int dering);
Johann's avatar
Johann committed
78

79
void vp9_loop_filter_partial_frame(struct VP9Common *cm,
Jim Bankoski's avatar
Jim Bankoski committed
80
                                   struct macroblockd *mbd,
Johann's avatar
Johann committed
81
82
                                   int default_filt_lvl);

83
void vp9_loop_filter_update_sharpness(loop_filter_info_n *lfi,
Johann's avatar
Johann committed
84
85
                                      int sharpness_lvl);

86
87
88
89
90
91
92
93
94
95
96
void vp9_mb_lpf_horizontal_edge_w(unsigned char *s, int p,
                                  const unsigned char *blimit,
                                  const unsigned char *limit,
                                  const unsigned char *thresh,
                                  int count);

void vp9_mb_lpf_vertical_edge_w(unsigned char *s, int p,
                                const unsigned char *blimit,
                                const unsigned char *limit,
                                const unsigned char *thresh,
                                int count);
97
#endif  // VP9_COMMON_VP9_LOOPFILTER_H_