ref: ec8008b086d39901c469386c0506c61ffd8a9ae4
parent: 75d27803d52f44f4618c4796111c179e24ba558e
author: Gregory Maxwell <[email protected]>
date: Tue Aug 30 12:50:01 EDT 2011
Adds many syntactically unnecessary casts to silence MSVC C4244; fix an MDCT encoder reset bug. st->tonal_average was being set to 1 instead of 256 on reset in floating point builds, otherwise the object code is unchanged.
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -1083,7 +1083,7 @@
for (j=0;j<N;j++)
{
*seed = lcg_rand(*seed);
- X[j] = (opus_int32)(*seed)>>20;
+ X[j] = (celt_norm)((opus_int32)*seed>>20);
}
cm = cm_mask;
} else {
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -1816,7 +1816,7 @@
st->vbr_offset = 0;
st->delayedIntra = 1;
st->spread_decision = SPREAD_NORMAL;
- st->tonal_average = QCONST16(1.f,8);
+ st->tonal_average = 256;
}
break;
case CELT_SET_INPUT_CLIPPING_REQUEST:
@@ -2063,7 +2063,7 @@
for (j=0;j<blen;j++)
{
seed = lcg_rand(seed);
- X[boffs+j] = (opus_int32)(seed)>>20;
+ X[boffs+j] = (celt_norm)((opus_int32)seed>>20);
}
renormalise_vector(X+boffs, blen, Q15ONE);
}
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -244,7 +244,7 @@
qi = -1;
error[i+c*m->nbEBands] = PSHR32(f,7) - SHL16(qi,DB_SHIFT);
badness += abs(qi0-qi);
- q = SHL32(EXTEND32(qi),DB_SHIFT);
+ q = (opus_val32)SHL32(EXTEND32(qi),DB_SHIFT);
tmp = PSHR32(MULT16_16(coef,oldE),8) + prev[c] + SHL32(q,7);
#ifdef FIXED_POINT
@@ -275,7 +275,7 @@
SAVE_STACK;
intra = force_intra || (!two_pass && *delayedIntra>2*C*(end-start) && nbAvailableBytes > (end-start)*C);
- intra_bias = ((budget**delayedIntra*loss_rate)/(C*512));
+ intra_bias = (opus_int32)((budget**delayedIntra*loss_rate)/(C*512));
new_distortion = loss_distortion(eBands, oldEBands, start, effEnd, m->nbEBands, C);
tell = ec_tell(enc);
@@ -470,7 +470,7 @@
}
else
qi = -1;
- q = SHL32(EXTEND32(qi),DB_SHIFT);
+ q = (opus_val32)SHL32(EXTEND32(qi),DB_SHIFT);
oldEBands[i+c*m->nbEBands] = MAX16(-QCONST16(9.f,DB_SHIFT), oldEBands[i+c*m->nbEBands]);
tmp = PSHR32(MULT16_16(coef,oldEBands[i+c*m->nbEBands]),8) + prev[c] + SHL32(q,7);
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -239,7 +239,7 @@
#else
iy[j] = (int)floor(rcp*X[j]);
#endif
- y[j] = iy[j];
+ y[j] = (celt_norm)iy[j];
yy = MAC16_16(yy, y[j],y[j]);
xy = MAC16_16(xy, X[j],y[j]);
y[j] *= 2;