/* * Copyright (c) 2013 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
staticint get_fixed_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 << REF_SCALE_SHIFT) / this_size;
}
#if CONFIG_VP9_HIGHBITDEPTH void vp9_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 vp9_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; return;
}
// 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 == 16) { if (sf->y_step_q4 == 16) { // No scaling in either direction.
sf->predict[0][0][0] = vpx_convolve_copy;
sf->predict[0][0][1] = vpx_convolve_avg;
sf->predict[0][1][0] = vpx_convolve8_vert;
sf->predict[0][1][1] = vpx_convolve8_avg_vert;
sf->predict[1][0][0] = vpx_convolve8_horiz;
sf->predict[1][0][1] = vpx_convolve8_avg_horiz;
} else { // No scaling in x direction. Must always scale in the y direction.
sf->predict[0][0][0] = vpx_scaled_vert;
sf->predict[0][0][1] = vpx_scaled_avg_vert;
sf->predict[0][1][0] = vpx_scaled_vert;
sf->predict[0][1][1] = vpx_scaled_avg_vert;
sf->predict[1][0][0] = vpx_scaled_2d;
sf->predict[1][0][1] = vpx_scaled_avg_2d;
}
} else { if (sf->y_step_q4 == 16) { // No scaling in the y direction. Must always scale in the x direction.
sf->predict[0][0][0] = vpx_scaled_horiz;
sf->predict[0][0][1] = vpx_scaled_avg_horiz;
sf->predict[0][1][0] = vpx_scaled_2d;
sf->predict[0][1][1] = vpx_scaled_avg_2d;
sf->predict[1][0][0] = vpx_scaled_horiz;
sf->predict[1][0][1] = vpx_scaled_avg_horiz;
} else { // Must always scale in both directions.
sf->predict[0][0][0] = vpx_scaled_2d;
sf->predict[0][0][1] = vpx_scaled_avg_2d;
sf->predict[0][1][0] = vpx_scaled_2d;
sf->predict[0][1][1] = vpx_scaled_avg_2d;
sf->predict[1][0][0] = vpx_scaled_2d;
sf->predict[1][0][1] = vpx_scaled_avg_2d;
}
}
// 2D subpel motion always gets filtered in both directions
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.