# Compression In G.729

Started by August 17, 2006
Hi all,
Now I am working with ITU-T's G.729 recommentation. I have one doubt.As you know In G.729 Codec the compression rate is 1/8. But here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10 bytes).Then how can we say this is 1/8th compression?
Please clear my doubt.
Bineesh Jose
Bineesh-

> Now I am working with ITU-T's G.729 recommentation. I have one
> doubt.As you know In G.729 Codec the compression rate is 1/8. But
> here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10
> bytes).Then how can we say this is 1/8th compression?
> Please clear my doubt.

Your mistake is to equate 80 words with 160 bytes. In a 10 msec frame,
there are 80 *PCM samples*, each sample 8-bit u-Law or A-Law. 80 bytes /
10 bytes = 1/8.

Maybe better to think "samples" instead of words.

-Jeff

Comment Embedded !

On Thu, 17 Aug 2006 b...@gmail.com wrote :
>Hi all,
> Now I am working with ITU-T's G.729 recommentation. I have one doubt.As you know In G.729 Codec the compression rate is 1/8. But here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10 bytes).Then how can we say this is 1/8th compression?

10 milisecond data = one frame;
One Frame = 80 samples of speech wave,
1 sample = 16bit data
16bit = 2 bytes

so conclusion is 1 frames = 80 samples of speech = 160 bytes.
So 160 bytes makes One frame, which is to be processed by ITU G729 Algorthim.

When you get the encoded data then the resultant size is 20bytes. or 10Samples (one Sameple = 16bit data)

HTH
Ranjeet Gupta

> Please clear my doubt.
> Thanks in advance
> Bineesh Jose
>
Ranjeet-

> Comment Embedded !
>
> On Thu, 17 Aug 2006 b...@gmail.com wrote :
>>Hi all,
>> Now I am working with ITU-T's G.729 recommentation. I have one
>> doubt.As you know In G.729 Codec the compression rate is 1/8. But
>> here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10
>> bytes).Then how can we say this is 1/8th compression?
>
> 10 milisecond data = one frame;
> One Frame = 80 samples of speech wave,
> 1 sample = 16bit data
> 16bit = 2 bytes
>
> so conclusion is 1 frames = 80 samples of speech = 160 bytes.
> So 160 bytes makes One frame, which is to be processed by ITU G729
> Algorthim.
>
> When you get the encoded data then the resultant size is 20bytes. or
> 10Samples (one Sameple = 16bit data)

No. G.729AB codec output framesize is 80 bits, or 10 bytes, as Bineesh
mentioned. Some applications transmit *two* frames per packet as the
voice payload, but that has to do with bandwidth efficiency, not the
compression rate of the codec. Here is a nice page with concise
information:

http://www.newport-networks.com/whitepapers/voip-bandwidth3.html

-Jeff
Ranjeet-

> The Compression ratio of G729A/B is 8, well I hope so, if you are
> saying that you are getting the "output framesize is 80 bits, or 10
> bytes", then it means that your frame size is 40 samples i.e 80
> bytes, RIGHT !
>
> Can you specifiaclly mentioned where I am wrong ? BTW I have Desigend
> the G729 Encoder/Decoder, by processing the frame size with 80samples
> each, means 160 bytes. And checked with parsing the ITU TestVectors
> to my encoder and decoder, :-) WHICH IS PERFECT after parsing
>
> Anyway please do correct me, where you think I am wrong.

The ITU implementation inputs 16-bit samples, then performs u-Law (or
A-Law) conversion internally. This allows 16-bit, 14-bit, etc. input data
as long as it's sign-extended.

In a typical application, input data may arrive as either 16-bit linear or
8-bit u/A Law PCM.

-Jeff
Ranjeet-

> You are correct, that "The ITU implementation inputs 16-bit samples"
> and it also specifically mentioned in ITU G729 A/B that the data
> to be processed is of 10miliseconds, and this results in 80sampels
> per frame, Now one sample is 16bit then number of Bytes are 160.
>
> and when this ITU G729 Algorthim is runned on this particular frame
> then the resultant size of the encoded frame is 1/8 times, which
> will be equal to 20 bytes or 10 samples.
>
> I persume My previous statment which I said is Correct ;-)
>
> Thats why we have the compression ratio of the G729 as 8times,

That's a 16x ratio -- 128 kbps down to 8 kbps. Output is 10 bytes, or 80 bits, every
10 msec.

> On your second satement i.e "then performs u-Law (or A-Law) conversion
> internally.", I Dont Agree, Please Clarify for my better understanding.
> may be I am missing some thing as I developed the ITU G729
> Encoder/Decoder 2 years back.

I think you are right. I worked on ITU G.729 5 years ago, so this part is fuzzy.
But hopefully we can agree on:

-10 msec frame interval

-80 16-bit input samples

-80-bit output frame

Really the only confusion is that Bineesh is trying to verify 8:1 compression ratio
from G.711 (8-bit samples) to G.729.

-Jeff
Jeff Brower--

On Sat, 19 Aug 2006 Jeff Brower wrote :
>Ranjeet-
>
> > Comment Embedded !
> >
> > On Thu, 17 Aug 2006 b...@gmail.com wrote :
> >>Hi all,
> >> Now I am working with ITU-T's G.729 recommentation. I have one
> >> doubt.As you know In G.729 Codec the compression rate is 1/8. But
> >> here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10
> >> bytes).Then how can we say this is 1/8th compression?
> >
> > 10 milisecond data = one frame;
> > One Frame = 80 samples of speech wave,
> > 1 sample = 16bit data
> > 16bit = 2 bytes
> >
> > so conclusion is 1 frames = 80 samples of speech = 160 bytes.
> > So 160 bytes makes One frame, which is to be processed by ITU G729
> > Algorthim.
> >
> > When you get the encoded data then the resultant size is 20bytes. or
> > 10Samples (one Sameple = 16bit data)
>
>No. G.729AB codec output framesize is 80 bits, or 10 bytes, as Bineesh
>mentioned. Some applications transmit *two* frames per packet as the
>voice payload, but that has to do with bandwidth efficiency, not the
>compression rate of the codec. Here is a nice page with concise
>information:

The Compression ratio of G729A/B is 8, well I hope so, if you are
saying that you are getting the "output framesize is 80 bits, or 10
bytes", then it means that your frame size is 40 samples i.e 80
bytes, RIGHT !

Can you specifiaclly mentioned where I am wrong ? BTW I have Desigend
the G729 Encoder/Decoder, by processing the frame size with 80samples
each, means 160 bytes. And checked with parsing the ITU TestVectors
to my encoder and decoder, :-) WHICH IS PERFECT after parsing

Anyway please do correct me, where you think I am wrong.

~Ranjeet

Jeff Brower

On Mon, 21 Aug 2006 Jeff Brower wrote :
>Ranjeet-
>
> > You are correct, that "The ITU implementation inputs 16-bit samples"
> > and it also specifically mentioned in ITU G729 A/B that the data
> > to be processed is of 10miliseconds, and this results in 80sampels
> > per frame, Now one sample is 16bit then number of Bytes are 160.
> >
> > and when this ITU G729 Algorthim is runned on this particular frame
> > then the resultant size of the encoded frame is 1/8 times, which
> > will be equal to 20 bytes or 10 samples.
> >
> > I persume My previous statment which I said is Correct ;-)
> >
> > Thats why we have the compression ratio of the G729 as 8times,
>
>That's a 16x ratio -- 128 kbps down to 8 kbps. Output is 10 bytes, or 80 bits, every
>10 msec.
>
> > On your second satement i.e "then performs u-Law (or A-Law) conversion
> > internally.", I Dont Agree, Please Clarify for my better understanding.
> > may be I am missing some thing as I developed the ITU G729
> > Encoder/Decoder 2 years back.
>
>I think you are right. I worked on ITU G.729 5 years ago, so this part is fuzzy.
>But hopefully we can agree on:
>
> -10 msec frame interval
>
> -80 16-bit input samples
>
> -80-bit output frame
>

Yes I do agree as what you have mentioned is correct.

>Really the only confusion is that Bineesh is trying to verify 8:1 compression ratio
> from G.711 (8-bit samples) to G.729.
>
I hope by this time it would had cleared all his doubts, if he

Thanks
Ranjeet.
>-Jeff
Jeff Brower

On Mon, 21 Aug 2006 Jeff Brower wrote :
>Ranjeet-
>
> > The Compression ratio of G729A/B is 8, well I hope so, if you are
> > saying that you are getting the "output framesize is 80 bits, or 10
> > bytes", then it means that your frame size is 40 samples i.e 80
> > bytes, RIGHT !
> >
> > Can you specifiaclly mentioned where I am wrong ? BTW I have Desigend
> > the G729 Encoder/Decoder, by processing the frame size with 80samples
> > each, means 160 bytes. And checked with parsing the ITU TestVectors
> > to my encoder and decoder, :-) WHICH IS PERFECT after parsing
> >
> > Anyway please do correct me, where you think I am wrong.
>
>The ITU implementation inputs 16-bit samples, then performs u-Law (or
>A-Law) conversion internally. This allows 16-bit, 14-bit, etc. input data
>as long as it's sign-extended.

You are correct, that "The ITU implementation inputs 16-bit samples"
and it also specifically mentioned in ITU G729 A/B that the data
to be processed is of 10miliseconds, and this results in 80sampels
per frame, Now one sample is 16bit then number of Bytes are 160.

and when this ITU G729 Algorthim is runned on this particular frame
then the resultant size of the encoded frame is 1/8 times, which
will be equal to 20 bytes or 10 samples.

I persume My previous statment which I said is Correct ;-)

Thats why we have the compression ratio of the G729 as 8times,

On your second satement i.e "then performs u-Law (or A-Law) conversion internally.", I Dont Agree, Please Clarify for my better understanding.
may be I am missing some thing as I developed the ITU G729
Encoder/Decoder 2 years back.

Yes one thing I persume that you mey be confused on one issue.
As we know that G711 Input parameter is also same as what is of
G729 i.e 8Khz sampled frequency and 16bit data. and in this the
encoded data is obtained by either A-Law or u-Law, That is what you
are talking ?
>In a typical application, input data may arrive as either 16-bit linear or 8-bit u/A Law PCM.

If you mean to say that you can pass 8-bit u/A Law PCM data to the G729
encoder then I am sure that your encoder will fail to encode.

~Ranjeet Gupta

>
>-Jeff
>
Jeff:

I believe Ranjeet's numbers are not referring to G729 other than specifying
10 ms as the "comparison period". His numbers are perfectly correct for the
raw audio. His mistake is the same as the first poster: the comparison point
for compression is not normally the raw audio but rather G.711.

Chuck

_____

From: s... [mailto:s...] On
Behalf Of Jeff Brower
Sent: Saturday, August 19, 2006 10:05 AM
To: Ranjeet Gupta
Cc: Bineesh Jose; s...
Subject: Re: [speechcoding] Compression In G.729

Ranjeet-

> Comment Embedded !
>
> On Thu, 17 Aug 2006 bineeshjose@
gmail.com wrote :
>>Hi all,
>> Now I am working with ITU-T's G.729 recommentation. I have one
>> doubt.As you know In G.729 Codec the compression rate is 1/8. But
>> here in 10 ms, 80 words(160 bytes) are compressed into 80 bits(10
>> bytes).Then how can we say this is 1/8th compression?
>
> 10 milisecond data = one frame;
> One Frame = 80 samples of speech wave,
> 1 sample = 16bit data
> 16bit = 2 bytes
>
> so conclusion is 1 frames = 80 samples of speech = 160 bytes.
> So 160 bytes makes One frame, which is to be processed by ITU G729
> Algorthim.
>
> When you get the encoded data then the resultant size is 20bytes. or
> 10Samples (one Sameple = 16bit data)

No. G.729AB codec output framesize is 80 bits, or 10 bytes, as Bineesh
mentioned. Some applications transmit *two* frames per packet as the
voice payload, but that has to do with bandwidth efficiency, not the
compression rate of the codec. Here is a nice page with concise
information:

http://www.newport-

networks.com/whitepapers/voip-bandwidth3.html

-Jeff