From: Kostya Shishkov Date: Mon, 2 Mar 2026 17:23:03 +0000 (+0100) Subject: prune duplicate definitions of RGB555_FORMAT X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=c6dba09e21d2ffa3ec9af6e19835a810da8f2870;p=nihav.git prune duplicate definitions of RGB555_FORMAT Also rename to/from BGR555_FORMAT where appropriate. --- diff --git a/nihav-acorn/src/codecs/escape.rs b/nihav-acorn/src/codecs/escape.rs index f37bca9..cf61db1 100644 --- a/nihav-acorn/src/codecs/escape.rs +++ b/nihav-acorn/src/codecs/escape.rs @@ -4,17 +4,8 @@ use nihav_core::io::bitreader::*; use nihav_codec_support::codecs::imaadpcm::*; use std::convert::TryFrom; use std::str::FromStr; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; -const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - trait ReadECode { fn read_ecode(&mut self) -> DecoderResult; } @@ -85,7 +76,7 @@ impl Escape102Decoder { impl NADecoder for Escape102Decoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); validate!((vinfo.get_width() | vinfo.get_height()) & 1 == 0); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.frame = vec![0; vinfo.get_width() * vinfo.get_height()]; @@ -384,7 +375,7 @@ impl Escape124Decoder { impl NADecoder for Escape124Decoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, BGR555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); validate!((vinfo.get_width() | vinfo.get_height()) & 7 == 0); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.frame = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-acorn/src/codecs/linepack.rs b/nihav-acorn/src/codecs/linepack.rs index feb1cd6..d1bb57c 100644 --- a/nihav-acorn/src/codecs/linepack.rs +++ b/nihav-acorn/src/codecs/linepack.rs @@ -1,7 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; #[derive(Default)] @@ -20,7 +19,7 @@ impl LinePackDecoder { impl NADecoder for LinePackDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.cur_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; self.prev_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-acorn/src/codecs/mod.rs b/nihav-acorn/src/codecs/mod.rs index 9230527..675f2ad 100644 --- a/nihav-acorn/src/codecs/mod.rs +++ b/nihav-acorn/src/codecs/mod.rs @@ -10,13 +10,7 @@ macro_rules! validate { } #[allow(dead_code)] -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; +const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton::make_rgb16_fmt(5, 5, 5, false, false); #[allow(dead_code)] mod yuvtab; diff --git a/nihav-acorn/src/codecs/movingblocks.rs b/nihav-acorn/src/codecs/movingblocks.rs index 3668640..677937e 100644 --- a/nihav-acorn/src/codecs/movingblocks.rs +++ b/nihav-acorn/src/codecs/movingblocks.rs @@ -1,7 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::bitreader::*; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; fn get_mv(br: &mut BitReader, is_4x4: bool) -> DecoderResult<((i8, i8), bool)> { @@ -42,7 +41,7 @@ impl MBDecoder { impl NADecoder for MBDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.cur_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; self.prev_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-acorn/src/codecs/movingblockshq.rs b/nihav-acorn/src/codecs/movingblockshq.rs index 1784809..416516e 100644 --- a/nihav-acorn/src/codecs/movingblockshq.rs +++ b/nihav-acorn/src/codecs/movingblockshq.rs @@ -2,7 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::bitreader::*; use nihav_core::io::codebook::*; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; struct DeltaCodebook { @@ -57,7 +56,7 @@ impl MBDecoder { impl NADecoder for MBDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.cur_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; self.prev_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-acorn/src/codecs/movinglines.rs b/nihav-acorn/src/codecs/movinglines.rs index fb9696b..4ea9065 100644 --- a/nihav-acorn/src/codecs/movinglines.rs +++ b/nihav-acorn/src/codecs/movinglines.rs @@ -1,7 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; const END_CODE: u16 = 0x7300; @@ -22,7 +21,7 @@ impl MLDecoder { impl NADecoder for MLDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.cur_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; self.prev_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-acorn/src/codecs/rawvideo.rs b/nihav-acorn/src/codecs/rawvideo.rs index 71f9f74..8f45a66 100644 --- a/nihav-acorn/src/codecs/rawvideo.rs +++ b/nihav-acorn/src/codecs/rawvideo.rs @@ -2,7 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; use nihav_core::io::bitreader::*; -use super::RGB555_FORMAT; use super::yuvtab::YUV2RGB; const YUV422_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel:: @@ -72,7 +71,7 @@ impl NADecoder for RawDecoder { } let fmt = match self.codec_id { - 2 => RGB555_FORMAT, + 2 => super::BGR555_FORMAT, 3 if self.is_yuv => { validate!((self.width & 1) == 0); YUV422_FORMAT diff --git a/nihav-acorn/src/codecs/supermovingblocks.rs b/nihav-acorn/src/codecs/supermovingblocks.rs index e4fc8c3..cfc6997 100644 --- a/nihav-acorn/src/codecs/supermovingblocks.rs +++ b/nihav-acorn/src/codecs/supermovingblocks.rs @@ -2,8 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::bitreader::*; use nihav_core::io::codebook::*; -use super::RGB555_FORMAT; - struct DeltaCodebook { cb: Codebook, } @@ -56,7 +54,7 @@ impl MBDecoder { impl NADecoder for MBDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, RGB555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(vinfo.get_width(), vinfo.get_height(), false, super::BGR555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); self.cur_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; self.prev_frm = vec![0; vinfo.get_width() * vinfo.get_height()]; diff --git a/nihav-commonfmt/src/codecs/rawvideomsenc.rs b/nihav-commonfmt/src/codecs/rawvideomsenc.rs index 3ef87fd..dc697e9 100644 --- a/nihav-commonfmt/src/codecs/rawvideomsenc.rs +++ b/nihav-commonfmt/src/codecs/rawvideomsenc.rs @@ -1,14 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; -const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - pub const BGR24_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, comp_info: [ Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 2, next_elem: 3 }), @@ -60,7 +52,7 @@ impl NAEncoder for RawEncoder { let depth = if vinfo.format.is_paletted() { 8 } else { vinfo.format.get_total_depth() } as usize; vinfo.format = match depth { 8 => PAL8_FORMAT, - 15 | 16 => BGR555_FORMAT, + 15 | 16 => RGB555_FORMAT, 24 => BGR24_FORMAT, _ if vinfo.format.has_alpha() => BGR32_FORMAT, _ => BGR24_FORMAT, diff --git a/nihav-commonfmt/src/codecs/zmbv.rs b/nihav-commonfmt/src/codecs/zmbv.rs index 660244a..24177f6 100644 --- a/nihav-commonfmt/src/codecs/zmbv.rs +++ b/nihav-commonfmt/src/codecs/zmbv.rs @@ -151,13 +151,6 @@ fn decode_inter(frm: &mut [u8], prev: &[u8], dpal: bool, pal: &mut [u8; 768], pp const INTRA_FLAG: u8 = 0x01; const DELTA_PAL: u8 = 0x02; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; const RGB24_0_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, comp_info: [ Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 2, next_elem: 4 }), diff --git a/nihav-commonfmt/src/codecs/zmbvenc.rs b/nihav-commonfmt/src/codecs/zmbvenc.rs index 59efa99..47ebb89 100644 --- a/nihav-commonfmt/src/codecs/zmbvenc.rs +++ b/nihav-commonfmt/src/codecs/zmbvenc.rs @@ -2,13 +2,6 @@ use nihav_core::codecs::*; use nihav_core::compr::deflate::{Deflate, DeflateMode, DeflateWriter}; use nihav_core::io::byteio::*; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; const RGB24_0_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, comp_info: [ Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 2, next_elem: 4 }), @@ -620,7 +613,7 @@ mod test { use nihav_core::muxers::*; use crate::*; use nihav_codec_support::test::enc_video::*; - use super::{RGB555_FORMAT, RGB24_0_FORMAT}; + use super::RGB24_0_FORMAT; // samples are from https://samples.mplayerhq.hu/V-codecs/ZMBV/ #[test] diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index 44d58e9..c89b886 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -11,14 +11,7 @@ macro_rules! mktag { }); } -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { - model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: true, alpha: false, palette: false }; +const QT_RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton::make_rgb16_fmt(5, 5, 5, true, true); pub const ARGB_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 4, @@ -722,7 +715,7 @@ fn read_stsd(track: &mut Track, br: &mut dyn ByteIO, size: u64) -> DemuxerResult } else { match depth { 1..=8 | 33..=40 => PAL8_FORMAT, - 15 | 16 => RGB555_FORMAT, + 15 | 16 => QT_RGB555_FORMAT, 24 => RGB24_FORMAT, 32 => ARGB_FORMAT, _ => { diff --git a/nihav-duck/src/codecs/truemotion1data.rs b/nihav-duck/src/codecs/truemotion1data.rs index 8474588..2a144c4 100644 --- a/nihav-duck/src/codecs/truemotion1data.rs +++ b/nihav-duck/src/codecs/truemotion1data.rs @@ -1,12 +1,5 @@ use nihav_core::formats::*; -pub const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; pub const BGR0_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, comp_info: [ Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 8, shift: 0, comp_offs: 2, next_elem: 4 }), diff --git a/nihav-duck/src/codecs/truemotion1enc.rs b/nihav-duck/src/codecs/truemotion1enc.rs index bdf710f..00e85ca 100644 --- a/nihav-duck/src/codecs/truemotion1enc.rs +++ b/nihav-duck/src/codecs/truemotion1enc.rs @@ -793,7 +793,7 @@ mod test { use crate::*; use nihav_commonfmt::*; use nihav_codec_support::test::enc_video::*; - use super::super::truemotion1data::{RGB555_FORMAT, BGR0_FORMAT}; + use super::super::truemotion1data::BGR0_FORMAT; #[allow(unused_variables)] fn encode_test(name: &'static str, enc_options: &[NAOption], hash: &[u32; 4], is16: bool) { diff --git a/nihav-game/src/codecs/gremlinvideo.rs b/nihav-game/src/codecs/gremlinvideo.rs index 6db1913..3609cdf 100644 --- a/nihav-game/src/codecs/gremlinvideo.rs +++ b/nihav-game/src/codecs/gremlinvideo.rs @@ -519,14 +519,6 @@ impl GremlinVideoDecoder { } } -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 1, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 2, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - impl NADecoder for GremlinVideoDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { diff --git a/nihav-game/src/codecs/pdq2.rs b/nihav-game/src/codecs/pdq2.rs index ff1b654..9f2246b 100644 --- a/nihav-game/src/codecs/pdq2.rs +++ b/nihav-game/src/codecs/pdq2.rs @@ -1,13 +1,7 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; -const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 1, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 2, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; +const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton::make_rgb16_fmt(5, 5, 5, false, false); struct HybridReader<'a> { src: MemoryReader<'a>, diff --git a/nihav-game/src/codecs/sga.rs b/nihav-game/src/codecs/sga.rs index 4339fd6..c3be0e6 100644 --- a/nihav-game/src/codecs/sga.rs +++ b/nihav-game/src/codecs/sga.rs @@ -1,14 +1,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 1, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 2, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - const OPCODE_SKIP: usize = 91; struct DPVideoDecoder { diff --git a/nihav-game/src/codecs/vmd.rs b/nihav-game/src/codecs/vmd.rs index 82da8da..fd0de8f 100644 --- a/nihav-game/src/codecs/vmd.rs +++ b/nihav-game/src/codecs/vmd.rs @@ -232,14 +232,6 @@ impl VMDVideoDecoder { } } -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 1, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 2, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - impl NADecoder for VMDVideoDecoder { fn init(&mut self, _supp: &mut NADecoderSupport, info: NACodecInfoRef) -> DecoderResult<()> { if let NACodecTypeInfo::Video(vinfo) = info.get_properties() { diff --git a/nihav-game/src/demuxers/sga.rs b/nihav-game/src/demuxers/sga.rs index 6c82708..a0f1927 100644 --- a/nihav-game/src/demuxers/sga.rs +++ b/nihav-game/src/demuxers/sga.rs @@ -1,13 +1,6 @@ use nihav_core::frame::*; use nihav_core::demuxers::*; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 1, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 2, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; struct SGADemuxer<'a> { src: &'a mut dyn ByteIO, subtype: u8, diff --git a/nihav-misc/src/codecs/motionpixels.rs b/nihav-misc/src/codecs/motionpixels.rs index b477205..6e536b3 100644 --- a/nihav-misc/src/codecs/motionpixels.rs +++ b/nihav-misc/src/codecs/motionpixels.rs @@ -19,14 +19,6 @@ impl MPVersion { fn is_dos(self) -> bool { self == MPVersion::MotionPixelsDOS } } -const BGR555_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - #[derive(Clone,Copy,Debug,Default)] struct MPFlags(u16); @@ -540,7 +532,7 @@ impl NADecoder for MVIDecoder { } self.dec.init(w, h, mode, self.version.is_dos()); let flipped = !self.version.is_dos() && self.flags.is_flipped(); - let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, flipped, BGR555_FORMAT)); + let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, flipped, RGB555_FORMAT)); self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref(); Ok(()) } else { diff --git a/nihav-ms/src/codecs/msvideo1.rs b/nihav-ms/src/codecs/msvideo1.rs index 2795d0a..bd08755 100644 --- a/nihav-ms/src/codecs/msvideo1.rs +++ b/nihav-ms/src/codecs/msvideo1.rs @@ -2,15 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; use nihav_codec_support::codecs::HAMShuffler; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { - model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - #[derive(Default)] struct Video1Decoder { info: NACodecInfoRef, diff --git a/nihav-ms/src/codecs/msvideo1enc.rs b/nihav-ms/src/codecs/msvideo1enc.rs index 94c1cee..91911df 100644 --- a/nihav-ms/src/codecs/msvideo1enc.rs +++ b/nihav-ms/src/codecs/msvideo1enc.rs @@ -805,15 +805,6 @@ impl MSVideo1Encoder { } } -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { - model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - impl NAEncoder for MSVideo1Encoder { fn negotiate_format(&self, encinfo: &EncodeParameters) -> EncoderResult { match encinfo.format { @@ -1026,7 +1017,6 @@ mod test { use crate::*; use nihav_commonfmt::*; use nihav_codec_support::test::enc_video::*; - use super::RGB555_FORMAT; #[test] fn test_ms_video1_encoder_pal() { diff --git a/nihav-qt/src/codecs/rle.rs b/nihav-qt/src/codecs/rle.rs index ff7a372..eef8534 100644 --- a/nihav-qt/src/codecs/rle.rs +++ b/nihav-qt/src/codecs/rle.rs @@ -2,15 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; use nihav_codec_support::codecs::HAMShuffler; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { - model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - pub const ARGB_FORMAT: NAPixelFormaton = NAPixelFormaton { model: ColorModel::RGB(RGBSubmodel::RGB), components: 4, comp_info: [ diff --git a/nihav-qt/src/codecs/rpza.rs b/nihav-qt/src/codecs/rpza.rs index 8bc64ad..fdbbb80 100644 --- a/nihav-qt/src/codecs/rpza.rs +++ b/nihav-qt/src/codecs/rpza.rs @@ -2,15 +2,6 @@ use nihav_core::codecs::*; use nihav_core::io::byteio::*; use nihav_codec_support::codecs::HAMShuffler; -const RGB555_FORMAT: NAPixelFormaton = NAPixelFormaton { - model: ColorModel::RGB(RGBSubmodel::RGB), components: 3, - comp_info: [ - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 10, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 5, comp_offs: 0, next_elem: 2 }), - Some(NAPixelChromaton{ h_ss: 0, v_ss: 0, packed: true, depth: 5, shift: 0, comp_offs: 0, next_elem: 2 }), - None, None], - elem_size: 2, be: false, alpha: false, palette: false }; - #[derive(Default)] struct RpzaDecoder { info: NACodecInfoRef,