[FFmpeg-devel] [PATCH] G.729 main decoding routine (skeleton)
Vladimir Voroshilov
voroshil
Sun Jun 14 04:38:26 CEST 2009
2009/6/11 Michael Niedermayer <michaelni at gmx.at>:
> On Thu, Jun 11, 2009 at 01:17:02AM +0700, Vladimir Voroshilov wrote:
>> Updated patch with skeleton of main decoding routine.
>>
>>
>> --
>> Regards,
>> Vladimir Voroshilov ? ? mailto:voroshil at gmail.com
>> JID: voroshil at gmail.com, voroshil at jabber.ru
>> ICQ: 95587719
>
>> ?g729dec.c | ? 27 ++++++++++++++++++++++++---
>> ?1 file changed, 24 insertions(+), 3 deletions(-)
>> 197d04b2532d02b1d2761bdb01f92bbfaf571c3e ?0003-Main-decoding-routine.129.patch
>> From 30c91b86021c0c3359e5a5712999e61eac727ba7 Mon Sep 17 00:00:00 2001
>> From: Vladimir Voroshilov <voroshil at gmail.com>
>> Date: Thu, 4 Jun 2009 19:30:31 +0700
>> Subject: [PATCH] Main decoding routine
>>
>>
>> diff --git ffmpeg-r19127.orig/libavcodec/g729dec.c ffmpeg-r19127.mod/libavcodec/g729dec.c
>> index bbf75be..ad42bdb 100644
>> --- ffmpeg-r19127.orig/libavcodec/g729dec.c
>> +++ ffmpeg-r19127.mod/libavcodec/g729dec.c
>> @@ -81,6 +81,10 @@ typedef struct {
>> ? ? ?int mr_energy;
>> ?} G729FormatDescription;
>>
>> +typedef struct {
>> + ? ?int bytes_per_frame; ? ? ? ?///< input frame size (in bytes)
>> +} ?G729Context;
>> +
>> ?/**
>> ? * \brief pseudo random number generator
>> ? */
>> @@ -107,7 +111,13 @@ static inline int get_parity(uint8_t value)
>> ? */
>> ?static av_cold int decoder_init(AVCodecContext * avctx)
>> ?{
>> - ? ?if ((avctx->bit_rate != 8000) && (avctx->bit_rate != 6400)) {
>> + ? ?G729Context* ctx = avctx->priv_data;
>> +
>> + ? ?if (avctx->bit_rate == 8000) {
>> + ? ? ? ?ctx->bytes_per_frame = 10;
>> + ? ?} else if (avctx->bit_rate == 6400) {
>> + ? ? ? ?ctx->bytes_per_frame = 8;
>> + ? ?} else {
>> ? ? ? ? ?av_log(avctx, AV_LOG_ERROR, "Bitrate %d is not supported.\n", avctx->sample_rate);
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^^^^^^^^^^ ? ? ? ? ? ? ? ? ? ? ? ?^^^^^^^^^^^^^^^
> also, can they be distinguished based on the packet size?
> if so this is preferable, it would possibly allow mixing different types
> (not sure if the spec allows that but i would be surprised if not)
>
Done as suggested.
I've also checked mode with interleaved 6.4kbit/s and 8kbit/s packets
and it works fine.
Updated patch was posted in "G729 parameters decoding" mail thread,
since two patches were merged.
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
More information about the ffmpeg-devel
mailing list