[FFmpeg-devel] [PATCH] G.729 Add packet_type variable

Michael Niedermayer michaelni
Sun Jun 28 03:55:08 CEST 2009


On Sat, Jun 27, 2009 at 09:33:55AM +0700, Vladimir Voroshilov wrote:
> 2009/6/27 Michael Niedermayer <michaelni at gmx.at>:
> > On Sat, Jun 27, 2009 at 02:01:16AM +0700, Vladimir Voroshilov wrote:
> >> Due to wrong order of patches this patch was missing (and it was
> >> required for pitch delay decoding patch).
> >>
> >> --
> >> Regards,
> >> Vladimir Voroshilov ? ? mailto:voroshil at gmail.com
> >> JID: voroshil at gmail.com, voroshil at jabber.ru
> >> ICQ: 95587719
> >
> >> ?g729dec.c | ? ?9 +++++++++
> >> ?1 file changed, 9 insertions(+)
> >> fdb16f3c44b145a838a5e97780d5112bf86428dd ?0006-Add-packet_type.176.patch
> >> From a05604a16ab5b6536ec318c05c887b397a6d4dfe Mon Sep 17 00:00:00 2001
> >> From: Vladimir Voroshilov <voroshil at gmail.com>
> >> Date: Sat, 13 Jun 2009 00:24:23 +0700
> >> Subject: [PATCH 06/25] Add packet_type
> >>
> >>
> >> diff --git ffmpeg-r19281/libavcodec/g729dec.c ffmpeg-r19281_v176/libavcodec/g729dec.c
> >> index f193123..7961403 100644
> >> --- ffmpeg-r19281/libavcodec/g729dec.c
> >> +++ ffmpeg-r19281_v176/libavcodec/g729dec.c
> >> @@ -71,6 +71,12 @@
> >> ? */
> >> ?#define SHARP_MAX ? ? ? ? ? ? ? ? ?13017
> >>
> >> +typedef enum {
> >> + ? ?FORMAT_G729_8K = 0,
> >> + ? ?FORMAT_G729D_6K4,
> >> + ? ?FORMAT_COUNT,
> >> +} G729Formats;
> >> +
> >> ?typedef struct {
> >> ? ? ?uint8_t ac_index_bits[2]; ? ///< adaptive codebook index for second subframe (size in bits)
> >> ? ? ?uint8_t parity_bit; ? ? ? ? ///< parity bit for pitch delay
> >> @@ -233,6 +239,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
> >> ? ? ?int bad_pitch = 0; ? ? ? ?///< parity check failed
> >> ? ? ?int i;
> >> ? ? ?int16_t *tmp;
> >> + ? ?G729Formats packet_type;
> >> ? ? ?G729Context *ctx = avctx->priv_data;
> >> ? ? ?int16_t lp[2][11]; ? ? ? ? ? // (3.12)
> >> ? ? ?uint8_t ma_predictor; ? ? ///< switched MA predictor of LSP quantizer
> >> @@ -249,9 +256,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
> >> ? ? ?}
> >>
> >> ? ? ?if (buf_size == 10) {
> >> + ? ? ? ?packet_type = FORMAT_G729_8K;
> >> ? ? ? ? ?format = format_g729_8k;
> >> ? ? ? ? ?av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s");
> >> ? ? ?} else if (buf_size == 8) {
> >> + ? ? ? ?packet_type = FORMAT_G729D_6K4;
> >> ? ? ? ? ?format = format_g729d_6k4;
> >> ? ? ? ? ?av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s");
> >> ? ? ?} else {
> >
> > i dont see what this patch could be good for
> 
> 
> I have to differ code related to 8k/6k4 in several places (ppitch
> delay decoding, fixed-codebook vector, synthethis filter).
> Checking for bufer size (the only variable which differs between
> modes) inside code is possible but does not looks
> enough clear for me. Except, perhaps case like:
> #define BUFFER_SIZE_8k 10
> #define BUFFER_SIZE_64k 8
> 
> switch(buf_size) {
> case BUFFER_SIZE_8k:
> ...
> case BUFFER_SIZE_6k4:
> ...
> }
> 
> Comparing this to:
> switch(packet_type) {
> case PACKET_TYPE_8k:
> ...
> case PACKET_TYPE_6k4:
> ...
> }
> 
> The latter looks better for me. Of course this is just my preferences.
> If you think first case is better, i'll replace packet_type checks to
> buf_size checks.

I think this patch should be delayed until there is code actually using
buf_size/packet_type

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- 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/20090628/4894a592/attachment.pgp>



More information about the ffmpeg-devel mailing list