Mercurial > libavcodec.hg
changeset 1325:1cbc2380d172 libavcodec
CONFIG_ENCODERS cleanup
author | michaelni |
---|---|
date | Sun, 22 Jun 2003 11:08:22 +0000 |
parents | 7d328fd9d8a5 |
children | 6cdd3b8f4fd3 |
files | asv1.c ffv1.c huffyuv.c mjpeg.c mpeg12.c mpeg12data.h msmpeg4.c |
diffstat | 7 files changed, 29 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/asv1.c Sat Jun 21 01:11:31 2003 +0000 +++ b/asv1.c Sun Jun 22 11:08:22 2003 +0000 @@ -95,8 +95,6 @@ else return code - 3; } -#ifdef CONFIG_ENCODERS - static inline void put_level(PutBitContext *pb, int level){ unsigned int index= level + 3; @@ -107,8 +105,6 @@ } } -#endif //CONFIG_ENCODERS - static inline int decode_block(ASV1Context *a, DCTELEM block[64]){ int i; @@ -134,8 +130,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static inline void encode_block(ASV1Context *a, DCTELEM block[64]){ int i; int nc_count=0; @@ -169,8 +163,6 @@ put_bits(&a->pb, ccp_tab[16][1], ccp_tab[16][0]); } -#endif //CONFIG_ENCODERS - static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){ int i; @@ -183,8 +175,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static inline void encode_mb(ASV1Context *a, DCTELEM block[6][64]){ int i; @@ -192,8 +182,6 @@ encode_block(a, block[i]); } } - -#endif //CONFIG_ENCODERS static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){ DCTELEM (*block)[64]= a->block; @@ -214,8 +202,6 @@ } } -#ifdef CONFIG_ENCODERS - static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ DCTELEM (*block)[64]= a->block; int linesize= a->picture.linesize[0]; @@ -240,8 +226,6 @@ } } -#endif //CONFIG_ENCODERS - static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) @@ -324,8 +308,6 @@ return (get_bits_count(&a->gb)+31)/32*4; } -#ifdef CONFIG_ENCODERS - static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ ASV1Context * const a = avctx->priv_data; AVFrame *pict = data; @@ -374,8 +356,6 @@ return size*4; } -#endif //CONFIG_ENCODERS - static void common_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; @@ -416,8 +396,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static int encode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; int i; @@ -441,8 +419,6 @@ return 0; } -#endif //CONFIG_ENCODERS - static int decode_end(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data;
--- a/ffv1.c Sat Jun 21 01:11:31 2003 +0000 +++ b/ffv1.c Sun Jun 22 11:08:22 2003 +0000 @@ -905,6 +905,7 @@ NULL }; +#ifdef CONFIG_ENCODERS AVCodec ffv1_encoder = { "ffv1", CODEC_TYPE_VIDEO, @@ -914,3 +915,4 @@ encode_frame, encode_end, }; +#endif
--- a/huffyuv.c Sat Jun 21 01:11:31 2003 +0000 +++ b/huffyuv.c Sun Jun 22 11:08:22 2003 +0000 @@ -153,7 +153,6 @@ *left_top= lt; } -#ifdef CONFIG_ENCODERS //FIXME optimize static inline void sub_median_prediction(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w, int *left, int *left_top){ int i; @@ -173,8 +172,6 @@ *left_top= lt; } -#endif //CONFIG_ENCODERS - static inline void add_left_prediction_bgr32(uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){ int i; int r,g,b; @@ -197,7 +194,6 @@ *blue= b; } -#ifdef CONFIG_ENCODERS static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left){ int i; if(w<32){ @@ -217,7 +213,7 @@ return src[w-1]; } } -#endif //CONFIG_ENCODERS + static void read_len_table(uint8_t *dst, GetBitContext *gb){ int i, val, repeat; @@ -250,8 +246,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static void generate_len_table(uint8_t *dst, uint64_t *stats, int size){ uint64_t counts[2*size]; int up[2*size]; @@ -308,8 +302,6 @@ } } -#endif //CONFIG_ENCODERS - static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){ GetBitContext gb; int i; @@ -460,8 +452,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static void store_table(HYuvContext *s, uint8_t *len){ int i; int index= s->avctx->extradata_size; @@ -583,8 +573,6 @@ return 0; } -#endif //CONFIG_ENCODERS - static void decode_422_bitstream(HYuvContext *s, int count){ int i; @@ -609,8 +597,6 @@ } } -#ifdef CONFIG_ENCODERS - static void encode_422_bitstream(HYuvContext *s, int count){ int i; @@ -649,8 +635,6 @@ } } -#endif //CONFIG_ENCODERS - static void decode_bgr_bitstream(HYuvContext *s, int count){ int i; @@ -961,8 +945,6 @@ return 0; } -#ifdef CONFIG_ENCODERS - static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ HYuvContext *s = avctx->priv_data; AVFrame *pict = data; @@ -1130,8 +1112,6 @@ AVOPTION_END() }; -#endif //CONFIG_ENCODERS - AVCodec huffyuv_decoder = { "huffyuv", CODEC_TYPE_VIDEO,
--- a/mjpeg.c Sat Jun 21 01:11:31 2003 +0000 +++ b/mjpeg.c Sun Jun 22 11:08:22 2003 +0000 @@ -292,6 +292,7 @@ case 7: ret= (left + top)>>1; break;\ } +#ifdef CONFIG_ENCODERS static inline void put_marker(PutBitContext *p, int code) { put_bits(p, 8, 0xff); @@ -575,7 +576,7 @@ mant--; } - nbits= av_log2(val) + 1; + nbits= av_log2_16bit(val) + 1; put_bits(&s->pb, huff_size[nbits], huff_code[nbits]); @@ -789,6 +790,7 @@ // return (get_bit_count(&f->pb)+7)/8; } +#endif //CONFIG_ENCODERS /******************************************/ /* decoding */ @@ -2038,6 +2040,7 @@ NULL }; +#ifdef CONFIG_ENCODERS AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless jpeg shouldnt need them "ljpeg", CODEC_TYPE_VIDEO, @@ -2047,3 +2050,4 @@ encode_picture_lossless, MPV_encode_end, }; +#endif
--- a/mpeg12.c Sat Jun 21 01:11:31 2003 +0000 +++ b/mpeg12.c Sun Jun 22 11:08:22 2003 +0000 @@ -73,6 +73,13 @@ static uint32_t uni_mpeg1_ac_vlc_bits[64*64*2]; static uint8_t uni_mpeg1_ac_vlc_len [64*64*2]; + +/* simple include everything table for dc, first byte is bits number next 3 are code*/ +static uint32_t mpeg1_lum_dc_uni[512]; +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 static void init_2d_vlc_rl(RLTable *rl) @@ -114,6 +121,7 @@ } } +#ifdef CONFIG_ENCODERS static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){ int i; @@ -309,6 +317,7 @@ put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1); } +#endif static void common_init(MpegEncContext *s) { @@ -316,6 +325,13 @@ s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } +void ff_mpeg1_clean_buffers(MpegEncContext *s){ + s->last_dc[0] = 1 << (7 + s->intra_dc_precision); + s->last_dc[1] = s->last_dc[0]; + s->last_dc[2] = s->last_dc[0]; + memset(s->last_mv, 0, sizeof(s->last_mv)); +} + #ifdef CONFIG_ENCODERS void ff_mpeg1_encode_slice_header(MpegEncContext *s){ @@ -324,13 +340,6 @@ put_bits(&s->pb, 1, 0); /* slice extra information */ } -void ff_mpeg1_clean_buffers(MpegEncContext *s){ - s->last_dc[0] = 1 << (7 + s->intra_dc_precision); - s->last_dc[1] = s->last_dc[0]; - s->last_dc[2] = s->last_dc[0]; - memset(s->last_mv, 0, sizeof(s->last_mv)); -} - void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) { mpeg1_encode_sequence_header(s);
--- a/mpeg12data.h Sat Jun 21 01:11:31 2003 +0000 +++ b/mpeg12data.h Sun Jun 22 11:08:22 2003 +0000 @@ -25,7 +25,7 @@ 16, 16, 16, 16, 16, 16, 16, 16, }; -const unsigned char vlc_dc_table[256] = { +static const unsigned char vlc_dc_table[256] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, @@ -48,10 +48,10 @@ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -const uint16_t vlc_dc_lum_code[12] = { +static const uint16_t vlc_dc_lum_code[12] = { 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, }; -const unsigned char vlc_dc_lum_bits[12] = { +static const unsigned char vlc_dc_lum_bits[12] = { 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, }; @@ -62,10 +62,6 @@ 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, }; -/* simple include everything table for dc, first byte is bits number next 3 are code*/ -static uint32_t mpeg1_lum_dc_uni[512]; -static uint32_t mpeg1_chr_dc_uni[512]; - static const uint16_t mpeg1_vlc[113][2] = { { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, @@ -166,9 +162,6 @@ 25, 26, 27, 28, 29, 30, 31, }; -static uint8_t mpeg1_index_run[2][64]; -static int8_t mpeg1_max_level[2][64]; - static RLTable rl_mpeg1 = { 111, 111,
--- a/msmpeg4.c Sat Jun 21 01:11:31 2003 +0000 +++ b/msmpeg4.c Sun Jun 22 11:08:22 2003 +0000 @@ -58,17 +58,13 @@ static uint32_t v2_dc_lum_table[512][2]; static uint32_t v2_dc_chroma_table[512][2]; -#ifdef CONFIG_ENCODERS static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n); -#endif //CONFIG_ENCODERS static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, const uint8_t *scantable); static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); static int msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr); -#ifdef CONFIG_ENCODERS static void msmpeg4v2_encode_motion(MpegEncContext * s, int val); -#endif //CONFIG_ENCODERS static void init_h263_dc_for_msmpeg4(void); static inline void msmpeg4_memsetw(short *tab, int val, int n); #ifdef CONFIG_ENCODERS @@ -86,7 +82,9 @@ #include "msmpeg4data.h" +#ifdef CONFIG_ENCODERS //strangely gcc includes this even if its not references static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; +#endif //CONFIG_ENCODERS #ifdef STATS @@ -850,8 +848,6 @@ #define DC_MAX 119 -#ifdef CONFIG_ENCODERS - static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr) { int sign, code; @@ -1044,8 +1040,6 @@ } } -#endif //CONFIG_ENCODERS - /****************************************/ /* decoding stuff */ @@ -1428,8 +1422,6 @@ tab[i] = val; } -#ifdef CONFIG_ENCODERS - static void msmpeg4v2_encode_motion(MpegEncContext * s, int val) { int range, bit_size, sign, code, bits; @@ -1463,8 +1455,6 @@ } } -#endif //CONFIG_ENCODERS - /* this is identical to h263 except that its range is multiplied by 2 */ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code) {