summaryrefslogtreecommitdiffstats
path: root/third_party/aom/av1/common/scale.c
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-19 21:52:15 -0500
committertrav90 <travawine@palemoon.org>2018-10-19 21:52:20 -0500
commitbbcc64772580c8a979288791afa02d30bc476d2e (patch)
tree437ce94c3fdd7497508e5b55de06c6d011678597 /third_party/aom/av1/common/scale.c
parent14805f6ddbfb173c327768fff9f81f40ce5e81b0 (diff)
downloadUXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.gz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.lz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.tar.xz
UXP-bbcc64772580c8a979288791afa02d30bc476d2e.zip
Update aom to v1.0.0
Update aom to commit id d14c5bb4f336ef1842046089849dee4a301fbbf0.
Diffstat (limited to 'third_party/aom/av1/common/scale.c')
-rw-r--r--third_party/aom/av1/common/scale.c152
1 files changed, 46 insertions, 106 deletions
diff --git a/third_party/aom/av1/common/scale.c b/third_party/aom/av1/common/scale.c
index d5ccdfec0..c525fe229 100644
--- a/third_party/aom/av1/common/scale.c
+++ b/third_party/aom/av1/common/scale.c
@@ -9,7 +9,9 @@
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
-#include "./aom_dsp_rtcd.h"
+#include "config/aom_dsp_rtcd.h"
+#include "config/av1_rtcd.h"
+
#include "av1/common/filter.h"
#include "av1/common/scale.h"
#include "aom_dsp/aom_filter.h"
@@ -46,12 +48,9 @@ static int get_fixed_point_scale_factor(int other_size, int this_size) {
return ((other_size << REF_SCALE_SHIFT) + this_size / 2) / this_size;
}
-static int get_coarse_point_scale_factor(int other_size, int this_size) {
- // Calculate scaling factor once for each reference frame
- // and use fixed point scaling factors in decoding and encoding routines.
- // Hardware implementations can calculate scale factor in device driver
- // and use multiplication and shifting on hardware instead of division.
- return ((other_size << SCALE_SUBPEL_BITS) + this_size / 2) / this_size;
+// Given the fixed point scale, calculate coarse point scale.
+static int fixed_point_scale_to_coarse_point_scale(int scale_fp) {
+ return ROUND_POWER_OF_TWO(scale_fp, REF_SCALE_SHIFT - SCALE_SUBPEL_BITS);
}
// Note: x and y are integer precision, mvq4 is q4 precision.
@@ -64,14 +63,8 @@ MV32 av1_scale_mv(const MV *mvq4, int x, int y,
return res;
}
-#if CONFIG_HIGHBITDEPTH
-void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
- int other_h, int this_w, int this_h,
- int use_highbd) {
-#else
void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
int other_h, int this_w, int this_h) {
-#endif
if (!valid_ref_frame_size(other_w, other_h, this_w, this_h)) {
sf->x_scale_fp = REF_INVALID_SCALE;
sf->y_scale_fp = REF_INVALID_SCALE;
@@ -81,8 +74,8 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
sf->x_scale_fp = get_fixed_point_scale_factor(other_w, this_w);
sf->y_scale_fp = get_fixed_point_scale_factor(other_h, this_h);
- sf->x_step_q4 = get_coarse_point_scale_factor(other_w, this_w);
- sf->y_step_q4 = get_coarse_point_scale_factor(other_h, this_h);
+ sf->x_step_q4 = fixed_point_scale_to_coarse_point_scale(sf->x_scale_fp);
+ sf->y_step_q4 = fixed_point_scale_to_coarse_point_scale(sf->y_scale_fp);
if (av1_is_scaled(sf)) {
sf->scale_value_x = scaled_x;
@@ -92,95 +85,42 @@ void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w,
sf->scale_value_y = unscaled_value;
}
- // TODO(agrange): Investigate the best choice of functions to use here
- // for EIGHTTAP_SMOOTH. Since it is not interpolating, need to choose what
- // to do at full-pel offsets. The current selection, where the filter is
- // applied in one direction only, and not at all for 0,0, seems to give the
- // best quality, but it may be worth trying an additional mode that does
- // do the filtering on full-pel.
- if (sf->x_step_q4 == SCALE_SUBPEL_SHIFTS) {
- if (sf->y_step_q4 == SCALE_SUBPEL_SHIFTS) {
- // No scaling in either direction.
- sf->predict[0][0][0] = aom_convolve_copy;
- sf->predict[0][0][1] = aom_convolve_avg;
- sf->predict[0][1][0] = aom_convolve8_vert;
- sf->predict[0][1][1] = aom_convolve8_avg_vert;
- sf->predict[1][0][0] = aom_convolve8_horiz;
- sf->predict[1][0][1] = aom_convolve8_avg_horiz;
- } else {
- // No scaling in x direction. Must always scale in the y direction.
- sf->predict[0][0][0] = aom_convolve8_vert;
- sf->predict[0][0][1] = aom_convolve8_avg_vert;
- sf->predict[0][1][0] = aom_convolve8_vert;
- sf->predict[0][1][1] = aom_convolve8_avg_vert;
- sf->predict[1][0][0] = aom_convolve8;
- sf->predict[1][0][1] = aom_convolve8_avg;
- }
- } else {
- if (sf->y_step_q4 == SCALE_SUBPEL_SHIFTS) {
- // No scaling in the y direction. Must always scale in the x direction.
- sf->predict[0][0][0] = aom_convolve8_horiz;
- sf->predict[0][0][1] = aom_convolve8_avg_horiz;
- sf->predict[0][1][0] = aom_convolve8;
- sf->predict[0][1][1] = aom_convolve8_avg;
- sf->predict[1][0][0] = aom_convolve8_horiz;
- sf->predict[1][0][1] = aom_convolve8_avg_horiz;
- } else {
- // Must always scale in both directions.
- sf->predict[0][0][0] = aom_convolve8;
- sf->predict[0][0][1] = aom_convolve8_avg;
- sf->predict[0][1][0] = aom_convolve8;
- sf->predict[0][1][1] = aom_convolve8_avg;
- sf->predict[1][0][0] = aom_convolve8;
- sf->predict[1][0][1] = aom_convolve8_avg;
- }
- }
- // 2D subpel motion always gets filtered in both directions
- sf->predict[1][1][0] = aom_convolve8;
- sf->predict[1][1][1] = aom_convolve8_avg;
-
-#if CONFIG_HIGHBITDEPTH
- if (use_highbd) {
- if (sf->x_step_q4 == SCALE_SUBPEL_SHIFTS) {
- if (sf->y_step_q4 == SCALE_SUBPEL_SHIFTS) {
- // No scaling in either direction.
- sf->highbd_predict[0][0][0] = aom_highbd_convolve_copy;
- sf->highbd_predict[0][0][1] = aom_highbd_convolve_avg;
- sf->highbd_predict[0][1][0] = aom_highbd_convolve8_vert;
- sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg_vert;
- sf->highbd_predict[1][0][0] = aom_highbd_convolve8_horiz;
- sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg_horiz;
- } else {
- // No scaling in x direction. Must always scale in the y direction.
- sf->highbd_predict[0][0][0] = aom_highbd_convolve8_vert;
- sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg_vert;
- sf->highbd_predict[0][1][0] = aom_highbd_convolve8_vert;
- sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg_vert;
- sf->highbd_predict[1][0][0] = aom_highbd_convolve8;
- sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg;
- }
- } else {
- if (sf->y_step_q4 == SCALE_SUBPEL_SHIFTS) {
- // No scaling in the y direction. Must always scale in the x direction.
- sf->highbd_predict[0][0][0] = aom_highbd_convolve8_horiz;
- sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg_horiz;
- sf->highbd_predict[0][1][0] = aom_highbd_convolve8;
- sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg;
- sf->highbd_predict[1][0][0] = aom_highbd_convolve8_horiz;
- sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg_horiz;
- } else {
- // Must always scale in both directions.
- sf->highbd_predict[0][0][0] = aom_highbd_convolve8;
- sf->highbd_predict[0][0][1] = aom_highbd_convolve8_avg;
- sf->highbd_predict[0][1][0] = aom_highbd_convolve8;
- sf->highbd_predict[0][1][1] = aom_highbd_convolve8_avg;
- sf->highbd_predict[1][0][0] = aom_highbd_convolve8;
- sf->highbd_predict[1][0][1] = aom_highbd_convolve8_avg;
- }
- }
- // 2D subpel motion always gets filtered in both directions.
- sf->highbd_predict[1][1][0] = aom_highbd_convolve8;
- sf->highbd_predict[1][1][1] = aom_highbd_convolve8_avg;
- }
-#endif // CONFIG_HIGHBITDEPTH
+ // AV1 convolve functions
+ // Special case convolve functions should produce the same result as
+ // av1_convolve_2d.
+ // subpel_x_q4 == 0 && subpel_y_q4 == 0
+ sf->convolve[0][0][0] = av1_convolve_2d_copy_sr;
+ // subpel_x_q4 == 0
+ sf->convolve[0][1][0] = av1_convolve_y_sr;
+ // subpel_y_q4 == 0
+ sf->convolve[1][0][0] = av1_convolve_x_sr;
+ // subpel_x_q4 != 0 && subpel_y_q4 != 0
+ sf->convolve[1][1][0] = av1_convolve_2d_sr;
+ // subpel_x_q4 == 0 && subpel_y_q4 == 0
+ sf->convolve[0][0][1] = av1_jnt_convolve_2d_copy;
+ // subpel_x_q4 == 0
+ sf->convolve[0][1][1] = av1_jnt_convolve_y;
+ // subpel_y_q4 == 0
+ sf->convolve[1][0][1] = av1_jnt_convolve_x;
+ // subpel_x_q4 != 0 && subpel_y_q4 != 0
+ sf->convolve[1][1][1] = av1_jnt_convolve_2d;
+ // AV1 High BD convolve functions
+ // Special case convolve functions should produce the same result as
+ // av1_highbd_convolve_2d.
+ // subpel_x_q4 == 0 && subpel_y_q4 == 0
+ sf->highbd_convolve[0][0][0] = av1_highbd_convolve_2d_copy_sr;
+ // subpel_x_q4 == 0
+ sf->highbd_convolve[0][1][0] = av1_highbd_convolve_y_sr;
+ // subpel_y_q4 == 0
+ sf->highbd_convolve[1][0][0] = av1_highbd_convolve_x_sr;
+ // subpel_x_q4 != 0 && subpel_y_q4 != 0
+ sf->highbd_convolve[1][1][0] = av1_highbd_convolve_2d_sr;
+ // subpel_x_q4 == 0 && subpel_y_q4 == 0
+ sf->highbd_convolve[0][0][1] = av1_highbd_jnt_convolve_2d_copy;
+ // subpel_x_q4 == 0
+ sf->highbd_convolve[0][1][1] = av1_highbd_jnt_convolve_y;
+ // subpel_y_q4 == 0
+ sf->highbd_convolve[1][0][1] = av1_highbd_jnt_convolve_x;
+ // subpel_x_q4 != 0 && subpel_y_q4 != 0
+ sf->highbd_convolve[1][1][1] = av1_highbd_jnt_convolve_2d;
}