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;
- let b = buf[off - 1 * stride + x] as i16;
- let c = buf[off + 0 * stride + x] as i16;
- let d = buf[off + 1 * stride + x] as i16;
+ let a = i16::from(buf[off - 2 * stride + x]);
+ let b = i16::from(buf[off - 1 * stride + x]);
+ let c = i16::from(buf[off + 0 * stride + x]);
+ let d = i16::from(buf[off + 1 * stride + x]);
let diff = (3 * (a - d) + 8 * (c - b)) / 16;
if (diff != 0) && (diff > -24) && (diff < 24) {
- let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0);
+ let d1a = (diff.abs() - 2 * (diff.abs() - i16::from(strength)).max(0)).max(0);
let d1 = if diff < 0 { -d1a } else { d1a };
buf[off - 1 * stride + x] = (b + d1).max(0).min(255) as u8;
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;
- let b = buf[off - 1 + y * stride] as i16;
- let c = buf[off + 0 + y * stride] as i16;
- let d = buf[off + 1 + y * stride] as i16;
+ let a = i16::from(buf[off - 2 + y * stride]);
+ let b = i16::from(buf[off - 1 + y * stride]);
+ let c = i16::from(buf[off + 0 + y * stride]);
+ let d = i16::from(buf[off + 1 + y * stride]);
let diff = (3 * (a - d) + 8 * (c - b)) / 16;
if (diff != 0) && (diff > -24) && (diff < 24) {
- let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0);
+ let d1a = (diff.abs() - 2 * (diff.abs() - i16::from(strength)).max(0)).max(0);
let d1 = if diff < 0 { -d1a } else { d1a };
buf[off - 1 + y * stride] = (b + d1).max(0).min(255) as u8;
blockdsp::copy_block(&mut dst, src.clone(), 0, xpos, ypos, mv.x >> 1, mv.y >> 1, 16, 16, 0, 1, mode, H263_INTERP_FUNCS);
blockdsp::copy_block(&mut dst, src.clone(), 1, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_FUNCS);
- blockdsp::copy_block(&mut dst, src.clone(), 2, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_FUNCS);
+ blockdsp::copy_block(&mut dst, src, 2, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_FUNCS);
}
fn copy_blocks8x8(&self, dst: &mut NAVideoBuffer<u8>, src: NAVideoBufferRef<u8>, xpos: usize, ypos: usize, mvs: &[MV; 4]) {
let mut dst = NASimpleVideoFrame::from_video_buf(dst).unwrap();
blockdsp::copy_block(&mut dst, src.clone(), 0, xpos, ypos, mv.x >> 1, mv.y >> 1, 16, 16, 0, 1, mode, H263_INTERP_AVG_FUNCS);
blockdsp::copy_block(&mut dst, src.clone(), 1, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_AVG_FUNCS);
- blockdsp::copy_block(&mut dst, src.clone(), 2, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_AVG_FUNCS);
+ blockdsp::copy_block(&mut dst, src, 2, xpos >> 1, ypos >> 1, mv.x >> 2, mv.y >> 2, 8, 8, 0, 1, cmode, H263_INTERP_AVG_FUNCS);
}
fn avg_blocks8x8(&self, dst: &mut NAVideoBuffer<u8>, src: NAVideoBufferRef<u8>, xpos: usize, ypos: usize, mvs: &[MV; 4]) {
let mut dst = NASimpleVideoFrame::from_video_buf(dst).unwrap();
impl<'a> BlockDecoder for Intel263BR<'a> {
#[allow(unused_variables)]
+#[allow(clippy::unreadable_literal)]
fn decode_pichdr(&mut self) -> DecoderResult<PicInfo> {
let br = &mut self.br;
let syncw = br.read(22)?;
use nihav_core::codecs::RegisteredDecoders;
use nihav_core::demuxers::RegisteredDemuxers;
use nihav_codec_support::test::dec_video::*;
- use crate::indeo_register_all_codecs;
+ use crate::indeo_register_all_decoders;
use nihav_commonfmt::generic_register_all_demuxers;
#[test]
fn test_intel263() {
let mut dmx_reg = RegisteredDemuxers::new();
generic_register_all_demuxers(&mut dmx_reg);
let mut dec_reg = RegisteredDecoders::new();
- indeo_register_all_codecs(&mut dec_reg);
+ indeo_register_all_decoders(&mut dec_reg);
+ // sample: https://samples.mplayerhq.hu/A-codecs/IMC/neal73_saber.avi
test_decoding("avi", "intel263", "assets/Indeo/neal73_saber.avi", Some(16),
&dmx_reg, &dec_reg, ExpectedTestResult::MD5Frames(vec![
[0x698c4f70, 0xf727bfc1, 0x96e687e9, 0xc9e37073],