[FFmpeg-devel] Channel mapping integration in af pan
Nicolas George
nicolas.george at normalesup.org
Wed Jan 18 14:31:39 CET 2012
Le nonidi 29 nivôse, an CCXX, Clément Bœsch a écrit :
> + // 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.
Oh, yes, I see. At that point, the coefficients are still stored as double,
so you _must_ use them as such. Unions are not, in general, an automatic
conversion system.
Imagine it was written that way:
gain_d = malloc(n * n * sizeof(double));
/* before */
gain_i = malloc(n * n * sizeof(int));
for (i, j)
gain_i[i][j] = 256 * gain_d[i][j];
free(gain_d);
/* after */
In the "before" code, you can and must only use gain_d, and in the "after"
code, you can and must only use gain_i.
> Playing with the spacing doesn't seem to help.
Then I will try to search what is wrong when I have time.
Regards,
--
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/20120118/040caacd/attachment.asc>
More information about the ffmpeg-devel
mailing list