[FFmpeg-devel] [PATCH] G.729 Pitch delay decoding & frame erasure case
Michael Niedermayer
michaelni
Thu Jun 25 20:42:55 CEST 2009
On Thu, Jun 25, 2009 at 06:58:25PM +0700, Vladimir Voroshilov wrote:
> 2009/6/25 Michael Niedermayer <michaelni at gmx.at>:
> > On Wed, Jun 24, 2009 at 01:02:27PM +0700, Vladimir Voroshilov wrote:
> >> Code in first patch decodes pitch delay from adaptive-codebook index.
> >>
> >> Code in second patch calculates pitch delay when frame erasure is
> >> detected (it is small,
> >> i can join both patches if you wish).
> > [...]
> >> @@ -305,6 +310,20 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
> >> ? ? ? ? ?gc_1st_index ?= get_bits(&gb, format.gc_1st_index_bits);
> >> ? ? ? ? ?gc_2nd_index ?= get_bits(&gb, format.gc_2nd_index_bits);
> >>
> >> + ? ? ? ?if (!i && bad_pitch)
> >> + ? ? ? ? ? ?pitch_delay_3x ? = 3 * ctx->pitch_delay_int_prev;
> >> + ? ? ? ?else if(!i)
> >> + ? ? ? ? ? ?pitch_delay_3x = ff_acelp_decode_8bit_to_1st_delay3(ac_index);
> >> + ? ? ? ?else if(i && packet_type == FORMAT_G729D_6K4)
> >> + ? ? ? ? ? ?pitch_delay_3x = ff_acelp_decode_4bit_to_2nd_delay3(ac_index,
> >> + ? ? ? ? ? ? ? ? ? ?av_clip(ctx->pitch_delay_int_prev-5,PITCH_DELAY_MIN,PITCH_DELAY_MAX-9));
> >> + ? ? ? ?else
> >> + ? ? ? ? ? ?pitch_delay_3x = ff_acelp_decode_5_6_bit_to_2nd_delay3(ac_index,
> >> + ? ? ? ? ? ? ? ? ? ?av_clip(ctx->pitch_delay_int_prev - 5, PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9));
> >
> > if(!i){
> > ? ?if(bad_pitch)
> > ? ?else
> > }else{
> > ? ?if(packet_type == FORMAT_G729D_6K4)
> > ? ?else
> > }
> >
> > and you format your duplicated code inconsistently
>
> Fixed both.
>
> P.S. Due to wrong patch order this patch uses undefined value "packet_type".
> I have separate patch for it, of course. Is usage of this variable ok?
> Related patch (small) can be posted here or in separate thread ?
>
>
> --
> Regards,
> Vladimir Voroshilov mailto:voroshil at gmail.com
> JID: voroshil at gmail.com, voroshil at jabber.ru
> ICQ: 95587719
> g729dec.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> 20f1c93136971a38fbc84a44798db472eae7a370 0005-Pitch-delay-decoding.172.patch
> From dc4b4b0e1bebdb0e2d7a147569aeb171e3f81b19 Mon Sep 17 00:00:00 2001
> From: Vladimir Voroshilov <voroshil at gmail.com>
> Date: Fri, 5 Jun 2009 01:29:45 +0700
> Subject: [PATCH 05/25] Pitch delay decoding
>
>
> diff --git ffmpeg-r19260/libavcodec/g729dec.c ffmpeg-r19260_v172/libavcodec/g729dec.c
> index 367e0ab..c9b8009 100644
> --- ffmpeg-r19260/libavcodec/g729dec.c
> +++ ffmpeg-r19260_v172/libavcodec/g729dec.c
> @@ -81,6 +81,8 @@ typedef struct {
> } G729FormatDescription;
>
> typedef struct {
> + int pitch_delay_int_prev; ///< integer part of previous subframe's pitch delay (4.1.3)
> +
> /// (2.13) LSP quantizer outputs
> int16_t past_quantizer_output_buf[MA_NP + 1][10];
> int16_t* past_quantizer_outputs[MA_NP + 1];
> @@ -238,6 +240,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
> uint8_t quantizer_2nd_lo; ///< second stage lower vector of quantizer (size in bits)
> uint8_t quantizer_2nd_hi; ///< second stage higher vector of quantizer (size in bits)
>
> + int pitch_delay_int[2]; // pitch delay, integer part
why an array of 2 instead of a single value?
[...]
[...]
> + av_clip(ctx->pitch_delay_int_prev - 5, PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9));
> + else
[...]
> + av_clip(ctx->pitch_delay_int_prev - 5, PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9));
can be factorized out
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090625/8a0b398f/attachment.pgp>
More information about the ffmpeg-devel
mailing list