]> git.nihav.org Git - nihav.git/commitdiff
prune duplicate definitions of RGB555_FORMAT
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 2 Mar 2026 17:23:03 +0000 (18:23 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 2 Mar 2026 18:04:59 +0000 (19:04 +0100)
Also rename to/from BGR555_FORMAT where appropriate.

24 files changed:
nihav-acorn/src/codecs/escape.rs
nihav-acorn/src/codecs/linepack.rs
nihav-acorn/src/codecs/mod.rs
nihav-acorn/src/codecs/movingblocks.rs
nihav-acorn/src/codecs/movingblockshq.rs
nihav-acorn/src/codecs/movinglines.rs
nihav-acorn/src/codecs/rawvideo.rs
nihav-acorn/src/codecs/supermovingblocks.rs
nihav-commonfmt/src/codecs/rawvideomsenc.rs
nihav-commonfmt/src/codecs/zmbv.rs
nihav-commonfmt/src/codecs/zmbvenc.rs
nihav-commonfmt/src/demuxers/mov.rs
nihav-duck/src/codecs/truemotion1data.rs
nihav-duck/src/codecs/truemotion1enc.rs
nihav-game/src/codecs/gremlinvideo.rs
nihav-game/src/codecs/pdq2.rs
nihav-game/src/codecs/sga.rs
nihav-game/src/codecs/vmd.rs
nihav-game/src/demuxers/sga.rs
nihav-misc/src/codecs/motionpixels.rs
nihav-ms/src/codecs/msvideo1.rs
nihav-ms/src/codecs/msvideo1enc.rs
nihav-qt/src/codecs/rle.rs
nihav-qt/src/codecs/rpza.rs

index f37bca911b91e5c9d307a4a243d4c8bc62ec7156..cf61db1cdf85c4c10548f29d50d7e29ef430a93a 100644 (file)
@@ -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<usize>;
 }
@@ -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()];
index feb1cd6bbda5a63812a9185cfd64b2faeadbab0a..d1bb57c8ad0aaaf3562520bb889fe2207100a0e7 100644 (file)
@@ -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()];
index 923052764fbc2acc550ec58ee717fecfe6c411ad..675f2ad64c1f1acdf8431525f5540dfdcaf942e2 100644 (file)
@@ -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;
index 3668640c10593d4e73ab750f4ae6f0d245e4b57f..677937e368a861f36d9ea1f96c9cd1b433defdc9 100644 (file)
@@ -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()];
index 178480990150a6770f3e7115de87ccb155e59b97..416516e7b4ff3b23514d3b92afed7697bae31622 100644 (file)
@@ -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()];
index fb9696b936dd4e04f8b76131119b8c4b1c916e1a..4ea9065dd1f9d4158c6c28fd24fb2f4a3558a5eb 100644 (file)
@@ -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()];
index 71f9f74cc8657f38e787f1dfe50e2e7c306608c4..8f45a6657d2c83fc87fd33fb2357800cc8fdd6de 100644 (file)
@@ -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
index e4fc8c3f63113403182032c0cec98714f3ac4387..cfc69975a0e98081f3ef0f52026dbd8955fc58de 100644 (file)
@@ -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<u16>,
 }
@@ -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()];
index 3ef87fd46a84f485e7635af42538a8ccaf0df217..dc697e91170583b764bc3331228ec2c423b9f333 100644 (file)
@@ -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,
index 660244ae79f9f012f36b132ad4787baec1d5556e..24177f6b2a5124d82b66ec2a71e8238df50e26a8 100644 (file)
@@ -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 }),
index 59efa99c8130723b94212378f554b83fd9c241e1..47ebb89016f30c0744a022c33a595354ed226f6c 100644 (file)
@@ -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]
index 44d58e902a13620af548801a938f0a8ff905f151..c89b8866be3ed172aaffde0a5cf9e75fde2ae5a1 100644 (file)
@@ -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,
                             _ => {
index 8474588b539a5d37b11ff9c08e194e972cf3c0b2..2a144c44a0329437c655be311d3910e403c9c231 100644 (file)
@@ -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 }),
index bdf710fde3fdb0ed76a224980d93a00355db9544..00e85cab3daebd97b92f487148f5d315da1deca1 100644 (file)
@@ -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) {
index 6db19137a9aa48ebd49ff010b6a328254ef74b46..3609cdf5c86c34b94efd33915790ed0d9d377a7c 100644 (file)
@@ -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() {
index ff1b65442b48c1d2c88672956d7fcacb4f5970b2..9f2246b1feb89090e994687249df9057e7a12570 100644 (file)
@@ -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>,
index 4339fd6effe32aaf22fe0a490c2de945be648b8c..c3be0e6cf2ac58fc63eddf9f1de81e2499c1d370 100644 (file)
@@ -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 {
index 82da8da5b36f2d017620c7697de28e7d5f0a8458..fd0de8f266ae729c8dc589ecf854024d609b4ac5 100644 (file)
@@ -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() {
index 6c827089b12cc3829e6640b001f10e3b2f30c74f..a0f1927a3e37c7650f714db474eb71043a2829c7 100644 (file)
@@ -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,
index b4772056b8e903654ad65a00bb381eca72a85d42..6e536b3f0732f377d938d3b220079ff095407096 100644 (file)
@@ -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 {
index 2795d0a3522cd4f7167e82b3ec67b35b08530b47..bd0875593032c16caf7a419aa2745671608595d3 100644 (file)
@@ -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,
index 94c1ceedaa0a0893ec4c623ae831b07bf6182ae8..91911dfe22535fbaad7753f2293dd1c1c4f0a26e 100644 (file)
@@ -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<EncodeParameters> {
         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() {
index ff7a372c8b526038fa4631d071dcc3e61b02dca8..eef8534134bb4953f25c0ec90ccbbfae3342ced6 100644 (file)
@@ -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: [
index 8bc64ade50a82c04e0fcde3ee88da3aa9d57ac7a..fdbbb80e66bbcfedf0270cdff11f0a348f237ad9 100644 (file)
@@ -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,