Files
FFmpeg/libavcodec/dca_core.c
James Almer 57708daf61 avcodec/dca_core: export downmix matrix coefficients
$ ./ffmpeg -downmix stereo -i $fate-suite/dts/dcadec-suite/core_51_24_48_768_1.dtshd -y native.wav

Before:
$ ./ffmpeg -i $fate-suite/dts/dcadec-suite/core_51_24_48_768_1.dtshd -af aresample,aformat=channel_layouts=stereo -y swr.wav
[...]
[Parsed_aresample_0] [SWR] Using fltp internally between filters
[Parsed_aresample_0] [SWR] Matrix coefficients:
[Parsed_aresample_0] [SWR] FL: FL:0.414214 FR:0.000000 FC:0.292893 LFE:0.000000 SL:0.292893 SR:0.000000
[Parsed_aresample_0] [SWR] FR: FL:0.000000 FR:0.414214 FC:0.292893 LFE:0.000000 SL:0.000000 SR:0.292893
[Parsed_aresample_0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
[...]

$ tests/tiny_psnr.exe native.wav swr.wav s16
stddev:18907.06 PSNR: 10.80 MAXDIFF:51590 bytes:     8192/     8192

After:
$ ./ffmpeg -i $fate-suite/dts/dcadec-suite/core_51_24_48_768_1.dtshd -af aresample,aformat=channel_layouts=stereo -y swr.wav
[...]
[Parsed_aresample_0] [SWR] Using fltp internally between filters
[Parsed_aresample_0] [SWR] Custom matrix coefficients:
[Parsed_aresample_0] [SWR] FL: FL:-0.100006 FR:0.000000 FC:0.000000 LFE:0.000000 SL:-0.707092 SR:0.000000
[Parsed_aresample_0] [SWR] FR: FL:0.000000 FR:-0.100006 FC:0.000000 LFE:0.000000 SL:0.000000 SR:-0.707092
[Parsed_aresample_0] ch:6 chl:5.1(side) fmt:fltp r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
[...]

$ tests/tiny_psnr.exe native.wav swr.wav
stddev:    0.02 PSNR:129.44 MAXDIFF:    1 bytes:     8192/     8192

Signed-off-by: James Almer <jamrial@gmail.com>
2026-07-11 19:32:17 -03:00

85 KiB