本文整理汇总了C++中LOOP函数的典型用法代码示例。如果您正苦于以下问题:C++ LOOP函数的具体用法?C++ LOOP怎么用?C++ LOOP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOOP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcThreshExp
/* loudness calculation (threshold to the power of redExp) */
static void calcThreshExp(float thrExp[MAX_CHANNELS][MAX_GROUPED_SFB],
PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
const int nChannels)
{
int ch, sfb,sfbGrp;
COUNT_sub_start("calcThreshExp");
LOOP(1);
for (ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
PTR_INIT(1); /* counting operation above */
INDIRECT(2); LOOP(1);
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup) {
PTR_INIT(2); /* pointer for thrExp[][],
psyOutChan->sfbThreshold[]
*/
INDIRECT(1); LOOP(1);
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
TRANS(1); STORE(1);
thrExp[ch][sfbGrp+sfb] = (float) pow(psyOutChan->sfbThreshold[sfbGrp+sfb], redExp);
}
}
}
COUNT_sub_end();
}
示例2: CShortBlock_Init
void CShortBlock_Init(CAacDecoderChannelInfo *pAacDecoderChannelInfo)
{
int group,band;
char *pCodeBook = pAacDecoderChannelInfo->pCodeBook;
short *pScaleFactor = pAacDecoderChannelInfo->pScaleFactor;
COUNT_sub_start("CShortBlock_Init");
INDIRECT(2); PTR_INIT(2); /* counting previous operations */
PTR_INIT(2); /* pCodeBook[]
pScaleFactor[]
*/
LOOP(1);
for (group=0; group<MaximumGroups; group++)
{
LOOP(1);
for (band=0; band<MaximumScaleFactorBandsShort; band++)
{
MOVE(2);
pCodeBook[group*MaximumScaleFactorBandsShort+band] = 0;
pScaleFactor[group*MaximumScaleFactorBandsShort+band] = 0;
}
}
COUNT_sub_end();
}
示例3: reduceThresholds
/* apply reduction formula */
static void reduceThresholds(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
int ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
float thrExp[MAX_CHANNELS][MAX_GROUPED_SFB],
const int nChannels,
const float redVal)
{
int ch, sfb,sfbGrp;
float sfbEn, sfbThr,sfbThrReduced;
COUNT_sub_start("reduceThresholds");
LOOP(1);
for(ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
PTR_INIT(1); /* counting previous operation */
INDIRECT(2); LOOP(1);
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
PTR_INIT(5); /* pointers for psyOutChan->sfbMinSnr[sfbGrp+sfb],
psyOutChan->sfbEnergy[sfbGrp+sfb],
psyOutChan->sfbThreshold[sfbGrp+sfb],
thrExp[ch][sfbGrp+sfb],
ahFlag[ch][sfbGrp+sfb]
*/
INDIRECT(1); LOOP(1);
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
MOVE(2);
sfbEn = psyOutChan->sfbEnergy[sfbGrp+sfb];
sfbThr = psyOutChan->sfbThreshold[sfbGrp+sfb];
ADD(1); BRANCH(1);
if (sfbEn > sfbThr) {
/* threshold reduction formula */
ADD(1); TRANS(1);
sfbThrReduced = (float) pow(thrExp[ch][sfbGrp+sfb]+redVal, invRedExp);
/* avoid holes */
MULT(1); ADD(2); LOGIC(1); BRANCH(1);
if ((sfbThrReduced > psyOutChan->sfbMinSnr[sfbGrp+sfb] * sfbEn) && (ahFlag[ch][sfbGrp+sfb] != NO_AH)){
ADD(1); BRANCH(1); MOVE(1);
sfbThrReduced = max(psyOutChan->sfbMinSnr[sfbGrp+sfb] * sfbEn, sfbThr);
MOVE(1);
ahFlag[ch][sfbGrp+sfb] = AH_ACTIVE;
}
MOVE(1);
psyOutChan->sfbThreshold[sfbGrp+sfb] = sfbThrReduced;
}
}
}
}
COUNT_sub_end();
}
示例4: twoChannelFiltering
static void twoChannelFiltering( const float *pQmf,
float *mHybrid )
{
int n;
float cum0, cum1;
FLC_sub_start("twoChannelFiltering");
LOOP(1); PTR_INIT(2);
MULT(1);
cum0 = 0.5f * pQmf[HYBRID_FILTER_DELAY];
MOVE(1);
cum1 = 0;
LOOP(1); PTR_INIT(2);
for(n = 0; n < 6; n++) {
MAC(1); MULT(1);
cum1 += p2_6[n] * pQmf[2*n+1];
}
ADD(1); STORE(1);
mHybrid[0] = cum0 + cum1;
ADD(1); STORE(1);
mHybrid[1] = cum0 - cum1;
FLC_sub_end();
}
示例5: LOOP
void
VideoConsumer::HandleEvent(const media_timed_event* event, bigtime_t lateness,
bool realTimeEvent)
{
LOOP("VideoConsumer::HandleEvent\n");
switch (event->type) {
case BTimedEventQueue::B_START:
PROGRESS("VideoConsumer::HandleEvent - START\n");
_SetPerformanceTimeBase(event->event_time);
break;
case BTimedEventQueue::B_WARP:
case BTimedEventQueue::B_SEEK:
PROGRESS("VideoConsumer::HandleEvent - WARP or SEEK\n");
_SetPerformanceTimeBase(event->bigdata);
break;
case BTimedEventQueue::B_STOP:
PROGRESS("VideoConsumer::HandleEvent - STOP\n");
EventQueue()->FlushEvents(event->event_time, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER);
// unset the target's bitmap
_UnsetTargetBuffer();
break;
case BTimedEventQueue::B_HANDLE_BUFFER:
LOOP("VideoConsumer::HandleEvent - HANDLE BUFFER\n");
_HandleBuffer(static_cast<BBuffer*>(event->pointer));
break;
default:
ERROR("VideoConsumer::HandleEvent - BAD EVENT\n");
break;
}
}
示例6: current
/*
The function creates the interpolated spectral data according to the
energy of the last good frame and the current (good) frame.
*/
void CConcealment_InterpolateBuffer (float *spectrum,
float *enPrev,
float *enAct,
int sfbCnt,
const short *pSfbOffset)
{
int sfb, line = 0;
float multiplier;
FLC_sub_start("CConcealment_InterpolateBuffer");
MOVE(1); /* counting previous operation */
PTR_INIT(3); /* enAct[]
enPrev[]
spectrum[]
*/
LOOP(1);
for(sfb = 0; sfb < sfbCnt; sfb++) {
DIV(1); TRANS(1);
multiplier = (float) pow(enAct[sfb] / enPrev[sfb], 0.25f);
LOOP(1);
for(; line < pSfbOffset[sfb+1]; line++) {
MULT(1); STORE(1);
spectrum [line] = spectrum[line] * multiplier;
}
}
FLC_sub_end();
}
示例7: nonlocal_vec
static double nonlocal_vec(real *u, uint n, int op,
const nonlocal_info *info, MPI_Comm comm)
{
uint np = info->np, i;
MPI_Request *reqs = info->reqs;
uint *targ = info->target;
uint *nshared = info->nshared;
uint *sh_ind = info->sh_ind;
uint id = info->id;
real *buf = info->buf;
uint size = n*sizeof(real);
#ifdef GS_TIMING
double time0, time1;
#endif
for(i=0;i<np;++i) {
int nsn=n*nshared[i];
MPI_Irecv(buf,nsn,REAL_MPI,targ[i],targ[i],comm,reqs++);
buf+=nsn;
}
#ifdef GS_BARRIER
MPI_Barrier(comm);
#endif
#ifdef GS_TIMING
time0 = MPI_Wtime();
#endif
for(i=0;i<np;++i) {
uint ns=nshared[i], c=ns;
real *start = buf;
for(;c;--c) memcpy(buf,u+n*(*sh_ind++),size), buf+=n;
MPI_Isend(start,ns*n,REAL_MPI,targ[i],id,comm,reqs++);
}
MPI_Waitall(np*2,info->reqs,MPI_STATUSES_IGNORE);
#ifdef GS_TIMING
time1 = MPI_Wtime();
#endif
buf = info->buf;
sh_ind = info->sh_ind;
# define LOOP(OP) do { \
for(i=0;i<np;++i) { \
uint c,j; \
for(c=nshared[i];c;--c) { \
real *uu=u+n*(*sh_ind++); \
for(j=n;j;--j) { OP(*uu,*buf); ++uu, ++buf; } \
} \
} \
} while(0)
switch(op) {
case OP_ADD: LOOP(DO_ADD); break;
case OP_MUL: LOOP(DO_MUL); break;
case OP_MIN: LOOP(DO_MIN); break;
case OP_MAX: LOOP(DO_MAX); break;
case OP_BPR: LOOP(DO_BPR); break;
}
# undef LOOP
#ifdef GS_TIMING
return time1-time0;
#else
return 0;
#endif
}
示例8: Var_Dump
void
Var_Dump(void)
{
Var **t;
unsigned int i;
const char *banner;
bool first = true;
t = sort_ohash_by_name(&global_variables);
/* somewhat dirty, but does the trick */
#define LOOP(mask, value, do_stuff) \
for (i = 0; t[i] != NULL; i++) \
if ((t[i]->flags & (mask)) == (value)) { \
if (banner) { \
if (first) \
first = false; \
else \
putchar('\n'); \
fputs(banner, stdout); \
banner = NULL; \
} \
do_stuff; \
}
banner = "#variables from command line:\n";
LOOP(VAR_FROM_CMD | VAR_DUMMY, VAR_FROM_CMD, print_var(t[i]));
banner = "#global variables:\n";
LOOP(VAR_FROM_ENV| VAR_FROM_CMD | VAR_DUMMY, 0, print_var(t[i]));
banner = "#variables from env:\n";
LOOP(VAR_FROM_ENV|VAR_DUMMY, VAR_FROM_ENV, print_var(t[i]));
banner = "#variable name seen, but not defined:";
LOOP(VAR_DUMMY|POISONS, VAR_DUMMY, printf(" %s", t[i]->name));
#undef LOOP
printf("\n\n");
for (i = 0; t[i] != NULL; i++)
switch(t[i]->flags & POISONS) {
case POISON_NORMAL:
printf(".poison %s\n", t[i]->name);
break;
case POISON_EMPTY:
printf(".poison empty(%s)\n", t[i]->name);
break;
case POISON_NOT_DEFINED:
printf(".poison !defined(%s)\n", t[i]->name);
break;
default:
break;
}
free(t);
printf("\n");
}
示例9: prepareSfbPe
/* constants that do not change during successive pe calculations */
void prepareSfbPe(PE_CHANNEL_DATA *peChanData,
const float *sfbEnergy,
const float *sfbThreshold,
const float *sfbFormFactor,
const int *sfbOffset,
const int sfbCnt,
const int sfbPerGroup,
const int maxSfbPerGroup)
{
int sfbGrp,sfb;
int sfbWidth;
float avgFormFactor;
COUNT_sub_start("prepareSfbPe");
LOOP(1);
for(sfbGrp = 0;sfbGrp < sfbCnt;sfbGrp+=sfbPerGroup){
PTR_INIT(6); /* pointers for sfbEnergy[],
sfbThreshold[],
sfbOffset[],
sfbFormFactor[],
peChanData->sfbNLines[],
peChanData->sfbLdEnergy[]
*/
LOOP(1);
for (sfb=0; sfb<maxSfbPerGroup; sfb++) {
ADD(1); BRANCH(1);
if (sfbEnergy[sfbGrp+sfb] > sfbThreshold[sfbGrp+sfb]) {
ADD(1);
sfbWidth = sfbOffset[sfbGrp+sfb+1] - sfbOffset[sfbGrp+sfb];
/* estimate number of active lines */
DIV(1); TRANS(1);
avgFormFactor = (float) pow(sfbEnergy[sfbGrp+sfb]/(float)sfbWidth, 0.25f);
DIV(1); STORE(1);
peChanData->sfbNLines[sfbGrp+sfb] =
sfbFormFactor[sfbGrp+sfb]/avgFormFactor;
/* ld(sfbEn) */
TRANS(1); MULT(1); STORE(1);
peChanData->sfbLdEnergy[sfbGrp+sfb] = (float) (log(sfbEnergy[sfbGrp+sfb]) * LOG2_1);
}
else {
MOVE(2);
peChanData->sfbNLines[sfbGrp+sfb] = 0.0f;
peChanData->sfbLdEnergy[sfbGrp+sfb] = 0.0f;
}
}
}
COUNT_sub_end();
}
示例10: CalcBandEnergyMS
void CalcBandEnergyMS(const float *mdctSpectrumLeft,
const float *mdctSpectrumRight,
const int *bandOffset,
const int numBands,
float *bandEnergyMid,
float *bandEnergyMidSum,
float *bandEnergySide,
float *bandEnergySideSum) {
int i, j;
COUNT_sub_start("CalcBandEnergyMS");
MOVE(3);
j = 0;
*bandEnergyMidSum = 0.0f;
*bandEnergySideSum = 0.0f;
PTR_INIT(5); /* pointers for bandEnergyMid[],
bandEnergySide[],
bandOffset[],
mdctSpectrumLeft[],
mdctSpectrumRight[]
*/
LOOP(1);
for(i=0; i<numBands; i++) {
MOVE(2);
bandEnergyMid[i] = 0.0f;
bandEnergySide[i] = 0.0f;
LOOP(1);
while (j < bandOffset[i+1]) {
float specm, specs;
ADD(2);
MULT(2);
specm = 0.5f * (mdctSpectrumLeft[j] + mdctSpectrumRight[j]);
specs = 0.5f * (mdctSpectrumLeft[j] - mdctSpectrumRight[j]);
MAC(2);
STORE(2);
bandEnergyMid[i] += specm * specm;
bandEnergySide[i] += specs * specs;
j++;
}
ADD(2);
STORE(2);
*bandEnergyMidSum += bandEnergyMid[i];
*bandEnergySideSum += bandEnergySide[i];
}
COUNT_sub_end();
}
示例11: local_condense_vec
static void local_condense_vec(real *u, uint n, int op, const sint *cm)
{
switch(op) {
case OP_ADD: LOOP(DO_ADD); break;
case OP_MUL: LOOP(DO_MUL); break;
case OP_MIN: LOOP(DO_MIN); break;
case OP_MAX: LOOP(DO_MAX); break;
case OP_BPR: LOOP(DO_BPR); break;
}
}
示例12: findClosestEntry
static int
findClosestEntry(int goalSb,
unsigned char *v_k_master,
int numMaster,
int direction)
{
int index;
COUNT_sub_start("findClosestEntry");
ADD(1); BRANCH(1);
if( goalSb <= v_k_master[0] )
{
COUNT_sub_end();
return v_k_master[0];
}
INDIRECT(1); ADD(1); BRANCH(1);
if( goalSb >= v_k_master[numMaster] )
{
COUNT_sub_end();
return v_k_master[numMaster];
}
BRANCH(1);
if(direction) {
MOVE(1);
index = 0;
PTR_INIT(1); /* v_k_master[index] */
LOOP(1);
while( v_k_master[index] < goalSb ) {
ADD(1);
index++;
}
} else {
MOVE(1);
index = numMaster;
PTR_INIT(1); /* v_k_master[index] */
LOOP(1);
while( v_k_master[index] > goalSb ) {
ADD(1);
index--;
}
}
COUNT_sub_end();
return v_k_master[index];
}
示例13: main
int main(int argc, char **argv)
{
int n, i;
char *s;
char tmp[256];
void *p=(void*)0xdeadbeef;
if (argc < 3) {
usage();
return 1;
}
s = argv[2];
/* pre-printf tests */
TEST("pre-printf");
RUN(printf("string\n"));
RUN(printf("%s\n", s));
RUN(printf("%d\n", 45));
RUN(printf("%d\n", 45098));
RUN(printf("%d\n", (int32_t)INT_MAX));
RUN(printf("%u\n", (uint32_t)INT_MAX+1));
RUN(printf("%u\n", (uint32_t)UINT_MAX));
/* Test strtol */
TEST("strtol");
RUN(printf("%ld\n", strtol("678", NULL, 0)));
RUN(printf("%ld\n", strtol("0x4567", NULL, 0)));
RUN(printf("%ld\n", strtol("0777", NULL, 0)));
RUN(printf("%ld\n", strtol(argv[1], NULL, 0)));
n = strtol(argv[1], NULL, 0);
/* Dynamic printf */
TEST("printf");
LOOP(n)
RUN(printf("%d\n", i*i*2));
ENDLOOP;
LOOP(n)
RUN(printf("%.2f\n", 1000.0/i/i));
ENDLOOP
LOOP(n)
RUN(printf("%x\n", i+i*45));
ENDLOOP
RUN(printf("%s%s\n", s, s));
RUN(printf("%s%d%x%.2f%x%u%lu\n", s, n, n*n, 1024.0/n/n/n, 879875, (unsigned)n*n, (unsigned long)n*765*n));
RUN(printf("%p\n", p));
/* snprintf tests */
TEST("snprintf");
RUN(
snprintf(tmp, 256, "Testing snprintf %d", n);
printf("%s\n", tmp);
);
示例14: nonlocal
static double nonlocal(real *u, int op, const nonlocal_info *info,
MPI_Comm comm)
{
uint np = info->np, i;
MPI_Request *reqs = info->reqs;
uint *targ = info->target;
uint *nshared = info->nshared;
uint *sh_ind = info->sh_ind;
uint id = info->id;
real *buf = info->buf;
#ifdef GS_TIMING
double time0, time1;
#endif
for(i=0;i<np;++i) {
MPI_Irecv(buf,nshared[i],REAL_MPI,targ[i],targ[i],comm,reqs++);
buf+=nshared[i];
}
#ifdef GS_BARRIER
MPI_Barrier(comm);
#endif
#ifdef GS_TIMING
time0 = MPI_Wtime();
#endif
for(i=0;i<np;++i) {
uint c = nshared[i];
real *start = buf;
for(;c;--c) *buf++ = u[*sh_ind++];
MPI_Isend(start,nshared[i],REAL_MPI,targ[i],id,comm,reqs++);
}
MPI_Waitall(np*2,info->reqs,MPI_STATUSES_IGNORE);
#ifdef GS_TIMING
time1 = MPI_Wtime();
#endif
buf = info->buf;
sh_ind = info->sh_ind;
# define LOOP(OP) do { \
for(i=0;i<np;++i) { \
uint c; \
for(c=nshared[i];c;--c) { OP(u[*sh_ind],*buf); ++sh_ind, ++buf; } \
} \
} while(0)
switch(op) {
case OP_ADD: LOOP(DO_ADD); break;
case OP_MUL: LOOP(DO_MUL); break;
case OP_MIN: LOOP(DO_MIN); break;
case OP_MAX: LOOP(DO_MAX); break;
case OP_BPR: LOOP(DO_BPR); break;
}
# undef LOOP
#ifdef GS_TIMING
return time1-time0;
#else
return 0;
#endif
}
示例15: inverseModulation
/*
*
* \brief Perform complex-valued inverse modulation of the subband
* samples stored in rSubband (real part) and iSubband (imaginary
* part) and stores the result in timeOut
*
*/
static void
inverseModulation (float *qmfReal,
float *qmfImag,
HANDLE_SBR_QMF_FILTER_BANK synQmf
)
{
int i, no_synthesis_channels, M;
float r1, i1, r2, i2;
COUNT_sub_start("inverseModulation");
INDIRECT(1); MOVE(1);
no_synthesis_channels = synQmf->no_channels;
MULT(1);
M = no_synthesis_channels / 2;
PTR_INIT(2); /* pointer for qmfReal[],
qmfImag[] */
INDIRECT(1); LOOP(1);
for (i = synQmf->usb; i < no_synthesis_channels; i++) {
MOVE(2);
qmfReal[i]=qmfImag[i]=0;
}
FUNC(2);
cosMod (qmfReal, synQmf);
FUNC(2);
sinMod (qmfImag, synQmf);
PTR_INIT(4); /* pointer for qmfReal[],
qmfImag[],
qmfImag[no_synthesis_channels - 1 - i],
qmfReal[no_synthesis_channels - i - 1] */
LOOP(1);
for (i = 0; i < M; i++) {
MOVE(4);
r1 = qmfReal[i];
i2 = qmfImag[no_synthesis_channels - 1 - i];
r2 = qmfReal[no_synthesis_channels - i - 1];
i1 = qmfImag[i];
ADD(4); STORE(4);
qmfReal[i] = (r1 - i1);
qmfImag[no_synthesis_channels - 1 - i] = -(r1 + i1);
qmfReal[no_synthesis_channels - i - 1] = (r2 - i2);
qmfImag[i] = -(r2 + i2);
}
COUNT_sub_end();
}