254{
256 int32_t cbEndL, cbStartS, cbEndS;
257 int32_t nSamps, nonZero, sfactMultiplier, gbMask;
261
262
265 cbEndL = (fh->
ver ==
MPEG1 ? 8 : 6);
266 cbStartS = 3;
267 } else {
268 cbEndL = 0;
269 cbStartS = 0;
270 }
271 cbEndS = 13;
272 } else {
273
274 cbEndL = 22;
275 cbStartS = 13;
276 cbEndS = 13;
277 }
278 cbMax[2] = cbMax[1] = cbMax[0] = 0;
279 gbMask = 0;
280 i = 0;
281
282
283
284
285
287
288
289
290
291
294 globalGain -= 2;
296
297
298 for (cb = 0; cb < cbEndL; cb++) {
299
300 nonZero = 0;
302 gainI = 210 - globalGain + sfactMultiplier * (sfis->
l[cb] + (sis->
preFlag ? (int)
preTab[cb] : 0));
303
304 nonZero |=
DequantBlock(sampleBuf + i, sampleBuf + i, nSamps, gainI);
305 i += nSamps;
306
307
308 if (nonZero)
309 cbMax[0] = cb;
310 gbMask |= nonZero;
311
312 if (i >= *nonZeroBound)
313 break;
314 }
315
316
321
322
323 if (cbStartS >= 12)
324 return CLZ(gbMask) - 1;
325
326
327 cbMax[2] = cbMax[1] = cbMax[0] = cbStartS;
328 for (cb = cbStartS; cb < cbEndS; cb++) {
329
331 for (w = 0; w < 3; w++) {
332 nonZero = 0;
333 gainI = 210 - globalGain + 8*sis->
subBlockGain[w] + sfactMultiplier*(sfis->
s[cb][w]);
334
335 nonZero |=
DequantBlock(sampleBuf + i + nSamps*w, workBuf + nSamps*w, nSamps, gainI);
336
337
338 if (nonZero)
339 cbMax[w] = cb;
340 gbMask |= nonZero;
341 }
342
343
344 buf = (
ARRAY3 *)(sampleBuf + i);
345 i += 3*nSamps;
346 for (j = 0; j < nSamps; j++) {
347 buf[j][0] = workBuf[0*nSamps + j];
348 buf[j][1] = workBuf[1*nSamps + j];
349 buf[j][2] = workBuf[2*nSamps + j];
350 }
351
353
354 if (i >= *nonZeroBound)
355 break;
356 }
357
358
359
360
361
362
363
364
365 *nonZeroBound = i;
366
368
370
371 cbi->
cbEndS[0] = cbMax[0];
372 cbi->
cbEndS[1] = cbMax[1];
373 cbi->
cbEndS[2] = cbMax[2];
374
378
379 return CLZ(gbMask) - 1;
380}
#define MAX_REORDER_SAMPS
static int DequantBlock(int32_t *inbuf, int32_t *outbuf, int num, int scale) FL_NOEXCEPT
static const char preTab[22]
__inline int32_t CLZ(int32_t x) FL_NOEXCEPT
Leading zeros.
const SFBandTable * sfBand