ref: e8655d49f51412050f41027acb43aa2c88c81094
parent: 3d33a462b3e10f65074e9fae7a82d3f0f7a412db
parent: 4758d20227772f9fe5164c22c20c82c219de3f4f
author: Linfeng Zhang <linfengz@google.com>
date: Mon May 1 15:54:40 EDT 2017
Merge "Clean vp9_highbd_build_inter_predictor() and highbd_inter_predictor()"
--- a/vp9/common/vp9_reconinter.c
+++ b/vp9/common/vp9_reconinter.c
@@ -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 @@
#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 {
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -33,12 +33,12 @@
#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 @@
#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);
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -451,25 +451,20 @@
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;
+ 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);
}
-
- 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);
- }
}
#else
static void extend_and_predict(const uint8_t *buf_ptr1, int pre_buf_stride,
@@ -631,7 +626,8 @@
}
#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,
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -2420,7 +2420,8 @@
#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,
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1528,7 +1528,8 @@
#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 @@
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,
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -55,16 +55,19 @@
#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);