本文整理汇总了C++中MULT函数的典型用法代码示例。如果您正苦于以下问题:C++ MULT函数的具体用法?C++ MULT怎么用?C++ MULT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MULT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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();
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:56,代码来源:band_nrg.c
示例2: atan
/*****************************************************************************
functionname: atan_approx
description: Calculates atan , val >=0
returns: approx of atan(val), error is less then 0.5 %
input:
output:
*****************************************************************************/
static float atan_approx(float val)
{
COUNT_sub_start("atan_approx");
ADD(1); BRANCH(1);
if(val < (float)1.0)
{
DIV(1); MULT(2); ADD(1); /* counting post-operations */
COUNT_sub_end();
return(val/((float)1.0f+(float)0.280872f*val*val));
}
else
{
DIV(1); MULT(1); ADD(2); /* counting post-operations */
COUNT_sub_end();
return((float)1.57079633f-val/((float)0.280872f +val*val));
}
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:28,代码来源:psy_configuration.c
示例3: AdvanceARFilter
static void
AdvanceARFilter( IIR_FILTER *iirFilter,
float input
)
{
int j;
float y;
int ptr = iirFilter->ptr;
int i = ptr + (BUFFER_SIZE-1);
COUNT_sub_start("AdvanceARFilter");
INDIRECT(1); MOVE(1); ADD(1); /* counting previous operations */
INDIRECT(2); MULT(1); ADD(1);
y = input + (iirFilter->coeffIIRb[1] * (-iirFilter->ring_buf_2[i & (BUFFER_SIZE-1)]));
PTR_INIT(4); /* iirFilter->noOffCoeffs
iirFilter->coeffIIRb[]
iirFilter->ring_buf_2[i]
iirFilter->ring_buf_2[ptr]
*/
LOOP(1);
for (j=2; j<iirFilter->noOffCoeffs; j++) {
i--;
MULT(1); MAC(1);
y += (iirFilter->coeffIIRb[j] * (-iirFilter->ring_buf_2[i & (BUFFER_SIZE-1)]));
}
MOVE(1);
iirFilter->ring_buf_2[ptr] = y;
/* pointer update */
iirFilter->ptr = (ptr+1) & (BUFFER_SIZE-1);
COUNT_sub_end();
}
开发者ID:cpopescu,项目名称:whispermedialib,代码行数:41,代码来源:resampler.c
示例4: 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();
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:60,代码来源:qmf_dec.c
示例5: sbrForwardModulationLP
/*
*
* \brief Perform real-valued forward modulation of the time domain
* data of timeIn and stores the real part of the subband
* samples in rSubband
*
*/
static void
sbrForwardModulationLP (const float *timeIn,
float *rSubband,
HANDLE_SBR_QMF_FILTER_BANK qmfBank
)
{
int i, L, M;
COUNT_sub_start("sbrForwardModulationLP");
MOVE(1);
L = NO_ANALYSIS_CHANNELS;
MULT(1);
M = L/2;
PTR_INIT(1); /* pointers for rSubband[] */
MULT(1); MOVE(1);
rSubband[0] = timeIn[3 * M];
PTR_INIT(2); /* pointers for timeIn[3 * M - i],
timeIn[3 * M + i] */
LOOP(1);
for (i = 1; i < M; i++) {
ADD(1); STORE(1);
rSubband[i] = timeIn[3 * M - i] + timeIn[3 * M + i];
}
LOOP(1);
for (i = M; i < L; i++) {
ADD(1); STORE(1);
rSubband[i] = timeIn[3 * M - i] - timeIn[i - M];
}
FUNC(3);
dct3 (rSubband, L, qmfBank);
COUNT_sub_end();
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:46,代码来源:qmf_dec.c
示例6: main
int main(int argc, char *argv[]){
if (argc > 1 && atoi(argv[1]) > 10) limit = atoi(argv[1]);
clock_t start, end;
srand(clock());
M = rand() % limit/2 + limit/2;
N = rand() % limit/2 + limit/2;
O = (rand() % limit/8 + 1 + limit/16) * 4;
float* A = random_matrix(M, N, 10);
float* B = random_matrix(N, O, 10);
float* C = malloc(sizeof(float) * M * O);
float* D;
printf("Generadas dos matrices aleatorias de (%zu x %zu) y (%zu x %zu)\n", M, N, N, O);
if (print) {
print_matrix(A, M, N);
printf("\n");
print_matrix(B, N, O);
printf("\n");
}
start = clock();
D = MULT(A, B, M, N, O);
end = clock();
printf("RESULTADO FUERZA BRUTA: (%f)\n", ((double)(end - start))/CLOCKS_PER_SEC);
if (print) print_matrix(D, M, O);
start = clock();
SIMD_MULT(A, B, C, M, N, O);
end = clock();
printf("RESULTADO SIMD: (%f)\n", ((double)(end - start))/CLOCKS_PER_SEC);
if (print) print_matrix(C, M, O);
if (equal_mtrx(C, D, M*O)) printf("Son iguales!\n");
else printf("NO son iguales!\n");
free(A);
free(B);
free(C);
free(D);
}
开发者ID:mbucchi,项目名称:stuff,代码行数:50,代码来源:SIMD_matrix_mult.c
示例7: BarcLineValue
/*****************************************************************************
functionname: BarcLineValue
description: Calculates barc value for one frequency line
returns: barc value of line
input: number of lines in transform, index of line to check, Fs
output:
*****************************************************************************/
static float BarcLineValue(int noOfLines, int fftLine, long samplingFreq) {
float center_freq, temp, bvalFFTLine;
COUNT_sub_start("BarcLineValue");
/*
center frequency of fft line
*/
MULT(2); DIV(1);
center_freq = (float) fftLine * ((float)samplingFreq * (float)0.5f)/(float)noOfLines;
MULT(1); FUNC(1);
temp = (float) atan_approx((float)1.3333333e-4f * center_freq);
MULT(4); ADD(1); FUNC(1);
bvalFFTLine = (float)13.3f * atan_approx((float)0.00076f * center_freq) + (float)3.5f * temp * temp;
COUNT_sub_end();
return(bvalFFTLine);
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:32,代码来源:psy_configuration.c
示例8: SpreadingMax
void SpreadingMax(const int pbCnt,
const float *maskLowFactor,
const float *maskHighFactor,
float *pbSpreadedEnergy)
{
int i;
COUNT_sub_start("SpreadingMax");
/* slope to higher frequencies */
PTR_INIT(2); /* pointers for pbSpreadedEnergy[],
maskHighFactor[]
*/
LOOP(1);
for (i=1; i<pbCnt; i++) {
MULT(1); ADD(1); BRANCH(1); MOVE(1);
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
maskHighFactor[i] * pbSpreadedEnergy[i-1]);
}
/* slope to lower frequencies */
PTR_INIT(2); /* pointers for pbSpreadedEnergy[],
maskLowFactor[]
*/
LOOP(1);
for (i=pbCnt-2; i>=0; i--) {
MULT(1); ADD(1); BRANCH(1); MOVE(1);
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
maskLowFactor[i] * pbSpreadedEnergy[i+1]);
}
COUNT_sub_end();
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:36,代码来源:spreading.c
示例9: apply_window
static void apply_window(const float *buf, const float *win1,
const float *win2, float *sum1, float *sum2, int len)
{
const vector float *win1a = (const vector float *) win1;
const vector float *win2a = (const vector float *) win2;
const vector float *bufa = (const vector float *) buf;
vector float *sum1a = (vector float *) sum1;
vector float *sum2a = (vector float *) sum2;
vector float av_uninit(v0), av_uninit(v4);
vector float v1, v2, v3;
len = len >> 2;
#define MULT(a, b) \
{ \
v1 = vec_ld(a, win1a); \
v2 = vec_ld(b, win2a); \
v3 = vec_ld(a, bufa); \
v0 = vec_madd(v3, v1, v0); \
v4 = vec_madd(v2, v3, v4); \
}
while (len--)
{
v0 = vec_xor(v0, v0);
v4 = vec_xor(v4, v4);
MULT( 0, 0);
MULT( 256, 64);
MULT( 512, 128);
MULT( 768, 192);
MULT(1024, 256);
MULT(1280, 320);
MULT(1536, 384);
MULT(1792, 448);
vec_st(v0, 0, sum1a);
vec_st(v4, 0, sum2a);
sum1a++;
sum2a++;
win1a++;
win2a++;
bufa++;
}
}
开发者ID:hicks0074,项目名称:freescale_omx_framework,代码行数:45,代码来源:mpegaudiodec_altivec.c
示例10: IIR32GetResamplerFeed
int
IIR32GetResamplerFeed( int blockSizeOut)
{
int size;
COUNT_sub_start("IIR32GetResamplerFeed");
MULT(1);
size = blockSizeOut * 3;
DIV(1);
size /= 2;
COUNT_sub_end();
return size;
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:17,代码来源:iir32resample.c
示例11: getCrc
/*
\brief crc
*/
static int
getCrc (HANDLE_BIT_BUFFER hBitBuf, unsigned long NrBits)
{
int i;
int CrcStep = NrBits / MAXCRCSTEP;
int CrcNrBitsRest = (NrBits - CrcStep * MAXCRCSTEP);
unsigned long bValue;
CRC_BUFFER CrcBuf;
FLC_sub_start("getCrc");
DIV(1); MULT(1); ADD(1); /* counting previous operations */
MOVE(3);
CrcBuf.crcState = SBR_CRC_START;
CrcBuf.crcPoly = SBR_CRC_POLY;
CrcBuf.crcMask = SBR_CRC_MASK;
LOOP(1);
for (i = 0; i < CrcStep; i++) {
FUNC(2);
bValue = getbits (hBitBuf, MAXCRCSTEP);
PTR_INIT(1); FUNC(3);
calcCRC (&CrcBuf, bValue, MAXCRCSTEP);
}
FUNC(2);
bValue = getbits (hBitBuf, CrcNrBitsRest);
PTR_INIT(1); FUNC(3);
calcCRC (&CrcBuf, bValue, CrcNrBitsRest);
LOGIC(1); /* counting post operation */
FLC_sub_end();
return (CrcBuf.crcState & SBR_CRC_RANGE);
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:46,代码来源:sbr_crc.cpp
示例12: calcBitSave
static float calcBitSave(float fillLevel,
const float clipLow,
const float clipHigh,
const float minBitSave,
const float maxBitSave)
{
float bitsave;
COUNT_sub_start("calcBitSave");
ADD(2); BRANCH(2); MOVE(2);
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
ADD(4); DIV(1); MULT(1);
bitsave = maxBitSave - ((maxBitSave-minBitSave) / (clipHigh-clipLow)) *
(fillLevel-clipLow);
COUNT_sub_end();
return (bitsave);
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:22,代码来源:adj_thr.c
示例13: calcBitSpend
static float calcBitSpend(float fillLevel,
const float clipLow,
const float clipHigh,
const float minBitSpend,
const float maxBitSpend)
{
float bitspend;
COUNT_sub_start("calcBitSpend");
ADD(2); BRANCH(2); MOVE(2);
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
ADD(4); DIV(1); MULT(1);
bitspend = minBitSpend + ((maxBitSpend-minBitSpend) / (clipHigh-clipLow)) *
(fillLevel-clipLow);
COUNT_sub_end();
return (bitspend);
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:22,代码来源:adj_thr.c
示例14: AdvanceIIRFilter
static float
AdvanceIIRFilter(IIR_FILTER *iirFilter,
float input
)
{
float y = 0.0f;
int j = 0;
int i;
COUNT_sub_start("AdvanceIIRFilter");
MOVE(2); /* counting previous operations */
INDIRECT(1); MOVE(1);
iirFilter->ring_buf_1[iirFilter->ptr] = input;
PTR_INIT(4); /* pointer for iirFilter->ring_buf_1,
iirFilter->ring_buf_2,
iirFilter->coeffIIRa,
iirFilter->coeffIIRb
*/
ADD(1); LOOP(1);
for (i = iirFilter->ptr; i > iirFilter->ptr - iirFilter->noOffCoeffs; i--, j++) {
MULT(2); ADD(1);
y += iirFilter->coeffIIRa[j] * iirFilter->ring_buf_1[i & (BUFFER_SIZE - 1)] - iirFilter->coeffIIRb[j] * iirFilter->ring_buf_2[i & (BUFFER_SIZE - 1)];
}
MOVE(1);
iirFilter->ring_buf_2[(iirFilter->ptr) & (BUFFER_SIZE - 1)] = y;
iirFilter->ptr = (iirFilter->ptr+1) & (BUFFER_SIZE - 1);
COUNT_sub_end();
return y;
}
开发者ID:cpopescu,项目名称:whispermedialib,代码行数:38,代码来源:resampler.c
示例15: ImportRow
static WEBP_INLINE void ImportRow(const uint8_t* const src,
WebPRescaler* const wrk) {
int x_in = 0;
int x_out;
int accum = 0;
if (!wrk->x_expand) {
int sum = 0;
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
accum += wrk->x_add;
for (; accum > 0; accum -= wrk->x_sub) {
sum += src[x_in++];
}
{ // Emit next horizontal pixel.
const int32_t base = src[x_in++];
const int32_t frac = base * (-accum);
wrk->frow[x_out] = (sum + base) * wrk->x_sub - frac;
// fresh fractional start for next pixel
sum = MULT(frac, wrk->fx_scale);
}
}
} else { // simple bilinear interpolation
int left = src[0], right = src[0];
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
if (accum < 0) {
left = right;
right = src[++x_in];
accum += wrk->x_add;
}
wrk->frow[x_out] = right * wrk->x_add + (left - right) * accum;
accum -= wrk->x_sub;
}
}
// Accumulate the new row's contribution
for (x_out = 0; x_out < wrk->dst_width; ++x_out) {
wrk->irow[x_out] += wrk->frow[x_out];
}
}
开发者ID:soywiz,项目名称:nwebp,代码行数:37,代码来源:io.c
示例16: cairo_to_pixbuf
static void
cairo_to_pixbuf (GOImage *image)
{
guint i,j, rowstride;
unsigned char *src, *dst;
guint t;
g_return_if_fail (IS_GO_IMAGE (image) && image->data && image->pixbuf);
#define MULT(d,c,a,t) G_STMT_START { t = (a)? c * 255 / a: 0; d = t;} G_STMT_END
dst = gdk_pixbuf_get_pixels (image->pixbuf);
rowstride = gdk_pixbuf_get_rowstride (image->pixbuf);
src = image->data;
for (i = 0; i < image->height; i++) {
for (j = 0; j < image->width; j++) {
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
MULT(dst[0], src[2], src[3], t);
MULT(dst[1], src[1], src[3], t);
MULT(dst[2], src[0], src[3], t);
dst[3] = src[3];
#else
MULT(dst[3], src[2], src[3], t);
MULT(dst[2], src[1], src[3], t);
MULT(dst[1], src[0], src[3], t);
dst[0] = src[3];
#endif
src += 4;
dst += 4;
}
dst += rowstride - image->width * 4;
src += image->rowstride - image->width * 4;
}
#undef MULT
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:36,代码来源:go-image.c
示例17: lppTransposer
/*
* \brief Perform transposition by patching of subband samples.
*/
void lppTransposer (HANDLE_SBR_LPP_TRANS hLppTrans,
float **qmfBufferReal,
#ifndef LP_SBR_ONLY
float **qmfBufferImag,
#endif
float *degreeAlias,
int timeStep,
int firstSlotOffs,
int lastSlotOffs,
unsigned char nInvfBands,
INVF_MODE *sbr_invf_mode,
INVF_MODE *sbr_invf_mode_prev,
int bUseLP
)
{
int bwIndex[MAX_NUM_PATCHES];
float bwVector[MAX_NUM_PATCHES];
int i,j;
int loBand, hiBand;
PATCH_PARAM *patchParam;
int patch;
float alphar[LPC_ORDER], a0r, a1r;
float alphai[LPC_ORDER], a0i, a1i;
float bw;
int autoCorrLength;
float k1, k1_below, k1_below2;
ACORR_COEFS ac;
int startSample;
int stopSample;
int stopSampleClear;
int lb, hb;
int targetStopBand;
COUNT_sub_start("lppTransposer");
INDIRECT(1); PTR_INIT(1);
patchParam = hLppTrans->pSettings->patchParam;
MOVE(1);
bw = 0.0f;
MOVE(2);
k1_below=0, k1_below2=0;
MULT(1);
startSample = firstSlotOffs * timeStep;
INDIRECT(1); MULT(1); ADD(1);
stopSample = hLppTrans->pSettings->nCols + lastSlotOffs * timeStep;
FUNC(5);
inverseFilteringLevelEmphasis(hLppTrans, nInvfBands, sbr_invf_mode, sbr_invf_mode_prev, bwVector);
MOVE(1);
stopSampleClear = stopSample;
PTR_INIT(2); /* pointers for qmfBufferReal[],
qmfBufferImag[] */
INDIRECT(1); LOOP(1);
for ( patch = 0; patch < hLppTrans->pSettings->noOfPatches; patch++ ) {
LOOP(1);
for (i = startSample; i < stopSampleClear; i++) {
INDIRECT(1); ADD(1); LOOP(1);
for(j=patchParam[patch].guardStartBand; j<patchParam[patch].guardStartBand+GUARDBANDS; j++){
MOVE(1);
qmfBufferReal[i][j] = 0.0;
#ifndef LP_SBR_ONLY
BRANCH(1);
if (!bUseLP) {
MOVE(1);
qmfBufferImag[i][j] = 0.0;
}
#endif
}
}
}
INDIRECT(4); ADD(1);
targetStopBand = patchParam[hLppTrans->pSettings->noOfPatches-1].targetStartBand +
patchParam[hLppTrans->pSettings->noOfPatches-1].numBandsInPatch;
PTR_INIT(2); /* pointers for qmfBufferReal[],
qmfBufferImag[] */
LOOP(1);
for (i = startSample; i < stopSampleClear; i++) {
LOOP(1);
for (j=targetStopBand; j<NO_SYNTHESIS_CHANNELS; j++) {
//.........这里部分代码省略.........
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:101,代码来源:lpp_tran.c
示例18: autoCorrelation2ndLP
/*
*
* \brief Calculate second order autocorrelation using 2 accumulators
*
*/
static void
autoCorrelation2ndLP(ACORR_COEFS *ac,
float *realBuf,
int len
)
{
int j;
float accu1, accu2;
COUNT_sub_start("autoCorrelation2ndLP");
MOVE(1);
accu1 = 0.0;
PTR_INIT(1); /* pointer for realBuf[] */
ADD(1); LOOP(1);
for ( j = 0; j < len - 1; j++ ) {
MAC(1);
accu1 += realBuf[j-1] * realBuf[j-1];
}
MULT(1);
accu2 = realBuf[-2] * realBuf[-2];
ADD(1);
accu2 += accu1;
MAC(1);
accu1 += realBuf[j-1] * realBuf[j-1];
MOVE(2);
ac->r11r = accu1;
ac->r22r = accu2;
MOVE(1);
accu1 = 0.0;
PTR_INIT(1); /* pointer for realBuf[] */
LOOP(1);
for ( j = 0; j < len - 1; j++ ) {
MAC(1);
accu1 += realBuf[j] * realBuf[j-1];
}
MULT(1);
accu2 = realBuf[-1] * realBuf[-2];
ADD(1);
accu2 += accu1;
MAC(1);
accu1 += realBuf[j] * realBuf[j-1];
MOVE(2);
ac->r01r = accu1;
ac->r12r = accu2;
MOVE(1);
accu1=0.0;
PTR_INIT(1); /* pointer for realBuf[] */
LOOP(1);
for ( j = 0; j < len; j++ ) {
MAC(1);
accu1 += realBuf[j] * realBuf[j-2];
}
MOVE(1);
ac->r02r = accu1;
MULT(2); ADD(1); STORE(1);
ac->det = ac->r11r * ac->r22r - ac->r12r * ac->r12r;
MOVE(3);
ac->r01i = ac->r02i = ac->r12i = 0.0f;
INDIRECT(10); MOVE(10); /* move all register variables to the structure ac->... */
COUNT_sub_end();
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:91,代码来源:lpp_tran.c
示例19: InitStereoPreProcessing
/*!
\brief create and initialize a handle for stereo preprocessing
\return an error state
****************************************************************************/
int InitStereoPreProcessing(HANDLE_STEREO_PREPRO hStPrePro, /*! handle (modified) */
int nChannels, /*! number of channels */
int bitRate, /*! the bit rate */
int sampleRate, /*! the sample rate */
float usedScfRatio /*! the amount of scalefactors used (0-1.0) */
)
{
float bpf = bitRate*1024.0f/sampleRate;
float tmp;
COUNT_sub_start("InitStereoPreProcessing");
MULT(1); DIV(1); /* counting previous operation */
FUNC(2); LOOP(1); PTR_INIT(1); MOVE(1); STORE(sizeof(struct STEREO_PREPRO));
memset(hStPrePro,0,sizeof(struct STEREO_PREPRO));
ADD(1); BRANCH(1);
if(nChannels == 2) {
INDIRECT(1); MOVE(1);
(hStPrePro)->stereoAttenuationFlag = 1;
INDIRECT(1); MULT(1); DIV(1); STORE(1);
(hStPrePro)->normPeFac = 230.0f * usedScfRatio / bpf;
INDIRECT(1); DIV(2); MULT(1); ADD(2); BRANCH(1); MOVE(1);
(hStPrePro)->ImpactFactor = max (1, 400000.0f / (float) (bitRate - sampleRate*sampleRate/72000.0f) );
INDIRECT(2); DIV(3); MULT(2); STORE(2);
(hStPrePro)->stereoAttenuationInc = 22050.0f / sampleRate * 400.0f / bpf;
(hStPrePro)->stereoAttenuationDec = 22050.0f / sampleRate * 200.0f / bpf;
INDIRECT(2); MOVE(2);
(hStPrePro)->ConstAtt = 0.0f;
(hStPrePro)->stereoAttMax = 12.0f;
/* energy ratio thresholds (dB) */
INDIRECT(4); MOVE(4);
(hStPrePro)->SMMin = 0.0f;
(hStPrePro)->SMMax = 15.0f;
(hStPrePro)->LRMin = 10.0f;
(hStPrePro)->LRMax = 30.0f;
/* pe thresholds */
INDIRECT(3); MOVE(3);
(hStPrePro)->PeCrit = 1200.0f;
(hStPrePro)->PeMin = 700.0f;
(hStPrePro)->PeImpactMax = 100.0f;
/* init start values */
INDIRECT(8); MOVE(8);
(hStPrePro)->avrgFreqEnergyL = 0.0f;
(hStPrePro)->avrgFreqEnergyR = 0.0f;
(hStPrePro)->avrgFreqEnergyS = 0.0f;
(hStPrePro)->avrgFreqEnergyM = 0.0f;
(hStPrePro)->smoothedPeSumSum = 7000.0f; /* typical start value */
(hStPrePro)->avgStoM = -10.0f; /* typical start value */
(hStPrePro)->lastLtoR = 0.0f;
(hStPrePro)->lastNrgLR = 0.0f;
DIV(1); ADD(1);
tmp = 1.0f - (bpf / 2600.0f);
BRANCH(1); MOVE(1);
tmp = max (tmp, 0.0f);
INDIRECT(2); MULT(1); STORE(1);
(hStPrePro)->stereoAttenuation = tmp * (hStPrePro)->stereoAttMax;
}
COUNT_sub_end();
return 0;
}
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:83,代码来源:stprepro.c
示例20: ApplyStereoPreProcess
/*!
\brief do an appropriate attenuation on the side channel of a stereo
signal
\return nothing
****************************************************************************/
void ApplyStereoPreProcess(HANDLE_STEREO_PREPRO hStPrePro, /*!st.-preproc handle */
int nChannels, /*! total number of channels */
ELEMENT_INFO *elemInfo,
float *timeData, /*! lr time data (modified) */
int granuleLen) /*! num. samples to be processed */
{
/* inplace operation on inData ! */
float SMRatio, StoM;
float LRRatio, LtoR, deltaLtoR, deltaNrg;
float EnImpact, PeImpact, PeNorm;
float Att, AttAimed;
float maxInc, maxDec, swiftfactor;
float DELTA=0.1f;
float fac = hStPrePro->stereoAttFac;
float mPart, upper, div;
float lFac,rFac;
int i;
COUNT_sub_start("ApplyStereoPreProcess");
INDIRECT(1); MOVE(2); /* counting previous operations */
INDIRECT(1); BRANCH(1);
if (!hStPrePro->stereoAttenuationFlag) {
COUNT_sub_end();
return;
}
/* calc L/R ratio */
INDIRECT(1); MULT(3); ADD(1);
mPart = 2.0f * hStPrePro->avrgFreqEnergyM * (1.0f - fac*fac);
INDIRECT(2); ADD(4); MULT(2); MAC(2);
upper = hStPrePro->avrgFreqEnergyL * (1.0f+fac) + hStPrePro->avrgFreqEnergyR * (1.0f-fac) - mPart;
div = hStPrePro->avrgFreqEnergyR * (1.0f+fac) + hStPrePro->avrgFreqEnergyL * (1.0f-fac) - mPart;
LOGIC(1); BRANCH(1);
if (div == 0.0f || upper == 0.0f) {
INDIRECT(1); MOVE(1);
LtoR = hStPrePro->LRMax;
}
else {
DIV(1); MISC(1);
LRRatio = (float) fabs ( upper / div ) ;
TRANS(1); MULT(1); MISC(1);
LtoR = (float) fabs(10.0 * log10(LRRatio));
}
/* calc delta energy to previous frame */
INDIRECT(3); ADD(3); DIV(1);
deltaNrg = ( hStPrePro->avrgFreqEnergyL + hStPrePro->avrgFreqEnergyR + 1.0f) /
( hStPrePro->lastNrgLR + 1.0f );
TRANS(1); MULT(1); MISC(1);
deltaNrg = (float) (fabs(10.0 * log10(deltaNrg)));
/* Smooth S/M over time */
INDIRECT(2); ADD(2); DIV(1);
SMRatio = (hStPrePro->avrgFreqEnergyS + 1.0f) / (hStPrePro->avrgFreqEnergyM + 1.0f);
TRANS(1); MULT(1);
StoM = (float) (10.0 * log10(SMRatio));
INDIRECT(2); MULT(1); MAC(1); STORE(1);
hStPrePro->avgStoM = DELTA * StoM + (1-DELTA) * hStPrePro->avgStoM;
MOVE(1);
EnImpact = 1.0f;
INDIRECT(2); ADD(1); BRANCH(1);
if (hStPrePro->avgStoM > hStPrePro->SMMin) {
INDIRECT(1); ADD(1); BRANCH(1);
if (hStPrePro->avgStoM > hStPrePro->SMMax) {
MOVE(1);
EnImpact = 0.0f;
}
else {
//.........这里部分代码省略.........
开发者ID:KISSMonX,项目名称:aacplusenc,代码行数:101,代码来源:stprepro.c
注:本文中的MULT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论