]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpc.c
Implement a SIMD version of emulated_edge_mc() for x86.
[ffmpeg] / libavcodec / mpc.c
index 764afd65d3230473eb07d541a0cbe9d7ff7025cb..d9a1fb776aab6df599928226dd96bbc7a5e35328 100644 (file)
  */
 
 /**
- * @file mpc.c Musepack decoder core
+ * @file
+ * Musepack decoder core
  * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
  * divided into 32 subbands.
  */
 
-#include "libavutil/random.h"
 #include "avcodec.h"
-#include "bitstream.h"
+#include "get_bits.h"
 #include "dsputil.h"
 #include "mpegaudio.h"
 
 #include "mpc.h"
 #include "mpcdata.h"
 
-static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]);
-
 void ff_mpc_init(void)
 {
-    ff_mpa_synth_init(mpa_window);
+    ff_mpa_synth_init(ff_mpa_synth_window);
 }
 
 /**
  * Process decoded Musepack data and produce PCM
  */
-static void mpc_synth(MPCContext *c, int16_t *out)
+static void mpc_synth(MPCContext *c, int16_t *out, int channels)
 {
     int dither_state = 0;
     int i, ch;
     OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr;
 
-    for(ch = 0;  ch < 2; ch++){
+    for(ch = 0;  ch < channels; ch++){
         samples_ptr = samples + ch;
         for(i = 0; i < SAMPLES_PER_BAND; i++) {
             ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
-                                mpa_window, &dither_state,
-                                samples_ptr, 2,
+                                ff_mpa_synth_window, &dither_state,
+                                samples_ptr, channels,
                                 c->sb_samples[ch][i]);
-            samples_ptr += 64;
+            samples_ptr += 32 * channels;
         }
     }
-    for(i = 0; i < MPC_FRAME_SIZE*2; i++)
+    for(i = 0; i < MPC_FRAME_SIZE*channels; i++)
         *out++=samples[i];
 }
 
-void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data)
+void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data, int channels)
 {
     int i, j, ch;
     Band *bands = c->bands;
@@ -100,5 +98,5 @@ void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data)
         }
     }
 
-    mpc_synth(c, data);
+    mpc_synth(c, data, channels);
 }