Commit 83713e70 authored by Hui Su's avatar Hui Su Committed by Gerrit Code Review
Browse files

Merge "Use standard rounding in intra filters." into nextgenv2

parents f1c283f4 fa63b551
...@@ -391,7 +391,6 @@ static void vp10_init_intra_predictors_internal(void) { ...@@ -391,7 +391,6 @@ static void vp10_init_intra_predictors_internal(void) {
#if CONFIG_EXT_INTRA #if CONFIG_EXT_INTRA
#define FILTER_INTRA_PREC_BITS 10 #define FILTER_INTRA_PREC_BITS 10
#define FILTER_INTRA_ROUND_VAL 511
static const uint8_t ext_intra_extend_modes[FILTER_INTRA_MODES] = { static const uint8_t ext_intra_extend_modes[FILTER_INTRA_MODES] = {
NEED_LEFT | NEED_ABOVE, // FILTER_DC NEED_LEFT | NEED_ABOVE, // FILTER_DC
...@@ -774,9 +773,7 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs, ...@@ -774,9 +773,7 @@ static void filter_intra_predictors_4tap(uint8_t *dst, ptrdiff_t stride, int bs,
for (c = 1; c < 2 * bs + 1 - r; ++c) { for (c = 1; c < 2 * bs + 1 - r; ++c) {
ipred = c0 * pred[r - 1][c] + c1 * pred[r][c - 1] + ipred = c0 * pred[r - 1][c] + c1 * pred[r][c - 1] +
c2 * pred[r - 1][c - 1] + c3 * pred[r - 1][c + 1]; c2 * pred[r - 1][c - 1] + c3 * pred[r - 1][c + 1];
pred[r][c] = ipred < 0 ? pred[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
-((-ipred + FILTER_INTRA_ROUND_VAL) >> FILTER_INTRA_PREC_BITS) :
((ipred + FILTER_INTRA_ROUND_VAL) >> FILTER_INTRA_PREC_BITS);
} }
for (r = 0; r < bs; ++r) { for (r = 0; r < bs; ++r) {
...@@ -1050,9 +1047,7 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride, ...@@ -1050,9 +1047,7 @@ static void highbd_filter_intra_predictors_4tap(uint16_t *dst, ptrdiff_t stride,
for (c = 1; c < 2 * bs + 1 - r; ++c) { for (c = 1; c < 2 * bs + 1 - r; ++c) {
ipred = c0 * pred[r - 1][c] + c1 * pred[r][c - 1] + ipred = c0 * pred[r - 1][c] + c1 * pred[r][c - 1] +
c2 * pred[r - 1][c - 1] + c3 * pred[r - 1][c + 1]; c2 * pred[r - 1][c - 1] + c3 * pred[r - 1][c + 1];
pred[r][c] = ipred < 0 ? pred[r][c] = ROUND_POWER_OF_TWO_SIGNED(ipred, FILTER_INTRA_PREC_BITS);
-((-ipred + FILTER_INTRA_ROUND_VAL) >> FILTER_INTRA_PREC_BITS) :
((ipred + FILTER_INTRA_ROUND_VAL) >> FILTER_INTRA_PREC_BITS);
} }
for (r = 0; r < bs; ++r) { for (r = 0; r < bs; ++r) {
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
#define ROUNDZ_POWER_OF_TWO(value, n) \ #define ROUNDZ_POWER_OF_TWO(value, n) \
((n) ? (((value) + (1 << ((n) - 1))) >> (n)) : (value)) ((n) ? (((value) + (1 << ((n) - 1))) >> (n)) : (value))
/* Shift down with rounding for signed integers, for use when n > 0 */
#define ROUND_POWER_OF_TWO_SIGNED(value, n) \
(((value) < 0) ? -ROUND_POWER_OF_TWO(-(value), (n)) \
: ROUND_POWER_OF_TWO((value), (n)))
#define ALIGN_POWER_OF_TWO(value, n) \ #define ALIGN_POWER_OF_TWO(value, n) \
(((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) (((value) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment