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 VPX_VP9_COMMON_VP9_RECONINTER_H_
12 #define VPX_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](src, src_stride, dst,
30 dst_stride, kernel, subpel_x,
31 xs, subpel_y, 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, subpel_y, ys, w,
41 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 *src_mv,
65 const struct scale_factors *sf, int w, int h,
66 int ref, 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 *src_mv, const struct scale_factors *sf, int w, int h, int ref,
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 int64_t scaled_buffer_offset(int x_offset, int y_offset,
78 int stride,
79 const struct scale_factors *sf) {
80 const int x = sf ? sf->scale_value_x(x_offset, sf) : x_offset;
81 const int y = sf ? sf->scale_value_y(y_offset, sf) : y_offset;
82 return (int64_t)y * stride + x;
83 }
84
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)85 static INLINE void setup_pred_plane(struct buf_2d *dst, uint8_t *src,
86 int stride, int mi_row, int mi_col,
87 const struct scale_factors *scale,
88 int subsampling_x, int subsampling_y) {
89 const int x = (MI_SIZE * mi_col) >> subsampling_x;
90 const int y = (MI_SIZE * mi_row) >> subsampling_y;
91 dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
92 dst->stride = stride;
93 }
94
95 void vp9_setup_dst_planes(struct macroblockd_plane planes[MAX_MB_PLANE],
96 const YV12_BUFFER_CONFIG *src, int mi_row,
97 int mi_col);
98
99 void vp9_setup_pre_planes(MACROBLOCKD *xd, int idx,
100 const YV12_BUFFER_CONFIG *src, int mi_row, int mi_col,
101 const struct scale_factors *sf);
102
103 #ifdef __cplusplus
104 } // extern "C"
105 #endif
106
107 #endif // VPX_VP9_COMMON_VP9_RECONINTER_H_
108