]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cook.c
optimize imdct_half:
[ffmpeg] / libavcodec / cook.c
index 3b7a4fd51bedfc983b472c37dbd82a66f91c0ca2..3a16c777978fc1b09407c4dc9e9e01e2fdff9851 100644 (file)
@@ -232,16 +232,15 @@ static int init_cook_vlc_tables(COOKContext *q) {
 
 static int init_cook_mlt(COOKContext *q) {
     int j;
-    float alpha;
     int mlt_size = q->samples_per_channel;
 
     if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0)
       return -1;
 
     /* Initialize the MLT window: simple sine window. */
-    alpha = M_PI / (2.0 * (float)mlt_size);
+    ff_sine_window_init(q->mlt_window, mlt_size);
     for(j=0 ; j<mlt_size ; j++)
-        q->mlt_window[j] = sin((j + 0.5) * alpha) * sqrt(2.0 / q->samples_per_channel);
+        q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
 
     /* Initialize the MDCT. */
     if (ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1)) {
@@ -1179,6 +1178,8 @@ static int cook_decode_init(AVCodecContext *avctx)
         return -1;
     }
 
+    avctx->sample_fmt = SAMPLE_FMT_S16;
+
 #ifdef COOKDEBUG
     dump_cook_context(q);
 #endif
@@ -1195,5 +1196,5 @@ AVCodec cook_decoder =
     .init = cook_decode_init,
     .close = cook_decode_close,
     .decode = cook_decode_frame,
-    .long_name = "COOK",
+    .long_name = NULL_IF_CONFIG_SMALL("COOK"),
 };