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.
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] =
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
,
47 unsigned int output_height
,
48 unsigned int output_width
,
49 const short *vp8_filter
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
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;
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,
87 unsigned int output_height,
88 unsigned int output_width,
89 const short *vp8_filter
95 for ( i=0; i<output_height; i++ )
97 for ( j=0; j<output_width; j++ )
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);
108 //src_ptr += src_pixels_per_line - output_width;
109 output_ptr += output_pitch;
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
,
127 unsigned short FData
[36*16]; // Temp data bufffer used in filtering
129 // First filter 1-D horizontally...
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
,
144 unsigned char *dst_ptr
,
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
,
163 unsigned char *dst_ptr
,
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
,
182 unsigned char *dst_ptr
,
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
,
201 unsigned char *dst_ptr
,
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);