From e45f4692804f48c7e8b4a4229bbd51d72a6a6d42 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 10 Sep 2015 23:29:31 +0200 Subject: [PATCH] audio/format: fix interlaved vs. non-interleaved conversions This mixed up the returned score for some interleaved/non-interleaved comparisons. Changing interleaving subtracted 1 point, while extending sample size by 1 byte also subtracted 1 point. (This scoring system is not ideal - it'd be much cleaner to do a 3-way sample format comparison instead, and sort the formats according to the comparison instead of the score.) --- audio/format.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/format.c b/audio/format.c index 2817462f8e..ee9d2a1909 100644 --- a/audio/format.c +++ b/audio/format.c @@ -203,7 +203,7 @@ int af_format_conversion_score(int dst_format, int src_format) } else { int bytes = af_fmt_to_bytes(dst_format) - af_fmt_to_bytes(src_format); if (bytes > 0) { - score -= bytes; // has to add padding + score -= 1 + bytes; // has to add padding } else if (bytes < 0) { score -= 1024 - bytes; // has to reduce bit depth }