[FFmpeg-soc] [soc]: r2548 - alacenc/alacenc.c

jai_menon subversion at mplayerhq.hu
Sun Jun 22 19:32:48 CEST 2008


Author: jai_menon
Date: Sun Jun 22 19:32:48 2008
New Revision: 2548

Log:
add first order predictor

Modified:
   alacenc/alacenc.c

Modified: alacenc/alacenc.c
==============================================================================
--- alacenc/alacenc.c	(original)
+++ alacenc/alacenc.c	Sun Jun 22 19:32:48 2008
@@ -139,6 +139,17 @@ static void write_frame_header(AlacEncod
     put_bits(&s->pbctx, 32, s->avctx->frame_size);          // No. of samples in the frame
 }
 
+static void first_order_predictor(AlacEncodeContext *s, int ch)
+{
+    int i;
+
+    i = s->avctx->frame_size - 1;
+    while(i > 0) {
+        s->sample_buf[ch][i] -= s->sample_buf[ch][i-1];
+        i--;
+    }
+}
+
 static void alac_entropy_coder(AlacEncodeContext *s, int32_t *samples)
 {
     unsigned int history = s->rc.initial_history;
@@ -207,6 +218,7 @@ static void write_compressed_frame(AlacE
     // apply entropy coding to audio samples
 
     for(i=0;i<s->channels;i++) {
+        first_order_predictor(s, i);
         alac_entropy_coder(s, s->sample_buf[i]);
     }
 }
@@ -239,7 +251,7 @@ static av_cold int alac_encode_init(AVCo
     s->rc.rice_modifier   = 4;
 
     // Set default predictor order
-    s->lpc.lpc_order      = 0;
+    s->lpc.lpc_order      = 31;
 
     s->max_coded_frame_size = (ALAC_FRAME_HEADER_SIZE + ALAC_FRAME_FOOTER_SIZE +
                                avctx->frame_size*s->channels*avctx->bits_per_sample)>>3;



More information about the FFmpeg-soc mailing list