[FFmpeg-devel] [PATCH] ffmpeg2theora 6to2channel-resample.patch
Michael Niedermayer
michaelni at gmx.at
Sun May 1 20:17:50 CEST 2011
On Sun, May 01, 2011 at 07:50:47PM +0200, Reimar Döffinger wrote:
> Just some quick comments
>
> On Sun, May 01, 2011 at 07:38:27PM +0200, Michael Niedermayer wrote:
> > +/*
> > +*/
> > +static short clip_short(int v) {
> > + if (v < -32768)
> > + v = -32768;
> > + else if (v > 32767)
> > + v = 32767;
> > + return (short) v;
> > +}
>
> Looks like a bad reimplementation of av_clip_int16,
> and generally "short" shouldn't be used but that's
> already in existing code...
>
> > for(i=0;i<n;i++) {
> > - *output1++ = *input++;
> > - *output2++ = *input++;
> > + if (channels == 2) {
> > + /* simple stereo to stereo. Input is: l, r */
> > + l = input[0];
> > + r = input[1];
> > + } else if (channels == 6) {
> > + /* 5.1 to stereo input: [fl, fr, c, lfe, rl, rr] */
> > + int fl,fr,c,rl,rr,lfe;
> > + fl = input[0];
> > + fr = input[1];
> > + c = input[2];
> > + lfe = input[3];
> > + rl = input[4];
> > + rr = input[5];
> > +
> > + l = clip_short(fl + (0.5 * rl) + (0.7 * c));
> > + r = clip_short(fr + (0.5 * rr) + (0.7 * c));
> > + } else {
> > + /* channels must be 3-5, or >= 7. l, c, r, ? */
> > + l = input[0];
> > + r = input[2];
> > + }
>
> The ifs should hardly be inside the loop.
of course, i was just posting what i found in ffmpeg2theora.
in case someone wants to clean any of it up / apply it ...
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20110501/a0ab0848/attachment.asc>
More information about the ffmpeg-devel
mailing list