From c4a5ef1ced7c318fb1bcb361f670e776b277996a Mon Sep 17 00:00:00 2001 From: Peter de Rivaz Date: Mon, 12 May 2014 11:54:09 +0100 Subject: [PATCH] Added rounding to highbitdepth subtraction This improves encoding performance for high bitrate sequences when using 10 or 12bit. Change-Id: I358d30a69251d58589c075b7d52c0d9ae76b26ee --- vp9/encoder/vp9_encodemb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 7ebf7fb0d..3494e0d25 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -61,9 +61,13 @@ void vp9_high_subtract_block_c(int rows, int cols, int shift = bps - 8; uint16_t *src = CONVERT_TO_SHORTPTR(src8); uint16_t *pred = CONVERT_TO_SHORTPTR(pred8); + int rnd = 0; + if (shift >= 1) { + rnd = 1 << (shift - 1); + } for (r = 0; r < rows; r++) { for (c = 0; c < cols; c++) { - diff[c] = ((int)src[c] - (int)pred[c]) >> shift; + diff[c] = ((int)src[c] - (int)pred[c] + rnd) >> shift; } diff += diff_stride;