From: Wan-Teh Chang Date: Thu, 28 Sep 2023 16:26:58 +0000 (-0700) Subject: Use vpx_sse instead of vpx_mse to compute SSE X-Git-Tag: accepted/tizen/7.0/unified/20240521.012539~1^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d5811e4effb62672ec60aed5bd21553af158791;p=platform%2Fupstream%2Flibvpx.git 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 . Bug: webm:1819 Change-Id: I37e3ac72835e67ccb44ac89a4ed16df62c2169a7 (cherry picked from commit 7dfe343199381bddddc5eaa648e947876979b61b) --- diff --git a/vpx_dsp/psnr.c b/vpx_dsp/psnr.c index f0d4e92..4ee4130 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; }