forge
Explore
Log in

Don't you dare go Hollow

S12: dnxhd 2-byte samples via as_chunks; crate clippy allow list dropped (clippy -D warnings clean)

Browse files at this commit

9eb8b571078937732d5061b017dbebbab0ab2d3fAhmet Kaan GümüşParent: 2363871
crates/ec-dnxhd/src/decoder.rsmodified+2 -2
@@ -575,7 +575,7 @@ pub(crate) fn to_picture(c: Canvas) -> Picture {
575575 if c.bps == 1 {
576576 out.extend(row.iter().map(|&v| u16::from(v)));
577577 } else {
578- out.extend(row.chunks_exact(2).map(|b| u16::from_le_bytes([b[0], b[1]])));
578+ out.extend(row.as_chunks::<2>().0.iter().map(|b| u16::from_le_bytes(*b)));
579579 }
580580 }
581581 out
@@ -596,7 +596,7 @@ pub(crate) fn to_video_frame(mut c: Canvas) -> Result<VideoFrame> {
596596 };
597597 if info.bit_depth == 12 {
598598 for p in &mut c.planes {
599- for b in p.chunks_exact_mut(2) {
599+ for b in p.as_chunks_mut::<2>().0 {
600600 let v = (u32::from(u16::from_le_bytes([b[0], b[1]])) + 2) >> 2;
601601 b.copy_from_slice(&(v.min(1023) as u16).to_le_bytes());
602602 }
crates/ec-dnxhd/src/idct.rsmodified+1 -1
@@ -155,7 +155,7 @@ pub(crate) fn idct_put<const BD: u32>(blk: &mut Block, dst: &mut [u8], stride: u
155155 }
156156 } else {
157157 for (row, o) in dst.chunks_mut(stride).zip(out.iter()) {
158- for (d, &v) in row[..16].chunks_exact_mut(2).zip(o) {
158+ for (d, &v) in row[..16].as_chunks_mut::<2>().0.iter_mut().zip(o) {
159159 d.copy_from_slice(&v.to_le_bytes());
160160 }
161161 }
crates/ec-dnxhd/src/lib.rsmodified+0 -1
@@ -12,7 +12,6 @@
1212 //! ec-core has no 12-bit pixel formats, so [`DnxhdDecoder::decode`] narrows
1313 //! 12-bit pictures to 10 bits (`(v + 2) >> 2`, clamped); [`DnxhdDecoder::decode_native`]
1414 //! returns the samples at their coded depth.
15-#![allow(clippy::chunks_exact_to_as_chunks, clippy::needless_range_loop)]
1615 #![forbid(unsafe_code)]
1716 mod bits;
1817 mod codec;