[FFmpeg-devel] [PATCH] avcodec/alac: remove dead code cruft

Hendrik Leppkes h.leppkes at gmail.com
Sun Sep 6 12:02:53 CEST 2015


The output is always planar since two major bumps, remove all code
related to packed output.
---
 libavcodec/alac.c | 40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 13607b3..827c0db 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -404,7 +404,6 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
                           alac->extra_bits, channels, alac->nb_samples);
     }
 
-    if(av_sample_fmt_is_planar(avctx->sample_fmt)) {
     switch(alac->sample_size) {
     case 16: {
         for (ch = 0; ch < channels; ch++) {
@@ -420,37 +419,6 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
         }}
         break;
     }
-    }else{
-        switch(alac->sample_size) {
-        case 16: {
-            int16_t *outbuffer = ((int16_t *)frame->extended_data[0]) + ch_index;
-            for (i = 0; i < alac->nb_samples; i++) {
-                for (ch = 0; ch < channels; ch++)
-                    *outbuffer++ = alac->output_samples_buffer[ch][i];
-                outbuffer += alac->channels - channels;
-            }
-            }
-            break;
-        case 24: {
-            int32_t *outbuffer = ((int32_t *)frame->extended_data[0]) + ch_index;
-            for (i = 0; i < alac->nb_samples; i++) {
-                for (ch = 0; ch < channels; ch++)
-                    *outbuffer++ = alac->output_samples_buffer[ch][i] << 8;
-                outbuffer += alac->channels - channels;
-            }
-            }
-            break;
-        case 32: {
-            int32_t *outbuffer = ((int32_t *)frame->extended_data[0]) + ch_index;
-            for (i = 0; i < alac->nb_samples; i++) {
-                for (ch = 0; ch < channels; ch++)
-                    *outbuffer++ = alac->output_samples_buffer[ch][i];
-                outbuffer += alac->channels - channels;
-            }
-            }
-            break;
-        }
-    }
 
     return 0;
 }
@@ -544,7 +512,7 @@ static int allocate_buffers(ALACContext *alac)
         FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch],
                          buf_size, buf_alloc_fail);
 
-        alac->direct_output = alac->sample_size > 16 && av_sample_fmt_is_planar(alac->avctx->sample_fmt);
+        alac->direct_output = alac->sample_size > 16;
         if (!alac->direct_output) {
             FF_ALLOC_OR_GOTO(alac->avctx, alac->output_samples_buffer[ch],
                              buf_size, buf_alloc_fail);
@@ -593,7 +561,6 @@ static int alac_set_info(ALACContext *alac)
 static av_cold int alac_decode_init(AVCodecContext * avctx)
 {
     int ret;
-    int req_packed;
     ALACContext *alac = avctx->priv_data;
     alac->avctx = avctx;
 
@@ -607,12 +574,11 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
         return -1;
     }
 
-    req_packed = LIBAVCODEC_VERSION_MAJOR < 55 && !av_sample_fmt_is_planar(avctx->request_sample_fmt);
     switch (alac->sample_size) {
-    case 16: avctx->sample_fmt = req_packed ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_S16P;
+    case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
              break;
     case 24:
-    case 32: avctx->sample_fmt = req_packed ? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S32P;
+    case 32: avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
              break;
     default: avpriv_request_sample(avctx, "Sample depth %d", alac->sample_size);
              return AVERROR_PATCHWELCOME;
-- 
2.5.1.windows.1



More information about the ffmpeg-devel mailing list