Open chris-hld opened 11 months ago
Opusfile fails to decode Ambisonics. Both mapping families (2 and 3) are broken / not implemented.
With a third order Ambix file, the encoding works:
./../../opus-tools/opusenc --channels ambix opus_AmbixTCs.wav opus_ambi.opus Skipping chunk of type "fact", length 4 Skipping chunk of type "PEAK", length 136 Encoding using libopus 1.4-6-g9fc8fc4c (audio) ----------------------------------------------------- Input: 48 kHz, 16 channels Output: 16 channels (16 coupled) 20ms packets, 768 kbit/s VBR Preskip: 312 Encoding complete ----------------------------------------------------- Encoded: 10.02 seconds Runtime: 1 second (10.02x realtime) Wrote: 1028095 bytes, 501 packets, 19 pages Bitrate: 815.996 kbit/s (without overhead) Instant rates: 12.4 to 1496.4 kbit/s (31 to 3741 bytes per packet) Overhead: 0.589% (container+metadata)
The bitstream seams also seems valid
./../../opus-tools/opusinfo opus_ambi.opus Processing file "opus_ambi.opus"... New logical stream (#1, serial: 572bd79b): type opus Encoded with libopus 1.4-6-g9fc8fc4c, libopusenc 0.2.1-16-ge4285b5 User comments section follows... ENCODER=opusenc from opus-tools 0.2-32-ge7f495e ENCODER_OPTIONS=--channels ambix Opus stream 1: Pre-skip: 312 Playback gain: 0 dB Channels: 16 Original sample rate: 48000 Hz Streams: 8, Coupled: 8 Channel Mapping Family: 3 Demixing Matrix [16x16]: [ 8192, 0, -3413, 13829, 0, 0, -8176, -7075, 15617, 0, 0, 0, 11826, -7890, -9974, 16112] [ 8192, -9779, 3413, 9779, -15617, -5003, -8176, 5003, 0, -11393, -9974, 5579, -11826, -5579, 0, -11393] [ 8192, 9779, 3413, -9779, -15617, 5003, -8176, -5003, 0, 11393, -9974, -5579, -11826, 5579, 0, 11393] [ 8192, 6263, -11359, 6263, 6406, -10664, 8208, -10664, 0, 2993, -13617, 10185, -901, 10185, 0, -2993] [ 8192, 8857, 11359, 0, 0, 15081, 8208, 0, -6406, -4233, 0, 14403, 901, 0, -13617, 0] [ 8192, 0, 11359, 8857, 0, 0, 8208, 15081, 6406, 0, 0, 0, 901, 14403, 13617, 4233] [ 8192, 6263, -11359, -6263, -6406, -10664, 8208, 10664, 0, 2993, 13617, 10185, -901, -10185, 0, 2993] [ 8192, 13829, -3413, 0, 0, -7075, -8176, 0, -15617, -16112, 0, -7890, 11826, 0, 9974, 0] [ 8192, 9779, 3413, 9779, 15617, 5003, -8176, 5003, 0, 11393, 9974, -5579, -11826, -5579, 0, -11393] [ 8192, -13829, -3413, 0, 0, 7075, -8176, 0, -15617, 16112, 0, 7890, 11826, 0, 9974, 0] [ 8192, 0, -3413, -13829, 0, 0, -8176, 7075, 15617, 0, 0, 0, 11826, 7890, -9974, -16112] [ 8192, -6263, -11359, 6263, -6406, 10664, 8208, -10664, 0, -2993, 13617, -10185, -901, 10185, 0, -2993] [ 8192, 0, 11359, -8857, 0, 0, 8208, -15081, 6406, 0, 0, 0, 901, -14403, 13617, -4233] [ 8192, -8857, 11359, 0, 0, -15081, 8208, 0, -6406, 4233, 0, -14403, 901, 0, -13617, 0] [ 8192, -6263, -11359, -6263, 6406, 10664, 8208, 10664, 0, -2993, -13617, -10185, -901, -10185, 0, 2993] [ 8192, -9779, 3413, -9779, 15617, -5003, -8176, -5003, 0, -11393, 9974, 5579, -11826, 5579, 0, 11393] Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min) Page duration: 640.0ms (max), 589.4ms (avg), 500.0ms (min) Total data length: 1028095 bytes (overhead: 0.589%) Playback length: 0m:10.000s Average bitrate: 822.5 kbit/s, w/o overhead: 817.6 kbit/s Logical stream 1 ended
However, decoding fails very quickly:
./../../opus-tools/opusdec opus_ambi.opus opus_ambi_dec.wav Failed to open 'opus_ambi.opus'.
This PR fixes at least Ambisonics mapping 2 https://github.com/xiph/opusfile/pull/45
https://github.com/xiph/opusfile/pull/45 now also fixes Ambisonics mapping 3 and mapping 255.
Opusfile fails to decode Ambisonics. Both mapping families (2 and 3) are broken / not implemented.
With a third order Ambix file, the encoding works:
The bitstream seams also seems valid
However, decoding fails very quickly:
This PR fixes at least Ambisonics mapping 2 https://github.com/xiph/opusfile/pull/45