[Ffmpeg-devel] [PATCH] THP PCM decoder (GSoC Qualification)
Wed Apr 4 03:21:43 CEST 2007
On Wed, Apr 04, 2007 at 02:44:18AM +0200, Marco Gerards wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> > Hi
> > On Tue, Apr 03, 2007 at 08:59:31PM +0200, Marco Gerards wrote:
> >> Michael Niedermayer <michaelni at gmx.at> writes:
> >> > Hi
> >> >
> >> > On Tue, Apr 03, 2007 at 03:21:56PM +0200, Marco Gerards wrote:
> >> > [...]
> >> >> In this new patch there are still two issues. For some reason the
> >> >> quality of the sound was not that good. It wasn't as bad as someone
> >> >> reported, for example he said that there were issues with mono sound.
> >> >> I can not reproduce this.
> >> >>
> >> >> The problem is in stereo sound. I have disabled stereo in this patch
> >> >> and the sound is just fine now. To be honest, I am not sure what the
> >> >> problem is. I have tried all kinds of things without much success.
> >> >> Perhaps it is better to commit this first. After that I can fix this
> >> >> with another patch.
> >> >
> >> > hmm did you properly interleave right and left channel samples? that is
> >> > does it work if you decode just the other channel?
> >> > could it be that the encoding is R+L,R-L ? instead of R,L
> >> I tried about anything. This is the first time I am working with
> >> audio, so I perhaps made a silly mistake.
> >> What I tried was interleaving the data send to the output buffer. The
> >> PCM data in the THP files is stored in packets. First x samples for
> >> the first channel are stored, after that x samples for the second
> >> channel.
> >> 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 ... ?
> + 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
> + uint8_t index = get_bits (&gb, 4) & 7;
iam curious what the removed bit does, is it always 0 ?
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
More information about the ffmpeg-devel