diff options
author | Niklas Haas <git@haasn.dev> | 2024-05-25 18:05:04 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2024-06-14 13:43:55 +0200 |
commit | 6225ad5c19751ed55555ac9ffb738c2e4acc1f92 (patch) | |
tree | e9726534ef4af034daf407c95e50259e3582662a /libavutil/common.h | |
parent | 08383443ff695816297f94775ab793159ff38422 (diff) | |
download | ffmpeg-6225ad5c19751ed55555ac9ffb738c2e4acc1f92.tar.gz |
avcodec/dovi_rpu{enc,dec}: fix ms_weight handling
The code as written was wrong. In the spec, these fields are treated
merely as plain integers in the range 0 to 4095. The only difference
between L2 and L8 is that L2.ms_weight also accepts an additional value
of -1, hence the extra sign bit. While it's likely that these are still
shifted integers in disguise, since all real-world samples seem to use
a value of 2048 here, the offset used in the code was wrong.
In addition, because the l8.ms_weight struct member is unsigned, these
wrong shifting semantics ended up overflowing the field, leading to
undefined behavior when transcoding. Fortunately, the damage was
relatively contained in practice, because it just corrupts the coding of
this field, which is ignored in practice in all implementations I have
seen.
Diffstat (limited to 'libavutil/common.h')
0 files changed, 0 insertions, 0 deletions