[FFmpeg-devel] [PATCH] G.729 initialization routine (skeleton)

Vladimir Voroshilov voroshil
Wed Jun 10 20:14:56 CEST 2009

2009/6/10 Michael Niedermayer <michaelni at gmx.at>:
> On Wed, Jun 10, 2009 at 01:55:08AM +0700, Vladimir Voroshilov wrote:


>> OMG! I've mixed bit_rate and sample_rate.
>> Well...
>> First look give me (at least for 8k and 6k4. i'll finally drop out 4k4
>> in next patch since i've no method to test it):
>> avctx->sample_rate=8000
>> avctx->bit_rate = 8000 and 6400 respectively
>> avctx->frame_size = avctx->sample_rate /100 (1 packet = 10ms)
>> ctx->subframe_size=avctx->frame_size/2
>> ctx->packed_frame_size = avctx-bit_rate / 800 (1 packet = 10ms and bits->bytes)
>> ctx->unpacked_frame_size = avctx->frame_size * sizeof(int16_t)
>> No format tables at this stage are required (they will due to
>> different bits allocation in packet)!
>> I'll test and fix all these calculations in next patch, but i have
>> several question now:
>> 1. Who should initialize sample_rate and frame_size (decoder or demuxer) ?
> whoever is able to
> the demuxer will set it if it can, the decoder should set it if there is a
> sample_rate stored in the bitstream
>> 2. Can i be sure that output buffer passed to decode_frame will be at
>> least frame_size*2 long or i have to check this explicitly ?
> if you set frame_size during init then you should not need an explicit
> check, that said, this is one of the things i dont mind if done redundantly
>> 3. What should i pass instead of X, Y and Z to av_set_pts(st, X, Y, Z)
>> in demuxer to ensure that all packets will be
>> packets_frame_size long (10 and 8 bytes respectively) ? av_set_pts(st,
>> 10, bit_rate, sample_rate) if all packets are 10ms ?
> which demuxer ?

ACT format.

Now about patch.
Dropping out 4.4kbit/s mode made things more easy.
I don't need ctx->subframe and MAX_SUBRAME_SIZE anymore (replaced with
since the size is the same in all G.729 modes.

I've also simplified initialization and added G.729D support too (will
help clarify things, i hope).
Here is updated patch. Firstly i planned add G.729D later, but
describing things more and more harder without it.

I'm also attaching patch for renaming MAX_SUBFRAME_SIZE and
ctx->subframe_size to SUBFRAME_SIZE for already committed code.

Vladimir Voroshilov     mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-subframe_size-SUBFRAME_SIZE.129.patch
Type: text/x-diff
Size: 2292 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090611/2a5e77d4/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Initialization-routine.129.patch
Type: text/x-diff
Size: 1699 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090611/2a5e77d4/attachment-0001.patch>

More information about the ffmpeg-devel mailing list