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