diff options
author | Niklas Haas <git@haasn.dev> | 2023-09-27 15:16:51 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2023-09-28 17:11:23 +0200 |
commit | 338a5fcdbe9571e6f22817a111621259d83f2e59 (patch) | |
tree | dccdb78f2f553c3dc30d69c03e82988e3e9c42fa /libavcodec | |
parent | 7a24d794f64050212b320072ab663bc4e2f1d101 (diff) | |
download | ffmpeg-338a5fcdbe9571e6f22817a111621259d83f2e59.tar.gz |
lavc/h274: fix PRNG definition
The spec specifies x^31 + x^3 + 1 as the polynomial, but the diagram in
Figure 1-1 omits the +1 offset. The initial implementation was based on
the diagram, but this is wrong (produces subtly incorrect results).
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h274.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h274.c b/libavcodec/h274.c index a69f941142..fc111cdb50 100644 --- a/libavcodec/h274.c +++ b/libavcodec/h274.c @@ -38,7 +38,7 @@ static void prng_shift(uint32_t *state) { // Primitive polynomial x^31 + x^3 + 1 (modulo 2) uint32_t x = *state; - uint8_t feedback = (x >> 2) ^ (x >> 30); + uint8_t feedback = 1u ^ (x >> 2) ^ (x >> 30); *state = (x << 1) | (feedback & 1u); } |