x++;
/* Technically the store could be moved outside of the if because
the stores we don't want will just be overwritten */
+ if (count==0)
+ *y = SCALEOUT(SIG2WORD16(tmp));
if (++count==downsample)
{
- *y = SCALEOUT(SIG2WORD16(tmp));
y+=C;
count=0;
}
#ifndef FLOAT_CAST_H
#define FLOAT_CAST_H
+
+#include "arch.h"
+
/*============================================================================
** On Intel Pentium processors (especially PIII and probably P4), converting
** from float to int is very slow. To meet the C specs, the code produced by
#define SILK_SIGPROC_FLP_H
#include "SigProc_FIX.h"
+#include "float_cast.h"
#include <math.h>
#ifdef __cplusplus
/* floating-point to integer conversion (rounding) */
static inline opus_int32 silk_float2int( double x )
{
-#ifdef _WIN32
- double t = x + 6755399441055744.0;
- return *((opus_int32 *)( &t ));
-#else
- return (opus_int32)( ( x > 0 ) ? x + 0.5 : x - 0.5 );
-#endif
+ return (opus_int32)float2int( x );
}
/* floating-point to integer conversion (rounding) */
{
opus_int32 k;
for( k = length - 1; k >= 0; k-- ) {
-#ifdef _WIN32
- double t = in[k] + 6755399441055744.0;
- out[k] = (opus_int16)silk_SAT16(*(( opus_int32 * )( &t )));
-#else
double x = in[k];
- out[k] = (opus_int16)silk_SAT16( ( x > 0 ) ? x + 0.5 : x - 0.5 );
-#endif
+ out[k] = silk_SAT16( (opus_int32)float2int( x ) );
}
}
celt_encoder_ctl(celt_enc, OPUS_SET_COMPLEXITY(10));
st->use_vbr = 1;
+ /* Makes constrained VBR the default (safer for real-time use) */
+ st->vbr_constraint = 1;
st->user_bitrate_bps = OPUS_AUTO;
st->bitrate_bps = 3000+Fs*channels;
st->application = application;