[FFmpeg-devel] [PATCH] WMA Voice decoder

Ronald S. Bultje rsbultje
Wed Feb 10 17:55:47 CET 2010


Hi,

Last response item on my list, after this a new patch will follow:

On Mon, Feb 1, 2010 at 2:35 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Sun, Jan 31, 2010 at 09:46:43PM -0500, Ronald S. Bultje wrote:
>> On Sat, Jan 30, 2010 at 6:48 PM, Reimar D?ffinger
>> <Reimar.Doeffinger at gmx.de> wrote:
>> >> + ? ? ? ? ? ?while (fcb->x[fcb->n] < 0)
>> >> + ? ? ? ? ? ? ? ?fcb->x[fcb->n] += fcb->pitch_lag;
>> >
>> > What are the values here? This might be a particularly slow way to calculate
>> > if (fcb->x[fcb->n] < 0)
>> > ? ?fcb->x[fcb->n] = (fcb->x[fcb->n] % fcb->pitch_lag) + fcb->pitch_lag;
>>
>> They could be 1-2 pitch values below zero, so -10, -20 or so.
>
> Then it might make sense (speed wise, it might be too ugly to do it if the speed
> does not make a difference) to do
> if (fcb->x[fcb->n] < 0) {
> ?? ?fcb->x[fcb->n] += fcb->pitch_lag;
> ? ?if (fcb->x[fcb->n] < 0) {
> ?? ? ? ?fcb->x[fcb->n] += fcb->pitch_lag;
> }

I looked at this, it's a little more complicated. fcb->x is set to any
value of pulse_off - range / 2, where pulse_off is guaranteed >= 0 and
range is 16 (pitch <= 32) or 24 (pitch > 32). That means that it's
always within 1 pitch value, as long as pitch >= 8 [*]. Right now,
pitch should simply be >= 1 (note how the binary doesn't actually
check for this, easy crasher, I added a check just to be sure). Min
pitch is sample-rate dependent, so if I require min_pitch to be >= 8
(samplerate=3122) instead of 1 (samplerate=322). Is this an acceptable
compromise? Then, in the above while-loop that you quoted from me, I
could simply s/while/if/ and it'd work.

Ronald



More information about the ffmpeg-devel mailing list