ref: 1e9c428ae4e3a8a280ca448d32e1989ec37d2f08
parent: 62dd32c47481b46ad9128003c17a682b4482640b
author: Janne Grunau <janne-vlc@jannau.net>
date: Mon Dec 3 17:50:48 EST 2018
film_grain: limit overlapped pixels to block boundaries Fixes #210.
--- a/src/film_grain_tmpl.c
+++ b/src/film_grain_tmpl.c
@@ -255,8 +255,8 @@
offsets[0][i] = get_random_number(8, &seed[i]);
// x/y block offsets to compensate for overlapped regions
- const int ystart = data->overlap_flag && row_num ? 2 : 0;
- const int xstart = data->overlap_flag && bx ? 2 : 0;
+ const int ystart = data->overlap_flag && row_num ? imin(2, bh) : 0;
+ const int xstart = data->overlap_flag && bx ? imin(2, bw) : 0;
static const int w[2][2] = { { 27, 17 }, { 17, 27 } };
@@ -373,8 +373,8 @@
offsets[0][i] = get_random_number(8, &seed[i]);
// x/y block offsets to compensate for overlapped regions
- const int ystart = data->overlap_flag && row_num ? (2 >> sy) : 0;
- const int xstart = data->overlap_flag && bx ? (2 >> sx) : 0;
+ const int ystart = data->overlap_flag && row_num ? imin(2 >> sy, bh) : 0;
+ const int xstart = data->overlap_flag && bx ? imin(2 >> sx, bw) : 0;
static const int w[2 /* sub */][2 /* off */][2] = {
{ { 27, 17 }, { 17, 27 } },