[FFmpeg-cvslog] alacenc: implement the 2-pass prediction type.

Justin Ruggles git at videolan.org
Wed Jan 4 01:39:33 CET 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Dec  7 13:01:01 2011 -0500| [bb63475aec53e001ad84a24ed6e2a23ad1697fc8] | committer: Justin Ruggles

alacenc: implement the 2-pass prediction type.

This isn't used by the reference encoder, but it is supported by the decoder.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb63475aec53e001ad84a24ed6e2a23ad1697fc8
---

 libavcodec/alacenc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c
index e7977b3..89d8e09 100644
--- a/libavcodec/alacenc.c
+++ b/libavcodec/alacenc.c
@@ -348,6 +348,7 @@ static void alac_entropy_coder(AlacEncodeContext *s)
 static void write_compressed_frame(AlacEncodeContext *s)
 {
     int i, j;
+    int prediction_type = 0;
 
     if (s->avctx->channels == 2)
         alac_stereo_decorrelation(s);
@@ -358,7 +359,7 @@ static void write_compressed_frame(AlacEncodeContext *s)
 
         calc_predictor_params(s, i);
 
-        put_bits(&s->pbctx, 4, 0);  // prediction type : currently only type 0 has been RE'd
+        put_bits(&s->pbctx, 4, prediction_type);
         put_bits(&s->pbctx, 4, s->lpc[i].lpc_quant);
 
         put_bits(&s->pbctx, 3, s->rc.rice_modifier);
@@ -373,6 +374,14 @@ static void write_compressed_frame(AlacEncodeContext *s)
 
     for (i = 0; i < s->avctx->channels; i++) {
         alac_linear_predictor(s, i);
+
+        // TODO: determine when this will actually help. for now it's not used.
+        if (prediction_type == 15) {
+            // 2nd pass 1st order filter
+            for (j = s->avctx->frame_size - 1; j > 0; j--)
+                s->predictor_buf[j] -= s->predictor_buf[j - 1];
+        }
+
         alac_entropy_coder(s);
     }
 }



More information about the ffmpeg-cvslog mailing list