[FFmpeg-devel] [PATCH 02/10] lavc/flacdsp: separate the encoder and decoder functions

James Darnley james.darnley at gmail.com
Tue Feb 11 23:49:40 CET 2014


Only initialises the relevant functions allowing the unused functions to
be ignored by the compiler.
---
 libavcodec/flacdsp.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/flacdsp.c b/libavcodec/flacdsp.c
index b15bc74..d741603 100644
--- a/libavcodec/flacdsp.c
+++ b/libavcodec/flacdsp.c
@@ -88,13 +88,11 @@ static void flac_lpc_32_c(int32_t *decoded, const int coeffs[32],
 av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt,
                              int bps)
 {
-    if (bps > 16) {
+    if (CONFIG_FLAC_DECODER) {
+    if (bps > 16)
         c->lpc            = flac_lpc_32_c;
-        c->lpc_encode     = flac_lpc_encode_c_32;
-    } else {
+    else
         c->lpc            = flac_lpc_16_c;
-        c->lpc_encode     = flac_lpc_encode_c_16;
-    }
 
     switch (fmt) {
     case AV_SAMPLE_FMT_S32:
@@ -125,6 +123,14 @@ av_cold void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt,
         c->decorrelate[3] = flac_decorrelate_ms_c_16p;
         break;
     }
+    }
+
+    if (CONFIG_FLAC_ENCODER) {
+        if (bps > 16)
+            c->lpc_encode     = flac_lpc_encode_c_32;
+        else
+            c->lpc_encode     = flac_lpc_encode_c_16;
+    }
 
     if (ARCH_ARM)
         ff_flacdsp_init_arm(c, fmt, bps);
-- 
1.7.9



More information about the ffmpeg-devel mailing list