Commit 6706e674 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Moving several static functions from vp9_reconinter.h to vp9_reconinter.c.

Change-Id: I5da9c16bab26f6ff0c9d3a2a29ef6c84f5093161
parent 2cf0d4be
......@@ -17,6 +17,78 @@
#include "vp9/common/vp9_reconinter.h"
#include "vp9/common/vp9_reconintra.h"
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_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_mv32 mv_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 mv_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 mv_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 mv_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;
}
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;
}
void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
int other_w, int other_h,
int this_w, int this_h) {
......@@ -34,18 +106,14 @@ void vp9_setup_scale_factors_for_frame(struct scale_factors *scale,
scale->scale_value_x = unscaled_value;
scale->scale_value_y = unscaled_value;
scale->set_scaled_offsets = set_offsets_without_scaling;
scale->scale_motion_vector_q3_to_q4 =
motion_vector_q3_to_q4_without_scaling;
scale->scale_motion_vector_component_q4 =
motion_vector_component_q4_without_scaling;
scale->scale_motion_vector_q3_to_q4 = mv_q3_to_q4_without_scaling;
scale->scale_motion_vector_component_q4 = mv_component_q4_without_scaling;
} else {
scale->scale_value_x = scale_value_x_with_scaling;
scale->scale_value_y = scale_value_y_with_scaling;
scale->set_scaled_offsets = set_offsets_with_scaling;
scale->scale_motion_vector_q3_to_q4 =
motion_vector_q3_to_q4_with_scaling;
scale->scale_motion_vector_component_q4 =
motion_vector_component_q4_with_scaling;
scale->scale_motion_vector_q3_to_q4 = mv_q3_to_q4_with_scaling;
scale->scale_motion_vector_component_q4 = mv_component_q4_with_scaling;
}
// TODO(agrange): Investigate the best choice of functions to use here
......
......@@ -52,21 +52,6 @@ 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_with_scaling(int val,
const struct scale_factors *scale) {
return val * scale->x_num / scale->x_den;
}
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) {
const int x = scale ? scale->scale_value_x(x_offset, scale) : x_offset;
......@@ -137,66 +122,4 @@ 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_
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