changeset 1530:3b31998fe22f libavcodec

disable encoders where appropriate (patch courtesy of BERO <bero -at- geocities.co.jp>)
author melanson
date Tue, 14 Oct 2003 04:15:53 +0000
parents cb523a2ca00f
children a78de892cefd
files adpcm.c i386/dsputil_mmx.c mjpeg.c mpeg12.c mpegvideo.c
diffstat 5 files changed, 43 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/adpcm.c	Mon Oct 13 19:38:34 2003 +0000
+++ b/adpcm.c	Tue Oct 14 04:15:53 2003 +0000
@@ -107,6 +107,7 @@
 
 /* XXX: implement encoding */
 
+#ifdef CONFIG_ENCODERS
 static int adpcm_encode_init(AVCodecContext *avctx)
 {
     if (avctx->channels > 2)
@@ -265,6 +266,7 @@
     }
     return dst - frame;
 }
+#endif //CONFIG_ENCODERS
 
 static int adpcm_decode_init(AVCodecContext * avctx)
 {
@@ -685,7 +687,10 @@
     return src - buf;
 }
 
-#define ADPCM_CODEC(id, name)                   \
+
+
+#ifdef CONFIG_ENCODERS
+#define ADPCM_ENCODER(id,name)                  \
 AVCodec name ## _encoder = {                    \
     #name,                                      \
     CODEC_TYPE_AUDIO,                           \
@@ -695,7 +700,13 @@
     adpcm_encode_frame,                         \
     adpcm_encode_close,                         \
     NULL,                                       \
-};                                              \
+};
+#else
+#define ADPCM_ENCODER(id,name)
+#endif
+
+#ifdef CONFIG_DECODERS
+#define ADPCM_DECODER(id,name)                  \
 AVCodec name ## _decoder = {                    \
     #name,                                      \
     CODEC_TYPE_AUDIO,                           \
@@ -706,6 +717,12 @@
     NULL,                                       \
     adpcm_decode_frame,                         \
 };
+#else
+#define ADPCM_DECODER(id,name)
+#endif
+
+#define ADPCM_CODEC(id, name)                   \
+ADPCM_ENCODER(id,name) ADPCM_DECODER(id,name)
 
 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
 ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
--- a/i386/dsputil_mmx.c	Mon Oct 13 19:38:34 2003 +0000
+++ b/i386/dsputil_mmx.c	Tue Oct 14 04:15:53 2003 +0000
@@ -171,6 +171,7 @@
 /***********************************/
 /* standard MMX */
 
+#ifdef CONFIG_ENCODERS
 static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
 {
     asm volatile(
@@ -227,6 +228,7 @@
         : "%eax"
     );
 }
+#endif //CONFIG_ENCODERS
 
 void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
 {
@@ -401,6 +403,7 @@
         );
 }
 
+#ifdef CONFIG_ENCODERS
 static int pix_sum16_mmx(uint8_t * pix, int line_size){
     const int h=16;
     int sum;
@@ -438,6 +441,7 @@
 
         return sum;
 }
+#endif //CONFIG_ENCODERS
 
 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
     int i=0;
@@ -461,6 +465,7 @@
         dst[i+0] += src[i+0];
 }
 
+#ifdef CONFIG_ENCODERS
 static int pix_norm1_mmx(uint8_t *pix, int line_size) {
     int tmp;
   asm volatile (
@@ -856,6 +861,7 @@
 
 WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx)
 WARPER88_1616(hadamard8_diff_mmx2, hadamard8_diff16_mmx2)
+#endif //CONFIG_ENCODERS
 
 #define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d)
 #define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d)
@@ -1619,12 +1625,16 @@
             c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
         }
         
+#ifdef CONFIG_ENCODERS
         c->get_pixels = get_pixels_mmx;
         c->diff_pixels = diff_pixels_mmx;
+#endif //CONFIG_ENCODERS
         c->put_pixels_clamped = put_pixels_clamped_mmx;
         c->add_pixels_clamped = add_pixels_clamped_mmx;
         c->clear_blocks = clear_blocks_mmx;
+#ifdef CONFIG_ENCODERS
         c->pix_sum = pix_sum16_mmx;
+#endif //CONFIG_ENCODERS
 
         c->put_pixels_tab[0][0] = put_pixels16_mmx;
         c->put_pixels_tab[0][1] = put_pixels16_x2_mmx;
@@ -1667,6 +1677,7 @@
         c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx;
                 
         c->add_bytes= add_bytes_mmx;
+#ifdef CONFIG_ENCODERS
         c->diff_bytes= diff_bytes_mmx;
         
         c->hadamard8_diff[0]= hadamard8_diff16_mmx;
@@ -1674,6 +1685,7 @@
         
 	c->pix_norm1 = pix_norm1_mmx;
 	c->sse[0] = sse16_mmx;
+#endif //CONFIG_ENCODERS
         
         if (mm_flags & MM_MMXEXT) {
             c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
@@ -1690,8 +1702,10 @@
             c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
             c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
 
+#ifdef CONFIG_ENCODERS
             c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
             c->hadamard8_diff[1]= hadamard8_diff_mmx2;
+#endif //CONFIG_ENCODERS
 
             if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
                 c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
@@ -1797,7 +1811,9 @@
         }
     }
         
+#ifdef CONFIG_ENCODERS
     dsputil_init_pix_mmx(c, avctx);
+#endif //CONFIG_ENCODERS
 #if 0
     // for speed testing
     get_pixels = just_return;
--- a/mjpeg.c	Mon Oct 13 19:38:34 2003 +0000
+++ b/mjpeg.c	Tue Oct 14 04:15:53 2003 +0000
@@ -243,6 +243,7 @@
     }
 }
 
+#ifdef CONFIG_ENCODERS
 int mjpeg_init(MpegEncContext *s)
 {
     MJpegContext *m;
@@ -280,6 +281,7 @@
 {
     av_free(s->mjpeg_ctx);
 }
+#endif //CONFIG_ENCODERS
 
 #define PREDICT(ret, topleft, top, left, predictor)\
     switch(predictor){\
--- a/mpeg12.c	Mon Oct 13 19:38:34 2003 +0000
+++ b/mpeg12.c	Tue Oct 14 04:15:53 2003 +0000
@@ -48,10 +48,12 @@
 #define MB_BTYPE_VLC_BITS 6
 #define TEX_VLC_BITS 9
 
+#ifdef CONFIG_ENCODERS
 static void mpeg1_encode_block(MpegEncContext *s, 
                          DCTELEM *block, 
                          int component);
 static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code);    // RAL: f_code parameter added
+#endif //CONFIG_ENCODERS
 static void mpeg1_skip_picture(MpegEncContext *s, int pict_num);
 static inline int mpeg1_decode_block_inter(MpegEncContext *s, 
                               DCTELEM *block, 
@@ -85,7 +87,7 @@
 
 static uint8_t mpeg1_index_run[2][64];
 static int8_t mpeg1_max_level[2][64];
-#endif
+#endif //CONFIG_ENCODERS
 
 static void init_2d_vlc_rl(RLTable *rl)
 {
@@ -361,7 +363,7 @@
     put_bits(&s->pb, 1, 1); 
     put_bits(&s->pb, 1, 1); 
 }
-#endif
+#endif //CONFIG_ENCODERS
 
 static void common_init(MpegEncContext *s)
 {
--- a/mpegvideo.c	Mon Oct 13 19:38:34 2003 +0000
+++ b/mpegvideo.c	Tue Oct 14 04:15:53 2003 +0000
@@ -173,6 +173,7 @@
     }
 }
 
+#ifdef CONFIG_ENCODERS
 void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
     int i;
 
@@ -184,6 +185,7 @@
     }else
         put_bits(pb, 1, 0);
 }
+#endif //CONFIG_ENCODERS
 
 /* init common dct for both encoder and decoder */
 int DCT_common_init(MpegEncContext *s)