#[derive(Default)]
struct Bink2Decoder {
- info: Rc<NACodecInfo>,
+ info: NACodecInfoRef,
ips: IPShuffler,
version: u32,
let (mut off_y, mut off_u, mut off_v, mut off_a) = (buf.get_offset(0), buf.get_offset(1), buf.get_offset(2), buf.get_offset(3));
let (ooff_y, ooff_u, ooff_v, ooff_a) = (off_y, off_u, off_v, off_a);
let (width, height) = buf.get_dimensions(0);
- let mut data = buf.get_data_mut();
+ let data = buf.get_data_mut().unwrap();
let dst = data.as_mut_slice();
let bw = (width + 31) >> 5;
let bheight = (height + 31) >> 5;
let dcs = &dcinfo.dcs;
for i in 0..4 {
decode_acs_4blocks(br, codes, &mut dst[i], BINK2_QUANT_INTER, q, cbp >> (i * 4))?;
- for j in 0..4 { dst[i][j][0] = dcs[i * 4 + j]; }
+ for j in 0..4 { dst[i][j][0] = dcs[i * 4 + j] * 8; }
}
Ok(cbp)
}
dcinfo.predict_inter(min_dc, max_dc);
let dcs = &dcinfo.dcs;
decode_acs_4blocks(br, codes, dst, BINK2_QUANT_INTER, q, cbp)?;
- for i in 0..4 { dst[i][0] = dcs[i]; }
+ for i in 0..4 { dst[i][0] = dcs[i] * 8; }
Ok(cbp)
}
level = -level;
}
let pos = scan[idx];
- dst[blk_no][pos] = (level as f32) * quant_mat[idx] * quant;
+ dst[blk_no][pos] = (level as f32) * quant_mat[(pos & 7) * 8 + (pos >> 3)] * quant;
}
idx += 1;
if idx >= 64 { break; }
const KB2H_NUM_SLICES: [usize; 4] = [ 2, 3, 4, 8 ];
impl NADecoder for Bink2Decoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
let w = vinfo.get_width();
let h = vinfo.get_height();
if self.has_alpha { FORMATON_FLAG_ALPHA } else { 0 },
if self.has_alpha { 4 } else { 3 });
let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, false, fmt));
- self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()));
+ self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
Ok(())
} else {