[Ffmpeg-devel] [PATCH] THP PCM decoder (GSoC Qualification)

Marco Gerards mgerards
Wed Apr 4 12:33:21 CEST 2007


Michael Niedermayer <michaelni at gmx.at> writes:

Hi,

[...]

>> >> When I decode the other channel it seems to work as well.  So I assume
>> >> the problem is in how I fill the output buffer and how I tell ffmpeg
>> >> the format (stereo, interleaved samples) of this data.  How does one
>> >> in general deal with stereo from a decoder?
>> >
>> > stereo in ffmpeg is always
>> > channel0-sample0, channel1-sample0, channel0-sample1, channel1-sample1, channel0-sample2, channel1-sample2, ...
>> 
>> Well, I have this now and it works... kinda.  When I am playing either
>> one of the two channels as mono sound, it works.  When I am using both
>> channels, there is some kind of noise/cracks.  The noise is not there
>> all the time and it is not very loud, but I am mentioning this because
>> there must still be something that I do wrong...
>
> hmm, is AVCodecContext.channels set correctly
> does it also sound bad if you dump it to a file or let ffmpeg transcode it
> to pcm wav and then play that ... ?

Same problem...  I put it online, in case you want to hear it:
http://www.xs4all.nl/~mgerards/AfterCredits.wav

> [...]
>> +        init_get_bits(&gb, src, buf_size * 8);
>> +        src += buf_size;
>> +
>> +                    get_bits(&gb, 32); /* Channel size */
>> +        samplecnt = get_bits(&gb, 32);
>
> get_bits does have undefined behavior when reading more then 17-25 bits
> depending on the used bitreader, get_bits_long() is a better choice

Sorry, I forgot to change this.

> [...]
>
>> +                uint8_t index = get_bits (&gb, 4) & 7;
>
> iam curious what the removed bit does, is it always 0 ?

Yes.

--
Marco





More information about the ffmpeg-devel mailing list