]> git.nihav.org Git - nihav.git/commitdiff
pgvv: obtain YUV422 formaton by parsing string instead of hardcoding it
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 2 Mar 2026 17:07:45 +0000 (18:07 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 2 Mar 2026 17:07:45 +0000 (18:07 +0100)
nihav-misc/src/codecs/pgvv.rs

index e3b7eda08f49289805dd8eec5439decae1b1dcff..5146ce64c40b8bb069f81bc5734e6979001c0167 100644 (file)
@@ -3,6 +3,7 @@
 use nihav_core::io::byteio::{ByteIO,MemoryReader};
 use nihav_core::codecs::*;
 use nihav_codec_support::codecs::jpeg::*;
+use std::str::FromStr;
 
 struct RadiusStudioDecoder {
     info:       NACodecInfoRef,
@@ -62,42 +63,7 @@ impl NADecoder for RadiusStudioDecoder {
 
         let field0_size = if version == 0 { size_v0 } else { size_v1 };
 
-        let formaton = NAPixelFormaton {
-                model:      ColorModel::YUV(YUVSubmodel::YUVJ),
-                components: 3,
-                comp_info:  [
-                    Some(NAPixelChromaton {
-                        h_ss: 0, v_ss: 0,
-                        packed:     false,
-                        depth:      8,
-                        shift:      0,
-                        comp_offs:  0,
-                        next_elem:  1,
-                    }),
-                    Some(NAPixelChromaton {
-                        h_ss: 1, v_ss: 0,
-                        packed:     false,
-                        depth:      8,
-                        shift:      0,
-                        comp_offs:  1,
-                        next_elem:  1,
-                    }),
-                    Some(NAPixelChromaton {
-                        h_ss: 1, v_ss: 0,
-                        packed:     false,
-                        depth:      8,
-                        shift:      0,
-                        comp_offs:  2,
-                        next_elem:  1,
-                    }),
-                    None,
-                    None
-                ],
-                elem_size:  0,
-                be:         false,
-                alpha:      false,
-                palette:    false,
-            };
+        let formaton = NAPixelFormaton::from_str("yuv422p").unwrap();
         let vinfo = NAVideoInfo::new(self.jpeg.width, self.jpeg.height, false, formaton);
         let bufinfo = alloc_video_buffer(vinfo, 4)?;