Avoids unnecessary copying in opus_encode for delayed decision exp_surround1
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 29 Sep 2013 03:51:11 +0000 (23:51 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 29 Sep 2013 03:51:11 +0000 (23:51 -0400)
src/opus_encoder.c

index 3dcd35a..c151fd0 100644 (file)
@@ -2004,9 +2004,9 @@ opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int analysis_fram
          st->variable_duration, st->channels, st->Fs, st->bitrate_bps,
          delay_compensation, downmix_float, st->analysis.subframe_mem);
 
-   ALLOC(in, analysis_frame_size*st->channels, float);
+   ALLOC(in, frame_size*st->channels, float);
 
-   for (i=0;i<analysis_frame_size*st->channels;i++)
+   for (i=0;i<frame_size*st->channels;i++)
       in[i] = (1.0f/32768)*pcm[i];
    ret = opus_encode_native(st, in, frame_size, data, max_data_bytes, 16, pcm, analysis_frame_size, 0, -2, st->channels, downmix_int);
    RESTORE_STACK;