avcodec/decode: Update decode_simple_internal() to get the side data correctly.
[ffmpeg.git] / libavcodec / alacenc.c
index c80c887..804cc7b 100644 (file)
@@ -38,6 +38,7 @@
 #define DEFAULT_MAX_PRED_ORDER    6
 #define DEFAULT_MIN_PRED_ORDER    4
 #define ALAC_MAX_LPC_PRECISION    9
+#define ALAC_MIN_LPC_SHIFT        0
 #define ALAC_MAX_LPC_SHIFT        9
 
 #define ALAC_CHMODE_LEFT_RIGHT    0
@@ -81,7 +82,7 @@ typedef struct AlacEncodeContext {
 
 
 static void init_sample_buffers(AlacEncodeContext *s, int channels,
-                                uint8_t const *samples[2])
+                                const uint8_t *samples[2])
 {
     int ch, i;
     int shift = av_get_bytes_per_sample(s->avctx->sample_fmt) * 8 -
@@ -171,7 +172,8 @@ static void calc_predictor_params(AlacEncodeContext *s, int ch)
                                       s->max_prediction_order,
                                       ALAC_MAX_LPC_PRECISION, coefs, shift,
                                       FF_LPC_TYPE_LEVINSON, 0,
-                                      ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
+                                      ORDER_METHOD_EST, ALAC_MIN_LPC_SHIFT,
+                                      ALAC_MAX_LPC_SHIFT, 1);
 
         s->lpc[ch].lpc_order = opt_order;
         s->lpc[ch].lpc_quant = shift[opt_order-1];
@@ -364,7 +366,7 @@ static void write_element(AlacEncodeContext *s,
                           enum AlacRawDataBlockType element, int instance,
                           const uint8_t *samples0, const uint8_t *samples1)
 {
-    uint8_t const *samples[2] = { samples0, samples1 };
+    const uint8_t *samples[2] = { samples0, samples1 };
     int i, j, channels;
     int prediction_type = 0;
     PutBitContext *pb = &s->pbctx;
@@ -376,14 +378,14 @@ static void write_element(AlacEncodeContext *s,
         /* samples are channel-interleaved in verbatim mode */
         if (s->avctx->sample_fmt == AV_SAMPLE_FMT_S32P) {
             int shift = 32 - s->avctx->bits_per_raw_sample;
-            int32_t const *samples_s32[2] = { (const int32_t *)samples0,
+            const int32_t *samples_s32[2] = { (const int32_t *)samples0,
                                               (const int32_t *)samples1 };
             for (i = 0; i < s->frame_size; i++)
                 for (j = 0; j < channels; j++)
                     put_sbits(pb, s->avctx->bits_per_raw_sample,
                               samples_s32[j][i] >> shift);
         } else {
-            int16_t const *samples_s16[2] = { (const int16_t *)samples0,
+            const int16_t *samples_s16[2] = { (const int16_t *)samples0,
                                               (const int16_t *)samples1 };
             for (i = 0; i < s->frame_size; i++)
                 for (j = 0; j < channels; j++)
@@ -623,7 +625,7 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     else
         max_frame_size = s->max_coded_frame_size;
 
-    if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size, 0)) < 0)
+    if ((ret = ff_alloc_packet2(avctx, avpkt, 4 * max_frame_size, 0)) < 0)
         return ret;
 
     /* use verbatim mode for compression_level 0 */