# [FFmpeg-devel] Channel mapping integration in af pan

Clément Bœsch ubitux at gmail.com
Wed Jan 18 14:17:03 CET 2012

```On Wed, Jan 18, 2012 at 01:58:12PM +0100, Nicolas George wrote:
> Le nonidi 29 nivôse, an CCXX, Clément Bœsch a écrit :
> > After the first attempt to have a channel mapping filter [1], Nicolas proposed
> > to integrate it in af pan filter instead. So here here is a patch set for that
> > purpose.
>
> Thanks.
>
> > Note: I noticed the union gain (double/int) doesn't work as expected when we
> > try "if (pan->gain.i[x][y])" with small coefficients.
>
> I am not sure what you mean here. Is it that coefficients smaller than 1/256
> are effectively rounded to 0, and therefore considered as such? If so, this
> is the expected behaviour: by working with integers, we trade accuracy for
> speed.
>

}
}
}
+    // gains are pures, init the channel mapping array
+    if (pan->pure_gains) {
+        for (i = 0; i < pan->nb_output_channels; i++) {
+            int ch_id = -1;
+            for (j = 0; j < pan->nb_input_channels; j++) {
+                if (pan->gain.d[i][j]) {

If I replace this with "if (pan->gain.i[i][j]) {", it doesn't work as expected:
since the int are 32 bits and the gains are stored in double (64),
pan->gain.i[0][3] will evaluate the first gain (low 32 bits of the second
double) instead of the 3rd. That's how I understand the issue.

+                    ch_id = j;
+                    break;
+                }
+            }
+            pan->ch[i] = ch_id;
+        }
+    } else {
// renormalize
for (i = 0; i < pan->nb_output_channels; i++) {
if (!((pan->need_renorm >> i) & 1))

[...]
>
> > Also, a more problematic issue is that this example (taken from the doc):
> >
> >   pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
> >
> > doesn't actually work ('Expected out channel name, got " FL < FL"'). I didn't
> > look closer though.
>
> Probably a place where I forgot to skip spaces. Does it work if you remove
> the space in front of FL?
>

Playing with the spacing doesn't seem to help.

> >		      BTW, I think quotes should be added in this example.
>
> I am not sure: quotes are for the shell, they are necessary when describing
> complete command lines, but for isolated examples this is less obvious.
>

Yes we may postpone this debate.

[...]

--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120118/42ed5f89/attachment.asc>
```