summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_rdopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_rdopt.c')
-rw-r--r--vp9/encoder/vp9_rdopt.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index a6a0a7b4f..5fef9f89b 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1549,13 +1549,6 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]};
int_mv ref_mv[2];
int ite, ref;
- // Prediction buffer from second frame.
-#if CONFIG_VP9_HIGHBITDEPTH
- uint8_t *second_pred;
- uint8_t *second_pred_alloc;
-#else
- uint8_t *second_pred = vpx_memalign(16, pw * ph * sizeof(uint8_t));
-#endif // CONFIG_VP9_HIGHBITDEPTH
const InterpKernel *kernel = vp9_get_interp_kernel(mbmi->interp_filter);
struct scale_factors sf;
@@ -1566,14 +1559,13 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]),
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[1])
};
+
+ // Prediction buffer from second frame.
#if CONFIG_VP9_HIGHBITDEPTH
- if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
- second_pred_alloc = vpx_memalign(16, pw * ph * sizeof(uint16_t));
- second_pred = CONVERT_TO_BYTEPTR(second_pred_alloc);
- } else {
- second_pred_alloc = vpx_memalign(16, pw * ph * sizeof(uint8_t));
- second_pred = second_pred_alloc;
- }
+ DECLARE_ALIGNED_ARRAY(16, uint16_t, second_pred_alloc_16, 64 * 64);
+ uint8_t *second_pred;
+#else
+ DECLARE_ALIGNED_ARRAY(16, uint8_t, second_pred, 64 * 64);
#endif // CONFIG_VP9_HIGHBITDEPTH
for (ref = 0; ref < 2; ++ref) {
@@ -1628,6 +1620,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
// Get the prediction block from the 'other' reference frame.
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ second_pred = CONVERT_TO_BYTEPTR(second_pred_alloc_16);
vp9_highbd_build_inter_predictor(ref_yv12[!id].buf,
ref_yv12[!id].stride,
second_pred, pw,
@@ -1637,6 +1630,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
mi_col * MI_SIZE, mi_row * MI_SIZE,
xd->bd);
} else {
+ second_pred = (uint8_t *)second_pred_alloc_16;
vp9_build_inter_predictor(ref_yv12[!id].buf,
ref_yv12[!id].stride,
second_pred, pw,
@@ -1722,12 +1716,6 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
&mbmi->ref_mvs[refs[ref]][0].as_mv,
x->nmvjointcost, x->mvcost, MV_COST_WEIGHT);
}
-
-#if CONFIG_VP9_HIGHBITDEPTH
- vpx_free(second_pred_alloc);
-#else
- vpx_free(second_pred);
-#endif // CONFIG_VP9_HIGHBITDEPTH
}
static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,