Skip to content
Snippets Groups Projects
Unverified Commit c245abdd authored by Tristan Matthews's avatar Tristan Matthews Committed by GitHub
Browse files

header: write CDEF strengths in order (#1402)

This avoids a desync when e.g., CDEF bits == 2
parent 7f7209e9
No related branches found
No related tags found
No related merge requests found
......@@ -851,11 +851,10 @@ impl<W: io::Write> UncompressedHeader for BitWriter<W, BigEndian> {
assert!(fi.cdef_bits < 4);
self.write(2, fi.cdef_bits)?; // cdef bits
for i in 0..(1 << fi.cdef_bits) {
let j = i << (3 - fi.cdef_bits);
assert!(fi.cdef_y_strengths[j] < 64);
assert!(fi.cdef_uv_strengths[j] < 64);
self.write(6, fi.cdef_y_strengths[j])?; // cdef y strength
self.write(6, fi.cdef_uv_strengths[j])?; // cdef uv strength
assert!(fi.cdef_y_strengths[i] < 64);
assert!(fi.cdef_uv_strengths[i] < 64);
self.write(6, fi.cdef_y_strengths[i])?; // cdef y strength
self.write(6, fi.cdef_uv_strengths[i])?; // cdef uv strength
}
}
Ok(())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment