From f544a5fc84975879746f619e01b6f1e80844e59e Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 3 Sep 2008 12:33:21 +0000 Subject: [PATCH] Replace generic CONFIG_ENCODERS preprocessor conditionals by more specific CONFIG_FOO_ENCODER conditionals where appropriate. Originally committed as revision 15174 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/asv1.c | 16 ++++++++-------- libavcodec/cljr.c | 6 ++---- libavcodec/ffv1.c | 14 +++++++------- libavcodec/g726.c | 8 ++++---- libavcodec/huffyuv.c | 24 ++++++++++++------------ libavcodec/rv10.c | 4 ++-- libavcodec/sonic.c | 13 +++++++------ libavcodec/vcr1.c | 6 ++---- 8 files changed, 44 insertions(+), 47 deletions(-) diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c index f7ef68e..8f16111 100644 --- a/libavcodec/asv1.c +++ b/libavcodec/asv1.c @@ -465,7 +465,7 @@ for(i=0; iavctx->extradata_size; i++){ return (get_bits_count(&a->gb)+31)/32*4; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ ASV1Context * const a = avctx->priv_data; AVFrame *pict = data; @@ -519,7 +519,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return size*4; } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) */ static av_cold void common_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -569,7 +569,7 @@ static av_cold int decode_init(AVCodecContext *avctx){ return 0; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) static av_cold int encode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; int i; @@ -593,7 +593,7 @@ static av_cold int encode_init(AVCodecContext *avctx){ return 0; } -#endif +#endif /* defined(CONFIG_ASV1_ENCODER) || defined(CONFIG_ASV2_ENCODER) */ static av_cold int decode_end(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -631,8 +631,7 @@ AVCodec asv2_decoder = { .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), }; -#ifdef CONFIG_ENCODERS - +#ifdef CONFIG_ASV1_ENCODER AVCodec asv1_encoder = { "asv1", CODEC_TYPE_VIDEO, @@ -644,7 +643,9 @@ AVCodec asv1_encoder = { .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"), }; +#endif +#ifdef CONFIG_ASV2_ENCODER AVCodec asv2_encoder = { "asv2", CODEC_TYPE_VIDEO, @@ -656,5 +657,4 @@ AVCodec asv2_encoder = { .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), }; - -#endif //CONFIG_ENCODERS +#endif diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index ddc0058..fa2cda5 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -143,8 +143,7 @@ AVCodec cljr_decoder = { .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"), }; #if 0 -#ifdef CONFIG_ENCODERS - +#ifdef CONFIG_CLJR_ENCODER AVCodec cljr_encoder = { "cljr", CODEC_TYPE_VIDEO, @@ -155,6 +154,5 @@ AVCodec cljr_encoder = { //encode_end, .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"), }; - -#endif //CONFIG_ENCODERS +#endif #endif diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index c1fac10..7211e16 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -350,7 +350,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int return ret; } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_FFV1_ENCODER static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; @@ -524,7 +524,7 @@ static void write_header(FFV1Context *f){ for(i=0; i<5; i++) write_quant_table(c, f->quant_table[i]); } -#endif /* CONFIG_ENCODERS */ +#endif /* CONFIG_FFV1_ENCODER */ static av_cold int common_init(AVCodecContext *avctx){ FFV1Context *s = avctx->priv_data; @@ -543,7 +543,7 @@ static av_cold int common_init(AVCodecContext *avctx){ return 0; } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_FFV1_ENCODER static av_cold int encode_init(AVCodecContext *avctx) { FFV1Context *s = avctx->priv_data; @@ -607,7 +607,7 @@ static av_cold int encode_init(AVCodecContext *avctx) return 0; } -#endif /* CONFIG_ENCODERS */ +#endif /* CONFIG_FFV1_ENCODER */ static void clear_state(FFV1Context *f){ @@ -632,7 +632,7 @@ static void clear_state(FFV1Context *f){ } } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_FFV1_ENCODER static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ FFV1Context *f = avctx->priv_data; RangeCoder * const c= &f->c; @@ -688,7 +688,7 @@ static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, return used_count + (put_bits_count(&f->pb)+7)/8; } } -#endif /* CONFIG_ENCODERS */ +#endif /* CONFIG_FFV1_ENCODER */ static av_cold int common_end(AVCodecContext *avctx){ FFV1Context *s = avctx->priv_data; @@ -1025,7 +1025,7 @@ AVCodec ffv1_decoder = { .long_name= NULL_IF_CONFIG_SMALL("FFmpeg codec #1"), }; -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_FFV1_ENCODER AVCodec ffv1_encoder = { "ffv1", CODEC_TYPE_VIDEO, diff --git a/libavcodec/g726.c b/libavcodec/g726.c index a769c19..90a20da 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -285,7 +285,7 @@ static av_cold int g726_reset(G726Context* c, int index) return 0; } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_ADPCM_G726_ENCODER static int16_t g726_encode(G726Context* c, int16_t sig) { uint8_t i; @@ -342,7 +342,7 @@ static av_cold int g726_close(AVCodecContext *avctx) return 0; } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_ADPCM_G726_ENCODER static int g726_encode_frame(AVCodecContext *avctx, uint8_t *dst, int buf_size, void *data) { @@ -381,7 +381,7 @@ static int g726_decode_frame(AVCodecContext *avctx, return buf_size; } -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_ADPCM_G726_ENCODER AVCodec adpcm_g726_encoder = { "g726", CODEC_TYPE_AUDIO, @@ -394,7 +394,7 @@ AVCodec adpcm_g726_encoder = { .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), }; -#endif //CONFIG_ENCODERS +#endif AVCodec adpcm_g726_decoder = { "g726", diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index b262cd6..9d1a49a 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -261,7 +261,7 @@ static int generate_bits_table(uint32_t *dst, uint8_t *len_table){ return 0; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) typedef struct { uint64_t val; int name; @@ -317,7 +317,7 @@ static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ if(i==size) break; } } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) */ static void generate_joint_tables(HYuvContext *s){ uint16_t symbols[1<bgr32=1; } #endif /* defined(CONFIG_HUFFYUV_DECODER) || defined(CONFIG_FFVHUFF_DECODER) */ -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) static int store_table(HYuvContext *s, uint8_t *len, uint8_t *buf){ int i; int index= 0; @@ -725,7 +725,7 @@ static av_cold int encode_init(AVCodecContext *avctx) return 0; } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) */ /* TODO instead of restarting the read when the code isn't in the first level * of the joint table, jump into the 2nd level of the individual table. */ @@ -761,7 +761,7 @@ static void decode_gray_bitstream(HYuvContext *s, int count){ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) static int encode_422_bitstream(HYuvContext *s, int count){ int i; @@ -854,7 +854,7 @@ static int encode_gray_bitstream(HYuvContext *s, int count){ } return 0; } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) */ static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){ int i; @@ -1226,7 +1226,7 @@ static av_cold int decode_end(AVCodecContext *avctx) } #endif /* defined(CONFIG_HUFFYUV_DECODER) || defined(CONFIG_FFVHUFF_DECODER) */ -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ HYuvContext *s = avctx->priv_data; AVFrame *pict = data; @@ -1431,7 +1431,7 @@ static av_cold int encode_end(AVCodecContext *avctx) return 0; } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_HUFFYUV_ENCODER) || defined(CONFIG_FFVHUFF_ENCODER) */ #ifdef CONFIG_HUFFYUV_DECODER AVCodec huffyuv_decoder = { @@ -1465,8 +1465,7 @@ AVCodec ffvhuff_decoder = { }; #endif -#ifdef CONFIG_ENCODERS - +#ifdef CONFIG_HUFFYUV_ENCODER AVCodec huffyuv_encoder = { "huffyuv", CODEC_TYPE_VIDEO, @@ -1478,7 +1477,9 @@ AVCodec huffyuv_encoder = { .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"), }; +#endif +#ifdef CONFIG_FFVHUFF_ENCODER AVCodec ffvhuff_encoder = { "ffvhuff", CODEC_TYPE_VIDEO, @@ -1490,5 +1491,4 @@ AVCodec ffvhuff_encoder = { .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"), }; - -#endif //CONFIG_ENCODERS +#endif diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 86f8aeb..938e446 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -229,8 +229,8 @@ int rv_decode_dc(MpegEncContext *s, int n) return -code; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_RV10_ENCODER) || defined(CONFIG_RV20_ENCODER) /* write RV 1.0 compatible frame header */ void rv10_encode_picture_header(MpegEncContext *s, int picture_number) { @@ -304,7 +304,7 @@ static int get_num(GetBitContext *gb) } #endif -#endif //CONFIG_ENCODERS +#endif /* defined(CONFIG_RV10_ENCODER) || defined(CONFIG_RV20_ENCODER) */ /* read RV 1.0 compatible frame header */ static int rv10_decode_picture_header(MpegEncContext *s) diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index d8bae3a..6e0bdc8 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -408,7 +408,7 @@ static int predictor_calc_error(int *k, int *state, int order, int error) return x; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) // Heavily modified Levinson-Durbin algorithm which // copes better with quantization, and calculates the // actual whitened result as it goes. @@ -479,13 +479,12 @@ static void modified_levinson_durbin(int *window, int window_entries, av_free(state); } -#endif /* CONFIG_ENCODERS */ +#endif /* defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) */ static const int samplerate_table[] = { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 }; -#ifdef CONFIG_ENCODERS - +#if defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) static inline int code_samplerate(int samplerate) { switch (samplerate) @@ -748,7 +747,7 @@ static int sonic_encode_frame(AVCodecContext *avctx, flush_put_bits(&pb); return (put_bits_count(&pb)+7)/8; } -#endif //CONFIG_ENCODERS +#endif /* defined(CONFIG_SONIC_ENCODER) || defined(CONFIG_SONIC_LS_ENCODER) */ #ifdef CONFIG_SONIC_DECODER static av_cold int sonic_decode_init(AVCodecContext *avctx) @@ -937,7 +936,7 @@ static int sonic_decode_frame(AVCodecContext *avctx, } #endif /* CONFIG_SONIC_DECODER */ -#ifdef CONFIG_ENCODERS +#ifdef CONFIG_SONIC_ENCODER AVCodec sonic_encoder = { "sonic", CODEC_TYPE_AUDIO, @@ -949,7 +948,9 @@ AVCodec sonic_encoder = { NULL, .long_name = NULL_IF_CONFIG_SMALL("Sonic"), }; +#endif +#ifdef CONFIG_SONIC_LS_ENCODER AVCodec sonic_ls_encoder = { "sonicls", CODEC_TYPE_AUDIO, diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c index 73da86d..5022fe7 100644 --- a/libavcodec/vcr1.c +++ b/libavcodec/vcr1.c @@ -175,8 +175,7 @@ AVCodec vcr1_decoder = { .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), }; #if 0 -#ifdef CONFIG_ENCODERS - +#ifdef CONFIG_VCR1_ENCODER AVCodec vcr1_encoder = { "vcr1", CODEC_TYPE_VIDEO, @@ -187,6 +186,5 @@ AVCodec vcr1_encoder = { //encode_end, .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), }; - -#endif //CONFIG_ENCODERS +#endif #endif -- 2.7.4