pub const H263_SCALES: &[u8] = &[
0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15 ];
+#[allow(dead_code)]
+pub const H263_DC_SCALES: &[u8] = &[
+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62 ];
+
pub const H263_ZIGZAG: &[usize] = &[
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
level = code.get_level();
last = code.is_last();
if br.read_bool().unwrap() { level = -level; }
- level = (level * q) + q_add;
+ if (idx != 0) || !sstate.is_iframe {
+ level = (level * q) + q_add;
+ } else {
+ level = level * (H263_DC_SCALES[quant as usize] as i16);
+ }
} else {
last = br.read_bool().unwrap();
run = br.read(6).unwrap() as u8;
let top = br.read_s(6).unwrap() as i16;
level = (top << 5) | low;
}
- level = (level * q) + q_add;
+ if (idx != 0) || !sstate.is_iframe {
+ level = (level * q) + q_add;
+ } else {
+ level = level * (H263_DC_SCALES[quant as usize] as i16);
+ }
if level < -2048 { level = -2048; }
if level > 2047 { level = 2047; }
}
use test::dec_video::test_file_decoding;
#[test]
fn test_rv20() {
- test_file_decoding("realmedia", "assets/RV/rv20_cook_640x352_realproducer_plus_8.51.rm", /*None*/Some(1000), true, false, Some("rv20"));
+ test_file_decoding("realmedia", "assets/RV/rv20_cook_640x352_realproducer_plus_8.51.rm", /*None*/Some(1000), true, false, Some("rv20"));
}
}