uint32_t vpx_get4x4sse_cs_c(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride) {
int distortion = 0;
int r, c;
for (r = 0; r < 4; ++r) {
for (c = 0; c < 4; ++c) {
int diff = src_ptr[c] - ref_ptr[c];
distortion += diff * diff;
}
src_ptr += src_stride;
ref_ptr += ref_stride;
}
return distortion;
}
uint32_t vpx_get_mb_ss_c(const int16_t *src_ptr) { unsigned int i, sum = 0;
for (i = 0; i < 256; ++i) {
sum += src_ptr[i] * src_ptr[i];
}
return sum;
}
staticvoid variance(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, int w, int h,
uint32_t *sse, int *sum) {
int i, j;
*sum = 0;
*sse = 0;
for (i = 0; i < h; ++i) {
for (j = 0; j < w; ++j) { const int diff = src_ptr[j] - ref_ptr[j];
*sum += diff;
*sse += diff * diff;
}
src_ptr += src_stride;
ref_ptr += ref_stride;
}
}
// Applies a 1-D 2-tap bilinear filter to the source block in either horizontal // or vertical direction to produce the filtered output block. Used to implement // the first-pass of 2-D separable filter. // // Produces int16_t output to retain precision for the next pass. Two filter // taps should sum to FILTER_WEIGHT. pixel_step defines whether the filter is // applied horizontally (pixel_step = 1) or vertically (pixel_step = stride). // It defines the offset required to move from one input to the next. staticvoid var_filter_block2d_bil_first_pass( const uint8_t *src_ptr, uint16_t *ref_ptr, unsigned int src_pixels_per_line,
int pixel_step, unsigned int output_height, unsigned int output_width, const uint8_t *filter) { unsigned int i, j;
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
ref_ptr[j] = ROUND_POWER_OF_TWO(
(int)src_ptr[0] * filter[0] + (int)src_ptr[pixel_step] * filter[1],
FILTER_BITS);
// Applies a 1-D 2-tap bilinear filter to the source block in either horizontal // or vertical direction to produce the filtered output block. Used to implement // the second-pass of 2-D separable filter. // // Requires 16-bit input as produced by filter_block2d_bil_first_pass. Two // filter taps should sum to FILTER_WEIGHT. pixel_step defines whether the // filter is applied horizontally (pixel_step = 1) or vertically // (pixel_step = stride). It defines the offset required to move from one input // to the next. Output is 8-bit. staticvoid var_filter_block2d_bil_second_pass( const uint16_t *src_ptr, uint8_t *ref_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, const uint8_t *filter) { unsigned int i, j;
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
ref_ptr[j] = ROUND_POWER_OF_TWO(
(int)src_ptr[0] * filter[0] + (int)src_ptr[pixel_step] * filter[1],
FILTER_BITS);
++src_ptr;
}
void vpx_comp_avg_pred_c(uint8_t *comp_pred, const uint8_t *pred, int width,
int height, const uint8_t *ref, int ref_stride) {
int i, j;
for (i = 0; i < height; ++i) {
for (j = 0; j < width; ++j) { const int tmp = pred[j] + ref[j];
comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
}
comp_pred += width;
pred += width;
ref += ref_stride;
}
}
#if CONFIG_VP9_HIGHBITDEPTH // Note this function uses unsigned integer math in calculating the sum squared // error to avoid reports of signed integer overflow should a (fuzzing) test // use input values that are outside of the valid range for 12-bit content. The // additional annotation is necessary as an overflow will still be reported // with the integer/unsigned-integer-overflow (not undefined) sanitizer. // This function assumes `abs(value) <= UINT16_MAX`, as the only overflow // that's expected is from casting negative signed integer values to unsigned // and squaring the result. static VPX_NO_UNSIGNED_OVERFLOW_CHECK uint32_t square_value(int value) {
assert(abs(value) <= UINT16_MAX); const uint32_t unsigned_value = (uint32_t)value; return unsigned_value * unsigned_value;
}
staticvoid highbd_variance64(const uint8_t *src8_ptr, int src_stride, const uint8_t *ref8_ptr, int ref_stride, int w,
int h, uint64_t *sse, int64_t *sum) {
int i, j;
staticvoid highbd_var_filter_block2d_bil_second_pass( const uint16_t *src_ptr, uint16_t *output_ptr, unsigned int src_pixels_per_line, unsigned int pixel_step, unsigned int output_height, unsigned int output_width, const uint8_t *filter) { unsigned int i, j;
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
output_ptr[j] = ROUND_POWER_OF_TWO(
(int)src_ptr[0] * filter[0] + (int)src_ptr[pixel_step] * filter[1],
FILTER_BITS);
++src_ptr;
}
/* All three forms of the variance are available in the same sizes. */ #define HIGHBD_VARIANCES(W, H) \
HIGHBD_VAR(W, H) \
HIGHBD_SUBPIX_VAR(W, H) \
HIGHBD_SUBPIX_AVG_VAR(W, H)
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.