aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWan-Teh Chang <wtc@google.com>2023-09-28 09:26:58 -0700
committerJames Zern <jzern@google.com>2023-12-08 00:34:23 +0000
commit0d5811e4effb62672ec60aed5bd21553af158791 (patch)
treee237dd9faefe2aa6c8aa49253b76e6fd9dd6c990
parentc64a85d25afe01a3aac14980314836ee22281cb5 (diff)
downloadlibvpx-0d5811e4effb62672ec60aed5bd21553af158791.tar.gz
Use vpx_sse instead of vpx_mse to compute SSE
Use vpx_sse and vpx_highbd_sse instead of vpx_mse16x16 and vpx_highbd_8_mse16x16 respectively to compute SSE for PSNR calculations. This solves an issue whereby vpx_highbd_8_mse16x16 was being used to calculate SSE for 10- and 12-bit input. This is a port of the libaom CL https://aomedia-review.googlesource.com/c/aom/+/175063 by Jonathan Wright <jonathan.wright@arm.com>. Bug: webm:1819 Change-Id: I37e3ac72835e67ccb44ac89a4ed16df62c2169a7 (cherry picked from commit 7dfe343199381bddddc5eaa648e947876979b61b)
-rw-r--r--vpx_dsp/psnr.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/vpx_dsp/psnr.c b/vpx_dsp/psnr.c
index f0d4e927a..4ee4130a2 100644
--- a/vpx_dsp/psnr.c
+++ b/vpx_dsp/psnr.c
@@ -45,14 +45,14 @@ static int64_t encoder_sse(const uint8_t *a, int a_stride, const uint8_t *b,
}
#if CONFIG_VP9_HIGHBITDEPTH
-static int64_t encoder_highbd_8_sse(const uint8_t *a8, int a_stride,
- const uint8_t *b8, int b_stride, int w,
- int h) {
+static int64_t encoder_highbd_sse(const uint8_t *a8, int a_stride,
+ const uint8_t *b8, int b_stride, int w,
+ int h) {
int i, j;
int64_t sse = 0;
- uint16_t *a = CONVERT_TO_SHORTPTR(a8);
- uint16_t *b = CONVERT_TO_SHORTPTR(b8);
+ const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
+ const uint16_t *b = CONVERT_TO_SHORTPTR(b8);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
@@ -88,10 +88,8 @@ static int64_t get_sse(const uint8_t *a, int a_stride, const uint8_t *b,
for (y = 0; y < height / 16; ++y) {
const uint8_t *pa = a;
const uint8_t *pb = b;
- unsigned int sse;
for (x = 0; x < width / 16; ++x) {
- vpx_mse16x16(pa, a_stride, pb, b_stride, &sse);
- total_sse += sse;
+ total_sse += vpx_sse(pa, a_stride, pb, b_stride, 16, 16);
pa += 16;
pb += 16;
@@ -131,21 +129,19 @@ static int64_t highbd_get_sse(const uint8_t *a, int a_stride, const uint8_t *b,
const int dw = width % 16;
const int dh = height % 16;
if (dw > 0) {
- total_sse += encoder_highbd_8_sse(&a[width - dw], a_stride, &b[width - dw],
- b_stride, dw, height);
+ total_sse += encoder_highbd_sse(&a[width - dw], a_stride, &b[width - dw],
+ b_stride, dw, height);
}
if (dh > 0) {
- total_sse += encoder_highbd_8_sse(&a[(height - dh) * a_stride], a_stride,
- &b[(height - dh) * b_stride], b_stride,
- width - dw, dh);
+ total_sse += encoder_highbd_sse(&a[(height - dh) * a_stride], a_stride,
+ &b[(height - dh) * b_stride], b_stride,
+ width - dw, dh);
}
for (y = 0; y < height / 16; ++y) {
const uint8_t *pa = a;
const uint8_t *pb = b;
- unsigned int sse;
for (x = 0; x < width / 16; ++x) {
- vpx_highbd_8_mse16x16(pa, a_stride, pb, b_stride, &sse);
- total_sse += sse;
+ total_sse += vpx_highbd_sse(pa, a_stride, pb, b_stride, 16, 16);
pa += 16;
pb += 16;
}