X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fcodecs%2Fh263%2Fcode.rs;h=fa02e4e590082037af6948bf7921d960baa1aac7;hb=e243ceb4d694cc08767ad70027bb6963f4cefea3;hp=dd1279ee555c0e31af3a50f827b70fe9fd488e01;hpb=5641dccfbf2a70d589cf094a0d4ed5a10f919f00;p=nihav.git diff --git a/nihav-core/src/codecs/h263/code.rs b/nihav-core/src/codecs/h263/code.rs index dd1279e..fa02e4e 100644 --- a/nihav-core/src/codecs/h263/code.rs +++ b/nihav-core/src/codecs/h263/code.rs @@ -121,15 +121,16 @@ const W8: i32 = 181; const ROW_SHIFT: u8 = 8; const COL_SHIFT: u8 = 14; +#[allow(clippy::erasing_op)] fn idct_row(row: &mut [i16]) { - let in0 = ((row[0] as i32) << 11) + (1 << (ROW_SHIFT - 1)); - let in1 = (row[4] as i32) << 11; - let in2 = row[6] as i32; - let in3 = row[2] as i32; - let in4 = row[1] as i32; - let in5 = row[7] as i32; - let in6 = row[5] as i32; - let in7 = row[3] as i32; + let in0 = ((i32::from(row[0])) << 11) + (1 << (ROW_SHIFT - 1)); + let in1 = (i32::from(row[4])) << 11; + let in2 = i32::from(row[6]); + let in3 = i32::from(row[2]); + let in4 = i32::from(row[1]); + let in5 = i32::from(row[7]); + let in6 = i32::from(row[5]); + let in7 = i32::from(row[3]); let tmp = W7 * (in4 + in5); let a4 = tmp + (W1 - W7) * in4; @@ -167,15 +168,16 @@ fn idct_row(row: &mut [i16]) { row[4] = ((b5 - b6) >> ROW_SHIFT) as i16; } +#[allow(clippy::erasing_op)] fn idct_col(blk: &mut [i16; 64], off: usize) { - let in0 = ((blk[off + 0*8] as i32) << 8) + (1 << (COL_SHIFT - 1)); - let in1 = (blk[off + 4*8] as i32) << 8; - let in2 = blk[off + 6*8] as i32; - let in3 = blk[off + 2*8] as i32; - let in4 = blk[off + 1*8] as i32; - let in5 = blk[off + 7*8] as i32; - let in6 = blk[off + 5*8] as i32; - let in7 = blk[off + 3*8] as i32; + let in0 = ((i32::from(blk[off + 0*8])) << 8) + (1 << (COL_SHIFT - 1)); + let in1 = (i32::from(blk[off + 4*8])) << 8; + let in2 = i32::from(blk[off + 6*8]); + let in3 = i32::from(blk[off + 2*8]); + let in4 = i32::from(blk[off + 1*8]); + let in5 = i32::from(blk[off + 7*8]); + let in6 = i32::from(blk[off + 5*8]); + let in7 = i32::from(blk[off + 3*8]); let tmp = W7 * (in4 + in5); let a4 = (tmp + (W1 - W7) * in4) >> 3; @@ -345,9 +347,10 @@ impl H263BlockDSP { } } +#[allow(clippy::erasing_op)] fn deblock_hor(buf: &mut NAVideoBuffer, comp: usize, q: u8, off: usize) { let stride = buf.get_stride(comp); - let mut dptr = buf.get_data_mut(); + let dptr = buf.get_data_mut().unwrap(); let buf = dptr.as_mut_slice(); for x in 0..8 { let a = buf[off - 2 * stride + x] as i16; @@ -377,7 +380,7 @@ fn deblock_hor(buf: &mut NAVideoBuffer, comp: usize, q: u8, off: usize) { fn deblock_ver(buf: &mut NAVideoBuffer, comp: usize, q: u8, off: usize) { let stride = buf.get_stride(comp); - let mut dptr = buf.get_data_mut(); + let dptr = buf.get_data_mut().unwrap(); let buf = dptr.as_mut_slice(); for y in 0..8 { let a = buf[off - 2 + y * stride] as i16;