summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmeric Grange <emeric.grange@gmail.com>2012-01-18 17:20:30 +0100
committerEmeric Grange <emeric.grange@gmail.com>2012-06-24 16:57:32 +0200
commitc2e55f9a933a75d69ffd6a5ec3dcfabef4c288f6 (patch)
tree0a77e919366bfb5730c63061306485ed8c6c2cde
parent068ab275651f65ab65415fb1b0e017bc4ca8fd7b (diff)
g3dvl: Cleanup VP8 subpixel filters
Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/blockd.h10
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/filter.c322
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/filter.h60
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/filter_dispatch.h75
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/reconinter.c22
-rw-r--r--src/gallium/auxiliary/vl/vp8/common/reconinter.h2
-rw-r--r--src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c20
7 files changed, 294 insertions, 217 deletions
diff --git a/src/gallium/auxiliary/vl/vp8/common/blockd.h b/src/gallium/auxiliary/vl/vp8/common/blockd.h
index 9388d505c4..f747162d83 100644
--- a/src/gallium/auxiliary/vl/vp8/common/blockd.h
+++ b/src/gallium/auxiliary/vl/vp8/common/blockd.h
@@ -17,7 +17,7 @@
#include "mv.h"
#include "treecoder.h"
-#include "subpixel.h"
+#include "filter_dispatch.h"
#define MB_FEATURE_TREE_PROBS 3
#define MAX_MB_SEGMENTS 4
@@ -229,10 +229,10 @@ typedef struct
unsigned int frames_since_golden;
unsigned int frames_till_alt_ref_frame;
- vp8_subpix_fn_t subpixel_predict;
- vp8_subpix_fn_t subpixel_predict8x4;
- vp8_subpix_fn_t subpixel_predict8x8;
- vp8_subpix_fn_t subpixel_predict16x16;
+ vp8_filter_fn_t filter_predict4x4;
+ vp8_filter_fn_t filter_predict8x4;
+ vp8_filter_fn_t filter_predict8x8;
+ vp8_filter_fn_t filter_predict16x16;
void *current_bd;
diff --git a/src/gallium/auxiliary/vl/vp8/common/filter.c b/src/gallium/auxiliary/vl/vp8/common/filter.c
index 68f2a3a306..f71f2e983a 100644
--- a/src/gallium/auxiliary/vl/vp8/common/filter.c
+++ b/src/gallium/auxiliary/vl/vp8/common/filter.c
@@ -14,7 +14,10 @@
#include "filter.h"
#include "../vp8_mem.h"
-DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) =
+#define VP8_FILTER_WEIGHT 128
+#define VP8_FILTER_SHIFT 7
+
+DECLARE_ALIGNED(16, const short, vp8_filters_bilinear[8][2]) =
{
{ 128, 0 },
{ 112, 16 },
@@ -26,26 +29,26 @@ DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) =
{ 16, 112 }
};
-DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]) =
+DECLARE_ALIGNED(16, const short, vp8_filters_sixtap[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 */
{ 0, -6, 123, 12, -1, 0 },
- { 2, -11, 108, 36, -8, 1 }, /* New 1/4 pel 6 tap filter */
+ { 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 */
+ { 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 */
+ { 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
{ 0, -1, 12, 123, -6, 0 },
};
-static void filter_block2d_first_pass(unsigned char *src_ptr,
- int *output_ptr,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter)
+static void filter_sixtap_block2d_first_pass(unsigned char *src_ptr,
+ int *output_ptr,
+ unsigned int src_pixels_per_line,
+ unsigned int pixel_step,
+ unsigned int output_height,
+ unsigned int output_width,
+ const short *vp8_filter)
{
unsigned int i, j;
int temp;
@@ -60,10 +63,10 @@ static void filter_block2d_first_pass(unsigned char *src_ptr,
((int)src_ptr[pixel_step] * vp8_filter[3]) +
((int)src_ptr[2*pixel_step] * vp8_filter[4]) +
((int)src_ptr[3*pixel_step] * vp8_filter[5]) +
- (VP8_FILTER_WEIGHT >> 1); /* Rounding */
+ (VP8_FILTER_WEIGHT >> 1); /* Rounding */
/* Normalize back to 0-255 */
- temp = temp >> VP8_FILTER_SHIFT;
+ temp >>= VP8_FILTER_SHIFT;
if (temp < 0)
temp = 0;
@@ -80,14 +83,14 @@ static void filter_block2d_first_pass(unsigned char *src_ptr,
}
}
-static void filter_block2d_second_pass(int *src_ptr,
- unsigned char *output_ptr,
- int output_pitch,
- unsigned int src_pixels_per_line,
- unsigned int pixel_step,
- unsigned int output_height,
- unsigned int output_width,
- const short *vp8_filter)
+static void filter_sixtap_block2d_second_pass(int *src_ptr,
+ unsigned char *output_ptr,
+ int output_pitch,
+ unsigned int src_pixels_per_line,
+ unsigned int pixel_step,
+ unsigned int output_height,
+ unsigned int output_width,
+ const short *vp8_filter)
{
unsigned int i, j;
int temp;
@@ -103,10 +106,10 @@ static void filter_block2d_second_pass(int *src_ptr,
((int)src_ptr[pixel_step] * vp8_filter[3]) +
((int)src_ptr[2*pixel_step] * vp8_filter[4]) +
((int)src_ptr[3*pixel_step] * vp8_filter[5]) +
- (VP8_FILTER_WEIGHT >> 1); /* Rounding */
+ (VP8_FILTER_WEIGHT >> 1); /* Rounding */
/* Normalize back to 0-255 */
- temp = temp >> VP8_FILTER_SHIFT;
+ temp >>= VP8_FILTER_SHIFT;
if (temp < 0)
temp = 0;
@@ -123,38 +126,34 @@ static void filter_block2d_second_pass(int *src_ptr,
}
}
-
-static void filter_block2d(unsigned char *src_ptr,
- unsigned char *output_ptr,
- unsigned int src_pixels_per_line,
- int output_pitch,
- const short *HFilter,
- const short *VFilter)
+static void filter_sixtap_block2d(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[9*4]; /* Temp data buffer used in filtering */
/* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 4, HFilter);
+ filter_sixtap_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 4, HFilter);
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 8, output_ptr, output_pitch, 4, 4, 4, 4, VFilter);
+ /* Then filter verticaly... */
+ filter_sixtap_block2d_second_pass(FData + 8, output_ptr, output_pitch, 4, 4, 4, 4, VFilter);
}
-void vp8_sixtap_predict_c(unsigned char *src_ptr,
- int src_pixels_per_line,
- int xoffset,
- int yoffset,
- unsigned char *dst_ptr,
- int dst_pitch)
+void vp8_sixtap_predict4x4_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;
+ const short *HFilter = vp8_filters_sixtap[xoffset];
+ const short *VFilter = vp8_filters_sixtap[yoffset];
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
- filter_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
+ filter_sixtap_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
}
void vp8_sixtap_predict8x8_c(unsigned char *src_ptr,
@@ -164,18 +163,15 @@ void vp8_sixtap_predict8x8_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
+ const short *HFilter = vp8_filters_sixtap[xoffset];
+ const short *VFilter = vp8_filters_sixtap[yoffset];
int FData[13*16]; /* Temp data buffer used in filtering */
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
/* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 13, 8, HFilter);
+ filter_sixtap_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 13, 8, HFilter);
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
+ /* Then filter verticaly... */
+ filter_sixtap_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
}
void vp8_sixtap_predict8x4_c(unsigned char *src_ptr,
@@ -185,18 +181,15 @@ void vp8_sixtap_predict8x4_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
+ const short *HFilter = vp8_filters_sixtap[xoffset];
+ const short *VFilter = vp8_filters_sixtap[yoffset];
int FData[13*16]; /* Temp data buffer used in filtering */
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
/* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 8, HFilter);
+ filter_sixtap_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 9, 8, HFilter);
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 4, 8, VFilter);
+ /* Then filter verticaly... */
+ filter_sixtap_block2d_second_pass(FData + 16, dst_ptr, dst_pitch, 8, 8, 4, 8, VFilter);
}
void vp8_sixtap_predict16x16_c(unsigned char *src_ptr,
@@ -206,50 +199,40 @@ void vp8_sixtap_predict16x16_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
+ const short *HFilter = vp8_filters_sixtap[xoffset];
+ const short *VFilter = vp8_filters_sixtap[yoffset];
int FData[21*24]; /* Temp data buffer used in filtering */
- HFilter = vp8_sub_pel_filters[xoffset]; /* 6 tap */
- VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
-
/* First filter 1-D horizontally... */
- filter_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 21, 16, HFilter);
+ filter_sixtap_block2d_first_pass(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 1, 21, 16, HFilter);
- /* then filter verticaly... */
- filter_block2d_second_pass(FData + 32, dst_ptr, dst_pitch, 16, 16, 16, 16, VFilter);
+ /* Then filter verticaly... */
+ filter_sixtap_block2d_second_pass(FData + 32, dst_ptr, dst_pitch, 16, 16, 16, 16, VFilter);
}
+/* ************************************************************************** */
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_first_pass
- *
- * INPUTS : uint8_t *src_ptr : Pointer to source block.
- * uint16_t *dst_ptr : Pointer to destination block.
- * uint32_t src_stride : Stride of source block.
- * uint32_t height : Block height.
- * uint32_t width : Block width.
- * const short *vp8_filter : Array of 2 bi-linear filter taps.
- *
- * OUTPUTS : int32_t *dst_ptr : Pointer to filtered block.
+/**
+ * \param[in] *src_ptr Pointer to source block.
+ * \param[out] *dst_ptr Pointer to destination (filtered) block.
+ * \param[in] src_stride Stride of source block.
+ * \param[in] width Block width.
+ * \param[in] height Block height.
+ * \param[in] *vp8_filter Array of 2 bilinear filter taps.
*
- * RETURNS : void
+ * \note Produces INT32 output to retain precision for next pass. Two filter
+ * taps should sum to VP8_FILTER_WEIGHT.
*
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
- * in the horizontal direction to produce the filtered output
- * block. Used to implement first-pass of 2-D separable filter.
- *
- * SPECIAL NOTES : Produces INT32 output to retain precision for next pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- *
- ****************************************************************************/
-static void filter_block2d_bil_first_pass(unsigned char *src_ptr,
- unsigned short *dst_ptr,
- unsigned int src_stride,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter)
+ * Applies a 1-D 2-tap bilinear filter to the source block in the horizontal
+ * direction to produce the filtered output block. Used to implement first-pass
+ * of 2-D separable filter.
+ */
+static void filter_bilinear_block2d_first_pass(unsigned char *src_ptr,
+ unsigned short *dst_ptr,
+ unsigned int src_stride,
+ unsigned int width,
+ unsigned int height,
+ const short *vp8_filter)
{
unsigned int i, j;
@@ -270,35 +253,27 @@ static void filter_block2d_bil_first_pass(unsigned char *src_ptr,
}
}
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil_second_pass
+/**
+ * \param[in] *src_ptr Pointer to source block.
+ * \param[out] *dst_ptr Pointer to destination (filtered) block.
+ * \param[in] dst_pitch Destination block pitch.
+ * \param[in] width Block width.
+ * \param[in] height Block height.
+ * \param[in] *vp8_filter Array of 2 bilinear filter taps.
*
- * INPUTS : int32_t *src_ptr : Pointer to source block.
- * int32_t *dst_ptr : Pointer to destination block.
- * uint32_t dst_pitch : Destination block pitch.
- * uint32_t height : Block height.
- * uint32_t width : Block width.
- * int32_t *vp8_filter : Array of 2 bi-linear filter taps.
+ * \note Requires 32-bit input as produced by filter_block2d_bil_first_pass.
+ * Two filter taps should sum to VP8_FILTER_WEIGHT.
*
- * OUTPUTS : uint16_t *dst_ptr : Pointer to filtered block.
- *
- * RETURNS : void
- *
- * FUNCTION : Applies a 1-D 2-tap bi-linear filter to the source block
- * in the vertical direction to produce the filtered output
- * block. Used to implement second-pass of 2-D separable filter.
- *
- * SPECIAL NOTES : Requires 32-bit input as produced by filter_block2d_bil_first_pass.
- * Two filter taps should sum to VP8_FILTER_WEIGHT.
- *
- ****************************************************************************/
-static void filter_block2d_bil_second_pass(unsigned short *src_ptr,
- unsigned char *dst_ptr,
- int dst_pitch,
- unsigned int height,
- unsigned int width,
- const short *vp8_filter)
+ * Applies a 1-D 2-tap bilinear filter to the source block in the vertical
+ * direction to produce the filtered output block. Used to implement second-pass
+ * of 2-D separable filter.
+ */
+static void filter_bilinear_block2d_second_pass(unsigned short *src_ptr,
+ unsigned char *dst_ptr,
+ int dst_pitch,
+ unsigned int width,
+ unsigned int height,
+ const short *vp8_filter)
{
unsigned int i, j;
int temp;
@@ -320,47 +295,37 @@ static void filter_block2d_bil_second_pass(unsigned short *src_ptr,
}
}
-
-/****************************************************************************
- *
- * ROUTINE : filter_block2d_bil
- *
- * INPUTS : unsigned char *src_ptr : Pointer to source block.
- * unsigned char *dst_ptr : Pointer to destination block.
- * unsigned int src_pitch : Stride of source block.
- * unsigned int dst_pitch : Stride of destination block.
- * const short *HFilter : Array of 2 horizontal filter taps.
- * const short *VFilter : Array of 2 vertical filter taps.
- * int Width : Block width
- * int Height : Block height
- *
- * OUTPUTS : uint16_t *dst_ptr : Pointer to filtered block.
+/**
+ * \param[in] *src_ptr Pointer to source block.
+ * \param[out] *dst_ptr Pointer to destination (filtered) block.
+ * \param[in] src_pitch Stride of source block.
+ * \param[in] dst_pitch Stride of destination block.
+ * \param[in] *HFilter Array of 2 horizontal filter taps.
+ * \param[in] *VFilter Array of 2 vertical filter taps.
+ * \param[in] width Block width.
+ * \param[in] height Block height.
*
- * RETURNS : void
+ * \note The largest block size can be handled here is 16x16.
*
- * FUNCTION : 2-D filters an input block by applying a 2-tap
- * bi-linear filter horizontally followed by a 2-tap
- * bi-linear filter vertically on the result.
- *
- * SPECIAL NOTES : The largest block size can be handled here is 16x16
- *
- ****************************************************************************/
-static void filter_block2d_bil(unsigned char *src_ptr,
- unsigned char *dst_ptr,
- unsigned int src_pitch,
- unsigned int dst_pitch,
- const short *HFilter,
- const short *VFilter,
- int Width,
- int Height)
+ * 2-D filters an input block by applying a 2-tap bilinear filter horizontally
+ * followed by a 2-tap bilinear filter vertically on the result.
+ */
+static void filter_bilinear_block2d(unsigned char *src_ptr,
+ unsigned char *dst_ptr,
+ unsigned int src_pitch,
+ unsigned int dst_pitch,
+ const short *HFilter,
+ const short *VFilter,
+ int width,
+ int height)
{
unsigned short FData[17*16]; /* Temp data buffer used in filtering */
/* First filter 1-D horizontally... */
- filter_block2d_bil_first_pass(src_ptr, FData, src_pitch, Height + 1, Width, HFilter);
+ filter_bilinear_block2d_first_pass(src_ptr, FData, src_pitch, width, height + 1, HFilter);
/* then 1-D vertically... */
- filter_block2d_bil_second_pass(FData, dst_ptr, dst_pitch, Height, Width, VFilter);
+ filter_bilinear_block2d_second_pass(FData, dst_ptr, dst_pitch, width, height, VFilter);
}
void vp8_bilinear_predict4x4_c(unsigned char *src_ptr,
@@ -370,13 +335,10 @@ void vp8_bilinear_predict4x4_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
+ const short *HFilter = vp8_filters_bilinear[xoffset];
+ const short *VFilter = vp8_filters_bilinear[yoffset];
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
+ filter_bilinear_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 4, 4);
}
void vp8_bilinear_predict8x8_c(unsigned char *src_ptr,
@@ -386,13 +348,10 @@ void vp8_bilinear_predict8x8_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
+ const short *HFilter = vp8_filters_bilinear[xoffset];
+ const short *VFilter = vp8_filters_bilinear[yoffset];
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
+ filter_bilinear_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 8);
}
void vp8_bilinear_predict8x4_c(unsigned char *src_ptr,
@@ -402,26 +361,21 @@ void vp8_bilinear_predict8x4_c(unsigned char *src_ptr,
unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
+ const short *HFilter = vp8_filters_bilinear[xoffset];
+ const short *VFilter = vp8_filters_bilinear[yoffset];
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
-
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
+ filter_bilinear_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 8, 4);
}
-void vp8_bilinear_predict16x16_c(unsigned char *src_ptr,
+void vp8_bilinear_predict16x16_c(unsigned char *src_ptr,
int src_pixels_per_line,
int xoffset,
- int yoffset,unsigned char *dst_ptr,
+ int yoffset,
+ unsigned char *dst_ptr,
int dst_pitch)
{
- const short *HFilter;
- const short *VFilter;
-
- HFilter = vp8_bilinear_filters[xoffset];
- VFilter = vp8_bilinear_filters[yoffset];
+ const short *HFilter = vp8_filters_bilinear[xoffset];
+ const short *VFilter = vp8_filters_bilinear[yoffset];
- filter_block2d_bil(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
+ filter_bilinear_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter, 16, 16);
}
diff --git a/src/gallium/auxiliary/vl/vp8/common/filter.h b/src/gallium/auxiliary/vl/vp8/common/filter.h
index c10485ccc0..5ec2b255cf 100644
--- a/src/gallium/auxiliary/vl/vp8/common/filter.h
+++ b/src/gallium/auxiliary/vl/vp8/common/filter.h
@@ -8,15 +8,63 @@
* 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
+void vp8_sixtap_predict4x4_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_sixtap_predict8x8_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_sixtap_predict8x4_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_sixtap_predict16x16_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_bilinear_predict4x4_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_bilinear_predict8x8_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
+
+void vp8_bilinear_predict8x4_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
-extern const short vp8_bilinear_filters[8][2];
-extern const short vp8_sub_pel_filters[8][6];
+void vp8_bilinear_predict16x16_c(unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch);
#endif /* FILTER_H */
diff --git a/src/gallium/auxiliary/vl/vp8/common/filter_dispatch.h b/src/gallium/auxiliary/vl/vp8/common/filter_dispatch.h
new file mode 100644
index 0000000000..5b1ded79da
--- /dev/null
+++ b/src/gallium/auxiliary/vl/vp8/common/filter_dispatch.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2010 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_DISPATCH_H
+#define FILTER_DISPATCH_H
+
+#define prototype_filter_predict(sym) \
+ void sym(unsigned char *src, int src_pitch, int xofst, int yofst, \
+ unsigned char *dst, int dst_pitch)
+
+#ifndef vp8_filter_sixtap16x16
+#define vp8_filter_sixtap16x16 vp8_sixtap_predict16x16_c
+#endif
+extern prototype_filter_predict(vp8_filter_sixtap16x16);
+
+#ifndef vp8_filter_sixtap8x8
+#define vp8_filter_sixtap8x8 vp8_sixtap_predict8x8_c
+#endif
+extern prototype_filter_predict(vp8_filter_sixtap8x8);
+
+#ifndef vp8_filter_sixtap8x4
+#define vp8_filter_sixtap8x4 vp8_sixtap_predict8x4_c
+#endif
+extern prototype_filter_predict(vp8_filter_sixtap8x4);
+
+#ifndef vp8_filter_sixtap4x4
+#define vp8_filter_sixtap4x4 vp8_sixtap_predict4x4_c
+#endif
+extern prototype_filter_predict(vp8_filter_sixtap4x4);
+
+#ifndef vp8_filter_bilinear16x16
+#define vp8_filter_bilinear16x16 vp8_bilinear_predict16x16_c
+#endif
+extern prototype_filter_predict(vp8_filter_bilinear16x16);
+
+#ifndef vp8_filter_bilinear8x8
+#define vp8_filter_bilinear8x8 vp8_bilinear_predict8x8_c
+#endif
+extern prototype_filter_predict(vp8_filter_bilinear8x8);
+
+#ifndef vp8_filter_bilinear8x4
+#define vp8_filter_bilinear8x4 vp8_bilinear_predict8x4_c
+#endif
+extern prototype_filter_predict(vp8_filter_bilinear8x4);
+
+#ifndef vp8_filter_bilinear4x4
+#define vp8_filter_bilinear4x4 vp8_bilinear_predict4x4_c
+#endif
+extern prototype_filter_predict(vp8_filter_bilinear4x4);
+
+typedef prototype_filter_predict((*vp8_filter_fn_t));
+
+typedef struct
+{
+ vp8_filter_fn_t sixtap16x16;
+ vp8_filter_fn_t sixtap8x8;
+ vp8_filter_fn_t sixtap8x4;
+ vp8_filter_fn_t sixtap4x4;
+ vp8_filter_fn_t bilinear16x16;
+ vp8_filter_fn_t bilinear8x8;
+ vp8_filter_fn_t bilinear8x4;
+ vp8_filter_fn_t bilinear4x4;
+} vp8_filter_rtcd_vtable_t;
+
+#define FILTER_INVOKE(ctx,fn) vp8_filter_##fn
+
+#endif /* FILTER_DISPATCH_H */
diff --git a/src/gallium/auxiliary/vl/vp8/common/reconinter.c b/src/gallium/auxiliary/vl/vp8/common/reconinter.c
index 190c0203ed..03837bfea8 100644
--- a/src/gallium/auxiliary/vl/vp8/common/reconinter.c
+++ b/src/gallium/auxiliary/vl/vp8/common/reconinter.c
@@ -10,7 +10,7 @@
#include "recon.h"
-#include "subpixel.h"
+#include "filter_dispatch.h"
#include "blockd.h"
#include "reconinter.h"
@@ -106,7 +106,7 @@ void vp8_copy_mem8x4_c(unsigned char *src, int src_stride,
}
}
-void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf)
+void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_filter_fn_t sppf)
{
int r;
unsigned char *ptr_base;
@@ -152,7 +152,7 @@ static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d, int pitch)
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
{
- x->subpixel_predict8x8(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
+ x->filter_predict8x8(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
}
else
{
@@ -171,7 +171,7 @@ static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, int pitch)
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
{
- x->subpixel_predict8x4(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
+ x->filter_predict8x4(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
}
else
{
@@ -200,7 +200,7 @@ void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
if ((mv_row | mv_col) & 7)
{
- x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_y, dst_ystride);
+ x->filter_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_y, dst_ystride);
}
else
{
@@ -216,8 +216,8 @@ void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
if ((mv_row | mv_col) & 7)
{
- x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, dst_u, dst_uvstride);
- x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, dst_v, dst_uvstride);
+ x->filter_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, dst_u, dst_uvstride);
+ x->filter_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, dst_v, dst_uvstride);
}
else
{
@@ -249,8 +249,8 @@ void vp8_build_inter4x4_predictors_mb(MACROBLOCKD *x)
build_inter_predictors2b(x, d0, 16);
else
{
- vp8_build_inter_predictors_b(d0, 16, x->subpixel_predict);
- vp8_build_inter_predictors_b(d1, 16, x->subpixel_predict);
+ vp8_build_inter_predictors_b(d0, 16, x->filter_predict4x4);
+ vp8_build_inter_predictors_b(d1, 16, x->filter_predict4x4);
}
}
}
@@ -264,8 +264,8 @@ void vp8_build_inter4x4_predictors_mb(MACROBLOCKD *x)
build_inter_predictors2b(x, d0, 8);
else
{
- vp8_build_inter_predictors_b(d0, 8, x->subpixel_predict);
- vp8_build_inter_predictors_b(d1, 8, x->subpixel_predict);
+ vp8_build_inter_predictors_b(d0, 8, x->filter_predict4x4);
+ vp8_build_inter_predictors_b(d1, 8, x->filter_predict4x4);
}
}
}
diff --git a/src/gallium/auxiliary/vl/vp8/common/reconinter.h b/src/gallium/auxiliary/vl/vp8/common/reconinter.h
index a52504357f..a1ef79bdfb 100644
--- a/src/gallium/auxiliary/vl/vp8/common/reconinter.h
+++ b/src/gallium/auxiliary/vl/vp8/common/reconinter.h
@@ -22,7 +22,7 @@ extern void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
extern void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x);
extern void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel);
-extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf);
+extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_filter_fn_t sppf);
extern void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x);
#endif /* RECONINTER_H */
diff --git a/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c b/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c
index e9ef442a97..06a0458d72 100644
--- a/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c
+++ b/src/gallium/auxiliary/vl/vp8/decoder/decodeframe.c
@@ -522,19 +522,19 @@ static void vp8_frame_init(VP8D_COMP *pbi)
{
if (pc->use_bilinear_mc_filter)
{
- pc->mcomp_filter_type = BILINEAR;
- xd->subpixel_predict = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear4x4);
- xd->subpixel_predict8x4 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear8x4);
- xd->subpixel_predict8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear8x8);
- xd->subpixel_predict16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), bilinear16x16);
+ pc->mcomp_filter_type = BILINEAR;
+ xd->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear4x4);
+ xd->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x4);
+ xd->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear8x8);
+ xd->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), bilinear16x16);
}
else
{
- pc->mcomp_filter_type = SIXTAP;
- xd->subpixel_predict = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap4x4);
- xd->subpixel_predict8x4 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap8x4);
- xd->subpixel_predict8x8 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap8x8);
- xd->subpixel_predict16x16 = SUBPIX_INVOKE(RTCD_VTABLE(subpix), sixtap16x16);
+ pc->mcomp_filter_type = SIXTAP;
+ xd->filter_predict4x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap4x4);
+ xd->filter_predict8x4 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x4);
+ xd->filter_predict8x8 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap8x8);
+ xd->filter_predict16x16 = FILTER_INVOKE(RTCD_VTABLE(filter), sixtap16x16);
}
}