Jerry Avins <jya@ieee.org> wrote in message news:> > Luiz, > > Your writing "signal" where I would have used "sign" puzzled me, but > only for a second. I'm glad you brought out the XOR to flip alternate > bits. This thread showed how easy it is to overlook it when discussing > the format, even for those of us who know. I had actually forgotten the > implied most-significant 1 bit, but the least-significant bit puzzles > me. Isn't that just a programmer's arithmetic choice, or a common > processing convention? It's hard for me to see it as part of the defined > meaning of the original code. > > JerryHello Jerry, Sorry about the "signal" mistake. Try to forgive me, I'm not used to write in english. In portuguese the word "sinal" means signal and also sign. The least-significant bit is defined in G701, it is not a choice. Luiz Carlos
Combining G711 streams
Started by ●August 7, 2003
Reply by ●August 18, 20032003-08-18
Reply by ●August 18, 20032003-08-18
Luiz Carlos wrote:> > Jerry Avins <jya@ieee.org> wrote in message news: > > > > Luiz, > > > > Your writing "signal" where I would have used "sign" puzzled me, but > > only for a second. I'm glad you brought out the XOR to flip alternate > > bits. This thread showed how easy it is to overlook it when discussing > > the format, even for those of us who know. I had actually forgotten the > > implied most-significant 1 bit, but the least-significant bit puzzles > > me. Isn't that just a programmer's arithmetic choice, or a common > > processing convention? It's hard for me to see it as part of the defined > > meaning of the original code. > > > > Jerry > > Hello Jerry, > > Sorry about the "signal" mistake. Try to forgive me, I'm not used to > write in english. In portuguese the word "sinal" means signal and also > sign. > > The least-significant bit is defined in G701, it is not a choice. > > Luiz CarlosGood Lord! I wasn't criticizing, but merely passing on my amusement. If I wrote any foreign language as well as you write English, I would be disgustingly proud. Can you explain the significance of an implied least-significant one? Is it made explicit for conversion to 12 bits, or used only when adding two streams? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 19, 20032003-08-19
Jerry Avins <jya@ieee.org> wrote in message news:> > Can you explain the significance of an implied > least-significant one? Is it made explicit for conversion to 12 bits, or > used only when adding two streams? > > JerryThe implicit LSb is part of the conversion to 13 bits (A-LAW). You get more 3 dB of SNR. As I said, it's a kind of rounding. For example, let's take the linear number (13 bits): 0b0 0000 1001 0XXX. Where X means the bit don't care. The A-LAW code for it is: 0b1 011 0010 (1=positive number, 011=exponent or the number of X bits, bits you can't encode (lost in conversion), 0010=four bits subsequent to the first 1). Back to linear, we get: 0b0 0000 1001 0100. As we could not retrieve the XXX, it was changed to 100, half of the scale (rounding). Luiz Carlos
Reply by ●August 19, 20032003-08-19
Luiz Carlos wrote:> > Jerry Avins <jya@ieee.org> wrote in message news: > > > > Can you explain the significance of an implied > > least-significant one? Is it made explicit for conversion to 12 bits, or > > used only when adding two streams? > > > > Jerry > > The implicit LSb is part of the conversion to 13 bits (A-LAW). You get > more 3 dB of SNR. As I said, it's a kind of rounding. > > For example, let's take the linear number (13 bits): 0b0 0000 1001 > 0XXX. Where X means the bit don't care. > > The A-LAW code for it is: 0b1 011 0010 (1=positive number, > 011=exponent or the number of X bits, bits you can't encode (lost in > conversion), 0010=four bits subsequent to the first 1). > > Back to linear, we get: 0b0 0000 1001 0100. As we could not retrieve > the XXX, it was changed to 100, half of the scale (rounding). > > Luiz CarlosTruncating -- assuming an implicit zero -- makes the number smaller. Assuming an implicit one makes the number larger. Rounding, which improves SNR, adds a one _or_ a zero depending on the value of the next bit down. I don't get it. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 20, 20032003-08-20
Jerry Avins <jya@ieee.org> wrote in message news:> > Truncating -- assuming an implicit zero -- makes the number smaller. > Assuming an implicit one makes the number larger. Rounding, which > improves SNR, adds a one _or_ a zero depending on the value of the next > bit down. I don't get it. > > JerryKind of "rounding"!!!!! The G711 was designed whith hardware implementation in mind. A real rounding would require an adder. Of course it's not a truncation too. Let's see a four bit number where we must discard the 3 LSbs: Truncation: 0b1000 = 8d, truncating => 0b1000 (error = 8-8 = 0) 0b1111 = 15d, truncating => 0b1000 (error = 15-8 = 7) Rounding: 0b1000 = 8d, rounding => 0b1100 (error = 8-12 = -4) 0b1111 = 15d, rounding => 0b1 0011 (error = 15-18 = -3) G711: 0b1000 = 8d, G711ing => 0b1100 (error = 8-12 = -4) 0b1111 = 15d, G711ing => 0b1100 (error = 15-12 = 3) In G711 method, the absolute error is the same of rounding but it's direction (sign) depends on input. The increase in the SNR depends on input data, but I think that for a random input (blah, blah, blah), it is the same as for rounding. I din't patent the new verb "G711", so you can use it whith no fear of paying royalties. Sometimes I think someday I will not be allowed to use my own name! :) Luiz Carlos
Reply by ●August 20, 20032003-08-20
Luiz Carlos wrote:> > Jerry Avins <jya@ieee.org> wrote in message news: > > > > Truncating -- assuming an implicit zero -- makes the number smaller. > > Assuming an implicit one makes the number larger. Rounding, which > > improves SNR, adds a one _or_ a zero depending on the value of the next > > bit down. I don't get it. > > > > Jerry > > Kind of "rounding"!!!!! > The G711 was designed whith hardware implementation in mind. A real > rounding would require an adder. > Of course it's not a truncation too. > > Let's see a four bit number where we must discard the 3 LSbs: > Truncation: > 0b1000 = 8d, truncating => 0b1000 (error = 8-8 = 0) > 0b1111 = 15d, truncating => 0b1000 (error = 15-8 = 7) > > Rounding: > 0b1000 = 8d, rounding => 0b1100 (error = 8-12 = -4) > 0b1111 = 15d, rounding => 0b1 0011 (error = 15-18 = -3) > > G711: > 0b1000 = 8d, G711ing => 0b1100 (error = 8-12 = -4) > 0b1111 = 15d, G711ing => 0b1100 (error = 15-12 = 3) > > In G711 method, the absolute error is the same of rounding but it's > direction (sign) depends on input. The increase in the SNR depends on > input data, but I think that for a random input (blah, blah, blah), it > is the same as for rounding. > > I din't patent the new verb "G711", so you can use it whith no fear of > paying royalties. Sometimes I think someday I will not be allowed to > use my own name! :) > > Luiz CarlosI'm still in the dark because I don't really understand your examples. Discarding the three least-significant bits of a four-bit number leaves a single bit. The rounding procedure that I know is: if the most significant of the discarded bits is a one, increment the retained part; otherwise, leave it alone. This can be implemented by adding 1/2 and truncating, with due attention to accumulator size, number format, etc. When I round in assembly language after removing bits by shifting right (putting the most significant of the lost bits into the carry bit), I round with "add with carry immediate zero", one instruction. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 20, 20032003-08-20
Luiz Carlos wrote:> > Jerry Avins <jya@ieee.org> wrote in message news: > > > > Truncating -- assuming an implicit zero -- makes the number smaller. > > Assuming an implicit one makes the number larger. Rounding, which > > improves SNR, adds a one _or_ a zero depending on the value of the next > > bit down. I don't get it. > > > > Jerry > > Kind of "rounding"!!!!! > The G711 was designed whith hardware implementation in mind. A real > rounding would require an adder. > Of course it's not a truncation too. > > Let's see a four bit number where we must discard the 3 LSbs: > Truncation: > 0b1000 = 8d, truncating => 0b1000 (error = 8-8 = 0) > 0b1111 = 15d, truncating => 0b1000 (error = 15-8 = 7) > > Rounding: > 0b1000 = 8d, rounding => 0b1100 (error = 8-12 = -4) > 0b1111 = 15d, rounding => 0b1 0011 (error = 15-18 = -3) > > G711: > 0b1000 = 8d, G711ing => 0b1100 (error = 8-12 = -4) > 0b1111 = 15d, G711ing => 0b1100 (error = 15-12 = 3) > > In G711 method, the absolute error is the same of rounding but it's > direction (sign) depends on input. The increase in the SNR depends on > input data, but I think that for a random input (blah, blah, blah), it > is the same as for rounding. > > I din't patent the new verb "G711", so you can use it whith no fear of > paying royalties. Sometimes I think someday I will not be allowed to > use my own name! :) > > Luiz CarlosI'm still in the dark because I don't really understand your examples. Discarding the three least-significant bits of a four-bit number leaves a single bit. The rounding procedure that I know is: increment the retained part if the most significant of the discarded bits is a one; otherwise, leave it alone. This can be implemented by adding 1/2 and truncating, with due attention to accumulator size, number format, etc. When I round in assembly language after removing bits by shifting right (putting the most significant of the lost bits into the carry bit), I round with "add with carry immediate zero", one instruction. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 21, 20032003-08-21
Jerry Avins <jya@ieee.org> wrote in message news:> > I'm still in the dark because I don't really understand your examples. > Discarding the three least-significant bits of a four-bit number leaves > a single bit. > > The rounding procedure that I know is: increment the retained part if > the most significant of the discarded bits is a one; otherwise, leave it > alone. This can be implemented by adding 1/2 and truncating, with due > attention to accumulator size, number format, etc. When I round in > assembly language after removing bits by shifting right (putting the > most significant of the lost bits into the carry bit), I round with "add > with carry immediate zero", one instruction. > > JerryYes, it leaves a single bit. I wanted a simple example. Maybe I should show the numbers as 0b1.000 and 0b1.111. But you are right, I forgot to truncate in the rounding operation. Sorry. But doing it right, you can see similar results. 0b1.000 => 0b1.000 (no error) 0b1.111 => 0b10.000 (error = 15-16 = 1, or 0.125) 0b1.011 => 0b1.000 (error = 11-8 = 3, or 0.375 ) 0b1.100 => 0b10.000 (error = 12-16 = -4, or -0.5, maximum error) So we get a smilar result with G711 without rounding the number, just assuming a LSb = 1 (and converting to 13 bit linear, instead of 12 bit) . Luiz Carlos
Reply by ●August 21, 20032003-08-21
Luiz Carlos wrote:>...> > So we get a smilar result with G711 without rounding the number, just > assuming a LSb = 1 (and converting to 13 bit linear, instead of 12 > bit) . > > Luiz CarlosI still need to convince myself, but at least I now see the path. Thanks for staying with me while I struggled. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●August 22, 20032003-08-22
Jerry Avins <jya@ieee.org> wrote in message news:> > I still need to convince myself, but at least I now see the path. > Thanks for staying with me while I struggled. > > JerryNever mind. I think this is the purpose of the newsgroups, exchange knowledge, help, be helped and, sometimes, we get a friend! Luiz Carlos






