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

Vladimir Voroshilov voroshil
Sun Jun 28 05:40:46 CEST 2009


2009/6/28 Michael Niedermayer <michaelni at gmx.at>:
> 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

packet_type is already used in ok'ed pitch delay decoding and presents
in fixed-codebooc
vector patch wich is under discussion. It will be used near the call
to synthesis filter, but those code
in very questionable yet.

>
> [...]
> --
> Michael ? ? GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In a rich man's house there is no place to spit but his face.
> -- Diogenes of Sinope
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFKRs16YR7HhwQLD6sRAobwAJ9b4rEfUMkNZoV7y23yf/bJyfhknwCfcoK2
> R/pR0kgLrET5Qr2p/6DCvRQ=
> =EwMI
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>



-- 
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