本文整理汇总了C++中BRANCH函数的典型用法代码示例。如果您正苦于以下问题:C++ BRANCH函数的具体用法?C++ BRANCH怎么用?C++ BRANCH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BRANCH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsMainProfile
unsigned char IsMainProfile(CIcsInfo *pIcsInfo)
{
FLC_sub_start("IsMainProfile");
INDIRECT(1); ADD(1); BRANCH(1);
FLC_sub_end();
return (pIcsInfo->Profile == ProfileMain);
}
示例2: GetWindowsPerFrame
int GetWindowsPerFrame(CIcsInfo *pIcsInfo)
{
FLC_sub_start("GetWindowsPerFrame");
INDIRECT(1); ADD(1); BRANCH(1);
FLC_sub_end();
return (pIcsInfo->WindowSequence == EightShortSequence) ? 8 : 1;
}
示例3: IsShortBlock
unsigned char IsShortBlock(CIcsInfo *pIcsInfo)
{
FLC_sub_start("IsShortBlock");
INDIRECT(1); ADD(1); BRANCH(1);
FLC_sub_end();
return (pIcsInfo->WindowSequence == EightShortSequence);
}
示例4: resume_suspension_frame
void resume_suspension_frame(susp_fr_ptr resume_fr, or_fr_ptr top_or_fr) {
CACHE_REGS
or_fr_ptr or_frame;
sg_fr_ptr sg_frame;
/* copy suspended stacks */
memmove(SuspFr_global_reg(resume_fr),
SuspFr_global_start(resume_fr),
SuspFr_global_size(resume_fr));
memmove(SuspFr_local_reg(resume_fr),
SuspFr_local_start(resume_fr),
SuspFr_local_size(resume_fr));
memmove(SuspFr_trail_reg(resume_fr),
SuspFr_trail_start(resume_fr),
SuspFr_trail_size(resume_fr));
OPTYAP_ERROR_CHECKING(resume_suspension_frame, DepFr_cons_cp(SuspFr_top_dep_fr(resume_fr))->cp_h != SuspFr_global_reg(resume_fr) + SuspFr_global_size(resume_fr));
OPTYAP_ERROR_CHECKING(resume_suspension_frame, DepFr_cons_cp(SuspFr_top_dep_fr(resume_fr))->cp_tr != SuspFr_trail_reg(resume_fr) + SuspFr_trail_size(resume_fr));
OPTYAP_ERROR_CHECKING(resume_suspension_frame, DepFr_cons_cp(SuspFr_top_dep_fr(resume_fr)) != SuspFr_local_reg(resume_fr));
OPTYAP_ERROR_CHECKING(resume_suspension_frame, (void *)Get_LOCAL_top_cp() < SuspFr_local_reg(resume_fr) + SuspFr_local_size(resume_fr));
/* update shared nodes */
or_frame = top_or_fr;
while (or_frame != LOCAL_top_or_fr) {
LOCK_OR_FRAME(or_frame);
OrFr_owners(or_frame)++;
UNLOCK_OR_FRAME(or_frame);
or_frame = OrFr_next_on_stack(or_frame);
}
or_frame = top_or_fr;
while (or_frame != LOCAL_top_or_fr) {
LOCK_OR_FRAME(or_frame);
BITMAP_insert(OrFr_members(or_frame), worker_id);
BRANCH(worker_id, OrFr_depth(or_frame)) = 1;
UNLOCK_OR_FRAME(or_frame);
or_frame = OrFr_next(or_frame);
}
/* adjust top pointers */
LOCAL_top_or_fr = top_or_fr;
SetOrFr_node(top_or_fr, Get_LOCAL_top_cp());
LOCAL_top_sg_fr = SuspFr_top_sg_fr(resume_fr);
LOCAL_top_dep_fr = SuspFr_top_dep_fr(resume_fr);
Set_LOCAL_top_cp_on_stack( GetOrFr_node(SuspFr_top_or_fr_on_stack(resume_fr)) );
sg_frame = LOCAL_top_sg_fr;
while (sg_frame && YOUNGER_CP(SgFr_gen_cp(sg_frame), Get_LOCAL_top_cp_on_stack())) {
SgFr_gen_worker(sg_frame) = worker_id;
sg_frame = SgFr_next(sg_frame);
}
/* adjust freeze registers */
adjust_freeze_registers();
/* free suspension frame */
FREE_SUSPENSION_FRAME(resume_fr);
return;
}
示例5: 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();
}
示例6: CAacDecoderInit
int CAacDecoderInit(AACDECODER self,
int samplingRate,
int bitrate)
{
int i;
int numEntries = sizeof(SamplingRateInfoTable)/sizeof(SamplingRateInfo);
COUNT_sub_start("CAacDecoderInit");
MOVE(1); /* counting previous operation */
BRANCH(1);
if (!self)
{
COUNT_sub_end();
return -1;
}
INDIRECT(1); MOVE(1);
self->pStreamInfo->SamplingRate = samplingRate;
PTR_INIT(1); /* SamplingRateInfoTable[i] */
LOOP(1);
for (i=0; i<numEntries; i++)
{
ADD(1); BRANCH(1);
if (samplingRate == SamplingRateInfoTable[i].SamplingFrequency)
break;
}
ADD(1); BRANCH(1);
if (i == numEntries)
{
COUNT_sub_end();
return -1;
}
MOVE(2);
self->pStreamInfo->SamplingRateIndex = i;
self->pStreamInfo->BitRate = bitrate;
COUNT_sub_end();
return 0;
}
示例7: IIR21_Downsample
int
IIR21_Downsample(IIR21_RESAMPLER *DownSampler,
float *inSamples,
int numInSamples,
int inStride,
float *outSamples,
int *numOutSamples,
int outStride
)
{
int i;
*numOutSamples=0;
COUNT_sub_start("Downsample");
MOVE(1); /* counting previous operations */
PTR_INIT(2); /* pointer for inSamples[],
outSamples[]
*/
LOOP(1);
for(i=0;i<numInSamples;i++){
float iirOut;
#ifdef NEWIIR
FUNC(2);
AdvanceARFilter(&(DownSampler->iirFilter), inSamples[i*inStride]);
#else
FUNC(2);
iirOut = AdvanceIIRFilter(&(DownSampler->iirFilter), inSamples[i*inStride]);
#endif
ADD(1);
DownSampler->pending++;
ADD(1); BRANCH(1);
if(DownSampler->pending == DownSampler->ratio){
#ifdef NEWIIR
FUNC(1);
outSamples[(*numOutSamples)*outStride] = AdvanceMAFilter(&(DownSampler->iirFilter));;
#else
MOVE(1);
outSamples[(*numOutSamples)*outStride] = iirOut;
#endif
(*numOutSamples)++;
MOVE(1);
DownSampler->pending=0;
}
}
COUNT_sub_end();
return 1;
}
示例8: bcf_trim_alleles
int bcf_trim_alleles(const bcf_hdr_t *header, bcf1_t *line)
{
int i;
bcf_fmt_t *gt = bcf_get_fmt(header, line, "GT");
if ( !gt ) return 0;
int *ac = (int*) calloc(line->n_allele,sizeof(int));
// check if all alleles are populated
#define BRANCH(type_t,vector_end) { \
for (i=0; i<line->n_sample; i++) \
{ \
type_t *p = (type_t*) (gt->p + i*gt->size); \
int ial; \
for (ial=0; ial<gt->n; ial++) \
{ \
if ( p[ial]==vector_end ) break; /* smaller ploidy */ \
if ( bcf_gt_is_missing(p[ial]) ) continue; /* missing allele */ \
if ( (p[ial]>>1)-1 >= line->n_allele ) { free(ac); return -1; } \
ac[(p[ial]>>1)-1]++; \
} \
} \
}
switch (gt->type) {
case BCF_BT_INT8: BRANCH(int8_t, bcf_int8_vector_end); break;
case BCF_BT_INT16: BRANCH(int16_t, bcf_int16_vector_end); break;
case BCF_BT_INT32: BRANCH(int32_t, bcf_int32_vector_end); break;
default: fprintf(stderr, "[E::%s] todo: %d at %s:%d\n", __func__, gt->type, header->id[BCF_DT_CTG][line->rid].key, line->pos+1); exit(1); break;
}
#undef BRANCH
int nrm = 0;
kbitset_t *rm_set = kbs_init(line->n_allele);
for (i=1; i<line->n_allele; i++)
{
if ( !ac[i] ) { kbs_insert(rm_set, i); nrm++; }
}
free(ac);
if ( nrm ) bcf_remove_allele_set(header, line, rm_set);
kbs_destroy(rm_set);
return nrm;
}
示例9: findRegion
static int
findRegion(float currVal,
const float* borders,
const int numBorders,
int prevRegion
)
{
int i;
COUNT_sub_start("findRegion");
ADD(1); BRANCH(1);
if(currVal < borders[0])
{
COUNT_sub_end();
return 0;
}
PTR_INIT(1); /* borders[] */
LOOP(1);
for(i = 1; i < numBorders; i++){
ADD(2); LOGIC(1); BRANCH(1);
if( currVal >= borders[i-1] && currVal < borders[i])
{
COUNT_sub_end();
return i;
}
}
ADD(1); BRANCH(1);
if(currVal > borders[numBorders-1])
{
COUNT_sub_end();
return numBorders;
}
COUNT_sub_end();
return 0;
}
示例10: bcf_fmt_array
void bcf_fmt_array(kstring_t *s, int n, int type, void *data)
{
int j = 0;
if (n == 0) {
kputc('.', s);
return;
}
if (type == BCF_BT_CHAR)
{
char *p = (char*)data;
for (j = 0; j < n && *p; ++j, ++p) kputc(*p, s);
}
else
{
#define BRANCH(type_t, is_missing, kprint) {\
type_t *p = (type_t *) data; \
for (j=0; j<n && !(is_missing); j++) p++; \
if ( j ) \
{ \
p = (type_t *) data; \
for (j=0; j<n; j++, p++) \
{ \
if ( j ) kputc(',', s); \
if ( is_missing ) kputc('.', s); \
else kprint; \
} \
if (n && j == 0) kputc('.', s); \
} \
else kputc('.', s); \
}
switch (type) {
case BCF_BT_INT8: BRANCH(int8_t, *p==INT8_MIN, kputw(*p, s)); break;
case BCF_BT_INT16: BRANCH(int16_t, *p==INT16_MIN, kputw(*p, s)); break;
case BCF_BT_INT32: BRANCH(int32_t, *p==INT32_MIN, kputw(*p, s)); break;
case BCF_BT_FLOAT: BRANCH(float, *(uint32_t*)p==bcf_missing_float, ksprintf(s, "%g", *p)); break;
default: fprintf(stderr,"todo: type %d\n", type); exit(1); break;
}
#undef BRANCH
}
}
示例11: bcf_get_format_values
bcf1_t *process(bcf1_t *rec)
{
int nval = 0, i, j, nret = bcf_get_format_values(in_hdr,rec,"GP",(void**)&buf,&nbuf,gp_type);
if ( nret<0 )
{
if (!nskip_gp) fprintf(stderr, "[impute-info.c] Warning: info tag not added to sites without GP tag\n");
nskip_gp++;
return rec; // require FORMAT/GP tag, return site unchanged
}
nret /= rec->n_sample;
if ( nret != 3 )
{
if (!nskip_dip) fprintf(stderr, "[impute-info.c] Warning: info tag not added to sites that are not biallelic diploid\n");
nskip_dip++;
return rec; // require biallelic diploid, return site unchanged
}
double esum = 0, e2sum = 0, fsum = 0;
#define BRANCH(type_t,is_missing,is_vector_end) \
{ \
type_t *ptr = (type_t*) buf; \
for (i=0; i<rec->n_sample; i++) \
{ \
double vals[3] = {0,0,0}; \
for (j=0; j<nret; j++) \
{ \
if ( is_missing || is_vector_end ) break; \
vals[j] = ptr[j]; \
} \
esum += vals[1] + 2*vals[2]; \
e2sum += (vals[1] + 2*vals[2]) * (vals[1] + 2*vals[2]); \
fsum += vals[1] + 4*vals[2]; \
ptr += nret; \
nval++; \
} \
}
switch (gp_type)
{
case BCF_HT_INT: BRANCH(int32_t,ptr[j]==bcf_int32_missing,ptr[j]==bcf_int32_vector_end); break;
case BCF_HT_REAL: BRANCH(float,bcf_float_is_missing(ptr[j]),bcf_float_is_vector_end(ptr[j])); break;
}
#undef BRANCH
double theta = esum / (2 * (double)nval);
float info = (theta>0 && theta<1) ? (float)(1 - (fsum - e2sum) / (2 * (double)nval * theta * (1.0 - theta))) : 1;
bcf_update_info_float(out_hdr, rec, "INFO", &info, 1);
nrec++;
return rec;
}
示例12: gmStage1
static void
gmStage1(SECTION_INFO * section,
int bitLookUp[MAX_SFB_LONG][CODE_BOOK_ESC_NDX + 1],
const int maxSfb,
const int *sideInfoTab)
{
int mergeStart = 0, mergeEnd;
COUNT_sub_start("gmStage1");
MOVE(1); /* counting previous operations */
LOOP(1);
do
{
PTR_INIT(4); /* pointers for section[mergeStart]
section[mergeEnd]
bitLookUp[mergeStart]
bitLookUp[mergeEnd]
*/
ADD(1); LOOP(1);
for (mergeEnd = mergeStart + 1; mergeEnd < maxSfb; mergeEnd++)
{
ADD(1); BRANCH(1);
if (section[mergeStart].codeBook != section[mergeEnd].codeBook)
break;
ADD(1); STORE(1);
section[mergeStart].sfbCnt++;
ADD(1); STORE(1);
section[mergeStart].sectionBits += section[mergeEnd].sectionBits;
FUNC(2);
mergeBitLookUp(bitLookUp[mergeStart], bitLookUp[mergeEnd]);
}
INDIRECT(1); ADD(1); STORE(1);
section[mergeStart].sectionBits += sideInfoTab[section[mergeStart].sfbCnt];
MOVE(1);
section[mergeEnd - 1].sfbStart = section[mergeStart].sfbStart;
MOVE(1);
mergeStart = mergeEnd;
} while (mergeStart < maxSfb);
COUNT_sub_end();
}
示例13: q_share_work
int q_share_work(int worker_p) {
LOCK_OR_FRAME(LOCAL_top_or_fr);
if (Get_REMOTE_prune_request(worker_p)) {
/* worker p with prune request */
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
return FALSE;
}
#ifdef YAPOR_ERRORS
if (OrFr_pend_prune_cp(LOCAL_top_or_fr) &&
BRANCH_LTT(worker_p, OrFr_depth(LOCAL_top_or_fr)) < OrFr_pend_prune_ltt(LOCAL_top_or_fr))
YAPOR_ERROR_MESSAGE("prune ltt > worker_p branch ltt (q_share_work)");
#endif /* YAPOR_ERRORS */
/* there is no pending prune with worker p at right --> safe move to worker p branch */
BRANCH(worker_id, OrFr_depth(LOCAL_top_or_fr)) = BRANCH(worker_p, OrFr_depth(LOCAL_top_or_fr));
LOCAL_prune_request = NULL;
UNLOCK_OR_FRAME(LOCAL_top_or_fr);
/* make sharing request */
LOCK_WORKER(worker_p);
if (BITMAP_member(GLOBAL_bm_idle_workers, worker_p) ||
REMOTE_share_request(worker_p) != MAX_WORKERS) {
/* worker p is idle or has another request */
UNLOCK_WORKER(worker_p);
return FALSE;
}
REMOTE_share_request(worker_p) = worker_id;
UNLOCK_WORKER(worker_p);
/* wait for an answer */
while (LOCAL_reply_signal == ready);
if (LOCAL_reply_signal == no_sharing) {
/* sharing request refused */
LOCAL_reply_signal = ready;
return FALSE;
}
/* exit this process */
exit(0);
}
示例14: ZBRANCH
void ZBRANCH()
{
SWAP();
if (pop(PSP) == 0)
{
BRANCH();
}
else
{
DROP();
}
}
示例15: calcPeNoAH
/* sum the pe data only for bands where avoid hole is inactive */
static void calcPeNoAH(float *pe,
float *constPart,
float *nActiveLines,
PE_DATA *peData,
int ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
const int nChannels)
{
int ch, sfb,sfbGrp;
COUNT_sub_start("calcPeNoAH");
MOVE(3);
*pe = 0.0f;
*constPart = 0.0f;
*nActiveLines = 0;
LOOP(1);
for(ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
PE_CHANNEL_DATA *peChanData = &peData->peChannelData[ch];
PTR_INIT(2); /* counting previous operations */
INDIRECT(2); LOOP(1);
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
PTR_INIT(4); /* pointers for ahFlag[ch][sfbGrp+sfb],
peChanData->sfbPe[sfbGrp+sfb],
peChanData->sfbConstPart[sfbGrp+sfb],
peChanData->sfbNActiveLines[sfbGrp+sfb]
*/
INDIRECT(1); LOOP(1);
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
ADD(1); BRANCH(1);
if(ahFlag[ch][sfbGrp+sfb] < AH_ACTIVE) {
ADD(3); STORE(3);
*pe += peChanData->sfbPe[sfbGrp+sfb];
*constPart += peChanData->sfbConstPart[sfbGrp+sfb];
*nActiveLines += peChanData->sfbNActiveLines[sfbGrp+sfb];
}
}
}
}
COUNT_sub_end();
}