- if (pGain2->num_gain_data == 0)
- gain1 = 1.0;
- else
- gain1 = gain_tab1[pGain2->levcode[0]];
-
- if (pGain1->num_gain_data == 0) {
- for (cnt = 0; cnt < 256; cnt++)
- pOut[cnt] = pIn[cnt] * gain1 + pPrev[cnt];
- } else {
- numdata = pGain1->num_gain_data;
- pGain1->loccode[numdata] = 32;
- pGain1->levcode[numdata] = 4;
-
- nsample = 0; // current sample = 0
-
- for (cnt = 0; cnt < numdata; cnt++) {
- startLoc = pGain1->loccode[cnt] * 8;
- endLoc = startLoc + 8;
-
- gain2 = gain_tab1[pGain1->levcode[cnt]];
- gain_inc = gain_tab2[(pGain1->levcode[cnt+1] - pGain1->levcode[cnt])+15];
-
- /* interpolate */
- for (; nsample < startLoc; nsample++)
- pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
-
- /* interpolation is done over eight samples */
- for (; nsample < endLoc; nsample++) {
- pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
- gain2 *= gain_inc;
- }
+ for (j = 0; j < gain[i].num_points; j++) {
+ level[j] = bitstream_read(bc, 4);
+ loc[j] = bitstream_read(bc, 5);
+ if (j && loc[j] <= loc[j - 1])
+ return AVERROR_INVALIDDATA;