diff options
author | wm4 <wm4@nowhere> | 2015-05-08 19:33:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-08 19:33:17 +0200 |
commit | 3560a50029e160f0606d0cdc6aa1da662bbcace8 (patch) | |
tree | c3f2b0b62d625ffc6075c58be656d18c1100cb71 /test | |
parent | d32b71d52e9a45c141d2bd132189db68613ab0fb (diff) | |
download | mpv-3560a50029e160f0606d0cdc6aa1da662bbcace8.tar.bz2 mpv-3560a50029e160f0606d0cdc6aa1da662bbcace8.tar.xz |
audio: redo channel map fallback selection
Instead of somehow having 4 different cases with each their own weight,
do it with a single function that decides which channel layout is the
better fallback.
This is simpler, and also introduces new (fixed) semantics. The new test
added to test/chmap_sel.c actually works now. This is a mixed case with
no perfect upmix or downmix, but the better choice is the one which
loses the least channels from the original layout.
One test also changes. If the input is 7.1(wide-side), and the available
layouts are 7.1 and 5.1(side), the latter is now chosen instead of the
former. This makes sense: both layouts contain 6 out of 8 channels from
the original layout, but the 5.1(side) one is smaller. This follows the
general logic. The 7.1 layout has FLC/RLC speakers instead of BL/BR,
and judging by the names, "front left center" is completely different
from "back left". If these should be exchangeable, a separate exception
would have to be added.
Diffstat (limited to 'test')
-rw-r--r-- | test/chmap_sel.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/chmap_sel.c b/test/chmap_sel.c index b014e954ea..914e00368f 100644 --- a/test/chmap_sel.c +++ b/test/chmap_sel.c @@ -41,7 +41,7 @@ static void test_mp_chmap_sel_fallback_incompatible(void **state) { } static void test_mp_chmap_sel_fallback_prefer_compatible(void **state) { - test_sel("7.1(wide-side)", "7.1", LAYOUTS("7.1", "5.1(side)")); + test_sel("7.1(wide-side)", "5.1(side)", LAYOUTS("7.1", "5.1(side)")); } static void test_mp_chmap_sel_fallback_prefer_closest_upmix(void **state) { @@ -68,6 +68,11 @@ static void test_mp_chmap_sel_fallback_no_downmix(void **state) { test_sel("5.1(side)", "7.1(rear)", LAYOUTS("stereo", "7.1(rear)")); } +static void test_mp_chmap_sel_fallback_minimal_downmix(void **state) { + test_sel("7.1", "fl-fr-lfe-fc-bl-br-flc-frc", + LAYOUTS("fl-fr-lfe-fc-bl-br-flc-frc", "3.0(back)")); +} + static void test_mp_chmap_sel_fallback_reject_unknown(void **state) { struct mp_chmap a; struct mp_chmap b; @@ -94,6 +99,7 @@ int main(void) { unit_test(test_mp_chmap_sel_fallback_mono_to_stereo), unit_test(test_mp_chmap_sel_fallback_stereo_to_stereo), unit_test(test_mp_chmap_sel_fallback_no_downmix), + unit_test(test_mp_chmap_sel_fallback_minimal_downmix), unit_test(test_mp_chmap_sel_fallback_reject_unknown), }; return run_tests(tests); |