From: Kostya Shishkov Date: Mon, 27 Nov 2017 16:52:12 +0000 (+0100) Subject: h263: make is_gob a part of init X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=42a593529b69f5b4cac9e2e7fd8b4863c57e3caf;p=nihav.git h263: make is_gob a part of init --- diff --git a/src/codecs/h263/decoder.rs b/src/codecs/h263/decoder.rs index db200e7..15e18fc 100644 --- a/src/codecs/h263/decoder.rs +++ b/src/codecs/h263/decoder.rs @@ -129,6 +129,7 @@ pub struct H263BaseDecoder { has_b: bool, b_data: Vec, pred_coeffs: Vec, + is_gob: bool, } #[inline] @@ -147,7 +148,7 @@ fn clip_ac(ac: i16) -> i16 { #[allow(dead_code)] impl H263BaseDecoder { - pub fn new() -> Self { + pub fn new(is_gob: bool) -> Self { H263BaseDecoder{ w: 0, h: 0, mb_w: 0, mb_h: 0, num_mb: 0, ftype: Type::Special, @@ -155,6 +156,7 @@ impl H263BaseDecoder { last_ts: 0, has_b: false, b_data: Vec::new(), pred_coeffs: Vec::new(), + is_gob: is_gob, } } @@ -191,7 +193,7 @@ impl H263BaseDecoder { let mut bufinfo = bufret.unwrap(); let mut buf = bufinfo.get_vbuf().unwrap(); - let mut slice = if bd.is_gob() { + let mut slice = if self.is_gob { SliceInfo::get_default_slice(&pinfo) } else { bd.decode_slice_header(&pinfo)? diff --git a/src/codecs/h263/intel263.rs b/src/codecs/h263/intel263.rs index 55e49a9..9bef52d 100644 --- a/src/codecs/h263/intel263.rs +++ b/src/codecs/h263/intel263.rs @@ -316,8 +316,6 @@ impl<'a> BlockDecoder for Intel263BR<'a> { } fn is_slice_end(&mut self) -> bool { self.br.peek(16) == 0 } - - fn is_gob(&mut self) -> bool { true } } impl Intel263Decoder { @@ -345,7 +343,7 @@ impl Intel263Decoder { Intel263Decoder{ info: Rc::new(DUMMY_CODEC_INFO), - dec: H263BaseDecoder::new(), + dec: H263BaseDecoder::new(true), tables: tables, bdsp: H263BlockDSP::new(), } diff --git a/src/codecs/h263/mod.rs b/src/codecs/h263/mod.rs index 28eb44f..c5d63fc 100644 --- a/src/codecs/h263/mod.rs +++ b/src/codecs/h263/mod.rs @@ -21,7 +21,6 @@ pub trait BlockDecoder { fn decode_block_intra(&mut self, info: &BlockInfo, sstate: &SliceState, quant: u8, no: usize, coded: bool, blk: &mut [i16; 64]) -> DecoderResult<()>; fn decode_block_inter(&mut self, info: &BlockInfo, sstate: &SliceState, quant: u8, no: usize, coded: bool, blk: &mut [i16; 64]) -> DecoderResult<()>; fn is_slice_end(&mut self) -> bool; - fn is_gob(&mut self) -> bool; } pub trait BlockDSP { diff --git a/src/codecs/h263/rv10.rs b/src/codecs/h263/rv10.rs index 4b00bf6..0093f87 100644 --- a/src/codecs/h263/rv10.rs +++ b/src/codecs/h263/rv10.rs @@ -315,8 +315,6 @@ println!(" MB {}.{} cbp = {:X}", sstate.mb_x, sstate.mb_y, cbp); } fn is_slice_end(&mut self) -> bool { false } - - fn is_gob(&mut self) -> bool { false } } impl<'a> RealVideo10BR<'a> { @@ -399,7 +397,7 @@ impl RealVideo10Decoder { RealVideo10Decoder{ info: Rc::new(DUMMY_CODEC_INFO), - dec: H263BaseDecoder::new(), + dec: H263BaseDecoder::new(false), tables: tables, w: 0, h: 0, @@ -465,7 +463,7 @@ mod test { use test::dec_video::test_file_decoding; #[test] fn test_rv10() { - test_file_decoding("realmedia", "assets/RV/rv10_dnet_640x352_realvideo_encoder_4.0.rm", Some(1000), true, false, Some("rv10")); + test_file_decoding("realmedia", "assets/RV/rv10_dnet_640x352_realvideo_encoder_4.0.rm", Some(1000), true, false, None/*Some("rv10")*/); } } diff --git a/src/codecs/h263/rv20.rs b/src/codecs/h263/rv20.rs index 252c9b9..adcf503 100644 --- a/src/codecs/h263/rv20.rs +++ b/src/codecs/h263/rv20.rs @@ -321,8 +321,6 @@ println!(" MB {}.{} cbp = {:X}", sstate.mb_x, sstate.mb_y, cbp); } fn is_slice_end(&mut self) -> bool { false } - - fn is_gob(&mut self) -> bool { false } } impl<'a> RealVideo20BR<'a> { @@ -411,7 +409,7 @@ impl RealVideo20Decoder { RealVideo20Decoder{ info: Rc::new(DUMMY_CODEC_INFO), - dec: H263BaseDecoder::new(), + dec: H263BaseDecoder::new(false), tables: tables, w: 0, h: 0,