[FFmpeg-devel] [PATCH] lavfi: support unknown channel layouts.

Nicolas George nicolas.george at normalesup.org
Sat Jan 5 14:25:16 CET 2013

Le quintidi 15 nivôse, an CCXXI, Stefano Sabatini a écrit :
> I'm still confused by this. This is computing a score in case in or
> out channel count is defined, then layouts are set to unknown. What is
> this "run and get 0"? Also why to run the computation if you already
> know the result? I can't propose a better wording since I don't know
> what the comment is trying to address in the first place, I'm stating
> that it is confusing since it is confusing at least *me*.

The code is about computing a score for a (in, out) pair of layouts, in
order to minimize the conversion loss.

The current code looks like that, in a simplified form, and assumes that
both layouts are known:

	score = 0;
	for (all matching and mismatching channels)
	    score += something;
	score += something for the rest;

what we want would be something like that:

	if (both layouts are known) {
	    compute score the same as before
	} else {
	    compute score taking only the number of channels into account

The problem with this version is that "compute score the same as before" has
been reindented, therefore making the patch less readable and making merging
changes from the fork harder to read. The code I propose is this:

	score = 0;
	if (not both layouts are known) {
	    compute score the same as before
	    in_layout = out_layout = 0
	add to score same as before

The rationale is that the "same as before" code does not do anything if both
layouts are 0.

> I'm a bit unconfortable with the heuristics choosen in
> swap_channel_layouts,

I agree they do not seem perfect, but changing anything in that area is a
completely different issue IMHO.

>			but I don't think this should block inclusion if
> it doesn't break anything/passes FATE and does what it is meant to do.

FATE passes and I can transcode audio with unknown layout with this patch.

I will send an updated patch series very soon.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130105/1f137e3c/attachment.asc>

More information about the ffmpeg-devel mailing list