/* * Copyright (c) 2016, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
void aom_minmax_8x8_c(const uint8_t *s, int p, const uint8_t *d, int dp, int *min, int *max) { int i, j;
*min = 255;
*max = 0; for (i = 0; i < 8; ++i, s += p, d += dp) { for (j = 0; j < 8; ++j) { int diff = abs(s[j] - d[j]);
*min = diff < *min ? diff : *min;
*max = diff > *max ? diff : *max;
}
}
}
unsignedint aom_avg_4x4_c(const uint8_t *s, int p) { int i, j; int sum = 0; for (i = 0; i < 4; ++i, s += p) for (j = 0; j < 4; sum += s[j], ++j) {
}
return (sum + 8) >> 4;
}
unsignedint aom_avg_8x8_c(const uint8_t *s, int p) { int i, j; int sum = 0; for (i = 0; i < 8; ++i, s += p) for (j = 0; j < 8; sum += s[j], ++j) {
}
return (sum + 32) >> 6;
}
void aom_avg_8x8_quad_c(const uint8_t *s, int p, int x16_idx, int y16_idx, int *avg) { for (int k = 0; k < 4; k++) { constint x8_idx = x16_idx + ((k & 1) << 3); constint y8_idx = y16_idx + ((k >> 1) << 3); const uint8_t *s_tmp = s + y8_idx * p + x8_idx;
avg[k] = aom_avg_8x8_c(s_tmp, p);
}
}
#if CONFIG_AV1_HIGHBITDEPTH unsignedint aom_highbd_avg_8x8_c(const uint8_t *s8, int p) { int i, j; int sum = 0; const uint16_t *s = CONVERT_TO_SHORTPTR(s8); for (i = 0; i < 8; ++i, s += p) for (j = 0; j < 8; sum += s[j], ++j) {
}
return (sum + 32) >> 6;
}
unsignedint aom_highbd_avg_4x4_c(const uint8_t *s8, int p) { int i, j; int sum = 0; const uint16_t *s = CONVERT_TO_SHORTPTR(s8); for (i = 0; i < 4; ++i, s += p) for (j = 0; j < 4; sum += s[j], ++j) {
}
return (sum + 8) >> 4;
}
void aom_highbd_minmax_8x8_c(const uint8_t *s8, int p, const uint8_t *d8, int dp, int *min, int *max) { int i, j; const uint16_t *s = CONVERT_TO_SHORTPTR(s8); const uint16_t *d = CONVERT_TO_SHORTPTR(d8);
*min = 65535;
*max = 0; for (i = 0; i < 8; ++i, s += p, d += dp) { for (j = 0; j < 8; ++j) { int diff = abs(s[j] - d[j]);
*min = diff < *min ? diff : *min;
*max = diff > *max ? diff : *max;
}
}
} #endif// CONFIG_AV1_HIGHBITDEPTH
// The order of the output coeff of the hadamard is not important. For // optimization purposes the final transpose may be skipped. void aom_highbd_hadamard_8x8_c(const int16_t *src_diff, ptrdiff_t src_stride,
tran_low_t *coeff) { int idx;
int16_t buffer[64];
int32_t buffer2[64];
int16_t *tmp_buf = &buffer[0]; for (idx = 0; idx < 8; ++idx) { // src_diff: 13 bit // buffer: 16 bit, dynamic range [-32760, 32760]
hadamard_highbd_col8_first_pass(src_diff, src_stride, tmp_buf);
tmp_buf += 8;
++src_diff;
}
// coeff: 20 bits, dynamic range [-524287, 524287]. // length: value range {16, 32, 64, 128, 256, 512, 1024}. int aom_satd_c(const tran_low_t *coeff, int length) { int i; int satd = 0; for (i = 0; i < length; ++i) satd += abs(coeff[i]);
// Integer projection onto row vectors. // height: value range {16, 32, 64, 128}. void aom_int_pro_row_c(int16_t *hbuf, const uint8_t *ref, constint ref_stride, constint width, constint height, int norm_factor) {
assert(height >= 2); for (int idx = 0; idx < width; ++idx) {
hbuf[idx] = 0; // hbuf[idx]: 14 bit, dynamic range [0, 32640]. for (int i = 0; i < height; ++i) hbuf[idx] += ref[i * ref_stride]; // hbuf[idx]: 9 bit, dynamic range [0, 1020].
hbuf[idx] >>= norm_factor;
++ref;
}
}
// width: value range {16, 32, 64, 128}. void aom_int_pro_col_c(int16_t *vbuf, const uint8_t *ref, constint ref_stride, constint width, constint height, int norm_factor) { for (int ht = 0; ht < height; ++ht) {
int16_t sum = 0; // sum: 14 bit, dynamic range [0, 32640] for (int idx = 0; idx < width; ++idx) sum += ref[idx];
vbuf[ht] = sum >> norm_factor;
ref += ref_stride;
}
}
// ref: [0 - 510] // src: [0 - 510] // bwl: {2, 3, 4, 5} int aom_vector_var_c(const int16_t *ref, const int16_t *src, int bwl) { int i; int width = 4 << bwl; int sse = 0, mean = 0, var;
for (i = 0; i < width; ++i) { int diff = ref[i] - src[i]; // diff: dynamic range [-510, 510], 10 bits.
mean += diff; // mean: dynamic range 16 bits.
sse += diff * diff; // sse: dynamic range 26 bits.
}
// (mean * mean): dynamic range 31 bits. // If width == 128, the mean can be 510 * 128 = 65280, and log2(65280 ** 2) ~= // 31.99, so it needs to be casted to unsigned int to compute its square. constunsignedint mean_abs = abs(mean);
var = sse - ((mean_abs * mean_abs) >> (bwl + 2)); return var;
}
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.