make encoder test functions accept encoder-specific options
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 8 Aug 2021 10:55:53 +0000 (12:55 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sun, 8 Aug 2021 10:55:53 +0000 (12:55 +0200)
nihav-codec-support/src/test/enc_video.rs
nihav-commonfmt/src/codecs/cinepakenc.rs
nihav-commonfmt/src/codecs/zmbvenc.rs
nihav-ms/src/codecs/msadpcm.rs
nihav-ms/src/codecs/msvideo1enc.rs

index e9fcf1f0cf84ae4b03e353a90d0f19656be7e0d9..16ea415136052f7f38af895a56ebfaffa5c1ef34 100644 (file)
@@ -210,7 +210,7 @@ pub fn test_remuxing_md5(dec_config: &DecoderTestParams, muxer: &str, mux_reg: &
 }
 
 /// Tests an encoder by decoding a stream from input file, feeding it to the encoder and muxing the result into output file.
-pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters) {
+pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, enc_options: &[NAOption]) {
     let dmx_f = dec_config.dmx_reg.find_demuxer(dec_config.demuxer).unwrap();
     let mut file = File::open(dec_config.in_name).unwrap();
     let mut fr = FileReader::new_read(&mut file);
@@ -256,6 +256,7 @@ pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &Encode
 
     let encfunc = enc_config.enc_reg.find_encoder(enc_config.enc_name).unwrap();
     let mut encoder = (encfunc)();
+    encoder.set_options(enc_options);
     let out_str = encoder.init(0, enc_params).unwrap();
     out_sm.add_stream(NAStream::clone(&out_str));
 
@@ -318,7 +319,7 @@ pub fn test_encoding_to_file(dec_config: &DecoderTestParams, enc_config: &Encode
 }
 
 /// Tests an encoder by decoding a stream from input file, feeding it to the encoder and calculating the hash of codec information and packet data.
-pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, ref_hash: &[u32; 4]) {
+pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTestParams, mut enc_params: EncodeParameters, enc_options: &[NAOption], ref_hash: &[u32; 4]) {
     let dmx_f = dec_config.dmx_reg.find_demuxer(dec_config.demuxer).unwrap();
     let mut file = File::open(dec_config.in_name).unwrap();
     let mut fr = FileReader::new_read(&mut file);
@@ -363,6 +364,7 @@ pub fn test_encoding_md5(dec_config: &DecoderTestParams, enc_config: &EncoderTes
 
     let encfunc = enc_config.enc_reg.find_encoder(enc_config.enc_name).unwrap();
     let mut encoder = (encfunc)();
+    encoder.set_options(enc_options);
     let out_str = encoder.init(0, enc_params).unwrap();
 
     let mut md5 = MD5::new();
index 38f7cecb5c0365e28871caf8e75cf0210af12f43..01e5714615a283bffb71a2642e7a20d049841591 100644 (file)
@@ -1128,8 +1128,8 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, &[]);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
                           &[0xd73cb3c7, 0x30d59f90, 0x1d6e0e28, 0x5b72cc0c]);
     }
 }
index 0d5c1afa8388e9f66a730290fb008f3cf85cae4d..7de6c23a8f97162cb31ca53a24edbc0d0993e44f 100644 (file)
@@ -588,8 +588,9 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        let enc_options = &[];
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
                           &[0x50df10e2, 0x606f3268, 0xdd4bc2ff, 0x844e7d87]);
     }
 
@@ -632,8 +633,9 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        let enc_options = &[];
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
                           &[0x0b4cb528, 0x66c91f6c, 0x1c2187a5, 0x2723a08d]);
     }
 
@@ -676,8 +678,9 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        let enc_options = &[];
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
                           &[0x1a522743, 0x6c320a6e, 0xd08539e1, 0x03fc17ea]);
     }
 
@@ -720,8 +723,9 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        let enc_options = &[];
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, enc_options);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, enc_options,
                           &[0x3880e045, 0xe6c88dc7, 0x21066058, 0xc789f1e9]);
     }
 }
index 5010c03dc330457ef6e8de7a5b8d56af9be5c1bc..dfcf6403dbbabadacc206604dce9e2afc9a360aa 100644 (file)
@@ -464,7 +464,7 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
                           &[0xe1591a1e, 0x816d0239, 0x4cc42291, 0x4e6b69cb]);
     }
 }
index d2e5c34278f9f986e01e9f2c5cd5507f24f78220..89b4b2200aed810f46ecc15ed45609a60177283f 100644 (file)
@@ -610,8 +610,8 @@ mod test {
                 tb_den:  0,
                 flags:   0,
             };
-        //test_encoding_to_file(&dec_config, &enc_config, enc_params);
-        test_encoding_md5(&dec_config, &enc_config, enc_params,
+        //test_encoding_to_file(&dec_config, &enc_config, enc_params, &[]);
+        test_encoding_md5(&dec_config, &enc_config, enc_params, &[],
                           &[0x4339421d, 0x6393f1b6, 0x653d6cd2, 0x3a184382]);
     }
 }