[FFmpeg-cvslog] alacdec: 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 11:56:57 2011 -0500| [e49d21306a49c09bdf66435b73ea01384a5645ae] | committer: Justin Ruggles

alacdec: implement the 2-pass prediction type.

The reference encoder does not generate any streams using this, but the
reference decoder can handle it, so we should as well.

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

 libavcodec/alac.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index eb6c1cf..278cc99 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -452,24 +452,29 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
                                         ricemodifier[ch] * alac->setinfo_rice_historymult / 4,
                                         (1 << alac->setinfo_rice_kmodifier) - 1);
 
-            if (prediction_type[ch] == 0) {
-                /* adaptive fir */
-                predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
-                                               alac->outputsamples_buffer[ch],
-                                               outputsamples,
-                                               readsamplesize,
-                                               predictor_coef_table[ch],
-                                               predictor_coef_num[ch],
-                                               prediction_quantitization[ch]);
-            } else {
-                av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[ch]);
-                /* I think the only other prediction type (or perhaps this is
-                 * just a boolean?) runs adaptive fir twice.. like:
-                 * predictor_decompress_fir_adapt(predictor_error, tempout, ...)
-                 * predictor_decompress_fir_adapt(predictor_error, outputsamples ...)
-                 * little strange..
+            /* adaptive FIR filter */
+            if (prediction_type[ch] == 15) {
+                /* Prediction type 15 runs the adaptive FIR twice.
+                 * The first pass uses the special-case coef_num = 31, while
+                 * the second pass uses the coefs from the bitstream.
+                 *
+                 * However, this prediction type is not currently used by the
+                 * reference encoder.
                  */
+                predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
+                                               alac->predicterror_buffer[ch],
+                                               outputsamples, readsamplesize,
+                                               NULL, 31, 0);
+            } else if (prediction_type[ch] > 0) {
+                av_log(avctx, AV_LOG_WARNING, "unknown prediction type: %i\n",
+                       prediction_type[ch]);
             }
+            predictor_decompress_fir_adapt(alac->predicterror_buffer[ch],
+                                           alac->outputsamples_buffer[ch],
+                                           outputsamples, readsamplesize,
+                                           predictor_coef_table[ch],
+                                           predictor_coef_num[ch],
+                                           prediction_quantitization[ch]);
         }
     } else {
         /* not compressed, easy case */



More information about the ffmpeg-cvslog mailing list