void CBlock_ScaleSpectralData(CAacDecoderChannelInfo *pAacDecoderChannelInfo, SamplingRateInfo *pSamplingRateInfo) { int band; int window; const SHORT * RESTRICT pSfbScale = pAacDecoderChannelInfo->pDynData->aSfbScale; SHORT * RESTRICT pSpecScale = pAacDecoderChannelInfo->specScale; int groupwin,group; const SHORT * RESTRICT BandOffsets = GetScaleFactorBandOffsets(&pAacDecoderChannelInfo->icsInfo, pSamplingRateInfo); SPECTRAL_PTR RESTRICT pSpectralCoefficient = pAacDecoderChannelInfo->pSpectralCoefficient; FDKmemclear(pSpecScale, 8*sizeof(SHORT)); int max_band = GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo->icsInfo); for (window=0, group=0; group < GetWindowGroups(&pAacDecoderChannelInfo->icsInfo); group++) { for (groupwin=0; groupwin < GetWindowGroupLength(&pAacDecoderChannelInfo->icsInfo,group); groupwin++, window++) { int SpecScale_window = pSpecScale[window]; FIXP_DBL *pSpectrum = SPEC(pSpectralCoefficient, window, pAacDecoderChannelInfo->granuleLength); /* find scaling for current window */ for (band=0; band < max_band; band++) { SpecScale_window = fMax(SpecScale_window, (int)pSfbScale[window*16+band]); } if (pAacDecoderChannelInfo->pDynData->TnsData.Active) { SpecScale_window += TNS_SCALE; } /* store scaling of current window */ pSpecScale[window] = SpecScale_window; #ifdef FUNCTION_CBlock_ScaleSpectralData_func1 CBlock_ScaleSpectralData_func1(pSpectrum, max_band, BandOffsets, SpecScale_window, pSfbScale, window); #else /* FUNCTION_CBlock_ScaleSpectralData_func1 */ for (band=0; band < max_band; band++) { int scale = SpecScale_window - pSfbScale[window*16+band]; if (scale) { /* following relation can be used for optimizations: (BandOffsets[i]%4) == 0 for all i */ int max_index = BandOffsets[band+1]; for (int index = BandOffsets[band]; index < max_index; index++) { pSpectrum[index] >>= scale; } } } #endif /* FUNCTION_CBlock_ScaleSpectralData_func1 */ } } }
static void _kcmdline_parse_var(const char *start, size_t len) { static const struct spec { const char *prefix; size_t prefixlen; void *data; void (*parse)(const char *str, size_t size, void *data); } specs[] = { #define SPEC(str, storage, parse) \ { str, sizeof(str) - 1, storage, parse \ } SPEC("LEVELS", NULL, _levels_parse_wrapper), SPEC("LEVEL", &_global_domain.level, _level_parse_wrapper), SPEC("ABORT", &_abort_level, _level_parse_wrapper), SPEC("SHOW_COLORS", &_show_colors, _bool_parse_wrapper), SPEC("SHOW_FILE", &_show_file, _bool_parse_wrapper), SPEC("SHOW_FUNCTION", &_show_function, _bool_parse_wrapper), SPEC("SHOW_LINE", &_show_line, _bool_parse_wrapper), #undef SPEC }; const struct spec *itr, *itr_end; itr = specs; itr_end = itr + SOL_UTIL_ARRAY_SIZE(specs); for (; itr < itr_end; itr++) { if (itr->prefixlen + 1 < len && memcmp(itr->prefix, start, itr->prefixlen) == 0 && start[itr->prefixlen] == '=') { itr->parse(start + (itr->prefixlen + 1), len - (itr->prefixlen + 1), itr->data); break; } } }
/* Set register value */ EXPORT ER setRegister(W regno, UW val) { W i, ix; i = regTab[regno].id & (R_GRP | 0x3ff); if (i & R_ONLY) return E_RONLY; // cannot be set if (i < SPEC(0)) { // normal register regStack[i & 0xff] = val; return 0; } // obtain mode ix = ixCpuMode(); // special register switch(i) { case SPEC(0x00): // R8 case SPEC(0x01): // R9 case SPEC(0x02): // R10 case SPEC(0x03): // R11 case SPEC(0x04): // R12 if (ix != ixFIQ) ix = ixUSR; case SPEC(0x05): // R13 case SPEC(0x06): // R14 regStack[ix + i - SPEC(0x00)] = val; break; case SPEC(0x08): // SPSR if (ix == ixUSR) break; // undefined if (ix == ixFIQ) ix -= 5; regStack[ix + 4] = val; break; case SPEC(0x0F): // CP15 R1 regStack[ixCP15R1] &= MASK_CACHEMMU; regStack[ixCP15R1] |= val & VALID_CACHEMMU; break; default: return E_PAR; } return 0; }
/* obtain register value */ EXPORT UW getRegister(W regno) { W i, ix; i = regTab[regno].id & (R_GRP | 0x3ff); // normal register if (i < SPEC(0)) return regStack[i & 0xff]; // obtain mode ix = ixCpuMode(); // special register switch(i) { case SPEC(0x00): // R8 case SPEC(0x01): // R9 case SPEC(0x02): // R10 case SPEC(0x03): // R11 case SPEC(0x04): // R12 if (ix != ixFIQ) ix = ixUSR; case SPEC(0x05): // R13 case SPEC(0x06): // R14 return regStack[ix + i - SPEC(0)]; case SPEC(0x08): // SPSR if (ix == ixUSR) return 0; // undefined if (ix == ixFIQ) ix -= 5; return regStack[ix + 4]; case SPEC(0x0F): // CP15 R1 return regStack[ixCP15R1]; } // retur 0 on error return 0; }
#define ixCP15 39 // CP15 index #define ixCP15R1 (ixCP15 + 0) #define N_ACTREGS (16 + 7 + 7 + 8 + 7 + 10) #define N_REGS (N_ACTREGS + 3) LOCAL const REGTAB regTab[N_REGS] = { {"R0 ", R_GEN + 0x00 }, // 0 {"R1 ", R_GEN + 0x01 }, // 1 {"R2 ", R_GEN + 0x02 }, // 2 {"R3 ", R_GEN + 0x03 + R_LF }, // 3 {"R4 ", R_GEN + 0x04 }, // 4 {"R5 ", R_GEN + 0x05 }, // 5 {"R6 ", R_GEN + 0x06 }, // 6 {"R7 ", R_GEN + 0x07 + R_LF }, // 7 {"R8 ", R_GEN + SPEC(0x00) }, // 8 {"R9 ", R_GEN + SPEC(0x01) }, // 9 {"R10/SL ", R_GEN + SPEC(0x02) }, // 10 {"R11/FP ", R_GEN + SPEC(0x03) + R_LF }, // 11 {"R12/IP ", R_GEN + SPEC(0x04) }, // 12 {"R13/SP ", R_GEN + SPEC(0x05) }, // 13 {"R14/LR ", R_GEN + SPEC(0x06) }, // 14 {"R15/PC ", R_GEN + ixPC + R_LF }, // 15 {"R8_USR ", R_GEN + ixUSR + 0 + R_GAP }, // 16 {"R9_USR ", R_GEN + ixUSR + 1 }, // 17 {"R10_USR ", R_GEN + ixUSR + 2 }, // 18 {"R11_USR ", R_GEN + ixUSR + 3 + R_LF }, // 19 {"R12_USR ", R_GEN + ixUSR + 4 }, // 20 {"R13_USR ", R_GEN + ixUSR + 5 }, // 21 {"R14_USR ", R_GEN + ixUSR + 6 + R_LF }, // 22
return plugin_dispatch_values(vl); } /* dispatch_size */ static struct { const char *name; const char *config_key; size_t offset; int (*dispatcher)(CURL *, CURLINFO, value_list_t *); const char *type; CURLINFO info; } field_specs[] = { #define SPEC(name, config_key, dispatcher, type, info) \ { #name, config_key, offsetof(curl_stats_t, name), dispatcher, type, info } SPEC(total_time, "TotalTime", dispatch_gauge, "duration", CURLINFO_TOTAL_TIME), SPEC(namelookup_time, "NamelookupTime", dispatch_gauge, "duration", CURLINFO_NAMELOOKUP_TIME), SPEC(connect_time, "ConnectTime", dispatch_gauge, "duration", CURLINFO_CONNECT_TIME), SPEC(pretransfer_time, "PretransferTime", dispatch_gauge, "duration", CURLINFO_PRETRANSFER_TIME), SPEC(size_upload, "SizeUpload", dispatch_gauge, "bytes", CURLINFO_SIZE_UPLOAD), SPEC(size_download, "SizeDownload", dispatch_gauge, "bytes", CURLINFO_SIZE_DOWNLOAD), SPEC(speed_download, "SpeedDownload", dispatch_speed, "bitrate", CURLINFO_SPEED_DOWNLOAD), SPEC(speed_upload, "SpeedUpload", dispatch_speed, "bitrate", CURLINFO_SPEED_UPLOAD), SPEC(header_size, "HeaderSize", dispatch_size, "bytes",
void CJointStereo_ApplyMS( CAacDecoderChannelInfo *pAacDecoderChannelInfo[2], const SHORT *pScaleFactorBandOffsets, const UCHAR *pWindowGroupLength, const int windowGroups, const int scaleFactorBandsTransmittedL, const int scaleFactorBandsTransmittedR ) { CJointStereoData *pJointStereoData = &pAacDecoderChannelInfo[L]->pComData->jointStereoData; int window, group, scaleFactorBandsTransmitted; FDK_ASSERT(scaleFactorBandsTransmittedL == scaleFactorBandsTransmittedR); scaleFactorBandsTransmitted = scaleFactorBandsTransmittedL; for (window = 0, group = 0; group < windowGroups; group++) { UCHAR groupMask = 1 << group; for (int groupwin=0; groupwin<pWindowGroupLength[group]; groupwin++, window++) { int band; FIXP_DBL *leftSpectrum, *rightSpectrum; SHORT *leftScale = &pAacDecoderChannelInfo[L]->pDynData->aSfbScale[window*16]; SHORT *rightScale = &pAacDecoderChannelInfo[R]->pDynData->aSfbScale[window*16]; leftSpectrum = SPEC(pAacDecoderChannelInfo[L]->pSpectralCoefficient, window, pAacDecoderChannelInfo[L]->granuleLength); rightSpectrum = SPEC(pAacDecoderChannelInfo[R]->pSpectralCoefficient, window, pAacDecoderChannelInfo[R]->granuleLength); for (band=0; band<scaleFactorBandsTransmitted; band++) { if (pJointStereoData->MsUsed[band] & groupMask) { int lScale=leftScale[band]; int rScale=rightScale[band]; int commonScale=lScale > rScale ? lScale:rScale; /* ISO/IEC 14496-3 Chapter 4.6.8.1.1 : M/S joint channel coding can only be used if common_window is ‘1’. */ FDK_ASSERT(GetWindowSequence(&pAacDecoderChannelInfo[L]->icsInfo) == GetWindowSequence(&pAacDecoderChannelInfo[R]->icsInfo)); FDK_ASSERT(GetWindowShape(&pAacDecoderChannelInfo[L]->icsInfo) == GetWindowShape(&pAacDecoderChannelInfo[R]->icsInfo)); commonScale++; leftScale[band]=commonScale; rightScale[band]=commonScale; lScale = fMin(DFRACT_BITS-1, commonScale - lScale); rScale = fMin(DFRACT_BITS-1, commonScale - rScale); FDK_ASSERT(lScale >= 0 && rScale >= 0); for (int index=pScaleFactorBandOffsets[band]; index<pScaleFactorBandOffsets[band+1]; index++) { FIXP_DBL leftCoefficient = leftSpectrum [index] ; FIXP_DBL rightCoefficient = rightSpectrum [index] ; leftCoefficient >>= lScale ; rightCoefficient >>= rScale ; leftSpectrum [index] = leftCoefficient + rightCoefficient ; rightSpectrum [index] = leftCoefficient - rightCoefficient ; } } } } }