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

Michael Niedermayer michaelni
Wed Jun 10 23:10:55 CEST 2009


On Thu, Jun 11, 2009 at 01:20:40AM +0700, Vladimir Voroshilov wrote:
> 2009/6/11 Diego Biurrun <diego at biurrun.de>:
> > On Thu, Jun 11, 2009 at 01:14:56AM +0700, Vladimir Voroshilov wrote:
> >>
> >> --- ffmpeg-r19127.orig/libavcodec/g729dec.c
> >> +++ ffmpeg-r19127.mod/libavcodec/g729dec.c
> >> @@ -97,11 +97,37 @@ static inline int get_parity(uint8_t value)
> >>
> >> +/**
> >> + * Initializes G.729 decoder
> >
> > End sentences in periods.
> 
> Oops. fixed.
> 
> 
> 
> -- 
> Regards,
> Vladimir Voroshilov     mailto:voroshil at gmail.com
> JID: voroshil at gmail.com, voroshil at jabber.ru
> ICQ: 95587719

>  g729dec.c |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> d49989a613729b2a9e7878fc08ae6d452f2b73fe  0002-Initialization-routine.130.patch
> From 0508e4986565f87307eb4825b02b8d8672855fb0 Mon Sep 17 00:00:00 2001
> From: Vladimir Voroshilov <voroshil at gmail.com>
> Date: Fri, 5 Jun 2009 00:47:25 +0700
> Subject: [PATCH] Initialization routine
> 
> 
> diff --git ffmpeg-r19127.orig/libavcodec/g729dec.c ffmpeg-r19127.mod/libavcodec/g729dec.c
> index ab39a92..300f48c 100644
> --- ffmpeg-r19127.orig/libavcodec/g729dec.c
> +++ ffmpeg-r19127.mod/libavcodec/g729dec.c
> @@ -97,11 +97,37 @@ static inline int get_parity(uint8_t value)
>     return (0x6996966996696996ULL >> (value >> 2)) & 1;
>  }
>  
> +/**
> + * Initializes G.729 decoder.
> + * @param avctx private data structure
> + * @return 0 on success, non-zero otherwise

<0 is error in lav*
also its not really needed to document the init&decode functions as they
are the same for all codecs ...


> + *
> + * For decoder initialization Table 9 from section 4.3 of the specification
> + * is used.
> + */

and if the numbering changes in the spec this becomes meaningless, not
that it is too meaningfull anyway
things have names, even in the spec, use them instead of arbitrary
"page numbers"


> +static av_cold int decoder_init(AVCodecContext * avctx)
> +{
> +    if ((avctx->bit_rate != 8000) && (avctx->bit_rate != 6400)) {
> +        av_log(avctx, AV_LOG_ERROR, "Bitrate %d is not supported.\n", avctx->sample_rate);
> +        return AVERROR_NOFMT;
> +    }
> +

isnt there already such a check somewhere
also if the 2 types can be mixed there can be intermediate bitrates


> +    if (avctx->sample_rate != 8000) {
> +        av_log(avctx, AV_LOG_ERROR, "Sample rate %d is not supported.\n", avctx->sample_rate);
> +        return AVERROR_NOFMT;
> +    }
> +

this check is unneeded

>      if (avctx->channels != 1) {
>          av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels);
>          return AVERROR_NOFMT;
>      }
>  
> +    /* Both 8kbit/s and 6.4kbit/s modes uses two subframes per frame. */
> +    avctx->frame_size = SUBFRAME_SIZE << 1;
> +
> +    return 0;
> +}
> +
>          ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
>                                       fc + pitch_delay_int[i],
>                                       fc, 1 << 14,
> -- 
> 1.6.0.4
> 

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- 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/20090610/c88403ee/attachment.pgp>



More information about the ffmpeg-devel mailing list