diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2024-07-02 18:26:22 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2024-07-02 18:26:58 +0200 |
commit | d3ebda9bd0510626d1c87f4b7ba26bb10791c86d (patch) | |
tree | da48129cd3044912194d8b08263c5e8239690267 | |
parent | cb945ee68940b7c1d9971ae3b120996e41e91480 (diff) | |
download | nihav-d3ebda9bd0510626d1c87f4b7ba26bb10791c86d.tar.gz |
binkaud: fix monaural RDFT decoding (and add a test while at it)
-rw-r--r-- | nihav-rad/src/codecs/binkaud.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nihav-rad/src/codecs/binkaud.rs b/nihav-rad/src/codecs/binkaud.rs index b424c0e..b56b6d4 100644 --- a/nihav-rad/src/codecs/binkaud.rs +++ b/nihav-rad/src/codecs/binkaud.rs @@ -180,7 +180,7 @@ impl NADecoder for BinkAudioDecoder { self.version_b = false; } let mut frame_bits = if srate < 22050 { 9 } else if srate < 44100 { 10 } else { 11 }; - if !self.use_dct && !self.version_b { + if !self.use_dct && !self.version_b && channels > 1 { frame_bits += 1; } self.len = 1 << frame_bits; @@ -291,7 +291,18 @@ mod test { test_decode_audio("bink", file, None, None/*Some("bink")*/, &dmx_reg, &dec_reg); } #[test] - fn test_bink_audio_rdft() { + fn test_bink_audio_rdft_mono() { + let mut dmx_reg = RegisteredDemuxers::new(); + rad_register_all_demuxers(&mut dmx_reg); + let mut dec_reg = RegisteredDecoders::new(); + rad_register_all_decoders(&mut dec_reg); + + // sample from Star Trek: Armada demo + let file = "assets/RAD/F1DEM1.bik"; + test_decode_audio("bink", file, None, None/*Some("bink")*/, &dmx_reg, &dec_reg); + } + #[test] + fn test_bink_audio_rdft_stereo() { let mut dmx_reg = RegisteredDemuxers::new(); rad_register_all_demuxers(&mut dmx_reg); let mut dec_reg = RegisteredDecoders::new(); |