| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #ifndef loopfilter_h | 12 #ifndef loopfilter_h |
| 13 #define loopfilter_h | 13 #define loopfilter_h |
| 14 | 14 |
| 15 #include "vpx_ports/mem.h" | 15 #include "vpx_ports/mem.h" |
| 16 #include "vpx_config.h" |
| 16 | 17 |
| 17 #define MAX_LOOP_FILTER 63 | 18 #define MAX_LOOP_FILTER 63 |
| 18 | 19 |
| 19 typedef enum | 20 typedef enum |
| 20 { | 21 { |
| 21 NORMAL_LOOPFILTER = 0, | 22 NORMAL_LOOPFILTER = 0, |
| 22 SIMPLE_LOOPFILTER = 1 | 23 SIMPLE_LOOPFILTER = 1 |
| 23 } LOOPFILTERTYPE; | 24 } LOOPFILTERTYPE; |
| 24 | 25 |
| 25 /* FRK | 26 #if ARCH_ARM |
| 26 * Need to align this structure so when it is declared and | 27 #define SIMD_WIDTH 1 |
| 28 #else |
| 29 #define SIMD_WIDTH 16 |
| 30 #endif |
| 31 |
| 32 /* Need to align this structure so when it is declared and |
| 27 * passed it can be loaded into vector registers. | 33 * passed it can be loaded into vector registers. |
| 28 */ | 34 */ |
| 29 typedef struct | 35 typedef struct |
| 30 { | 36 { |
| 31 DECLARE_ALIGNED(16, signed char, lim[16]); | 37 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, mblim[MAX_LOOP_FILTER + 1][SIMD_W
IDTH]); |
| 32 DECLARE_ALIGNED(16, signed char, flim[16]); | 38 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, blim[MAX_LOOP_FILTER + 1][SIMD_WI
DTH]); |
| 33 DECLARE_ALIGNED(16, signed char, thr[16]); | 39 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, lim[MAX_LOOP_FILTER + 1][SIMD_WID
TH]); |
| 34 DECLARE_ALIGNED(16, signed char, mbflim[16]); | 40 DECLARE_ALIGNED(SIMD_WIDTH, unsigned char, hev_thr[4][SIMD_WIDTH]); |
| 41 unsigned char lvl[4][4][4]; |
| 42 unsigned char hev_thr_lut[2][MAX_LOOP_FILTER + 1]; |
| 43 unsigned char mode_lf_lut[10]; |
| 44 } loop_filter_info_n; |
| 45 |
| 46 typedef struct |
| 47 { |
| 48 const unsigned char * mblim; |
| 49 const unsigned char * blim; |
| 50 const unsigned char * lim; |
| 51 const unsigned char * hev_thr; |
| 35 } loop_filter_info; | 52 } loop_filter_info; |
| 36 | 53 |
| 37 | 54 |
| 38 #define prototype_loopfilter(sym) \ | 55 #define prototype_loopfilter(sym) \ |
| 39 void sym(unsigned char *src, int pitch, const signed char *flimit,\ | 56 void sym(unsigned char *src, int pitch, const unsigned char *blimit,\ |
| 40 const signed char *limit, const signed char *thresh, int count) | 57 const unsigned char *limit, const unsigned char *thresh, int count) |
| 41 | 58 |
| 42 #define prototype_loopfilter_block(sym) \ | 59 #define prototype_loopfilter_block(sym) \ |
| 43 void sym(unsigned char *y, unsigned char *u, unsigned char *v,\ | 60 void sym(unsigned char *y, unsigned char *u, unsigned char *v, \ |
| 44 int ystride, int uv_stride, loop_filter_info *lfi, int simpler) | 61 int ystride, int uv_stride, loop_filter_info *lfi) |
| 62 |
| 63 #define prototype_simple_loopfilter(sym) \ |
| 64 void sym(unsigned char *y, int ystride, const unsigned char *blimit) |
| 45 | 65 |
| 46 #if ARCH_X86 || ARCH_X86_64 | 66 #if ARCH_X86 || ARCH_X86_64 |
| 47 #include "x86/loopfilter_x86.h" | 67 #include "x86/loopfilter_x86.h" |
| 48 #endif | 68 #endif |
| 49 | 69 |
| 50 #if ARCH_ARM | 70 #if ARCH_ARM |
| 51 #include "arm/loopfilter_arm.h" | 71 #include "arm/loopfilter_arm.h" |
| 52 #endif | 72 #endif |
| 53 | 73 |
| 54 #ifndef vp8_lf_normal_mb_v | 74 #ifndef vp8_lf_normal_mb_v |
| 55 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c | 75 #define vp8_lf_normal_mb_v vp8_loop_filter_mbv_c |
| 56 #endif | 76 #endif |
| 57 extern prototype_loopfilter_block(vp8_lf_normal_mb_v); | 77 extern prototype_loopfilter_block(vp8_lf_normal_mb_v); |
| 58 | 78 |
| 59 #ifndef vp8_lf_normal_b_v | 79 #ifndef vp8_lf_normal_b_v |
| 60 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c | 80 #define vp8_lf_normal_b_v vp8_loop_filter_bv_c |
| 61 #endif | 81 #endif |
| 62 extern prototype_loopfilter_block(vp8_lf_normal_b_v); | 82 extern prototype_loopfilter_block(vp8_lf_normal_b_v); |
| 63 | 83 |
| 64 #ifndef vp8_lf_normal_mb_h | 84 #ifndef vp8_lf_normal_mb_h |
| 65 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c | 85 #define vp8_lf_normal_mb_h vp8_loop_filter_mbh_c |
| 66 #endif | 86 #endif |
| 67 extern prototype_loopfilter_block(vp8_lf_normal_mb_h); | 87 extern prototype_loopfilter_block(vp8_lf_normal_mb_h); |
| 68 | 88 |
| 69 #ifndef vp8_lf_normal_b_h | 89 #ifndef vp8_lf_normal_b_h |
| 70 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c | 90 #define vp8_lf_normal_b_h vp8_loop_filter_bh_c |
| 71 #endif | 91 #endif |
| 72 extern prototype_loopfilter_block(vp8_lf_normal_b_h); | 92 extern prototype_loopfilter_block(vp8_lf_normal_b_h); |
| 73 | 93 |
| 74 | |
| 75 #ifndef vp8_lf_simple_mb_v | 94 #ifndef vp8_lf_simple_mb_v |
| 76 #define vp8_lf_simple_mb_v vp8_loop_filter_mbvs_c | 95 #define vp8_lf_simple_mb_v vp8_loop_filter_simple_vertical_edge_c |
| 77 #endif | 96 #endif |
| 78 extern prototype_loopfilter_block(vp8_lf_simple_mb_v); | 97 extern prototype_simple_loopfilter(vp8_lf_simple_mb_v); |
| 79 | 98 |
| 80 #ifndef vp8_lf_simple_b_v | 99 #ifndef vp8_lf_simple_b_v |
| 81 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c | 100 #define vp8_lf_simple_b_v vp8_loop_filter_bvs_c |
| 82 #endif | 101 #endif |
| 83 extern prototype_loopfilter_block(vp8_lf_simple_b_v); | 102 extern prototype_simple_loopfilter(vp8_lf_simple_b_v); |
| 84 | 103 |
| 85 #ifndef vp8_lf_simple_mb_h | 104 #ifndef vp8_lf_simple_mb_h |
| 86 #define vp8_lf_simple_mb_h vp8_loop_filter_mbhs_c | 105 #define vp8_lf_simple_mb_h vp8_loop_filter_simple_horizontal_edge_c |
| 87 #endif | 106 #endif |
| 88 extern prototype_loopfilter_block(vp8_lf_simple_mb_h); | 107 extern prototype_simple_loopfilter(vp8_lf_simple_mb_h); |
| 89 | 108 |
| 90 #ifndef vp8_lf_simple_b_h | 109 #ifndef vp8_lf_simple_b_h |
| 91 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c | 110 #define vp8_lf_simple_b_h vp8_loop_filter_bhs_c |
| 92 #endif | 111 #endif |
| 93 extern prototype_loopfilter_block(vp8_lf_simple_b_h); | 112 extern prototype_simple_loopfilter(vp8_lf_simple_b_h); |
| 94 | 113 |
| 95 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t)); | 114 typedef prototype_loopfilter_block((*vp8_lf_block_fn_t)); |
| 115 typedef prototype_simple_loopfilter((*vp8_slf_block_fn_t)); |
| 116 |
| 96 typedef struct | 117 typedef struct |
| 97 { | 118 { |
| 98 vp8_lf_block_fn_t normal_mb_v; | 119 vp8_lf_block_fn_t normal_mb_v; |
| 99 vp8_lf_block_fn_t normal_b_v; | 120 vp8_lf_block_fn_t normal_b_v; |
| 100 vp8_lf_block_fn_t normal_mb_h; | 121 vp8_lf_block_fn_t normal_mb_h; |
| 101 vp8_lf_block_fn_t normal_b_h; | 122 vp8_lf_block_fn_t normal_b_h; |
| 102 vp8_lf_block_fn_t simple_mb_v; | 123 vp8_slf_block_fn_t simple_mb_v; |
| 103 vp8_lf_block_fn_t simple_b_v; | 124 vp8_slf_block_fn_t simple_b_v; |
| 104 vp8_lf_block_fn_t simple_mb_h; | 125 vp8_slf_block_fn_t simple_mb_h; |
| 105 vp8_lf_block_fn_t simple_b_h; | 126 vp8_slf_block_fn_t simple_b_h; |
| 106 } vp8_loopfilter_rtcd_vtable_t; | 127 } vp8_loopfilter_rtcd_vtable_t; |
| 107 | 128 |
| 108 #if CONFIG_RUNTIME_CPU_DETECT | 129 #if CONFIG_RUNTIME_CPU_DETECT |
| 109 #define LF_INVOKE(ctx,fn) (ctx)->fn | 130 #define LF_INVOKE(ctx,fn) (ctx)->fn |
| 110 #else | 131 #else |
| 111 #define LF_INVOKE(ctx,fn) vp8_lf_##fn | 132 #define LF_INVOKE(ctx,fn) vp8_lf_##fn |
| 112 #endif | 133 #endif |
| 113 | 134 |
| 114 typedef void loop_filter_uvfunction | 135 typedef void loop_filter_uvfunction |
| 115 ( | 136 ( |
| 116 unsigned char *u, /* source pointer */ | 137 unsigned char *u, /* source pointer */ |
| 117 int p, /* pitch */ | 138 int p, /* pitch */ |
| 118 const signed char *flimit, | 139 const unsigned char *blimit, |
| 119 const signed char *limit, | 140 const unsigned char *limit, |
| 120 const signed char *thresh, | 141 const unsigned char *thresh, |
| 121 unsigned char *v | 142 unsigned char *v |
| 122 ); | 143 ); |
| 123 | 144 |
| 145 /* assorted loopfilter functions which get used elsewhere */ |
| 146 struct VP8Common; |
| 147 struct MacroBlockD; |
| 148 |
| 149 void vp8_loop_filter_init(struct VP8Common *cm); |
| 150 |
| 151 void vp8_loop_filter_frame_init(struct VP8Common *cm, |
| 152 struct MacroBlockD *mbd, |
| 153 int default_filt_lvl); |
| 154 |
| 155 void vp8_loop_filter_frame(struct VP8Common *cm, struct MacroBlockD *mbd); |
| 156 |
| 157 void vp8_loop_filter_partial_frame(struct VP8Common *cm, |
| 158 struct MacroBlockD *mbd, |
| 159 int default_filt_lvl); |
| 160 |
| 161 void vp8_loop_filter_frame_yonly(struct VP8Common *cm, |
| 162 struct MacroBlockD *mbd, |
| 163 int default_filt_lvl); |
| 164 |
| 165 void vp8_loop_filter_update_sharpness(loop_filter_info_n *lfi, |
| 166 int sharpness_lvl); |
| 167 |
| 124 #endif | 168 #endif |
| OLD | NEW |