1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef VP9_COMMON_VP9_RECONINTER_H_
12 #define VP9_COMMON_VP9_RECONINTER_H_
13
14 #include "vp9/common/vp9_filter.h"
15 #include "vp9/common/vp9_onyxc_int.h"
16 #include "vpx/vpx_integer.h"
17 #include "vpx_dsp/vpx_filter.h"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
inter_predictor(const uint8_t * src,int src_stride,uint8_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)23 static INLINE void inter_predictor(const uint8_t *src, int src_stride,
24 uint8_t *dst, int dst_stride,
25 const int subpel_x, const int subpel_y,
26 const struct scale_factors *sf, int w, int h,
27 int ref, const InterpKernel *kernel, int xs,
28 int ys) {
29 sf->predict[subpel_x != 0][subpel_y != 0][ref](
30 src, src_stride, dst, dst_stride, kernel[subpel_x], xs, kernel[subpel_y],
31 ys, w, h);
32 }
33
34 #if CONFIG_VP9_HIGHBITDEPTH
highbd_inter_predictor(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)35 static INLINE void highbd_inter_predictor(
36 const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride,
37 const int subpel_x, const int subpel_y, const struct scale_factors *sf,
38 int w, int h, int ref, const InterpKernel *kernel, int xs, int ys, int bd) {
39 sf->highbd_predict[subpel_x != 0][subpel_y != 0][ref](
40 src, src_stride, dst, dst_stride, kernel[subpel_x], xs, kernel[subpel_y],
41 ys, w, h, bd);
42 }
43 #endif // CONFIG_VP9_HIGHBITDEPTH
44
45 MV average_split_mvs(const struct macroblockd_plane *pd, const MODE_INFO *mi,
46 int ref, int block);
47
48 MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, const MV *src_mv, int bw,
49 int bh, int ss_x, int ss_y);
50
51 void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
52 BLOCK_SIZE bsize);
53
54 void vp9_build_inter_predictors_sbp(MACROBLOCKD *xd, int mi_row, int mi_col,
55 BLOCK_SIZE bsize, int plane);
56
57 void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
58 BLOCK_SIZE bsize);
59
60 void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
61 BLOCK_SIZE bsize);
62
63 void vp9_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
64 int dst_stride, const MV *mv_q3,
65 const struct scale_factors *sf, int w, int h,
66 int do_avg, const InterpKernel *kernel,
67 enum mv_precision precision, int x, int y);
68
69 #if CONFIG_VP9_HIGHBITDEPTH
70 void vp9_highbd_build_inter_predictor(
71 const uint16_t *src, int src_stride, uint16_t *dst, int dst_stride,
72 const MV *mv_q3, const struct scale_factors *sf, int w, int h, int do_avg,
73 const InterpKernel *kernel, enum mv_precision precision, int x, int y,
74 int bd);
75 #endif
76
scaled_buffer_offset(int x_offset,int y_offset,int stride,const struct scale_factors * sf)77 static INLINE int scaled_buffer_offset(int x_offset, int y_offset, int stride,
78 const struct scale_factors *sf) {
79 const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset;
80 const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset;
81 return y * stride + x;
82 }
83
setup_pred_plane(struct buf_2d * dst,uint8_t * src,int stride,int mi_row,int mi_col,const struct scale_factors * scale,int subsampling_x,int subsampling_y)84 static INLINE void setup_pred_plane(struct buf_2d *dst, uint8_t *src,
85 int stride, int mi_row, int mi_col,
86 const struct scale_factors *scale,
87 int subsampling_x, int subsampling_y) {
88 const int x = (MI_SIZE * mi_col) >> subsampling_x;
89 const int y = (MI_SIZE * mi_row) >> subsampling_y;
90 dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
91 dst->stride = stride;
92 }
93
94 void vp9_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
95 const YV12_BUFFER_CONFIG *src, int mi_row,
96 int mi_col);
97
98 void vp9_setup_pre_planes(MACROBLOCKD *xd, int idx,
99 const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
100 const struct scale_factors *sf);
101
102 #ifdef __cplusplus
103 } // extern "C"
104 #endif
105
106 #endif // VP9_COMMON_VP9_RECONINTER_H_
107