clean up bilinear filter
make reference version of bilinear_filters short. use reference versions of bilinear_filters and sub_pel_filters when possible. recognize that Width was being passed into filter_block2d_bil_first_pass multiple times. ARM version had already fixed this. propegate to C. change references to src_pixels_per_line to src_pitch and standardize on src/dst (instead of input/output). recognize that first_pass is only run in the verticle and second_pass only horizontal. ARM version had already fixed this. propegate to C Change-Id: I292d376d239a9a7ca37ec2bf03cc0720606983e2
This commit is contained in:
parent
cc17629f30
commit
e5aaac24bb
@ -15,19 +15,19 @@
|
|||||||
AREA |.text|, CODE, READONLY ; name this block of code
|
AREA |.text|, CODE, READONLY ; name this block of code
|
||||||
|
|
||||||
;-------------------------------------
|
;-------------------------------------
|
||||||
; r0 unsigned char *src_ptr,
|
; r0 unsigned char *src_ptr,
|
||||||
; r1 unsigned short *output_ptr,
|
; r1 unsigned short *dst_ptr,
|
||||||
; r2 unsigned int src_pixels_per_line,
|
; r2 unsigned int src_pitch,
|
||||||
; r3 unsigned int output_height,
|
; r3 unsigned int height,
|
||||||
; stack unsigned int output_width,
|
; stack unsigned int width,
|
||||||
; stack const short *vp8_filter
|
; stack const short *vp8_filter
|
||||||
;-------------------------------------
|
;-------------------------------------
|
||||||
; The output is transposed stroed in output array to make it easy for second pass filtering.
|
; The output is transposed stroed in output array to make it easy for second pass filtering.
|
||||||
|vp8_filter_block2d_bil_first_pass_armv6| PROC
|
|vp8_filter_block2d_bil_first_pass_armv6| PROC
|
||||||
stmdb sp!, {r4 - r11, lr}
|
stmdb sp!, {r4 - r11, lr}
|
||||||
|
|
||||||
ldr r11, [sp, #40] ; vp8_filter address
|
ldr r11, [sp, #40] ; vp8_filter address
|
||||||
ldr r4, [sp, #36] ; output width
|
ldr r4, [sp, #36] ; width
|
||||||
|
|
||||||
mov r12, r3 ; outer-loop counter
|
mov r12, r3 ; outer-loop counter
|
||||||
sub r2, r2, r4 ; src increment for height loop
|
sub r2, r2, r4 ; src increment for height loop
|
||||||
@ -38,10 +38,10 @@
|
|||||||
|
|
||||||
ldr r5, [r11] ; load up filter coefficients
|
ldr r5, [r11] ; load up filter coefficients
|
||||||
|
|
||||||
mov r3, r3, lsl #1 ; output_height*2
|
mov r3, r3, lsl #1 ; height*2
|
||||||
add r3, r3, #2 ; plus 2 to make output buffer 4-bit aligned since height is actually (height+1)
|
add r3, r3, #2 ; plus 2 to make output buffer 4-bit aligned since height is actually (height+1)
|
||||||
|
|
||||||
mov r11, r1 ; save output_ptr for each row
|
mov r11, r1 ; save dst_ptr for each row
|
||||||
|
|
||||||
cmp r5, #128 ; if filter coef = 128, then skip the filter
|
cmp r5, #128 ; if filter coef = 128, then skip the filter
|
||||||
beq bil_null_1st_filter
|
beq bil_null_1st_filter
|
||||||
@ -140,17 +140,17 @@
|
|||||||
|
|
||||||
;---------------------------------
|
;---------------------------------
|
||||||
; r0 unsigned short *src_ptr,
|
; r0 unsigned short *src_ptr,
|
||||||
; r1 unsigned char *output_ptr,
|
; r1 unsigned char *dst_ptr,
|
||||||
; r2 int output_pitch,
|
; r2 int dst_pitch,
|
||||||
; r3 unsigned int output_height,
|
; r3 unsigned int height,
|
||||||
; stack unsigned int output_width,
|
; stack unsigned int width,
|
||||||
; stack const short *vp8_filter
|
; stack const short *vp8_filter
|
||||||
;---------------------------------
|
;---------------------------------
|
||||||
|vp8_filter_block2d_bil_second_pass_armv6| PROC
|
|vp8_filter_block2d_bil_second_pass_armv6| PROC
|
||||||
stmdb sp!, {r4 - r11, lr}
|
stmdb sp!, {r4 - r11, lr}
|
||||||
|
|
||||||
ldr r11, [sp, #40] ; vp8_filter address
|
ldr r11, [sp, #40] ; vp8_filter address
|
||||||
ldr r4, [sp, #36] ; output width
|
ldr r4, [sp, #36] ; width
|
||||||
|
|
||||||
ldr r5, [r11] ; load up filter coefficients
|
ldr r5, [r11] ; load up filter coefficients
|
||||||
mov r12, r4 ; outer-loop counter = width, since we work on transposed data matrix
|
mov r12, r4 ; outer-loop counter = width, since we work on transposed data matrix
|
||||||
|
@ -10,128 +10,48 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "filter.h"
|
||||||
#include "subpixel.h"
|
#include "subpixel.h"
|
||||||
|
|
||||||
#define BLOCK_HEIGHT_WIDTH 4
|
|
||||||
#define VP8_FILTER_WEIGHT 128
|
|
||||||
#define VP8_FILTER_SHIFT 7
|
|
||||||
|
|
||||||
static const short bilinear_filters[8][2] =
|
|
||||||
{
|
|
||||||
{ 128, 0 },
|
|
||||||
{ 112, 16 },
|
|
||||||
{ 96, 32 },
|
|
||||||
{ 80, 48 },
|
|
||||||
{ 64, 64 },
|
|
||||||
{ 48, 80 },
|
|
||||||
{ 32, 96 },
|
|
||||||
{ 16, 112 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern void vp8_filter_block2d_bil_first_pass_armv6
|
extern void vp8_filter_block2d_bil_first_pass_armv6
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
unsigned short *output_ptr,
|
unsigned short *dst_ptr,
|
||||||
unsigned int src_pixels_per_line,
|
unsigned int src_pitch,
|
||||||
unsigned int output_height,
|
unsigned int height,
|
||||||
unsigned int output_width,
|
unsigned int width,
|
||||||
const short *vp8_filter
|
const short *vp8_filter
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void vp8_filter_block2d_bil_second_pass_armv6
|
extern void vp8_filter_block2d_bil_second_pass_armv6
|
||||||
(
|
(
|
||||||
unsigned short *src_ptr,
|
unsigned short *src_ptr,
|
||||||
unsigned char *output_ptr,
|
unsigned char *dst_ptr,
|
||||||
int output_pitch,
|
int dst_pitch,
|
||||||
unsigned int output_height,
|
unsigned int height,
|
||||||
unsigned int output_width,
|
unsigned int width,
|
||||||
const short *vp8_filter
|
const short *vp8_filter
|
||||||
);
|
);
|
||||||
|
|
||||||
#if 0
|
|
||||||
void vp8_filter_block2d_bil_first_pass_6
|
|
||||||
(
|
|
||||||
unsigned char *src_ptr,
|
|
||||||
unsigned short *output_ptr,
|
|
||||||
unsigned int src_pixels_per_line,
|
|
||||||
unsigned int output_height,
|
|
||||||
unsigned int output_width,
|
|
||||||
const short *vp8_filter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
unsigned int i, j;
|
|
||||||
|
|
||||||
for ( i=0; i<output_height; i++ )
|
|
||||||
{
|
|
||||||
for ( j=0; j<output_width; j++ )
|
|
||||||
{
|
|
||||||
/* Apply bilinear filter */
|
|
||||||
output_ptr[j] = ( ( (int)src_ptr[0] * vp8_filter[0]) +
|
|
||||||
((int)src_ptr[1] * vp8_filter[1]) +
|
|
||||||
(VP8_FILTER_WEIGHT/2) ) >> VP8_FILTER_SHIFT;
|
|
||||||
src_ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Next row... */
|
|
||||||
src_ptr += src_pixels_per_line - output_width;
|
|
||||||
output_ptr += output_width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void vp8_filter_block2d_bil_second_pass_6
|
|
||||||
(
|
|
||||||
unsigned short *src_ptr,
|
|
||||||
unsigned char *output_ptr,
|
|
||||||
int output_pitch,
|
|
||||||
unsigned int output_height,
|
|
||||||
unsigned int output_width,
|
|
||||||
const short *vp8_filter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
unsigned int i,j;
|
|
||||||
int Temp;
|
|
||||||
|
|
||||||
for ( i=0; i<output_height; i++ )
|
|
||||||
{
|
|
||||||
for ( j=0; j<output_width; j++ )
|
|
||||||
{
|
|
||||||
/* Apply filter */
|
|
||||||
Temp = ((int)src_ptr[0] * vp8_filter[0]) +
|
|
||||||
((int)src_ptr[output_width] * vp8_filter[1]) +
|
|
||||||
(VP8_FILTER_WEIGHT/2);
|
|
||||||
output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
|
|
||||||
src_ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Next row... */
|
|
||||||
/*src_ptr += src_pixels_per_line - output_width;*/
|
|
||||||
output_ptr += output_pitch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void vp8_filter_block2d_bil_armv6
|
void vp8_filter_block2d_bil_armv6
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
unsigned char *output_ptr,
|
unsigned char *dst_ptr,
|
||||||
unsigned int src_pixels_per_line,
|
unsigned int src_pitch,
|
||||||
unsigned int dst_pitch,
|
unsigned int dst_pitch,
|
||||||
const short *HFilter,
|
const short *HFilter,
|
||||||
const short *VFilter,
|
const short *VFilter,
|
||||||
int Width,
|
int Width,
|
||||||
int Height
|
int Height
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
unsigned short FData[36*16]; /* Temp data buffer used in filtering */
|
||||||
unsigned short FData[36*16]; /* Temp data bufffer used in filtering */
|
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
/* pixel_step = 1; */
|
vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
|
||||||
vp8_filter_block2d_bil_first_pass_armv6(src_ptr, FData, src_pixels_per_line, Height + 1, Width, HFilter);
|
|
||||||
|
|
||||||
/* then 1-D vertically... */
|
/* then 1-D vertically... */
|
||||||
vp8_filter_block2d_bil_second_pass_armv6(FData, output_ptr, dst_pitch, Height, Width, VFilter);
|
vp8_filter_block2d_bil_second_pass_armv6(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,8 +68,8 @@ void vp8_bilinear_predict4x4_armv6
|
|||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
|
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
|
||||||
}
|
}
|
||||||
@ -167,8 +87,8 @@ void vp8_bilinear_predict8x8_armv6
|
|||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
||||||
}
|
}
|
||||||
@ -186,8 +106,8 @@ void vp8_bilinear_predict8x4_armv6
|
|||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
||||||
}
|
}
|
||||||
@ -205,8 +125,8 @@ void vp8_bilinear_predict16x16_armv6
|
|||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
vp8_filter_block2d_bil_armv6(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
||||||
}
|
}
|
||||||
|
@ -11,26 +11,10 @@
|
|||||||
|
|
||||||
#include "vpx_ports/config.h"
|
#include "vpx_ports/config.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "filter.h"
|
||||||
#include "subpixel.h"
|
#include "subpixel.h"
|
||||||
#include "vpx_ports/mem.h"
|
#include "vpx_ports/mem.h"
|
||||||
|
|
||||||
#define BLOCK_HEIGHT_WIDTH 4
|
|
||||||
#define VP8_FILTER_WEIGHT 128
|
|
||||||
#define VP8_FILTER_SHIFT 7
|
|
||||||
|
|
||||||
DECLARE_ALIGNED(16, static const short, sub_pel_filters[8][6]) =
|
|
||||||
{
|
|
||||||
{ 0, 0, 128, 0, 0, 0 }, /* note that 1/8 pel positions are just as per alpha -0.5 bicubic */
|
|
||||||
{ 0, -6, 123, 12, -1, 0 },
|
|
||||||
{ 2, -11, 108, 36, -8, 1 }, /* New 1/4 pel 6 tap filter */
|
|
||||||
{ 0, -9, 93, 50, -6, 0 },
|
|
||||||
{ 3, -16, 77, 77, -16, 3 }, /* New 1/2 pel 6 tap filter */
|
|
||||||
{ 0, -6, 50, 93, -9, 0 },
|
|
||||||
{ 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
|
|
||||||
{ 0, -1, 12, 123, -6, 0 },
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern void vp8_filter_block2d_first_pass_armv6
|
extern void vp8_filter_block2d_first_pass_armv6
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
@ -93,11 +77,11 @@ void vp8_sixtap_predict_armv6
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data bufffer used in filtering */
|
DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
/* Vfilter is null. First pass only */
|
/* Vfilter is null. First pass only */
|
||||||
if (xoffset && !yoffset)
|
if (xoffset && !yoffset)
|
||||||
@ -129,47 +113,6 @@ void vp8_sixtap_predict_armv6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void vp8_sixtap_predict8x4_armv6
|
|
||||||
(
|
|
||||||
unsigned char *src_ptr,
|
|
||||||
int src_pixels_per_line,
|
|
||||||
int xoffset,
|
|
||||||
int yoffset,
|
|
||||||
unsigned char *dst_ptr,
|
|
||||||
int dst_pitch
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const short *HFilter;
|
|
||||||
const short *VFilter;
|
|
||||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data bufffer used in filtering */
|
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
|
||||||
|
|
||||||
|
|
||||||
/*if (xoffset && !yoffset)
|
|
||||||
{
|
|
||||||
vp8_filter_block2d_first_pass_only_armv6 ( src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter );
|
|
||||||
}*/
|
|
||||||
/* Hfilter is null. Second pass only */
|
|
||||||
/*else if (!xoffset && yoffset)
|
|
||||||
{
|
|
||||||
vp8_filter_block2d_second_pass_only_armv6 ( src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (yoffset & 0x1)
|
|
||||||
vp8_filter_block2d_first_pass_armv6 ( src_ptr-src_pixels_per_line, FData+1, src_pixels_per_line, 8, 7, HFilter );
|
|
||||||
else*/
|
|
||||||
|
|
||||||
vp8_filter_block2d_first_pass_armv6 ( src_ptr-(2*src_pixels_per_line), FData, src_pixels_per_line, 8, 9, HFilter );
|
|
||||||
|
|
||||||
vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, 8, VFilter );
|
|
||||||
/*}*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void vp8_sixtap_predict8x8_armv6
|
void vp8_sixtap_predict8x8_armv6
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
@ -182,10 +125,10 @@ void vp8_sixtap_predict8x8_armv6
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data bufffer used in filtering */
|
DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
if (xoffset && !yoffset)
|
if (xoffset && !yoffset)
|
||||||
{
|
{
|
||||||
@ -224,10 +167,10 @@ void vp8_sixtap_predict16x16_armv6
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16); /* Temp data bufffer used in filtering */
|
DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16); /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
if (xoffset && !yoffset)
|
if (xoffset && !yoffset)
|
||||||
{
|
{
|
||||||
|
@ -10,13 +10,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "filter.h"
|
||||||
|
#include "vpx_ports/mem.h"
|
||||||
|
|
||||||
#define BLOCK_HEIGHT_WIDTH 4
|
DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) =
|
||||||
#define VP8_FILTER_WEIGHT 128
|
|
||||||
#define VP8_FILTER_SHIFT 7
|
|
||||||
|
|
||||||
|
|
||||||
static const int bilinear_filters[8][2] =
|
|
||||||
{
|
{
|
||||||
{ 128, 0 },
|
{ 128, 0 },
|
||||||
{ 112, 16 },
|
{ 112, 16 },
|
||||||
@ -28,8 +25,7 @@ static const int bilinear_filters[8][2] =
|
|||||||
{ 16, 112 }
|
{ 16, 112 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]) =
|
||||||
static const short sub_pel_filters[8][6] =
|
|
||||||
{
|
{
|
||||||
|
|
||||||
{ 0, 0, 128, 0, 0, 0 }, /* note that 1/8 pel positions are just as per alpha -0.5 bicubic */
|
{ 0, 0, 128, 0, 0, 0 }, /* note that 1/8 pel positions are just as per alpha -0.5 bicubic */
|
||||||
@ -40,9 +36,6 @@ static const short sub_pel_filters[8][6] =
|
|||||||
{ 0, -6, 50, 93, -9, 0 },
|
{ 0, -6, 50, 93, -9, 0 },
|
||||||
{ 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
|
{ 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
|
||||||
{ 0, -1, 12, 123, -6, 0 },
|
{ 0, -1, 12, 123, -6, 0 },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void vp8_filter_block2d_first_pass
|
void vp8_filter_block2d_first_pass
|
||||||
@ -146,7 +139,7 @@ void vp8_filter_block2d
|
|||||||
const short *VFilter
|
const short *VFilter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int FData[9*4]; /* Temp data bufffer used in filtering */
|
int FData[9*4]; /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 4, HFilter);
|
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 4, HFilter);
|
||||||
@ -195,8 +188,8 @@ void vp8_sixtap_predict_c
|
|||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
vp8_filter_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
|
vp8_filter_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
|
||||||
}
|
}
|
||||||
@ -212,10 +205,10 @@ void vp8_sixtap_predict8x8_c
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
int FData[13*16]; /* Temp data bufffer used in filtering */
|
int FData[13*16]; /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 13, 8, HFilter);
|
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 13, 8, HFilter);
|
||||||
@ -238,10 +231,10 @@ void vp8_sixtap_predict8x4_c
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
int FData[13*16]; /* Temp data bufffer used in filtering */
|
int FData[13*16]; /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 8, HFilter);
|
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 8, HFilter);
|
||||||
@ -264,11 +257,11 @@ void vp8_sixtap_predict16x16_c
|
|||||||
{
|
{
|
||||||
const short *HFilter;
|
const short *HFilter;
|
||||||
const short *VFilter;
|
const short *VFilter;
|
||||||
int FData[21*24]; /* Temp data bufffer used in filtering */
|
int FData[21*24]; /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
|
|
||||||
HFilter = sub_pel_filters[xoffset]; /* 6 tap */
|
HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
|
||||||
VFilter = sub_pel_filters[yoffset]; /* 6 tap */
|
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 21, 16, HFilter);
|
vp8_filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 21, 16, HFilter);
|
||||||
@ -283,57 +276,50 @@ void vp8_sixtap_predict16x16_c
|
|||||||
*
|
*
|
||||||
* ROUTINE : filter_block2d_bil_first_pass
|
* ROUTINE : filter_block2d_bil_first_pass
|
||||||
*
|
*
|
||||||
* INPUTS : UINT8 *src_ptr : Pointer to source block.
|
* INPUTS : UINT8 *src_ptr : Pointer to source block.
|
||||||
* UINT32 src_pixels_per_line : Stride of input block.
|
* UINT32 src_stride : Stride of source block.
|
||||||
* UINT32 pixel_step : Offset between filter input samples (see notes).
|
* UINT32 height : Block height.
|
||||||
* UINT32 output_height : Input block height.
|
* UINT32 width : Block width.
|
||||||
* UINT32 output_width : Input block width.
|
* INT32 *vp8_filter : Array of 2 bi-linear filter taps.
|
||||||
* INT32 *vp8_filter : Array of 2 bi-linear filter taps.
|
|
||||||
*
|
*
|
||||||
* OUTPUTS : INT32 *output_ptr : Pointer to filtered block.
|
* OUTPUTS : INT32 *dst_ptr : Pointer to filtered block.
|
||||||
*
|
*
|
||||||
* RETURNS : void
|
* RETURNS : void
|
||||||
*
|
*
|
||||||
* FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
|
* FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
|
||||||
* either horizontal or vertical direction to produce the
|
* in the horizontal direction to produce the filtered output
|
||||||
* filtered output block. Used to implement first-pass
|
* block. Used to implement first-pass of 2-D separable filter.
|
||||||
* of 2-D separable filter.
|
|
||||||
*
|
*
|
||||||
* SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
|
* SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
|
||||||
* Two filter taps should sum to VP8_FILTER_WEIGHT.
|
* Two filter taps should sum to VP8_FILTER_WEIGHT.
|
||||||
* pixel_step defines whether the filter is applied
|
|
||||||
* horizontally (pixel_step=1) or vertically (pixel_step=stride).
|
|
||||||
* It defines the offset required to move from one input
|
|
||||||
* to the next.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void vp8_filter_block2d_bil_first_pass
|
void vp8_filter_block2d_bil_first_pass
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
unsigned short *output_ptr,
|
unsigned short *dst_ptr,
|
||||||
unsigned int src_pixels_per_line,
|
unsigned int src_stride,
|
||||||
int pixel_step,
|
unsigned int height,
|
||||||
unsigned int output_height,
|
unsigned int width,
|
||||||
unsigned int output_width,
|
const short *vp8_filter
|
||||||
const int *vp8_filter
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
||||||
for (i = 0; i < output_height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < output_width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
/* Apply bilinear filter */
|
/* Apply bilinear filter */
|
||||||
output_ptr[j] = (((int)src_ptr[0] * vp8_filter[0]) +
|
dst_ptr[j] = (((int)src_ptr[0] * vp8_filter[0]) +
|
||||||
((int)src_ptr[pixel_step] * vp8_filter[1]) +
|
((int)src_ptr[1] * vp8_filter[1]) +
|
||||||
(VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
|
(VP8_FILTER_WEIGHT / 2)) >> VP8_FILTER_SHIFT;
|
||||||
src_ptr++;
|
src_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next row... */
|
/* Next row... */
|
||||||
src_ptr += src_pixels_per_line - output_width;
|
src_ptr += src_stride - width;
|
||||||
output_ptr += output_width;
|
dst_ptr += width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,60 +327,51 @@ void vp8_filter_block2d_bil_first_pass
|
|||||||
*
|
*
|
||||||
* ROUTINE : filter_block2d_bil_second_pass
|
* ROUTINE : filter_block2d_bil_second_pass
|
||||||
*
|
*
|
||||||
* INPUTS : INT32 *src_ptr : Pointer to source block.
|
* INPUTS : INT32 *src_ptr : Pointer to source block.
|
||||||
* UINT32 src_pixels_per_line : Stride of input block.
|
* UINT32 dst_pitch : Destination block pitch.
|
||||||
* UINT32 pixel_step : Offset between filter input samples (see notes).
|
* UINT32 height : Block height.
|
||||||
* UINT32 output_height : Input block height.
|
* UINT32 width : Block width.
|
||||||
* UINT32 output_width : Input block width.
|
* INT32 *vp8_filter : Array of 2 bi-linear filter taps.
|
||||||
* INT32 *vp8_filter : Array of 2 bi-linear filter taps.
|
|
||||||
*
|
*
|
||||||
* OUTPUTS : UINT16 *output_ptr : Pointer to filtered block.
|
* OUTPUTS : UINT16 *dst_ptr : Pointer to filtered block.
|
||||||
*
|
*
|
||||||
* RETURNS : void
|
* RETURNS : void
|
||||||
*
|
*
|
||||||
* FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block in
|
* FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
|
||||||
* either horizontal or vertical direction to produce the
|
* in the vertical direction to produce the filtered output
|
||||||
* filtered output block. Used to implement second-pass
|
* block. Used to implement second-pass of 2-D separable filter.
|
||||||
* of 2-D separable filter.
|
|
||||||
*
|
*
|
||||||
* SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
|
* SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
|
||||||
* Two filter taps should sum to VP8_FILTER_WEIGHT.
|
* Two filter taps should sum to VP8_FILTER_WEIGHT.
|
||||||
* pixel_step defines whether the filter is applied
|
|
||||||
* horizontally (pixel_step=1) or vertically (pixel_step=stride).
|
|
||||||
* It defines the offset required to move from one input
|
|
||||||
* to the next.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void vp8_filter_block2d_bil_second_pass
|
void vp8_filter_block2d_bil_second_pass
|
||||||
(
|
(
|
||||||
unsigned short *src_ptr,
|
unsigned short *src_ptr,
|
||||||
unsigned char *output_ptr,
|
unsigned char *dst_ptr,
|
||||||
int output_pitch,
|
int dst_pitch,
|
||||||
unsigned int src_pixels_per_line,
|
unsigned int height,
|
||||||
unsigned int pixel_step,
|
unsigned int width,
|
||||||
unsigned int output_height,
|
const short *vp8_filter
|
||||||
unsigned int output_width,
|
|
||||||
const int *vp8_filter
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
int Temp;
|
int Temp;
|
||||||
|
|
||||||
for (i = 0; i < output_height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
for (j = 0; j < output_width; j++)
|
for (j = 0; j < width; j++)
|
||||||
{
|
{
|
||||||
/* Apply filter */
|
/* Apply filter */
|
||||||
Temp = ((int)src_ptr[0] * vp8_filter[0]) +
|
Temp = ((int)src_ptr[0] * vp8_filter[0]) +
|
||||||
((int)src_ptr[pixel_step] * vp8_filter[1]) +
|
((int)src_ptr[width] * vp8_filter[1]) +
|
||||||
(VP8_FILTER_WEIGHT / 2);
|
(VP8_FILTER_WEIGHT / 2);
|
||||||
output_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
|
dst_ptr[j] = (unsigned int)(Temp >> VP8_FILTER_SHIFT);
|
||||||
src_ptr++;
|
src_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next row... */
|
/* Next row... */
|
||||||
src_ptr += src_pixels_per_line - output_width;
|
dst_ptr += dst_pitch;
|
||||||
output_ptr += output_pitch;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,11 +381,14 @@ void vp8_filter_block2d_bil_second_pass
|
|||||||
* ROUTINE : filter_block2d_bil
|
* ROUTINE : filter_block2d_bil
|
||||||
*
|
*
|
||||||
* INPUTS : UINT8 *src_ptr : Pointer to source block.
|
* INPUTS : UINT8 *src_ptr : Pointer to source block.
|
||||||
* UINT32 src_pixels_per_line : Stride of input block.
|
* UINT32 src_pitch : Stride of source block.
|
||||||
* INT32 *HFilter : Array of 2 horizontal filter taps.
|
* UINT32 dst_pitch : Stride of destination block.
|
||||||
* INT32 *VFilter : Array of 2 vertical filter taps.
|
* INT32 *HFilter : Array of 2 horizontal filter taps.
|
||||||
|
* INT32 *VFilter : Array of 2 vertical filter taps.
|
||||||
|
* INT32 Width : Block width
|
||||||
|
* INT32 Height : Block height
|
||||||
*
|
*
|
||||||
* OUTPUTS : UINT16 *output_ptr : Pointer to filtered block.
|
* OUTPUTS : UINT16 *dst_ptr : Pointer to filtered block.
|
||||||
*
|
*
|
||||||
* RETURNS : void
|
* RETURNS : void
|
||||||
*
|
*
|
||||||
@ -422,23 +402,23 @@ void vp8_filter_block2d_bil_second_pass
|
|||||||
void vp8_filter_block2d_bil
|
void vp8_filter_block2d_bil
|
||||||
(
|
(
|
||||||
unsigned char *src_ptr,
|
unsigned char *src_ptr,
|
||||||
unsigned char *output_ptr,
|
unsigned char *dst_ptr,
|
||||||
unsigned int src_pixels_per_line,
|
unsigned int src_pitch,
|
||||||
unsigned int dst_pitch,
|
unsigned int dst_pitch,
|
||||||
const int *HFilter,
|
const short *HFilter,
|
||||||
const int *VFilter,
|
const short *VFilter,
|
||||||
int Width,
|
int Width,
|
||||||
int Height
|
int Height
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned short FData[17*16]; /* Temp data bufffer used in filtering */
|
unsigned short FData[17*16]; /* Temp data buffer used in filtering */
|
||||||
|
|
||||||
/* First filter 1-D horizontally... */
|
/* First filter 1-D horizontally... */
|
||||||
vp8_filter_block2d_bil_first_pass(src_ptr, FData, src_pixels_per_line, 1, Height + 1, Width, HFilter);
|
vp8_filter_block2d_bil_first_pass(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
|
||||||
|
|
||||||
/* then 1-D vertically... */
|
/* then 1-D vertically... */
|
||||||
vp8_filter_block2d_bil_second_pass(FData, output_ptr, dst_pitch, Width, Width, Height, Width, VFilter);
|
vp8_filter_block2d_bil_second_pass(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -452,11 +432,11 @@ void vp8_bilinear_predict4x4_c
|
|||||||
int dst_pitch
|
int dst_pitch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int *HFilter;
|
const short *HFilter;
|
||||||
const int *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -490,11 +470,11 @@ void vp8_bilinear_predict8x8_c
|
|||||||
int dst_pitch
|
int dst_pitch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int *HFilter;
|
const short *HFilter;
|
||||||
const int *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
|
||||||
|
|
||||||
@ -510,11 +490,11 @@ void vp8_bilinear_predict8x4_c
|
|||||||
int dst_pitch
|
int dst_pitch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int *HFilter;
|
const short *HFilter;
|
||||||
const int *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
|
||||||
|
|
||||||
@ -530,11 +510,11 @@ void vp8_bilinear_predict16x16_c
|
|||||||
int dst_pitch
|
int dst_pitch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const int *HFilter;
|
const short *HFilter;
|
||||||
const int *VFilter;
|
const short *VFilter;
|
||||||
|
|
||||||
HFilter = bilinear_filters[xoffset];
|
HFilter = vp8_bilinear_filters[xoffset];
|
||||||
VFilter = bilinear_filters[yoffset];
|
VFilter = vp8_bilinear_filters[yoffset];
|
||||||
|
|
||||||
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
vp8_filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
|
||||||
}
|
}
|
22
vp8/common/filter.h
Normal file
22
vp8/common/filter.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 The WebM project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license
|
||||||
|
* that can be found in the LICENSE file in the root of the source
|
||||||
|
* tree. An additional intellectual property rights grant can be found
|
||||||
|
* in the file PATENTS. All contributing project authors may
|
||||||
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef FILTER_H
|
||||||
|
#define FILTER_H
|
||||||
|
|
||||||
|
#define BLOCK_HEIGHT_WIDTH 4
|
||||||
|
#define VP8_FILTER_WEIGHT 128
|
||||||
|
#define VP8_FILTER_SHIFT 7
|
||||||
|
|
||||||
|
extern const short vp8_bilinear_filters[8][2];
|
||||||
|
extern const short vp8_sub_pel_filters[8][6];
|
||||||
|
|
||||||
|
#endif //FILTER_H
|
@ -35,7 +35,7 @@ VP8_COMMON_SRCS-yes += common/entropy.c
|
|||||||
VP8_COMMON_SRCS-yes += common/entropymode.c
|
VP8_COMMON_SRCS-yes += common/entropymode.c
|
||||||
VP8_COMMON_SRCS-yes += common/entropymv.c
|
VP8_COMMON_SRCS-yes += common/entropymv.c
|
||||||
VP8_COMMON_SRCS-yes += common/extend.c
|
VP8_COMMON_SRCS-yes += common/extend.c
|
||||||
VP8_COMMON_SRCS-yes += common/filter_c.c
|
VP8_COMMON_SRCS-yes += common/filter.c
|
||||||
VP8_COMMON_SRCS-yes += common/findnearmv.c
|
VP8_COMMON_SRCS-yes += common/findnearmv.c
|
||||||
VP8_COMMON_SRCS-yes += common/generic/systemdependent.c
|
VP8_COMMON_SRCS-yes += common/generic/systemdependent.c
|
||||||
VP8_COMMON_SRCS-yes += common/idctllm.c
|
VP8_COMMON_SRCS-yes += common/idctllm.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user