summaryrefslogtreecommitdiff
path: root/vp9/common
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common')
-rw-r--r--vp9/common/vp9_blockd.h9
-rw-r--r--vp9/common/vp9_convolve.h5
-rw-r--r--vp9/common/vp9_filter.c35
-rw-r--r--vp9/common/vp9_filter.h27
-rw-r--r--vp9/common/vp9_reconinter.c27
5 files changed, 58 insertions, 45 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index 5c82d0d49..f116c0647 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -20,6 +20,7 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_common_data.h"
#include "vp9/common/vp9_enums.h"
+#include "vp9/common/vp9_filter.h"
#include "vp9/common/vp9_mv.h"
#include "vp9/common/vp9_scale.h"
#include "vp9/common/vp9_seg_common.h"
@@ -56,14 +57,6 @@ typedef enum {
} FRAME_TYPE;
typedef enum {
- EIGHTTAP = 0,
- EIGHTTAP_SMOOTH = 1,
- EIGHTTAP_SHARP = 2,
- BILINEAR = 3,
- SWITCHABLE = 4 /* should be the last one */
-} INTERPOLATIONFILTERTYPE;
-
-typedef enum {
DC_PRED, // Average of above and left pixels
V_PRED, // Vertical
H_PRED, // Horizontal
diff --git a/vp9/common/vp9_convolve.h b/vp9/common/vp9_convolve.h
index 3d4cf6914..9a5caa662 100644
--- a/vp9/common/vp9_convolve.h
+++ b/vp9/common/vp9_convolve.h
@@ -21,9 +21,4 @@ typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
const int16_t *filter_y, int y_step_q4,
int w, int h);
-struct subpix_fn_table {
- const int16_t (*filter_x)[8];
- const int16_t (*filter_y)[8];
-};
-
#endif // VP9_COMMON_VP9_CONVOLVE_H_
diff --git a/vp9/common/vp9_filter.c b/vp9/common/vp9_filter.c
index 4ac2bc93f..cedd44cad 100644
--- a/vp9/common/vp9_filter.c
+++ b/vp9/common/vp9_filter.c
@@ -8,12 +8,14 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <assert.h>
+
#include "vpx_ports/mem.h"
#include "vp9/common/vp9_filter.h"
-DECLARE_ALIGNED(256, const int16_t,
- vp9_bilinear_filters[SUBPEL_SHIFTS][SUBPEL_TAPS]) = {
+DECLARE_ALIGNED(256, const subpel_kernel,
+ vp9_bilinear_filters[SUBPEL_SHIFTS]) = {
{ 0, 0, 0, 128, 0, 0, 0, 0 },
{ 0, 0, 0, 120, 8, 0, 0, 0 },
{ 0, 0, 0, 112, 16, 0, 0, 0 },
@@ -33,8 +35,8 @@ DECLARE_ALIGNED(256, const int16_t,
};
// Lagrangian interpolation filter
-DECLARE_ALIGNED(256, const int16_t,
- vp9_sub_pel_filters_8[SUBPEL_SHIFTS][SUBPEL_TAPS]) = {
+DECLARE_ALIGNED(256, const subpel_kernel,
+ vp9_sub_pel_filters_8[SUBPEL_SHIFTS]) = {
{ 0, 0, 0, 128, 0, 0, 0, 0},
{ 0, 1, -5, 126, 8, -3, 1, 0},
{ -1, 3, -10, 122, 18, -6, 2, 0},
@@ -54,8 +56,8 @@ DECLARE_ALIGNED(256, const int16_t,
};
// DCT based filter
-DECLARE_ALIGNED(256, const int16_t,
- vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][SUBPEL_TAPS]) = {
+DECLARE_ALIGNED(256, const subpel_kernel,
+ vp9_sub_pel_filters_8s[SUBPEL_SHIFTS]) = {
{0, 0, 0, 128, 0, 0, 0, 0},
{-1, 3, -7, 127, 8, -3, 1, 0},
{-2, 5, -13, 125, 17, -6, 3, -1},
@@ -75,8 +77,8 @@ DECLARE_ALIGNED(256, const int16_t,
};
// freqmultiplier = 0.5
-DECLARE_ALIGNED(256, const int16_t,
- vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][SUBPEL_TAPS]) = {
+DECLARE_ALIGNED(256, const subpel_kernel,
+ vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS]) = {
{ 0, 0, 0, 128, 0, 0, 0, 0},
{-3, -1, 32, 64, 38, 1, -3, 0},
{-2, -2, 29, 63, 41, 2, -3, 0},
@@ -94,3 +96,20 @@ DECLARE_ALIGNED(256, const int16_t,
{ 0, -3, 2, 41, 63, 29, -2, -2},
{ 0, -3, 1, 38, 64, 32, -1, -3}
};
+
+const subpel_kernel *vp9_get_filter_kernel(INTERPOLATIONFILTERTYPE type) {
+ switch (type) {
+ case EIGHTTAP:
+ return vp9_sub_pel_filters_8;
+ case EIGHTTAP_SMOOTH:
+ return vp9_sub_pel_filters_8lp;
+ case EIGHTTAP_SHARP:
+ return vp9_sub_pel_filters_8s;
+ case BILINEAR:
+ return vp9_bilinear_filters;
+ default:
+ assert(!"Invalid filter type.");
+ return NULL;
+ }
+}
+
diff --git a/vp9/common/vp9_filter.h b/vp9/common/vp9_filter.h
index 58260ce99..676b274b9 100644
--- a/vp9/common/vp9_filter.h
+++ b/vp9/common/vp9_filter.h
@@ -19,11 +19,28 @@
#define SUBPEL_SHIFTS (1 << SUBPEL_BITS)
#define SUBPEL_TAPS 8
-extern const int16_t vp9_bilinear_filters[SUBPEL_SHIFTS][SUBPEL_TAPS];
-extern const int16_t vp9_sub_pel_filters_6[SUBPEL_SHIFTS][SUBPEL_TAPS];
-extern const int16_t vp9_sub_pel_filters_8[SUBPEL_SHIFTS][SUBPEL_TAPS];
-extern const int16_t vp9_sub_pel_filters_8s[SUBPEL_SHIFTS][SUBPEL_TAPS];
-extern const int16_t vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS][SUBPEL_TAPS];
+typedef enum {
+ EIGHTTAP = 0,
+ EIGHTTAP_SMOOTH = 1,
+ EIGHTTAP_SHARP = 2,
+ BILINEAR = 3,
+ SWITCHABLE = 4 /* should be the last one */
+} INTERPOLATIONFILTERTYPE;
+
+typedef const int16_t subpel_kernel[SUBPEL_TAPS];
+
+struct subpix_fn_table {
+ const subpel_kernel *filter_x;
+ const subpel_kernel *filter_y;
+};
+
+const subpel_kernel *vp9_get_filter_kernel(INTERPOLATIONFILTERTYPE type);
+
+extern const subpel_kernel vp9_bilinear_filters[SUBPEL_SHIFTS];
+extern const subpel_kernel vp9_sub_pel_filters_6[SUBPEL_SHIFTS];
+extern const subpel_kernel vp9_sub_pel_filters_8[SUBPEL_SHIFTS];
+extern const subpel_kernel vp9_sub_pel_filters_8s[SUBPEL_SHIFTS];
+extern const subpel_kernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS];
// The VP9_BILINEAR_FILTERS_2TAP macro returns a pointer to the bilinear
// filter kernel as a 2 tap filter.
diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c
index 18407dd73..b3b9e1d8a 100644
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -20,34 +20,23 @@
#include "vp9/common/vp9_reconinter.h"
#include "vp9/common/vp9_reconintra.h"
-
void vp9_setup_interp_filters(MACROBLOCKD *xd,
INTERPOLATIONFILTERTYPE mcomp_filter_type,
VP9_COMMON *cm) {
if (xd->mi_8x8 && xd->this_mi) {
- MB_MODE_INFO * mbmi = &xd->this_mi->mbmi;
+ MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
- set_scale_factors(xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1,
- cm->active_ref_scale);
+ set_scale_factors(xd, mbmi->ref_frame[0] - LAST_FRAME,
+ mbmi->ref_frame[1] - LAST_FRAME,
+ cm->active_ref_scale);
} else {
set_scale_factors(xd, -1, -1, cm->active_ref_scale);
}
- switch (mcomp_filter_type) {
- case EIGHTTAP:
- case SWITCHABLE:
- xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8;
- break;
- case EIGHTTAP_SMOOTH:
- xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8lp;
- break;
- case EIGHTTAP_SHARP:
- xd->subpix.filter_x = xd->subpix.filter_y = vp9_sub_pel_filters_8s;
- break;
- case BILINEAR:
- xd->subpix.filter_x = xd->subpix.filter_y = vp9_bilinear_filters;
- break;
- }
+ xd->subpix.filter_x = xd->subpix.filter_y =
+ vp9_get_filter_kernel(mcomp_filter_type == SWITCHABLE ?
+ EIGHTTAP : mcomp_filter_type);
+
assert(((intptr_t)xd->subpix.filter_x & 0xff) == 0);
}