aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2023-09-27 15:39:00 +0200
committerNiklas Haas <git@haasn.dev>2023-09-28 17:11:23 +0200
commit616e9d24137d34fba02ebd159d5a7186aaf53eca (patch)
tree539601a33dc6b1b48c8244516ddbd37c13a958e3 /libavcodec
parent338a5fcdbe9571e6f22817a111621259d83f2e59 (diff)
downloadffmpeg-616e9d24137d34fba02ebd159d5a7186aaf53eca.tar.gz
lavc/h274: correct grain DB indices
The spec specified indices in the order [x][y], but our code follows the traditional C convention of [y][x]. This was not correctly account for when calculating the base index of the grain database access.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h274.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/h274.c b/libavcodec/h274.c
index fc111cdb50..2388826d54 100644
--- a/libavcodec/h274.c
+++ b/libavcodec/h274.c
@@ -259,11 +259,11 @@ int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame,
// only advanced in 16x16 blocks, so use a nested loop
for (int y = 0; y < height; y += 16) {
for (int x = 0; x < width; x += 16) {
- uint16_t y_offset = (seed >> 16) % 52;
- uint16_t x_offset = (seed & 0xFFFF) % 56;
+ uint16_t x_offset = (seed >> 16) % 52;
+ uint16_t y_offset = (seed & 0xFFFF) % 56;
const int invert = (seed & 0x1);
- y_offset &= 0xFFFC;
- x_offset &= 0xFFF8;
+ x_offset &= 0xFFFC;
+ y_offset &= 0xFFF8;
prng_shift(&seed);
for (int yy = 0; yy < 16 && y+yy < height; yy += 8) {