From f7686373872ed8a9378dbde734d6f6220ed64aef Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 13 Oct 2022 18:21:33 +0200 Subject: [PATCH] prepare for implementing scalable Indeo 5 --- nihav-indeo/src/codecs/indeo4.rs | 2 +- nihav-indeo/src/codecs/indeo5.rs | 10 +++++++--- nihav-indeo/src/codecs/ivibr.rs | 6 +++++- nihav-indeo/src/codecs/mod.rs | 2 ++ nihav-indeo/src/demuxers/ivf.rs | 2 +- nihav-registry/src/register.rs | 1 + 6 files changed, 17 insertions(+), 6 deletions(-) diff --git a/nihav-indeo/src/codecs/indeo4.rs b/nihav-indeo/src/codecs/indeo4.rs index 526668b..cc73702 100644 --- a/nihav-indeo/src/codecs/indeo4.rs +++ b/nihav-indeo/src/codecs/indeo4.rs @@ -422,7 +422,7 @@ impl Indeo4Decoder { fn new() -> Self { Indeo4Decoder { info: NACodecInfo::new_dummy(), - dec: IVIDecoder::new(), + dec: IVIDecoder::new(false), } } } diff --git a/nihav-indeo/src/codecs/indeo5.rs b/nihav-indeo/src/codecs/indeo5.rs index 0115b2a..ec23981 100644 --- a/nihav-indeo/src/codecs/indeo5.rs +++ b/nihav-indeo/src/codecs/indeo5.rs @@ -499,10 +499,10 @@ struct Indeo5Decoder { } impl Indeo5Decoder { - fn new() -> Self { + fn new(scalable: bool) -> Self { Indeo5Decoder { info: NACodecInfo::new_dummy(), - dec: IVIDecoder::new(), + dec: IVIDecoder::new(scalable), ip: Indeo5Parser::new(), } } @@ -723,7 +723,11 @@ const INDEO5_QSCALE4_INTER: [u8; 24] = [ ]; pub fn get_decoder() -> Box { - Box::new(Indeo5Decoder::new()) + Box::new(Indeo5Decoder::new(false)) +} + +pub fn get_decoder_scalable() -> Box { + Box::new(Indeo5Decoder::new(true)) } #[cfg(test)] diff --git a/nihav-indeo/src/codecs/ivibr.rs b/nihav-indeo/src/codecs/ivibr.rs index 9165d01..5831f80 100644 --- a/nihav-indeo/src/codecs/ivibr.rs +++ b/nihav-indeo/src/codecs/ivibr.rs @@ -488,10 +488,12 @@ pub struct IVIDecoder { tiles: Vec, num_tiles: [[usize; 4]; 4], tile_start: [[usize; 4]; 4], + + scalable: bool, } impl IVIDecoder { - pub fn new() -> Self { + pub fn new(scalable: bool) -> Self { let mut bands: Vec = Vec::with_capacity(12); bands.resize(12, BandHeader::new_empty(42, 42)); IVIDecoder { @@ -506,6 +508,8 @@ impl IVIDecoder { bands, band_tiles: 0, tiles: Vec::new(), tile_start: [[0; 4]; 4], num_tiles: [[0; 4]; 4], + + scalable, } } diff --git a/nihav-indeo/src/codecs/mod.rs b/nihav-indeo/src/codecs/mod.rs index a5a8ec3..2352bf9 100644 --- a/nihav-indeo/src/codecs/mod.rs +++ b/nihav-indeo/src/codecs/mod.rs @@ -37,6 +37,8 @@ const INDEO_CODECS: &[DecoderInfo] = &[ DecoderInfo { name: "indeo4", get_decoder: indeo4::get_decoder }, #[cfg(feature="decoder_indeo5")] DecoderInfo { name: "indeo5", get_decoder: indeo5::get_decoder }, +#[cfg(feature="decoder_indeo5")] + DecoderInfo { name: "indeo5s", get_decoder: indeo5::get_decoder_scalable }, #[cfg(feature="decoder_intel263")] DecoderInfo { name: "intel263", get_decoder: intel263::get_decoder }, diff --git a/nihav-indeo/src/demuxers/ivf.rs b/nihav-indeo/src/demuxers/ivf.rs index 952e526..6ea4623 100644 --- a/nihav-indeo/src/demuxers/ivf.rs +++ b/nihav-indeo/src/demuxers/ivf.rs @@ -90,7 +90,7 @@ impl<'a> DemuxCore<'a> for IVFDemuxer<'a> { let cname = match &fcc { b"IV31" | b"IV32" => "indeo3", b"IV41" => "indeo4", - b"IV50" => "indeo5", + b"IV50" => "indeo5s", _ => "unknown", }; let edata = if vhdr_size > 40 { diff --git a/nihav-registry/src/register.rs b/nihav-registry/src/register.rs index 222d921..3a37892 100644 --- a/nihav-registry/src/register.rs +++ b/nihav-registry/src/register.rs @@ -165,6 +165,7 @@ static CODEC_REGISTER: &[CodecDescription] = &[ desc!(video; "indeo3", "Intel Indeo 3"), desc!(video; "indeo4", "Intel Indeo 4", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE), desc!(video; "indeo5", "Intel Indeo 5", CODEC_CAP_REORDER | CODEC_CAP_SCALABLE), + desc!(video; "indeo5s", "Intel Indeo 5 Scalable", CODEC_CAP_SCALABLE), desc!(video; "intel263", "Intel I263", CODEC_CAP_REORDER), desc!(audio; "iac", "Intel Indeo audio"), desc!(audio; "imc", "Intel Music Coder"), -- 2.39.5