ref: 91b0af2fa2572dfbb22700183c70eefa61136c33
parent: 1ffbeda00def479c554b46ad5f2fd29480d56906
author: Ronald S. Bultje <[email protected]>
date: Fri Aug 30 03:38:05 EDT 2019
Apply high-bitdepth adjustment of pixel index after delta calculation Fixes libaom/dav1d mismatch in av1-1-b10-23-film_grain-50.ivf.
--- a/src/film_grain_tmpl.c
+++ b/src/film_grain_tmpl.c
@@ -180,16 +180,16 @@
// Linearly interpolate the values in the middle
for (int i = 0; i < num - 1; i++) {
- const int bx = points[i][0] << shift_x;
+ const int bx = points[i][0];
const int by = points[i][1];
- const int ex = points[i+1][0] << shift_x;
+ const int ex = points[i+1][0];
const int ey = points[i+1][1];
const int dx = ex - bx;
const int dy = ey - by;
const int delta = dy * ((0x10000 + (dx >> 1)) / dx);
- for (int x = 0; x < dx; x += pad) {
+ for (int x = 0; x < dx; x++) {
const int v = by + ((x * delta + 0x8000) >> 16);
- scaling[bx + x] = v;
+ scaling[(bx + x) << shift_x] = v;
}
}