[FFmpeg-devel] [PATCH] G.729 main decoding routine (skeleton)
Michael Niedermayer
michaelni
Wed Jun 10 20:38:16 CEST 2009
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)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- 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/89c266e9/attachment.pgp>
More information about the ffmpeg-devel
mailing list