Lines Matching refs:blockSwitchingControl
104 BLOCK_SWITCHING_CONTROL *RESTRICT blockSwitchingControl,
151 void FDKaacEnc_InitBlockSwitching(BLOCK_SWITCHING_CONTROL *blockSwitchingControl, INT isLowDelay)
153 FDKmemclear (blockSwitchingControl, sizeof(BLOCK_SWITCHING_CONTROL));
157 blockSwitchingControl->nBlockSwitchWindows = 4;
158 blockSwitchingControl->allowShortFrames = 0;
159 blockSwitchingControl->allowLookAhead = 0;
163 blockSwitchingControl->nBlockSwitchWindows = 8;
164 blockSwitchingControl->allowShortFrames = 1;
165 blockSwitchingControl->allowLookAhead = 1;
168 blockSwitchingControl->noOfGroups = MAX_NO_OF_GROUPS;
171 blockSwitchingControl->lastWindowSequence = LONG_WINDOW;
172 blockSwitchingControl->windowShape = blockType2windowShape[blockSwitchingControl->allowShortFrames][blockSwitchingControl->lastWindowSequence];
208 int FDKaacEnc_BlockSwitching(BLOCK_SWITCHING_CONTROL *blockSwitchingControl, const INT granuleLength, const int isLFE, const INT_PCM *pTimeSignal)
213 UINT nBlockSwitchWindows = blockSwitchingControl->nBlockSwitchWindows;
220 blockSwitchingControl->lastWindowSequence = LONG_WINDOW;
221 blockSwitchingControl->windowShape = SINE_WINDOW;
222 blockSwitchingControl->noOfGroups = 1;
223 blockSwitchingControl->groupLen[0] = 1;
229 blockSwitchingControl->lastattack = blockSwitchingControl->attack;
230 blockSwitchingControl->lastAttackIndex = blockSwitchingControl->attackIndex;
233 FDKmemcpy(blockSwitchingControl->windowNrg[0], blockSwitchingControl->windowNrg[1], sizeof(blockSwitchingControl->windowNrg[0]));
234 FDKmemcpy(blockSwitchingControl->windowNrgF[0], blockSwitchingControl->windowNrgF[1], sizeof(blockSwitchingControl->windowNrgF[0]));
236 if (blockSwitchingControl->allowShortFrames)
241 FDKmemclear (blockSwitchingControl->groupLen, sizeof(blockSwitchingControl->groupLen));
244 blockSwitchingControl->noOfGroups = MAX_NO_OF_GROUPS;
246 FDKmemcpy(blockSwitchingControl->groupLen, suggestedGroupingTable[blockSwitchingControl->lastAttackIndex], sizeof(blockSwitchingControl->groupLen));
248 if (blockSwitchingControl->attack == TRUE)
249 blockSwitchingControl->maxWindowNrg = FDKaacEnc_GetWindowEnergy(blockSwitchingControl->windowNrg[0], blockSwitchingControl->lastAttackIndex);
251 blockSwitchingControl->maxWindowNrg = FL2FXCONST_DBL(0.0);
257 FDKaacEnc_CalcWindowEnergy(blockSwitchingControl, granuleLength>>(nBlockSwitchWindows==4? 2:3 ), pTimeSignal);
262 blockSwitchingControl->attack = FALSE;
266 enM1 = blockSwitchingControl->windowNrgF[0][nBlockSwitchWindows-1];
269 FIXP_DBL tmp = fMultDiv2(oneMinusAccWindowNrgFac, blockSwitchingControl->accWindowNrg);
270 blockSwitchingControl->accWindowNrg = fMultAdd(tmp, accWindowNrgFac, enM1) ;
272 if (fMult(blockSwitchingControl->windowNrgF[1][i],invAttackRatio) > blockSwitchingControl->accWindowNrg ) {
273 blockSwitchingControl->attack = TRUE;
274 blockSwitchingControl->attackIndex = i;
276 enM1 = blockSwitchingControl->windowNrgF[1][i];
281 if (enMax < minAttackNrg) blockSwitchingControl->attack = FALSE;
284 if((blockSwitchingControl->attack == FALSE) && (blockSwitchingControl->lastattack == TRUE)) {
286 if ( ((blockSwitchingControl->windowNrgF[0][nBlockSwitchWindows-1]>>4) > fMult((FIXP_DBL)(10<<(DFRACT_BITS-1-4)), blockSwitchingControl->windowNrgF[1][1]))
287 && (blockSwitchingControl->lastAttackIndex == (INT)nBlockSwitchWindows-1)
290 blockSwitchingControl->attack = TRUE;
291 blockSwitchingControl->attackIndex = 0;
296 if(blockSwitchingControl->allowLookAhead)
300 blockSwitchingControl->lastWindowSequence =
301 chgWndSqLkAhd[blockSwitchingControl->lastattack][blockSwitchingControl->attack][blockSwitchingControl->lastWindowSequence];
306 blockSwitchingControl->lastWindowSequence =
307 chgWndSq[blockSwitchingControl->attack][blockSwitchingControl->lastWindowSequence];
312 blockSwitchingControl->windowShape = blockType2windowShape[blockSwitchingControl->allowShortFrames][blockSwitchingControl->lastWindowSequence];
329 static void FDKaacEnc_CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *RESTRICT blockSwitchingControl, INT windowLen, const INT_PCM *pTimeSignal)
338 for (w=0; w < blockSwitchingControl->nBlockSwitchWindows; w++) {
342 FIXP_DBL temp_iirState0 = blockSwitchingControl->iirStates[0];
343 FIXP_DBL temp_iirState1 = blockSwitchingControl->iirStates[1];
370 blockSwitchingControl->windowNrg[1][w] = temp_windowNrg;
371 blockSwitchingControl->windowNrgF[1][w] = temp_windowNrgF;
372 blockSwitchingControl->iirStates[0] = temp_iirState0;
373 blockSwitchingControl->iirStates[1] = temp_iirState1;