/* * 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.
*/
/* Sum the difference between every corresponding element of the buffers. */ staticinlineunsignedint sad(const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height) { int y, x; unsignedint sad = 0;
for (y = 0; y < height; y++) { for (x = 0; x < width; x++) {
sad += abs(a[x] - b[x]);
}
a += a_stride;
b += b_stride;
} return sad;
}
#define SADMXN(m, n) \ unsignedint aom_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ const uint8_t *ref, int ref_stride) { \ return sad(src, src_stride, ref, ref_stride, m, n); \
}
#define SADMXN_AVG(m, n) \ unsignedint aom_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \ const uint8_t *ref, int ref_stride, \ const uint8_t *second_pred) { \
uint8_t comp_pred[m * n]; \
aom_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \ return sad(src, src_stride, comp_pred, m, m, n); \
}
// Calculate sad against 4 reference locations and store each in sad_array #define SAD_MXNX4D_NO_SKIP(m, n) \ void aom_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \ const uint8_t *const ref_array[4], \ int ref_stride, uint32_t sad_array[4]) { \ int i; \ for (i = 0; i < 4; ++i) { \
sad_array[i] = \
aom_sad##m##x##n##_c(src, src_stride, ref_array[i], ref_stride); \
} \
}
#define SAD_MXNX4D(m, n) \
SAD_MXNX4D_NO_SKIP(m, n) \ void aom_sad_skip_##m##x##n##x4d_c(const uint8_t *src, int src_stride, \ const uint8_t *const ref_array[4], \ int ref_stride, uint32_t sad_array[4]) { \ int i; \ for (i = 0; i < 4; ++i) { \
sad_array[i] = 2 * sad(src, 2 * src_stride, ref_array[i], \
2 * ref_stride, (m), (n / 2)); \
} \
} // Call SIMD version of aom_sad_mxnx4d if the 3d version is unavailable. #define SAD_MXNX3D(m, n) \ void aom_sad##m##x##n##x3d_c(const uint8_t *src, int src_stride, \ const uint8_t *const ref_array[4], \ int ref_stride, uint32_t sad_array[4]) { \
aom_sad##m##x##n##x4d(src, src_stride, ref_array, ref_stride, sad_array); \
}
#if CONFIG_AV1_HIGHBITDEPTH staticinlineunsignedint highbd_sad(const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, int width, int height) { int y, x; unsignedint sad = 0; const uint16_t *a = CONVERT_TO_SHORTPTR(a8); const uint16_t *b = CONVERT_TO_SHORTPTR(b8); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) {
sad += abs(a[x] - b[x]);
}
a += a_stride;
b += b_stride;
} return sad;
}
staticinlineunsignedint highbd_sadb(const uint8_t *a8, int a_stride, const uint8_t *b8, int b_stride, int width, int height) { int y, x; unsignedint sad = 0; const uint16_t *a = CONVERT_TO_SHORTPTR(a8); const uint16_t *b = CONVERT_TO_SHORTPTR(b8); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) {
sad += abs(a[x] - b[x]);
}
a += a_stride;
b += b_stride;
} return sad;
}
#define HIGHBD_SADMXN(m, n) \ unsignedint aom_highbd_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ const uint8_t *ref, \ int ref_stride) { \ return highbd_sad(src, src_stride, ref, ref_stride, m, n); \
}
#define HIGHBD_SADMXN_AVG(m, n) \ unsignedint aom_highbd_sad##m##x##n##_avg_c( \ const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride, \ const uint8_t *second_pred) { \
uint16_t comp_pred[m * n]; \
uint8_t *const comp_pred8 = CONVERT_TO_BYTEPTR(comp_pred); \
aom_highbd_comp_avg_pred(comp_pred8, second_pred, m, n, ref, ref_stride); \ return highbd_sadb(src, src_stride, comp_pred8, m, m, n); \
}
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.