tim/failure-end_gp_before_last_packet1.opus This file has 1 audio page, with data of untrimmed length 31680, preskip of 488, final granpos of 5760, and packet size of 20ms (960). A correctly behaving decoder should output a file with a duration of 5272 but that requires trimming more than one packet from the end. A correctly behaving encoder SHOULD NOT make a file requiring that. opusdec - decodes ~110ms of 'noise' at the original 11025Hz sample rate. recodec - decodes 1318 samples at 12kHz sample rate. (resampling to oddball original rates is supported, but not enabled for these tests, so only opus supported rates are used) opusinfo - WARNING: stream 1 has more than one packet of end trimming tim/failure-end_gp_before_last_packet2.opus This file has 1 audio page, with data of untrimmed length 31680, preskip of 488, final granpos of 5759, and packet size of 20ms (960). A correctly behaving decoder should output a file with a duration of 5271 but that requires trimming more than one packet from the end. A correctly behaving encoder SHOULD NOT make a file requiring that. opusdec - decodes ~110ms of noise at 11025Hz sample rate. recodec - decodes 1317 samples at 12kHz sample rate. opusinfo - WARNING: stream 1 has more than one packet of end trimming tim/failure-end_gp_before_last_packet3.opus This file has 2 audio pages, with data of untrimmed length 31680, preskip of 488, final granpos of 30720, and packet size of 20ms (960). A correctly behaving decoder should output a file with a duration of 30232, discarding the first 488 samples and the entire final packet. A correctly behaving encoder SHOULD NOT have included the final packet. opusdec - decodes ~630ms at the original 11025Hz sample rate, which loudly, clearly, and otherwise correctly, says the word "failure". recodec - decodes 7558 samples at 12kHz sample rate, correctly aside from restoring the original rate. opusinfo - does not complain. But probably should. The spec says: "The number of discarded samples SHOULD be smaller than the number decoded from the last packet." And here it is equal to, not smaller than. ron/failure-end_gp_before_last_packet4.opus The same as failure-end_gp_before_last_packet3.opus, except the final granpos is reduced to 30464, requiring trimming of part of the second to last packet. opusdec - correctly decodes ~624ms at the original 11025Hz sample rate. recodec - correctly decodes 7494 samples at 12kHz. opusinfo - WARNING: stream 1 has more than one packet of end trimming ron/failure-end_gp_before_last_packet5.opus The same as failure-end_gp_before_last_packet3.opus, except the final granpos is reduced to 24567, requiring trimming all the way back to part of the first packet in the final page. opusdec - correctly decodes ~502ms at the original 11025Hz sample rate. recodec - correctly decodes 6022 samples at 12kHz. opusinfo - WARNING: stream 1 has more than one packet of end trimming tim/failure-end_gp_less_than_preskip.opus This file has 1 audio page, with data of untrimmed length 31680, preskip of 488, final granpos of 400, and packet size of 20ms (960). A correctly behaving decoder MUST reject this stream as invalid because "more samples should be skipped from the initial decoded output than exist in the stream." opusdec - does not complain, but outputs an empty .wav (headers only) recodec - rejects the stream with: Opus::Decode: granpos 400 (100) < lookahead 488 (122) at end of stream opusinfo - ERROR: stream 1 has a negative duration WARNING: stream 1 has more than one packet of end trimming Playback length: 0m:00.-01s Average bitrate: -2.616e+04 kb/s, w/o overhead: -2.519e+04 kb/s tim/failure-first_gp_less_than_preskip.opus This file has 2 audio pages, with data of untrimmed length 31680, preskip of 488, first page granpos of 400, first page duration of 24000, and packet size of 20ms (960). A correctly behaving decoder MUST reject this stream as invalid because the granpos of the first page with a completed packet must not be smaller than the number of samples read unles the EOS flag is set. That it's also less than the preskip too is just a bonus. opusdec - decodes 160ms of noise at 11025Hz sample rate. recodec - rejects the stream with: Opus::Decode: initial sample time < 0, granpos 400, duration 6000 (24000) opusinfo - WARNING: Samples with negative granpos in stream 1 WARNING: Sample count behind granule (31680>55100) in stream 1 Playback length: 0m:01.137s tim/failure-first_gp_less_than_sample_count.opus This file has 2 audio pages, with data of untrimmed length 31680, preskip of 488, first page granpos of 23744, first page duration of 24000, and packet size of 20ms (960). A correctly behaving decoder MUST reject this stream as invalid because the granpos of the first page with a completed packet must not be smaller than the number of samples read unles the EOS flag is set. opusdec - decodes 646ms at 11025Hz sample rate, which loudly and clearly says the word "failure". recodec - rejects the stream with: Opus::Decode: initial sample time < 0, granpos 23744, duration 6000 (24000) opusinfo - WARNING: Samples with negative granpos in stream 1 WARNING: Sample count behind granule (31680>31756) in stream 1 Playback length: 0m:00.651s greg/broken.phobosstream.opus: The initial granule position of this file is not 0, but its granpos calculations after that are All Wrong. A validating decoder should catch this after the second Ogg audio page is read, but Opus::read does not sanity check that until the requested number of octets have all been decoded. For recodec, that's a 64k block, so it could miss a bogus granpos on some page if subsequent pages are correct again. opusdec - decodes without warnings. Reports "Header v0" recodec - rejects the stream with: Opus::read: invalid granpos 23766120 < expected 23772000 at sample 26256 (2 channels) opusinfo - complains about many things greg/broken.testvector01.bit.opus opusdec - decodes a broken stream with numerous missing packets. outputs many warnings of "Decoding error: corrupted stream". recodec - rejects the stream with: Opus::read: decoding 200 byte packet failed at octet 1697: corrupted stream opusinfo - complains about many things greg/correctness_gain_loud_speech.opus Test expectation described in Ogg comments. opusdec and recodec produce the same duration output, at levels within a poofteenth of a dB of each other. Most of which appears to be attributable to the dither/noise-shaper in opusdec, which rings and does amusing things in places where recodec decodes pure silence. greg/correctness_gain_silent_output.opus As above. Visually, the dithered output of opusdec looks like all-noise all-the-time, compared to the recodec output which looks like it contains speech ... But when amplified again to a level where they can actually be heard, the dithered output really does win. It replaces scratchy noise bursts at each utterance with a constant hiss, but is much more pleasant to listen to. As would be expected :) greg/correctness_trimming_nobeeps.opus opusdec and recodec produce the same result, modulo dither. greg/testvector01.bit.opus No description of the test in the Ogg comments. OpusHead has pre-skip and input sample rate of 0. opusenc and recodec produce the same duration output, the only difference being opusenc forces 48k output while recodec currently defaults to 8k. Neither of them warn about the preskip (or produce bad output without it). opusinfo does warn about the preskip being implausible. greg/testvector02.bit.opus As above, except with something about gluing sheep to dark blue backgrounds. 23kb/s speech instead of 180kb/s music, and Header v0 the only difference. greg/testvector03.bit.opus As above. 27kb/s speech. greg/testvector04.bit.opus As above. 23kb/s speech. greg/testvector05.bit.opus greg/testvector06.bit.opus As above. 42kb/s speech. greg/testvector07.bit.opus As above. Average 65kb/s speech. But lots of mode switches? Parts of it sound like crap in both decoders. greg/testvector08.bit.opus As above. Average 40kb/s speech. Some unsafe mode switches? A few glitches as well as parts that sound crap. greg/testvector09.bit.opus 232kb/s speech. 2.5 - 60ms packets. greg/testvector10.bit.opus drone hum with woop-woop pings. 184kb/s, 2.5 - 100ms packets. greg/testvector11.bit.opus music. 96kb/s, 10 - 120ms packets. greg/testvector12.bit.opus speech, 14kb/s, mostly 20ms, some 10ms packets. Some unsafe mode switches? A couple of clear glitches in this one too. Other: opusdec needs to tack a newline to the end of its Bitrate in use: output after decoding is completed. tacking the shell prompt on the end of that halfway across the terminal sucks.