History

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.

Niklas Haas committed 3 years ago

Commit 616e9d21 parent 338a5fc1 file · +4 −4Browse files

Unified · Split

libavcodec/h274.c+4−4
@@ -259,11 +259,11 @@ int ff_h274_apply_film_grain(AVFrame *out_frame, const AVFrame *in_frame, · 258 unmodified lines
259259 // only advanced in 16x16 blocks, so use a nested loop
260260 for (int y = 0; y < height; y += 16) {
261261 for (int x = 0; x < width; x += 16) {
262− uint16_t y_offset = (seed >> 16) % 52;
263− uint16_t x_offset = (seed & 0xFFFF) % 56;
262+ uint16_t x_offset = (seed >> 16) % 52;
263+ uint16_t y_offset = (seed & 0xFFFF) % 56;
264264 const int invert = (seed & 0x1);
265− y_offset &= 0xFFFC;
266− x_offset &= 0xFFF8;
265+ x_offset &= 0xFFFC;
266+ y_offset &= 0xFFF8;
267267 prng_shift(&seed);
268268
269269 for (int yy = 0; yy < 16 && y+yy < height; yy += 8) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t