This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit c16840b826584b7682078cec4d5e8405b06f03c8
Author:     James Almer <[email protected]>
AuthorDate: Fri Jun 12 15:08:03 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Sat Jul 11 19:32:17 2026 -0300

    avcodec/dca_xll: export downmix matrix coefficients
    
    Only for primary channel sets if they embeed coefficients for now.
    
    $ ./ffmpeg -downmix stereo -i 
$fate-suite/dts/dcadec-suite/xll_51_24_48_768.dtshd -y native.wav
    
    Before:
    $ ./ffmpeg -i $fate-suite/dts/dcadec-suite/xll_51_24_48_768.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:s32p r:48000Hz -> ch:2 
chl:stereo fmt:s16 r:48000Hz
    [...]
    
    $ tests/tiny_psnr.exe native.wav swr.wav
    stddev:21178.05 PSNR:  9.81 MAXDIFF:49613 bytes:     8192/     8192
    
    After:
    $ ./ffmpeg -i $fate-suite/dts/dcadec-suite/xll_51_24_48_768.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:s32p r:48000Hz -> ch:2 
chl:stereo fmt:s16 r:48000Hz
    [...]
    
    $ tests/tiny_psnr.exe native.wav swr.wav
    stddev:    0.71 PSNR: 99.22 MAXDIFF:    1 bytes:     8192/     8192
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/dca_xll.c                              | 11 +++++++++++
 tests/fate/dca.mak                                |  4 ++++
 tests/ref/fate/dca-xll_51_24_48_768-dmix_2_matrix |  1 +
 3 files changed, 16 insertions(+)

diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c
index 6eedad7eb8..0f3c651a9c 100644
--- a/libavcodec/dca_xll.c
+++ b/libavcodec/dca_xll.c
@@ -1499,6 +1499,17 @@ int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame 
*frame)
     } else if (request_mask != s->output_mask && p->dmix_type == 
DCA_DMIX_TYPE_LtRt) {
         matrix_encoding = AV_MATRIX_ENCODING_DOLBY;
     }
+
+    // TODO: Support downmix when the primary channel set lacks coeffs.
+    if (p->ch_mask == s->output_mask && !dca->request_channel_layout &&
+        p->dmix_embedded && (p->dmix_type == DCA_DMIX_TYPE_LoRo ||
+                             p->dmix_type == DCA_DMIX_TYPE_LtRt)) {
+        ret = ff_dca_export_downmix_matrix(avctx, frame, p->dmix_type, 
s->output_mask,
+                                           p->dmix_coeff);
+        if (ret < 0)
+            return ret;
+    }
+
     if ((ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 
0)
         return ret;
 
diff --git a/tests/fate/dca.mak b/tests/fate/dca.mak
index e083d6fd28..43c961a361 100644
--- a/tests/fate/dca.mak
+++ b/tests/fate/dca.mak
@@ -64,6 +64,10 @@ $(FATE_DCADEC_LOSSY): CMP = oneoff
 $(FATE_DCADEC_LOSSY): CMP_UNIT = f32
 $(FATE_DCADEC_LOSSY): FUZZ = 9
 
+# lossless downmix tests
+FATE_DCADEC_LOSSLESS_s24le += fate-dca-xll_51_24_48_768-dmix_2_matrix
+fate-dca-xll_51_24_48_768-dmix_2_matrix: CMD = fmtstdout "streamhash -hash 
md5" -i $(TARGET_SAMPLES)/dts/dcadec-suite/xll_51_24_48_768.dtshd -c:a 
pcm_s24le -af aresample=tsf=s32p,aformat=channel_layouts=stereo
+
 FATE_DCA_FFMPEG_FFPROBE-$(call FRAMEMD5, DTSHD, DCA, ARESAMPLE_FILTER 
PCM_S16LE_ENCODER) += $(FATE_DCADEC_LOSSLESS_s16le)
 FATE_DCA_FFMPEG_FFPROBE-$(call FRAMEMD5, DTSHD, DCA, ARESAMPLE_FILTER 
PCM_S24LE_ENCODER) += $(FATE_DCADEC_LOSSLESS_s24le)
 FATE_DCA-$(call FILTERDEMDECENCMUX, ARESAMPLE, DTSHD, DCA, PCM_F32LE, 
PCM_F32LE, PIPE_PROTOCOL) += $(FATE_DCADEC_LOSSY)
diff --git a/tests/ref/fate/dca-xll_51_24_48_768-dmix_2_matrix 
b/tests/ref/fate/dca-xll_51_24_48_768-dmix_2_matrix
new file mode 100644
index 0000000000..c1c99a39de
--- /dev/null
+++ b/tests/ref/fate/dca-xll_51_24_48_768-dmix_2_matrix
@@ -0,0 +1 @@
+0,a,MD5=6395033e2bfda75a343deb3a61934d42

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to