Merge "vp8_rd_pick_best_mbsegmentation code restructure"
[libvpx.git] / vp8 / common / arm / bilinearfilter_arm.c
blob65afb41a1ff8c3db975266c43c606caea80e8f42
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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 */
12 #include <math.h>
13 #include "subpixel.h"
15 #define BLOCK_HEIGHT_WIDTH 4
16 #define VP8_FILTER_WEIGHT 128
17 #define VP8_FILTER_SHIFT 7
19 static const short bilinear_filters[8][2] =
21 { 128, 0 },
22 { 112, 16 },
23 { 96, 32 },
24 { 80, 48 },
25 { 64, 64 },
26 { 48, 80 },
27 { 32, 96 },
28 { 16, 112 }
32 extern void vp8_filter_block2d_bil_first_pass_armv6
34 unsigned char *src_ptr,
35 unsigned short *output_ptr,
36 unsigned int src_pixels_per_line,
37 unsigned int output_height,
38 unsigned int output_width,
39 const short *vp8_filter
42 extern void vp8_filter_block2d_bil_second_pass_armv6
44 unsigned short *src_ptr,
45 unsigned char *output_ptr,
46 int output_pitch,
47 unsigned int output_height,
48 unsigned int output_width,
49 const short *vp8_filter
52 #if 0
53 void vp8_filter_block2d_bil_first_pass_6
55 unsigned char *src_ptr,
56 unsigned short *output_ptr,
57 unsigned int src_pixels_per_line,
58 unsigned int output_height,
59 unsigned int output_width,
60 const short *vp8_filter
63 unsigned int i, j;
65 for ( i=0; i<output_height; i++ )
67 for ( j=0; j<output_width; j++ )
69 /* Apply bilinear filter */
70 output_ptr[j] = ( ( (int)src_ptr[0] * vp8_filter[0]) +
71 ((int)src_ptr[1] * vp8_filter[1]) +
72 (VP8_FILTER_WEIGHT/2) ) >> VP8_FILTER_SHIFT;
73 src_ptr++;
76 /* Next row... */
77 src_ptr += src_pixels_per_line - output_width;
78 output_ptr += output_width;
82 void vp8_filter_block2d_bil_second_pass_6
84 unsigned short *src_ptr,
85 unsigned char *output_ptr,
86 int output_pitch,
87 unsigned int output_height,
88 unsigned int output_width,
89 const short *vp8_filter
92 unsigned int i,j;
93 int Temp;
95 for ( i=0; i<output_height; i++ )
97 for ( j=0; j<output_width; j++ )
99 /* Apply filter */
100 Temp = ((int)src_ptr[0] * vp8_filter[0]) +
101 ((int)src_ptr[output_width] * vp8_filter[1]) +
102 (VP8_FILTER_WEIGHT/2);
103 output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
104 src_ptr++;
107 /* Next row... */
108 /*src_ptr += src_pixels_per_line - output_width;*/
109 output_ptr += output_pitch;
112 #endif
114 void vp8_filter_block2d_bil_armv6
116 unsigned char *src_ptr,
117 unsigned char *output_ptr,
118 unsigned int src_pixels_per_line,
119 unsigned int dst_pitch,
120 const short *HFilter,
121 const short *VFilter,
122 int Width,
123 int Height
127 unsigned short FData[36*16]; /* Temp data bufffer used in filtering */
129 /* First filter 1-D horizontally... */
130 /* pixel_step = 1; */
131 vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pixels_per_line, Height + 1, Width, HFilter);
133 /* then 1-D vertically... */
134 vp8_filter_block2d_bil_second_pass_armv6(FData, output_ptr, dst_pitch, Height, Width, VFilter);
138 void vp8_bilinear_predict4x4_armv6
140 unsigned char *src_ptr,
141 int src_pixels_per_line,
142 int xoffset,
143 int yoffset,
144 unsigned char *dst_ptr,
145 int dst_pitch
148 const short *HFilter;
149 const short *VFilter;
151 HFilter = bilinear_filters[xoffset];
152 VFilter = bilinear_filters[yoffset];
154 vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
157 void vp8_bilinear_predict8x8_armv6
159 unsigned char *src_ptr,
160 int src_pixels_per_line,
161 int xoffset,
162 int yoffset,
163 unsigned char *dst_ptr,
164 int dst_pitch
167 const short *HFilter;
168 const short *VFilter;
170 HFilter = bilinear_filters[xoffset];
171 VFilter = bilinear_filters[yoffset];
173 vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
176 void vp8_bilinear_predict8x4_armv6
178 unsigned char *src_ptr,
179 int src_pixels_per_line,
180 int xoffset,
181 int yoffset,
182 unsigned char *dst_ptr,
183 int dst_pitch
186 const short *HFilter;
187 const short *VFilter;
189 HFilter = bilinear_filters[xoffset];
190 VFilter = bilinear_filters[yoffset];
192 vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
195 void vp8_bilinear_predict16x16_armv6
197 unsigned char *src_ptr,
198 int src_pixels_per_line,
199 int xoffset,
200 int yoffset,
201 unsigned char *dst_ptr,
202 int dst_pitch
205 const short *HFilter;
206 const short *VFilter;
208 HFilter = bilinear_filters[xoffset];
209 VFilter = bilinear_filters[yoffset];
211 vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);