# Regarding non uniform quantization problem

Started by January 8, 2005
 Dear friends I am facing a problem regarding implemenatation of non uniform quantization. problem is: A parameter wohose range is between -12 to 66 units I have to convert it into five bit information with following restrrictions 1) -12 to -4 I have to use step size of 8 unit. 2) -4 to 16 I heve to use uniform step size of 4 units. 3) 16 to 66 units I have to use uniform step size of 2 units. now I am unable to encode it. At decoder side how come I know about step size information, to decode the 5 bit information. please help me in this matter. I am looking for yuor suggestions. regards mahesh ===== ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony
 Hi Mahesh, Please don't tell me that this is not a homework :) The simpliest way to implement your 5 bit encoding is to use a lookup table of 12 + 1 + 66 = 79 entries. Your paramemter range is split in 3 segments, each of which with its own quantization size. Let the [ or ] means inclusive and ( or ) means exclusive, then: 1. for the [-12,-4) range step is 8, therefore the table is ----------------- inp out ----------------- -12 0 -11 0 ... -5 0 2. for the [-4, 16) range step is 4, the table is -4 1 -3 1 ... 0 2 ... 4 3 ... 8 4 ... 15 5 3. You can figure out the rest of the table now. For every two values of the parameter the output is incremented by 1. The range is [16,66) 16 6 17 6 18 7 19 7 20 8 ... 62 29 63 29 64 30 65 30 66 31 After you have created the encoding table, the process of encoding was reduced to retriving a value from the table: output = table [input + 12]; The index in the table entry was increneted by 12 to take into account the input parameter range, which is offset by -12. A C array index offset is always zero. Respectively, the left column of the above lookup table should be read as 0, 1, 2, ..., 78. Alternatively, the encoder can be implemented as a simple integer expression, e.g. if (input < -4) output = 0; else if (input < 16) output = (input + 4) / 4 + 1; else // input in [16,66) output = (input - 16) / 2 + 6; It is seen that the table method uses less arithmetic and takes more data storage (obviously!) than the formula calculation method. The decoder performs an inverse transformation and can use either another lookup table or implement the ricprocal formula calculation. You can easily figure out both of them now. The table entries would contain values taken from the range of encoder input values encoded to a single output value: decoder_lut[ 0] = -12 to -5 decoder_lut[ 1] = -4 to -1 decoder_lut[ 2] = 0 to 3 ... decoder lut[ 6] = 16, 17 ... decoder_lut[30] = 64, 65 decoder_lut[31] = 66 Of course, some of the information was lost in the encoding process and cannot be recovered by the decoder. This is a perfect illustration of how lossy compression methods work. Hope this helped, Andrew > Date: Sat, 8 Jan 2005 10:23:32 +0000 (GMT) > From: mahesh mudela <> > Subject: Regarding non uniform quantization problem > > Dear friends > > I am facing a problem regarding implemenatation of > non uniform quantization. > > problem is: > A parameter wohose range is between > -12 to 66 units > I have to convert it into five bit information > with following restrrictions > > 1) -12 to -4 I have to use step size of 8 unit. > > 2) -4 to 16 I heve to use uniform step size of > 4 units. > > 3) 16 to 66 units I have to use uniform step size > of 2 units. > > now I am unable to encode it. > > At decoder side how come I know about step size > information, to decode the 5 bit information. > > please help me in this matter. I am looking for yuor > suggestions. > > regards > mahesh >