mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
update to libvpx b46243d from repo https://chromium.googlesource.com/webm/libvpx
This commit is contained in:
@@ -17,15 +17,13 @@
|
||||
#include "vpx_ports/mem.h"
|
||||
|
||||
/* Sum the difference between every corresponding element of the buffers. */
|
||||
static INLINE unsigned int sad(const uint8_t *a, int a_stride,
|
||||
const uint8_t *b, int b_stride,
|
||||
int width, int height) {
|
||||
static INLINE unsigned int sad(const uint8_t *a, int a_stride, const uint8_t *b,
|
||||
int b_stride, int width, int height) {
|
||||
int y, x;
|
||||
unsigned int sad = 0;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
sad += abs(a[x] - b[x]);
|
||||
for (x = 0; x < width; x++) sad += abs(a[x] - b[x]);
|
||||
|
||||
a += a_stride;
|
||||
b += b_stride;
|
||||
@@ -33,81 +31,43 @@ static INLINE unsigned int sad(const uint8_t *a, int a_stride,
|
||||
return sad;
|
||||
}
|
||||
|
||||
// TODO(johannkoenig): this moved to vpx_dsp, should be able to clean this up.
|
||||
/* Remove dependency on vp9 variance function by duplicating vp9_comp_avg_pred.
|
||||
* The function averages every corresponding element of the buffers and stores
|
||||
* the value in a third buffer, comp_pred.
|
||||
* pred and comp_pred are assumed to have stride = width
|
||||
* In the usage below comp_pred is a local array.
|
||||
*/
|
||||
static INLINE void avg_pred(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;
|
||||
#define sadMxN(m, n) \
|
||||
unsigned int vpx_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); \
|
||||
} \
|
||||
unsigned int vpx_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]; \
|
||||
vpx_comp_avg_pred_c(comp_pred, second_pred, m, n, ref, ref_stride); \
|
||||
return sad(src, src_stride, comp_pred, m, m, n); \
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static INLINE void highbd_avg_pred(uint16_t *comp_pred, const uint8_t *pred8,
|
||||
int width, int height, const uint8_t *ref8,
|
||||
int ref_stride) {
|
||||
int i, j;
|
||||
uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
|
||||
uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
||||
#define sadMxN(m, n) \
|
||||
unsigned int vpx_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); \
|
||||
} \
|
||||
unsigned int vpx_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]; \
|
||||
avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \
|
||||
return sad(src, src_stride, comp_pred, m, m, n); \
|
||||
}
|
||||
|
||||
// depending on call sites, pass **ref_array to avoid & in subsequent call and
|
||||
// de-dup with 4D below.
|
||||
#define sadMxNxK(m, n, k) \
|
||||
void vpx_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *ref_array, int ref_stride, \
|
||||
uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < k; ++i) \
|
||||
sad_array[i] = vpx_sad##m##x##n##_c(src, src_stride, &ref_array[i], ref_stride); \
|
||||
}
|
||||
#define sadMxNxK(m, n, k) \
|
||||
void vpx_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *ref_array, int ref_stride, \
|
||||
uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < k; ++i) \
|
||||
sad_array[i] = \
|
||||
vpx_sad##m##x##n##_c(src, src_stride, &ref_array[i], ref_stride); \
|
||||
}
|
||||
|
||||
// This appears to be equivalent to the above when k == 4 and refs is const
|
||||
#define sadMxNx4D(m, n) \
|
||||
void vpx_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *const ref_array[], int ref_stride, \
|
||||
uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < 4; ++i) \
|
||||
sad_array[i] = vpx_sad##m##x##n##_c(src, src_stride, ref_array[i], ref_stride); \
|
||||
}
|
||||
#define sadMxNx4D(m, n) \
|
||||
void vpx_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *const ref_array[], \
|
||||
int ref_stride, uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < 4; ++i) \
|
||||
sad_array[i] = \
|
||||
vpx_sad##m##x##n##_c(src, src_stride, ref_array[i], ref_stride); \
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
// 64x64
|
||||
sadMxN(64, 64)
|
||||
sadMxNxK(64, 64, 3)
|
||||
@@ -175,18 +135,18 @@ sadMxN(4, 4)
|
||||
sadMxNxK(4, 4, 3)
|
||||
sadMxNxK(4, 4, 8)
|
||||
sadMxNx4D(4, 4)
|
||||
/* clang-format on */
|
||||
|
||||
#if CONFIG_VP9_HIGHBITDEPTH
|
||||
static INLINE unsigned int highbd_sad(const uint8_t *a8, int a_stride,
|
||||
const uint8_t *b8, int b_stride,
|
||||
int width, int height) {
|
||||
static INLINE
|
||||
unsigned int highbd_sad(const uint8_t *a8, int a_stride, const uint8_t *b8,
|
||||
int b_stride, int width, int height) {
|
||||
int y, x;
|
||||
unsigned int 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]);
|
||||
for (x = 0; x < width; x++) sad += abs(a[x] - b[x]);
|
||||
|
||||
a += a_stride;
|
||||
b += b_stride;
|
||||
@@ -201,8 +161,7 @@ static INLINE unsigned int highbd_sadb(const uint8_t *a8, int a_stride,
|
||||
unsigned int sad = 0;
|
||||
const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
sad += abs(a[x] - b[x]);
|
||||
for (x = 0; x < width; x++) sad += abs(a[x] - b[x]);
|
||||
|
||||
a += a_stride;
|
||||
b += b_stride;
|
||||
@@ -210,43 +169,43 @@ static INLINE unsigned int highbd_sadb(const uint8_t *a8, int a_stride,
|
||||
return sad;
|
||||
}
|
||||
|
||||
#define highbd_sadMxN(m, n) \
|
||||
unsigned int vpx_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); \
|
||||
} \
|
||||
unsigned int vpx_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]; \
|
||||
highbd_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \
|
||||
return highbd_sadb(src, src_stride, comp_pred, m, m, n); \
|
||||
}
|
||||
#define highbd_sadMxN(m, n) \
|
||||
unsigned int vpx_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); \
|
||||
} \
|
||||
unsigned int vpx_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]; \
|
||||
vpx_highbd_comp_avg_pred_c(comp_pred, second_pred, m, n, ref, ref_stride); \
|
||||
return highbd_sadb(src, src_stride, comp_pred, m, m, n); \
|
||||
}
|
||||
|
||||
#define highbd_sadMxNxK(m, n, k) \
|
||||
void vpx_highbd_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *ref_array, int ref_stride, \
|
||||
uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < k; ++i) { \
|
||||
sad_array[i] = vpx_highbd_sad##m##x##n##_c(src, src_stride, &ref_array[i], \
|
||||
ref_stride); \
|
||||
} \
|
||||
}
|
||||
#define highbd_sadMxNxK(m, n, k) \
|
||||
void vpx_highbd_sad##m##x##n##x##k##_c( \
|
||||
const uint8_t *src, int src_stride, const uint8_t *ref_array, \
|
||||
int ref_stride, uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < k; ++i) { \
|
||||
sad_array[i] = vpx_highbd_sad##m##x##n##_c(src, src_stride, \
|
||||
&ref_array[i], ref_stride); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define highbd_sadMxNx4D(m, n) \
|
||||
void vpx_highbd_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *const ref_array[], \
|
||||
int ref_stride, uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < 4; ++i) { \
|
||||
sad_array[i] = vpx_highbd_sad##m##x##n##_c(src, src_stride, ref_array[i], \
|
||||
ref_stride); \
|
||||
} \
|
||||
}
|
||||
#define highbd_sadMxNx4D(m, n) \
|
||||
void vpx_highbd_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
|
||||
const uint8_t *const ref_array[], \
|
||||
int ref_stride, uint32_t *sad_array) { \
|
||||
int i; \
|
||||
for (i = 0; i < 4; ++i) { \
|
||||
sad_array[i] = vpx_highbd_sad##m##x##n##_c(src, src_stride, \
|
||||
ref_array[i], ref_stride); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* clang-format off */
|
||||
// 64x64
|
||||
highbd_sadMxN(64, 64)
|
||||
highbd_sadMxNxK(64, 64, 3)
|
||||
@@ -314,5 +273,6 @@ highbd_sadMxN(4, 4)
|
||||
highbd_sadMxNxK(4, 4, 3)
|
||||
highbd_sadMxNxK(4, 4, 8)
|
||||
highbd_sadMxNx4D(4, 4)
|
||||
/* clang-format on */
|
||||
|
||||
#endif // CONFIG_VP9_HIGHBITDEPTH
|
||||
|
Reference in New Issue
Block a user