From 1f7c4114a670398e7bdaa0703389fdaea7df40e3 Mon Sep 17 00:00:00 2001 From: Luc Trudeau Date: Wed, 13 Sep 2017 15:10:08 -0400 Subject: [PATCH] Fix Dead Store in rdopt.c Change-Id: Iad6a16d3ab819405de037d5100060710e0636176 --- av1/encoder/rdopt.c | 86 +++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index e4569ef71..79e83a56b 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -801,78 +801,64 @@ static double od_compute_dist_common(int activity_masking, uint16_t *x, static double od_compute_dist(uint16_t *x, uint16_t *y, int bsize_w, int bsize_h, int qindex) { - int i; - double sum = 0; - assert(bsize_w >= 8 && bsize_h >= 8); - #if CONFIG_PVQ int activity_masking = 1; #else int activity_masking = 0; #endif - { - int j; - DECLARE_ALIGNED(16, od_coeff, e[MAX_TX_SQUARE]); - DECLARE_ALIGNED(16, od_coeff, tmp[MAX_TX_SQUARE]); - DECLARE_ALIGNED(16, od_coeff, e_lp[MAX_TX_SQUARE]); - int mid = OD_DIST_LP_MID; - for (i = 0; i < bsize_h; i++) { - for (j = 0; j < bsize_w; j++) { - e[i * bsize_w + j] = x[i * bsize_w + j] - y[i * bsize_w + j]; - } + int i, j; + DECLARE_ALIGNED(16, od_coeff, e[MAX_TX_SQUARE]); + DECLARE_ALIGNED(16, od_coeff, tmp[MAX_TX_SQUARE]); + DECLARE_ALIGNED(16, od_coeff, e_lp[MAX_TX_SQUARE]); + for (i = 0; i < bsize_h; i++) { + for (j = 0; j < bsize_w; j++) { + e[i * bsize_w + j] = x[i * bsize_w + j] - y[i * bsize_w + j]; } - for (i = 0; i < bsize_h; i++) { - tmp[i * bsize_w] = mid * e[i * bsize_w] + 2 * e[i * bsize_w + 1]; - tmp[i * bsize_w + bsize_w - 1] = - mid * e[i * bsize_w + bsize_w - 1] + 2 * e[i * bsize_w + bsize_w - 2]; - for (j = 1; j < bsize_w - 1; j++) { - tmp[i * bsize_w + j] = mid * e[i * bsize_w + j] + - e[i * bsize_w + j - 1] + e[i * bsize_w + j + 1]; - } + } + int mid = OD_DIST_LP_MID; + for (i = 0; i < bsize_h; i++) { + tmp[i * bsize_w] = mid * e[i * bsize_w] + 2 * e[i * bsize_w + 1]; + tmp[i * bsize_w + bsize_w - 1] = + mid * e[i * bsize_w + bsize_w - 1] + 2 * e[i * bsize_w + bsize_w - 2]; + for (j = 1; j < bsize_w - 1; j++) { + tmp[i * bsize_w + j] = mid * e[i * bsize_w + j] + e[i * bsize_w + j - 1] + + e[i * bsize_w + j + 1]; } - sum = od_compute_dist_common(activity_masking, x, y, bsize_w, bsize_h, - qindex, tmp, e_lp); } - return sum; + return od_compute_dist_common(activity_masking, x, y, bsize_w, bsize_h, + qindex, tmp, e_lp); } static double od_compute_dist_diff(uint16_t *x, int16_t *e, int bsize_w, int bsize_h, int qindex) { - int i; - double sum = 0; - assert(bsize_w >= 8 && bsize_h >= 8); - #if CONFIG_PVQ int activity_masking = 1; #else int activity_masking = 0; #endif - { - int j; - DECLARE_ALIGNED(16, uint16_t, y[MAX_TX_SQUARE]); - DECLARE_ALIGNED(16, od_coeff, tmp[MAX_TX_SQUARE]); - DECLARE_ALIGNED(16, od_coeff, e_lp[MAX_TX_SQUARE]); - int mid = OD_DIST_LP_MID; - for (i = 0; i < bsize_h; i++) { - for (j = 0; j < bsize_w; j++) { - y[i * bsize_w + j] = x[i * bsize_w + j] - e[i * bsize_w + j]; - } + DECLARE_ALIGNED(16, uint16_t, y[MAX_TX_SQUARE]); + DECLARE_ALIGNED(16, od_coeff, tmp[MAX_TX_SQUARE]); + DECLARE_ALIGNED(16, od_coeff, e_lp[MAX_TX_SQUARE]); + int i, j; + for (i = 0; i < bsize_h; i++) { + for (j = 0; j < bsize_w; j++) { + y[i * bsize_w + j] = x[i * bsize_w + j] - e[i * bsize_w + j]; } - for (i = 0; i < bsize_h; i++) { - tmp[i * bsize_w] = mid * e[i * bsize_w] + 2 * e[i * bsize_w + 1]; - tmp[i * bsize_w + bsize_w - 1] = - mid * e[i * bsize_w + bsize_w - 1] + 2 * e[i * bsize_w + bsize_w - 2]; - for (j = 1; j < bsize_w - 1; j++) { - tmp[i * bsize_w + j] = mid * e[i * bsize_w + j] + - e[i * bsize_w + j - 1] + e[i * bsize_w + j + 1]; - } + } + int mid = OD_DIST_LP_MID; + for (i = 0; i < bsize_h; i++) { + tmp[i * bsize_w] = mid * e[i * bsize_w] + 2 * e[i * bsize_w + 1]; + tmp[i * bsize_w + bsize_w - 1] = + mid * e[i * bsize_w + bsize_w - 1] + 2 * e[i * bsize_w + bsize_w - 2]; + for (j = 1; j < bsize_w - 1; j++) { + tmp[i * bsize_w + j] = mid * e[i * bsize_w + j] + e[i * bsize_w + j - 1] + + e[i * bsize_w + j + 1]; } - sum = od_compute_dist_common(activity_masking, x, y, bsize_w, bsize_h, - qindex, tmp, e_lp); } - return sum; + return od_compute_dist_common(activity_masking, x, y, bsize_w, bsize_h, + qindex, tmp, e_lp); } int64_t av1_dist_8x8(const AV1_COMP *const cpi, const MACROBLOCK *x, -- GitLab