[FFmpeg-devel] [PATCH] avcodec/wmaprodec: support multichannel XMA stream configurations

James Almer jamrial at gmail.com
Fri Oct 6 21:05:50 EEST 2017

On 10/5/2017 7:29 PM, Banana M. wrote:
> Here are samples of many stream configurations, generated with Microsoft's
> encoder:
> https://mega.nz/#!aQRUnTIT!gWUAfGNLIP62VKV2JEOGoyQ1jbVc3M7_qu7ChXQwb7w
> For real XMA used in games, I've only seen 2ch+..+2ch+1/2ch (usual, what
> FFmpeg supported before) and 1ch+..+1ch (rare, what motivates this patch).
> This adds support for all possible combinations though.
> I don't know enough about FATE to set up tests so I hope somebody could
> help, as the learning curve seems steep.

It's not hard. If you're already familiar with Makefile recipes it's a
matter of adding a few targets using the already defined testing
functions that better suit your needs (decoding, codec copy, etc).

See the apng.mak file, which is as simple as it gets. It defines two
targets, fate-apng-clock and fate-apng-osample, makes them be part of
the list FATE_SAMPLES_FFMPEG and use the fate function framecrc() with
the argument "-i INPUT_FILE". This, at the time of running the test,
will expand into "ffmpeg -i INPUT_FILE -flags +bitexact -fflags
+bitexact -f framecrc -".
Command line convenience fate functions like framecrc() are not always
needed, for that matter. You can call ffmpeg directly as well.

In the case of tests that require decoding to float formats (most lossy
decoders, including wmapro and xma1/2), since you can't test
bitexactness you need to compare the decoded output during the test with
a "known good" reference decoded output. This is what atrac.mak does
with the pcm() command line function and the oneoff() comparison function.

To create the reference output if it doesn't already exist, you simply
run the test with GEN=1 from the command line, which will also place the
reference files in the samples folder for you if they are decoded
samples. For those, it's also best to create them using a x86_32 build
of ffmpeg and running the test with CPUFLAGS=0.
Keep in mind that raw pcm audio weighs a lot, so if possible, the total
decoded frames should be no more than 3 or so, especially for
multistream samples. You can do this with the -frames:a ffmpeg output
option if the source files have several more frames.

The available functions are in fate-run.sh. Some are command line (CMD)
functions to run ffmpeg/ffprobe with specific arguments, like
framecrc(), and others are to compare output (CMP), like oneoff(). But
for your needs, copying what atrac.mak and the "lossy" set of tests from
dca.mak do is enough.

More information about the ffmpeg-devel mailing list