summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-10-14 04:15:53 +0000
committerMike Melanson <mike@multimedia.cx>2003-10-14 04:15:53 +0000
commit764ef400159b4f640eda8b22e8c7a20d6649a391 (patch)
tree2e359b478a7089f81c973e8153ce653ecadb39a8 /libavcodec
parenta003ee9a44eca32707eaa049171bc752ba3a9fde (diff)
disable encoders where appropriate (patch courtesy of BERO
<bero -at- geocities.co.jp>) Originally committed as revision 2375 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/adpcm.c21
-rw-r--r--libavcodec/i386/dsputil_mmx.c16
-rw-r--r--libavcodec/mjpeg.c2
-rw-r--r--libavcodec/mpeg12.c6
-rw-r--r--libavcodec/mpegvideo.c2
5 files changed, 43 insertions, 4 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 84d1e39f77..68a5c6f22f 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -107,6 +107,7 @@ typedef struct ADPCMContext {
/* XXX: implement encoding */
+#ifdef CONFIG_ENCODERS
static int adpcm_encode_init(AVCodecContext *avctx)
{
if (avctx->channels > 2)
@@ -265,6 +266,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
}
return dst - frame;
}
+#endif //CONFIG_ENCODERS
static int adpcm_decode_init(AVCodecContext * avctx)
{
@@ -685,7 +687,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
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 @@ AVCodec name ## _encoder = { \
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 @@ AVCodec name ## _decoder = { \
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);
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index 2447ab6abf..c523be74a8 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -171,6 +171,7 @@ static const uint64_t ff_pw_15 __attribute__ ((aligned(8))) = 0x000F000F000F000F
/***********************************/
/* 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 @@ static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint
: "%eax"
);
}
+#endif //CONFIG_ENCODERS
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
{
@@ -401,6 +403,7 @@ static void clear_blocks_mmx(DCTELEM *blocks)
);
}
+#ifdef CONFIG_ENCODERS
static int pix_sum16_mmx(uint8_t * pix, int line_size){
const int h=16;
int sum;
@@ -438,6 +441,7 @@ static int pix_sum16_mmx(uint8_t * pix, int line_size){
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 @@ static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
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 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride
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 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
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 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
}
+#ifdef CONFIG_ENCODERS
dsputil_init_pix_mmx(c, avctx);
+#endif //CONFIG_ENCODERS
#if 0
// for speed testing
get_pixels = just_return;
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
index 85d5b0fc7b..f67f280a88 100644
--- a/libavcodec/mjpeg.c
+++ b/libavcodec/mjpeg.c
@@ -243,6 +243,7 @@ static void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
}
}
+#ifdef CONFIG_ENCODERS
int mjpeg_init(MpegEncContext *s)
{
MJpegContext *m;
@@ -280,6 +281,7 @@ void mjpeg_close(MpegEncContext *s)
{
av_free(s->mjpeg_ctx);
}
+#endif //CONFIG_ENCODERS
#define PREDICT(ret, topleft, top, left, predictor)\
switch(predictor){\
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index e5d4f91621..a5e646d29f 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -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 uint32_t mpeg1_chr_dc_uni[512];
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 @@ static void mpeg1_skip_picture(MpegEncContext *s, int pict_num)
put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 1, 1);
}
-#endif
+#endif //CONFIG_ENCODERS
static void common_init(MpegEncContext *s)
{
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d56cde0ad9..b900167242 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -173,6 +173,7 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s
}
}
+#ifdef CONFIG_ENCODERS
void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
int i;
@@ -184,6 +185,7 @@ void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
}else
put_bits(pb, 1, 0);
}
+#endif //CONFIG_ENCODERS
/* init common dct for both encoder and decoder */
int DCT_common_init(MpegEncContext *s)