Adds many syntactically unnecessary casts to silence MSVC C4244; fix an MDCT encoder...
authorGregory Maxwell <greg@xiph.org>
Tue, 30 Aug 2011 20:50:01 +0000 (16:50 -0400)
committerGregory Maxwell <greg@xiph.org>
Tue, 30 Aug 2011 21:08:49 +0000 (17:08 -0400)
st->tonal_average was being set to 1 instead of 256 on reset in floating point builds, otherwise the object code is unchanged.

libcelt/bands.c
libcelt/celt.c
libcelt/quant_bands.c
libcelt/vq.c

index 75c3224..77ac170 100644 (file)
@@ -1083,7 +1083,7 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
                   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 {
index b325792..f85c21d 100644 (file)
@@ -1816,7 +1816,7 @@ int celt_encoder_ctl(CELTEncoder * restrict st, int request, ...)
          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 @@ static void celt_decode_lost(CELTDecoder * restrict st, opus_val16 * restrict pc
             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);
          }
index 9a14314..7a71864 100644 (file)
@@ -244,7 +244,7 @@ static int quant_coarse_energy_impl(const CELTMode *m, int start, int end,
             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 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
    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 @@ void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol
          }
          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);
index 05806ec..89b3687 100644 (file)
@@ -239,7 +239,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B,
 #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;