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

Vladimir Voroshilov voroshil
Sat Jun 6 19:18:10 CEST 2009


2009/6/6 Michael Niedermayer <michaelni at gmx.at>:
> On Sat, Jun 06, 2009 at 11:27:52PM +0700, Vladimir Voroshilov wrote:
>> 2009/6/6 Michael Niedermayer <michaelni at gmx.at>:
>> > On Sat, Jun 06, 2009 at 08:06:40PM +0700, Vladimir Voroshilov wrote:
>> >> 2009/6/6 Michael Niedermayer <michaelni at gmx.at>:
>> >> > On Sat, Jun 06, 2009 at 12:56:01PM +0700, Vladimir Voroshilov wrote:
>> >> >> 2009/6/6 Diego Biurrun <diego at biurrun.de>:
>> >> >> > On Sat, Jun 06, 2009 at 01:01:02AM +0200, Stefano Sabatini wrote:
>> >> >> >> On date Friday 2009-06-05 14:24:39 +0700, Vladimir Voroshilov encoded:
>>
>> [...]
>>
>> >> >> diff --git ffmpeg-r19120.orig/libavcodec/g729dec.c ffmpeg-r19120.mod/libavcodec/g729dec.c
>> >> >> index f224a37..dd55895 100644
>> >> >> --- ffmpeg-r19120.orig/libavcodec/g729dec.c
>> >> >> +++ ffmpeg-r19120.mod/libavcodec/g729dec.c
>> >> >> @@ -81,6 +81,16 @@ typedef struct {
>> >> >> ? ? ?int mr_energy;
>> >> >> ?} G729FormatDescription;
>> >> >>
>> >> >
>> >> >> +typedef enum {
>> >> >> + ? ?FORMAT_G729_8K = 0,
>> >> >> + ? ?FORMAT_G729_4K4,
>> >> >> +} G729Formats;
>> >> >
>> >> > this can be replaced by direct sample_rate checks in the code
>> >>
>> >> You suggest using:
>> >>
>> >> ========================
>> >> typedef G729Context{
>> >> ? int mr_energy
>> >> }
>> >>
>> >> decode()
>> >> {
>> >> ?some_routine(ctx->mr_energy);
>> >> }
>> >> init ()
>> >> {
>> >> ?if (sample_rate== 1)
>> >> ? ctx->mr_energy = 1;
>> >> ?else if (sample_rate == 2)
>> >> ? ctx->mr_energy = 3;
>> >> }
>> >> =======================
>> >
>> > no 1 and 2 are no sample rates
>> > your code did check AVCodecContext.sample_rate and then sets format
>> > based on it and then checks format everywhere, you can check sample_rate
>> > directly
>> > please remove the intermediate step not rename it
>> >
>>
>> In other words i should pass AVCodecContext instead of G729Context
>> when format check was required and check for
>> avctx->sample_rate instead of ctx->sample_rate or ctx->format. Also i
>> should use ctx->mr_energy (initialized in init routine once)
>> instead of formats[ctx->format].mr_energy (the same for other
>> G729FormatDescription members).
>>
>> Am i right ?
>
> i cant comment on how you should handle things in future patches, just that
> in the current patch format is redundant.

Ok. Will decide later.

Here is patch without format.

-- 
Regards,
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: 0002-Initialization-routine.122.patch
Type: text/x-diff
Size: 1847 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090607/e4141a81/attachment.patch>



More information about the ffmpeg-devel mailing list