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 #include "loopfilter.h" 13 #include "onyxc_int.h" 14 15 typedef void loop_filter_function_y_ppc 16 ( 17 unsigned char *s, // source pointer 18 int p, // pitch 19 const signed char *flimit, 20 const signed char *limit, 21 const signed char *thresh 22 ); 23 24 typedef void loop_filter_function_uv_ppc 25 ( 26 unsigned char *u, // source pointer 27 unsigned char *v, // source pointer 28 int p, // pitch 29 const signed char *flimit, 30 const signed char *limit, 31 const signed char *thresh 32 ); 33 34 typedef void loop_filter_function_s_ppc 35 ( 36 unsigned char *s, // source pointer 37 int p, // pitch 38 const signed char *flimit 39 ); 40 41 loop_filter_function_y_ppc mbloop_filter_horizontal_edge_y_ppc; 42 loop_filter_function_y_ppc mbloop_filter_vertical_edge_y_ppc; 43 loop_filter_function_y_ppc loop_filter_horizontal_edge_y_ppc; 44 loop_filter_function_y_ppc loop_filter_vertical_edge_y_ppc; 45 46 loop_filter_function_uv_ppc mbloop_filter_horizontal_edge_uv_ppc; 47 loop_filter_function_uv_ppc mbloop_filter_vertical_edge_uv_ppc; 48 loop_filter_function_uv_ppc loop_filter_horizontal_edge_uv_ppc; 49 loop_filter_function_uv_ppc loop_filter_vertical_edge_uv_ppc; 50 51 loop_filter_function_s_ppc loop_filter_simple_horizontal_edge_ppc; 52 loop_filter_function_s_ppc loop_filter_simple_vertical_edge_ppc; 53 54 // Horizontal MB filtering 55 void loop_filter_mbh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 56 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 57 { 58 (void)simpler_lpf; 59 mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr); 60 61 if (u_ptr) 62 mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr); 63 } 64 65 void loop_filter_mbhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 66 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 67 { 68 (void)simpler_lpf; 69 (void)u_ptr; 70 (void)v_ptr; 71 (void)uv_stride; 72 loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim); 73 } 74 75 // Vertical MB Filtering 76 void loop_filter_mbv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 77 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 78 { 79 (void)simpler_lpf; 80 mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr); 81 82 if (u_ptr) 83 mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr); 84 } 85 86 void loop_filter_mbvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 87 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 88 { 89 (void)simpler_lpf; 90 (void)u_ptr; 91 (void)v_ptr; 92 (void)uv_stride; 93 loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim); 94 } 95 96 // Horizontal B Filtering 97 void loop_filter_bh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 98 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 99 { 100 (void)simpler_lpf; 101 // These should all be done at once with one call, instead of 3 102 loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 103 loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 104 loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 105 106 if (u_ptr) 107 loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr); 108 } 109 110 void loop_filter_bhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 111 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 112 { 113 (void)simpler_lpf; 114 (void)u_ptr; 115 (void)v_ptr; 116 (void)uv_stride; 117 loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim); 118 loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim); 119 loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim); 120 } 121 122 // Vertical B Filtering 123 void loop_filter_bv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 124 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 125 { 126 (void)simpler_lpf; 127 loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr); 128 129 if (u_ptr) 130 loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr); 131 } 132 133 void loop_filter_bvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 134 int y_stride, int uv_stride, loop_filter_info *lfi, int simpler_lpf) 135 { 136 (void)simpler_lpf; 137 (void)u_ptr; 138 (void)v_ptr; 139 (void)uv_stride; 140 loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim); 141 loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim); 142 loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim); 143 } 144