Commit 4758d202 authored by Linfeng Zhang's avatar Linfeng Zhang
Browse files

Clean vp9_highbd_build_inter_predictor() and highbd_inter_predictor()

BUG=webm:1388

Change-Id: I7ee32e0c08f0fb41712a8cc640b2c5bba872421d
parent 51dc998f
......@@ -21,7 +21,7 @@
#if CONFIG_VP9_HIGHBITDEPTH
void vp9_highbd_build_inter_predictor(
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride,
const MV *src_mv, const struct scale_factors *sf, int w, int h, int ref,
const InterpKernel *kernel, enum mv_precision precision, int x, int y,
int bd) {
......@@ -190,7 +190,8 @@ static void build_inter_predictors(MACROBLOCKD *xd, int plane, int block,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_inter_predictor(pre, pre_buf->stride, dst, dst_buf->stride,
highbd_inter_predictor(CONVERT_TO_SHORTPTR(pre), pre_buf->stride,
CONVERT_TO_SHORTPTR(dst), dst_buf->stride,
subpel_x, subpel_y, sf, w, h, ref, kernel, xs, ys,
xd->bd);
} else {
......
......@@ -33,12 +33,12 @@ static INLINE void inter_predictor(const uint8_t *src, int src_stride,
#if CONFIG_VP9_HIGHBITDEPTH
static INLINE void highbd_inter_predictor(
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride,
const int subpel_x, const int subpel_y, const struct scale_factors *sf,
int w, int h, int ref, const InterpKernel *kernel, int xs, int ys, int bd) {
sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
CONVERT_TO_SHORTPTR(src), src_stride, CONVERT_TO_SHORTPTR(dst),
dst_stride, kernel[subpel_x], xs, kernel[subpel_y], ys, w, h, bd);
src, src_stride, dst, dst_stride, kernel[subpel_x], xs, kernel[subpel_y],
ys, w, h, bd);
}
#endif // CONFIG_VP9_HIGHBITDEPTH
......@@ -68,7 +68,7 @@ void vp9_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
#if CONFIG_VP9_HIGHBITDEPTH
void vp9_highbd_build_inter_predictor(
const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride,
const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride,
const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg,
const InterpKernel *kernel, enum mv_precision precision, int x, int y,
int bd);
......
......@@ -451,24 +451,19 @@ static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride,
const struct scale_factors *sf, MACROBLOCKD *xd,
int w, int h, int ref, int xs, int ys) {
DECLARE_ALIGNED(16, uint16_t, mc_buf_high[80 * 2 * 80 * 2]);
const uint8_t *buf_ptr;
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
high_build_mc_border(buf_ptr1, pre_buf_stride, mc_buf_high, b_w, x0, y0,
b_w, b_h, frame_width, frame_height);
buf_ptr = CONVERT_TO_BYTEPTR(mc_buf_high) + border_offset;
highbd_inter_predictor(mc_buf_high + border_offset, b_w,
CONVERT_TO_SHORTPTR(dst), dst_buf_stride, subpel_x,
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
} else {
build_mc_border(buf_ptr1, pre_buf_stride, (uint8_t *)mc_buf_high, b_w, x0,
y0, b_w, b_h, frame_width, frame_height);
buf_ptr = ((uint8_t *)mc_buf_high) + border_offset;
}
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x,
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
} else {
inter_predictor(buf_ptr, b_w, dst, dst_buf_stride, subpel_x, subpel_y, sf,
w, h, ref, kernel, xs, ys);
inter_predictor(((uint8_t *)mc_buf_high) + border_offset, b_w, dst,
dst_buf_stride, subpel_x, subpel_y, sf, w, h, ref, kernel,
xs, ys);
}
}
#else
......@@ -631,7 +626,8 @@ static void dec_build_inter_predictors(
}
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
highbd_inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x,
highbd_inter_predictor(CONVERT_TO_SHORTPTR(buf_ptr), buf_stride,
CONVERT_TO_SHORTPTR(dst), dst_buf->stride, subpel_x,
subpel_y, sf, w, h, ref, kernel, xs, ys, xd->bd);
} else {
inter_predictor(buf_ptr, buf_stride, dst, dst_buf->stride, subpel_x,
......
......@@ -2433,7 +2433,8 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int mi_row,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp9_highbd_build_inter_predictor(
pd->pre[0].buf, pd->pre[0].stride, pd->dst.buf, pd->dst.stride,
CONVERT_TO_SHORTPTR(pd->pre[0].buf), pd->pre[0].stride,
CONVERT_TO_SHORTPTR(pd->dst.buf), pd->dst.stride,
&xd->mi[0]->bmi[i].as_mv[0].as_mv, &xd->block_refs[0]->sf,
4 * num_4x4_blocks_wide, 4 * num_4x4_blocks_high, 0,
vp9_filter_kernels[mi->interp_filter], MV_PRECISION_Q3,
......
......@@ -1528,7 +1528,8 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, MACROBLOCK *x,
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp9_highbd_build_inter_predictor(
pre, y_stride, dst, pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv,
CONVERT_TO_SHORTPTR(pre), y_stride, CONVERT_TO_SHORTPTR(dst),
pd->dst.stride, &mi->bmi[i].as_mv[ref].as_mv,
&xd->block_refs[ref]->sf, width, height, ref, kernel, MV_PRECISION_Q3,
mi_col * MI_SIZE + 4 * (i % 2), mi_row * MI_SIZE + 4 * (i / 2),
xd->bd);
......@@ -1783,9 +1784,9 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
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,
&frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, kernel, MV_PRECISION_Q3,
mi_col * MI_SIZE, mi_row * MI_SIZE, xd->bd);
CONVERT_TO_SHORTPTR(ref_yv12[!id].buf), ref_yv12[!id].stride,
second_pred_alloc_16, pw, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0,
kernel, MV_PRECISION_Q3, 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,
......
......@@ -53,16 +53,19 @@ static void temporal_filter_predictors_mb_c(
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp9_highbd_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale,
16, 16, which_mv, kernel, MV_PRECISION_Q3,
x, y, xd->bd);
vp9_highbd_build_inter_predictor(CONVERT_TO_SHORTPTR(y_mb_ptr), stride,
CONVERT_TO_SHORTPTR(&pred[0]), 16, &mv,
scale, 16, 16, which_mv, kernel,
MV_PRECISION_Q3, x, y, xd->bd);
vp9_highbd_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256],
vp9_highbd_build_inter_predictor(CONVERT_TO_SHORTPTR(u_mb_ptr), uv_stride,
CONVERT_TO_SHORTPTR(&pred[256]),
uv_block_width, &mv, scale, uv_block_width,
uv_block_height, which_mv, kernel,
mv_precision_uv, x, y, xd->bd);
vp9_highbd_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512],
vp9_highbd_build_inter_predictor(CONVERT_TO_SHORTPTR(v_mb_ptr), uv_stride,
CONVERT_TO_SHORTPTR(&pred[512]),
uv_block_width, &mv, scale, uv_block_width,
uv_block_height, which_mv, kernel,
mv_precision_uv, x, y, xd->bd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment