int detectStaLtaINT32(DETECTOR_STALTA *stalta, INT32 *data, UINT32 nsamp)
{
BOOL SeenDetection = FALSE; /* TRUE if at least one sample results in a detection ON */
UINT32 i;

    if (stalta->debug.enabled && stalta->debug.nsamp < nsamp) {
        stalta->debug.diff = (INT32 *) realloc(stalta->debug.diff, nsamp * sizeof(INT32));
        stalta->debug.sta = (INT32 *) realloc(stalta->debug.sta, nsamp * sizeof(INT32));
        stalta->debug.lta = (INT32 *) realloc(stalta->debug.lta, nsamp * sizeof(INT32));
        stalta->debug.tla = (INT32 *) realloc(stalta->debug.tla, nsamp * sizeof(INT32));
        stalta->debug.ratio = (REAL32 *) realloc(stalta->debug.ratio, nsamp * sizeof(REAL32));
        stalta->debug.state = (INT32 *) realloc(stalta->debug.state, nsamp * sizeof(INT32));
        stalta->debug.nsamp = nsamp;
    }

/* Update and test for detection sample by sample */

    for (i = 0; i < nsamp; i++) {
        UpdateRatio(stalta, data[i]);
        CheckState(stalta);
        if (!SeenDetection && stalta->work.crnt.state == DETECTOR_STATE_ON) SeenDetection = TRUE;
        if (stalta->debug.enabled) {
            stalta->debug.diff[i] = stalta->work.diff;
            stalta->debug.sta[i] = stalta->work.crnt.sta;
            stalta->debug.lta[i] = stalta->work.crnt.lta;
            stalta->debug.tla[i] = stalta->trigger.lta;
            stalta->debug.ratio[i] = stalta->work.crnt.ratio;
            stalta->debug.state[i] = stalta->work.crnt.state;
        }
    }

    stalta->state = SeenDetection ? DETECTOR_STATE_ON : DETECTOR_STATE_OFF;

    return stalta->state;
}
Example #2
0
bool CFlashMenuScreen::Load(const char *strFile)
{
    if (LoadAnimation(strFile))
    {
        IRenderer *pRenderer = gEnv->pRenderer;
        UpdateRatio();
        //m_pFlashPlayer->SetViewport(0,0,pRenderer->GetWidth(),pRenderer->GetHeight());
        GetFlashPlayer()->SetBackgroundAlpha(0.0f);
        return true;
    }

    return false;
}