diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-01-18 07:27:03 +0100 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-01-18 07:27:03 +0100 |
commit | ba9b2f1e49732d597009ba514b0132a50562cd10 (patch) | |
tree | fa05f5feb181823ac9d3b5682a835ff825de6914 /audio/chmap_sel.c | |
parent | e1993d5ad2bdf3dd4c26474aaa2370cbc9c1cd1b (diff) | |
parent | 7b4ccb3e9f58a0745b58e473ee6e60b381242813 (diff) | |
download | mpv-ba9b2f1e49732d597009ba514b0132a50562cd10.tar.bz2 mpv-ba9b2f1e49732d597009ba514b0132a50562cd10.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'audio/chmap_sel.c')
-rw-r--r-- | audio/chmap_sel.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/audio/chmap_sel.c b/audio/chmap_sel.c index 8ddb7131e7..fa1941e6f6 100644 --- a/audio/chmap_sel.c +++ b/audio/chmap_sel.c @@ -274,19 +274,25 @@ static bool mp_chmap_is_better(struct mp_chmap *req, struct mp_chmap *old, if (new_lost_r != old_lost_r) return new_lost_r < old_lost_r; + struct mp_chmap old_p = *old, new_p = *new; + mp_chmap_remove_na(&old_p); + mp_chmap_remove_na(&new_p); + + // If the situation is equal with replaced speakers, but the replacement is + // perfect for only one of them, let the better one win. This prefers + // inexact equivalents over exact supersets. + bool perfect_r_new = !new_lost_r && new_p.num <= old_p.num; + bool perfect_r_old = !old_lost_r && old_p.num <= new_p.num; + if (perfect_r_new != perfect_r_old) + return perfect_r_new; + int old_lost = mp_chmap_diffn(req, old); int new_lost = mp_chmap_diffn(req, new); - - // If the situation is equal with replaced speakers, but one of them loses - // less if no replacements are performed, pick the better one, even if it - // means an upmix. This prefers exact supersets over inexact equivalents. + // If the situation is equal with replaced speakers, pick the better one, + // even if it means an upmix. if (new_lost != old_lost) return new_lost < old_lost; - struct mp_chmap old_p = *old, new_p = *new; - mp_chmap_remove_na(&old_p); - mp_chmap_remove_na(&new_p); - // Some kind of upmix. If it's perfect, prefer the smaller one. Even if not, // both have equal loss, so also prefer the smaller one. // Drop padding channels (NA) for the sake of this check, as the number of |