Round the fast coeff result instead of flooring

This commit is contained in:
Pauli Oikkonen 2020-02-20 15:12:28 +02:00
parent 0fb09c9920
commit 4712ce5f59
3 changed files with 3 additions and 3 deletions

View file

@ -850,7 +850,7 @@ static uint32_t fast_coeff_cost_avx2(const coeff_t *coeff, int32_t width, int32_
__m256i sum4 = _mm256_add_epi64 (sum2, sum3);
__m128i sum128 = _mm256_castsi256_si128 (sum4);
return _mm_cvtsi128_si32(sum128) >> 8;
return (_mm_cvtsi128_si32(sum128) + (1 << 7)) >> 8;
}
#endif //COMPILE_INTEL_AVX2 && defined X86_64

View file

@ -359,7 +359,7 @@ static uint32_t fast_coeff_cost_generic(const coeff_t *coeff, int32_t width, int
}
sum += weights[curr_abs];
}
return sum >> 8;
return (sum + (1 << 7)) >> 8;
}
int kvz_strategy_register_quant_generic(void* opaque, uint8_t bitdepth)

View file

@ -47,7 +47,7 @@
)
// Weights for 4 buckets (coeff 0, coeff 1, coeff 2, coeff >= 3), for QPs from
// 0 to 50 with ultrafast encoding
// MIN_FAST_COEFF_COST_QP to MAX_FAST_COEFF_COST_QP with ultrafast encoding
static const uint64_t fast_coeff_cost_wts[FAST_COEFF_QP_COUNT] = {
TO_4XQ88(0.134012, 4.207784, 3.431633, 6.556149),
TO_4XQ88(0.122972, 4.278606, 3.398710, 6.527168),