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) 57 { 58 mbloop_filter_horizontal_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr); 59 60 if (u_ptr) 61 mbloop_filter_horizontal_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr); 62 } 63 64 void loop_filter_mbhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 65 int y_stride, int uv_stride, loop_filter_info *lfi) 66 { 67 (void)u_ptr; 68 (void)v_ptr; 69 (void)uv_stride; 70 loop_filter_simple_horizontal_edge_ppc(y_ptr, y_stride, lfi->mbflim); 71 } 72 73 // Vertical MB Filtering 74 void loop_filter_mbv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 75 int y_stride, int uv_stride, loop_filter_info *lfi) 76 { 77 mbloop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->mbflim, lfi->lim, lfi->thr); 78 79 if (u_ptr) 80 mbloop_filter_vertical_edge_uv_ppc(u_ptr, v_ptr, uv_stride, lfi->mbflim, lfi->lim, lfi->thr); 81 } 82 83 void loop_filter_mbvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 84 int y_stride, int uv_stride, loop_filter_info *lfi) 85 { 86 (void)u_ptr; 87 (void)v_ptr; 88 (void)uv_stride; 89 loop_filter_simple_vertical_edge_ppc(y_ptr, y_stride, lfi->mbflim); 90 } 91 92 // Horizontal B Filtering 93 void loop_filter_bh_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 94 int y_stride, int uv_stride, loop_filter_info *lfi) 95 { 96 // These should all be done at once with one call, instead of 3 97 loop_filter_horizontal_edge_y_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 98 loop_filter_horizontal_edge_y_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 99 loop_filter_horizontal_edge_y_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim, lfi->lim, lfi->thr); 100 101 if (u_ptr) 102 loop_filter_horizontal_edge_uv_ppc(u_ptr + 4 * uv_stride, v_ptr + 4 * uv_stride, uv_stride, lfi->flim, lfi->lim, lfi->thr); 103 } 104 105 void loop_filter_bhs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 106 int y_stride, int uv_stride, loop_filter_info *lfi) 107 { 108 (void)u_ptr; 109 (void)v_ptr; 110 (void)uv_stride; 111 loop_filter_simple_horizontal_edge_ppc(y_ptr + 4 * y_stride, y_stride, lfi->flim); 112 loop_filter_simple_horizontal_edge_ppc(y_ptr + 8 * y_stride, y_stride, lfi->flim); 113 loop_filter_simple_horizontal_edge_ppc(y_ptr + 12 * y_stride, y_stride, lfi->flim); 114 } 115 116 // Vertical B Filtering 117 void loop_filter_bv_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 118 int y_stride, int uv_stride, loop_filter_info *lfi) 119 { 120 loop_filter_vertical_edge_y_ppc(y_ptr, y_stride, lfi->flim, lfi->lim, lfi->thr); 121 122 if (u_ptr) 123 loop_filter_vertical_edge_uv_ppc(u_ptr + 4, v_ptr + 4, uv_stride, lfi->flim, lfi->lim, lfi->thr); 124 } 125 126 void loop_filter_bvs_ppc(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr, 127 int y_stride, int uv_stride, loop_filter_info *lfi) 128 { 129 (void)u_ptr; 130 (void)v_ptr; 131 (void)uv_stride; 132 loop_filter_simple_vertical_edge_ppc(y_ptr + 4, y_stride, lfi->flim); 133 loop_filter_simple_vertical_edge_ppc(y_ptr + 8, y_stride, lfi->flim); 134 loop_filter_simple_vertical_edge_ppc(y_ptr + 12, y_stride, lfi->flim); 135 } 136