summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_reconinter.h
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common/vp9_reconinter.h')
-rw-r--r--vp9/common/vp9_reconinter.h78
1 files changed, 74 insertions, 4 deletions
diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h
index 585fcfd6d..068853d1d 100644
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -77,20 +77,27 @@ void vp9_build_inter_predictor_q4(const uint8_t *src, int src_stride,
int w, int h, int do_avg,
const struct subpix_fn_table *subpix);
-static int scale_value_x(int val, const struct scale_factors *scale) {
+static int scale_value_x_with_scaling(int val,
+ const struct scale_factors *scale) {
return val * scale->x_num / scale->x_den;
}
-static int scale_value_y(int val, const struct scale_factors *scale) {
+static int scale_value_y_with_scaling(int val,
+ const struct scale_factors *scale) {
return val * scale->y_num / scale->y_den;
}
+static int unscaled_value(int val, const struct scale_factors *scale) {
+ (void) scale;
+ return val;
+}
+
static int scaled_buffer_offset(int x_offset,
int y_offset,
int stride,
const struct scale_factors *scale) {
- return scale_value_y(y_offset, scale) * stride +
- scale_value_x(x_offset, scale);
+ return scale->scale_value_y(y_offset, scale) * stride +
+ scale->scale_value_x(x_offset, scale);
}
static void setup_pred_block(YV12_BUFFER_CONFIG *dst,
@@ -112,6 +119,7 @@ static void setup_pred_block(YV12_BUFFER_CONFIG *dst,
recon_yoffset = 16 * mb_row * recon_y_stride + 16 * mb_col;
recon_uvoffset = 8 * mb_row * recon_uv_stride + 8 * mb_col;
}
+
*dst = *src;
dst->y_buffer += recon_yoffset;
dst->u_buffer += recon_uvoffset;
@@ -128,4 +136,66 @@ static void set_scale_factors(MACROBLOCKD *xd,
xd->scale_factor_uv[1] = xd->scale_factor[1];
}
+static void set_offsets_with_scaling(struct scale_factors *scale,
+ int row, int col) {
+ const int x_q4 = 16 * col;
+ const int y_q4 = 16 * row;
+
+ scale->x_offset_q4 = (x_q4 * scale->x_num / scale->x_den) & 0xf;
+ scale->y_offset_q4 = (y_q4 * scale->y_num / scale->y_den) & 0xf;
+}
+
+static void set_offsets_without_scaling(struct scale_factors *scale,
+ int row, int col) {
+ scale->x_offset_q4 = 0;
+ scale->y_offset_q4 = 0;
+}
+
+static int_mv32 motion_vector_q3_to_q4_with_scaling(
+ const int_mv *src_mv,
+ const struct scale_factors *scale) {
+ // returns mv * scale + offset
+ int_mv32 result;
+ const int32_t mv_row_q4 = src_mv->as_mv.row << 1;
+ const int32_t mv_col_q4 = src_mv->as_mv.col << 1;
+
+ /* TODO(jkoleszar): make fixed point, or as a second multiply? */
+ result.as_mv.row = mv_row_q4 * scale->y_num / scale->y_den
+ + scale->y_offset_q4;
+ result.as_mv.col = mv_col_q4 * scale->x_num / scale->x_den
+ + scale->x_offset_q4;
+ return result;
+}
+
+static int_mv32 motion_vector_q3_to_q4_without_scaling(
+ const int_mv *src_mv,
+ const struct scale_factors *scale) {
+ // returns mv * scale + offset
+ int_mv32 result;
+
+ result.as_mv.row = src_mv->as_mv.row << 1;
+ result.as_mv.col = src_mv->as_mv.col << 1;
+ return result;
+}
+
+static int32_t motion_vector_component_q4_with_scaling(int mv_q4,
+ int num,
+ int den,
+ int offset_q4) {
+ // returns the scaled and offset value of the mv component.
+
+ /* TODO(jkoleszar): make fixed point, or as a second multiply? */
+ return mv_q4 * num / den + offset_q4;
+}
+
+static int32_t motion_vector_component_q4_without_scaling(int mv_q4,
+ int num,
+ int den,
+ int offset_q4) {
+ // returns the scaled and offset value of the mv component.
+ (void)num;
+ (void)den;
+ (void)offset_q4;
+ return mv_q4;
+}
#endif // VP9_COMMON_VP9_RECONINTER_H_