diff --git a/vp8/common/filter.c b/vp8/common/filter.c index 4a8f70a2f..55e84e4c5 100644 --- a/vp8/common/filter.c +++ b/vp8/common/filter.c @@ -860,6 +860,26 @@ static void filter_block2d_8 filter_block2d_second_pass_8(FData + 4*(Interp_Extend-1), output_ptr, output_pitch, 4, 4, 4, 4, VFilter); } +static void filter_block2d_avg_8 +( + unsigned char *src_ptr, + unsigned char *output_ptr, + unsigned int src_pixels_per_line, + int output_pitch, + const short *HFilter, + const short *VFilter +) +{ + int FData[(3+Interp_Extend*2)*4]; /* Temp data buffer used in filtering */ + + /* First filter 1-D horizontally... */ + filter_block2d_first_pass_8(src_ptr - ((Interp_Extend-1) * src_pixels_per_line), FData, src_pixels_per_line, 1, + 3+Interp_Extend*2, 4, HFilter); + + /* then filter verticaly... */ + filter_block2d_second_pass_avg_8(FData + 4*(Interp_Extend-1), output_ptr, output_pitch, 4, 4, 4, 4, VFilter); +} + void vp8_eighttap_predict_c ( unsigned char *src_ptr, @@ -879,6 +899,25 @@ void vp8_eighttap_predict_c filter_block2d_8(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter); } +void vp8_eighttap_predict_avg4x4_c +( + 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; + + HFilter = vp8_sub_pel_filters_8[xoffset]; /* 8 tap */ + VFilter = vp8_sub_pel_filters_8[yoffset]; /* 8 tap */ + + filter_block2d_avg_8(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter); +} + void vp8_eighttap_predict_sharp_c ( unsigned char *src_ptr, @@ -898,6 +937,25 @@ void vp8_eighttap_predict_sharp_c filter_block2d_8(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter); } +void vp8_eighttap_predict_avg4x4_sharp_c +( + 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; + + HFilter = vp8_sub_pel_filters_8s[xoffset]; /* 8 tap */ + VFilter = vp8_sub_pel_filters_8s[yoffset]; /* 8 tap */ + + filter_block2d_avg_8(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter); +} + void vp8_eighttap_predict8x8_c ( unsigned char *src_ptr, diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c index 16dcd414d..79622487e 100644 --- a/vp8/common/generic/systemdependent.c +++ b/vp8/common/generic/systemdependent.c @@ -84,12 +84,14 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) rtcd->subpix.eighttap8x8 = vp8_eighttap_predict8x8_c; rtcd->subpix.eighttap_avg16x16 = vp8_eighttap_predict_avg16x16_c; rtcd->subpix.eighttap_avg8x8 = vp8_eighttap_predict_avg8x8_c; + rtcd->subpix.eighttap_avg4x4 = vp8_eighttap_predict_avg4x4_c; rtcd->subpix.eighttap8x4 = vp8_eighttap_predict8x4_c; rtcd->subpix.eighttap4x4 = vp8_eighttap_predict_c; rtcd->subpix.eighttap16x16_sharp = vp8_eighttap_predict16x16_sharp_c; rtcd->subpix.eighttap8x8_sharp = vp8_eighttap_predict8x8_sharp_c; rtcd->subpix.eighttap_avg16x16_sharp = vp8_eighttap_predict_avg16x16_sharp_c; rtcd->subpix.eighttap_avg8x8_sharp = vp8_eighttap_predict_avg8x8_sharp_c; + rtcd->subpix.eighttap_avg4x4_sharp = vp8_eighttap_predict_avg4x4_sharp_c; rtcd->subpix.eighttap8x4_sharp = vp8_eighttap_predict8x4_sharp_c; rtcd->subpix.eighttap4x4_sharp = vp8_eighttap_predict_sharp_c; #endif diff --git a/vp8/common/subpixel.h b/vp8/common/subpixel.h index 5b9a1de62..1812bed03 100644 --- a/vp8/common/subpixel.h +++ b/vp8/common/subpixel.h @@ -89,6 +89,11 @@ extern prototype_subpixel_predict(vp8_subpix_eighttap8x4); #endif extern prototype_subpixel_predict(vp8_subpix_eighttap4x4); +#ifndef vp8_subpix_eighttap_avg4x4 +#define vp8_subpix_eighttap_avg4x4 vp8_eighttap_predict_avg4x4_c +#endif +extern prototype_subpixel_predict(vp8_subpix_eighttap_avg4x4); + #ifndef vp8_subpix_eighttap16x16_sharp #define vp8_subpix_eighttap16x16_sharp vp8_eighttap_predict16x16_sharp_c #endif @@ -118,6 +123,11 @@ extern prototype_subpixel_predict(vp8_subpix_eighttap8x4_sharp); #define vp8_subpix_eighttap4x4_sharp vp8_eighttap_predict_sharp_c #endif extern prototype_subpixel_predict(vp8_subpix_eighttap4x4_sharp); + +#ifndef vp8_subpix_eighttap_avg4x4_sharp +#define vp8_subpix_eighttap_avg4x4_sharp vp8_eighttap_predict_avg4x4_sharp_c +#endif +extern prototype_subpixel_predict(vp8_subpix_eighttap_avg4x4_sharp); #endif /* CONFIG_ENAHNCED_INTERP */ #ifndef vp8_subpix_bilinear16x16 @@ -163,12 +173,14 @@ typedef struct vp8_subpix_fn_t eighttap8x8; vp8_subpix_fn_t eighttap_avg16x16; vp8_subpix_fn_t eighttap_avg8x8; + vp8_subpix_fn_t eighttap_avg4x4; vp8_subpix_fn_t eighttap8x4; vp8_subpix_fn_t eighttap4x4; vp8_subpix_fn_t eighttap16x16_sharp; vp8_subpix_fn_t eighttap8x8_sharp; vp8_subpix_fn_t eighttap_avg16x16_sharp; vp8_subpix_fn_t eighttap_avg8x8_sharp; + vp8_subpix_fn_t eighttap_avg4x4_sharp; vp8_subpix_fn_t eighttap8x4_sharp; vp8_subpix_fn_t eighttap4x4_sharp; #endif diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 055ec43e6..7615e5bdd 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -729,6 +729,7 @@ static void init_frame(VP8D_COMP *pbi) RTCD_VTABLE(subpix), eighttap_avg8x8); xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE( RTCD_VTABLE(subpix), eighttap_avg16x16); + xd->subpixel_predict_avg = SUBPIX_INVOKE(RTCD_VTABLE(subpix), eighttap_avg4x4); } else if (pc->mcomp_filter_type == EIGHTTAP_SHARP) { @@ -736,6 +737,7 @@ static void init_frame(VP8D_COMP *pbi) xd->subpixel_predict8x4 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), eighttap8x4_sharp); xd->subpixel_predict8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), eighttap8x8_sharp); xd->subpixel_predict16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), eighttap16x16_sharp); + xd->subpixel_predict_avg = SUBPIX_INVOKE(RTCD_VTABLE(subpix), eighttap_avg4x4_sharp); xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE( RTCD_VTABLE(subpix), eighttap_avg8x8_sharp); xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE( diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 15a131412..a044f8cb9 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -1105,6 +1105,8 @@ static void encode_frame_internal(VP8_COMP *cpi) &cpi->common.rtcd.subpix, eighttap8x8); xd->subpixel_predict16x16 = SUBPIX_INVOKE( &cpi->common.rtcd.subpix, eighttap16x16); + xd->subpixel_predict_avg = SUBPIX_INVOKE( + &cpi->common.rtcd.subpix, eighttap_avg4x4); xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE( &cpi->common.rtcd.subpix, eighttap_avg8x8); xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE( @@ -1120,6 +1122,8 @@ static void encode_frame_internal(VP8_COMP *cpi) &cpi->common.rtcd.subpix, eighttap8x8_sharp); xd->subpixel_predict16x16 = SUBPIX_INVOKE( &cpi->common.rtcd.subpix, eighttap16x16_sharp); + xd->subpixel_predict_avg = SUBPIX_INVOKE( + &cpi->common.rtcd.subpix, eighttap_avg4x4_sharp); xd->subpixel_predict_avg8x8 = SUBPIX_INVOKE( &cpi->common.rtcd.subpix, eighttap_avg8x8_sharp); xd->subpixel_predict_avg16x16 = SUBPIX_INVOKE(