diff options
author | Wolfgang Hesseler <qv@multimediaware.com> | 2003-02-16 23:05:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-02-16 23:05:38 +0000 |
commit | 7604246d1a27a0c32e036bb01704787c435fa153 (patch) | |
tree | 7ea7cf2a9983f549dc42b1b4d178097ab3579405 /libavcodec/mpegvideo.c | |
parent | 0a6de063b05088c9c9556f0aefd2171906e8baf4 (diff) | |
download | ffmpeg-7604246d1a27a0c32e036bb01704787c435fa153.tar.gz |
more #ifdef CONFIG_ENCODERS patch by (Wolfgang Hesseler <qv at multimediaware dot com>) with modifications by me (s/WOLFGANG/CONFIG_ENCODERS/ and some other fixes)
Originally committed as revision 1588 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 965439bb3d..63aedd6765 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -33,7 +33,9 @@ //#undef NDEBUG //#include <assert.h> +#ifdef CONFIG_ENCODERS static void encode_picture(MpegEncContext *s, int picture_number); +#endif //CONFIG_ENCODERS static void dct_unquantize_mpeg1_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_mpeg2_c(MpegEncContext *s, @@ -41,8 +43,10 @@ static void dct_unquantize_mpeg2_c(MpegEncContext *s, static void dct_unquantize_h263_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w); +#ifdef CONFIG_ENCODERS static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); +#endif //CONFIG_ENCODERS void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c; @@ -85,6 +89,7 @@ static const uint8_t h263_chroma_roundtab[16] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, }; +#ifdef CONFIG_ENCODERS static uint16_t (*default_mv_penalty)[MAX_MV*2+1]=NULL; static uint8_t default_fcode_tab[MAX_MV*2+1]; @@ -137,6 +142,8 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16 } } } +#endif //CONFIG_ENCODERS + // move into common.c perhaps #define CHECKED_ALLOCZ(p, size)\ {\ @@ -198,12 +205,14 @@ int DCT_common_init(MpegEncContext *s) s->dct_unquantize_h263 = dct_unquantize_h263_c; s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c; s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c; +#ifdef CONFIG_ENCODERS s->dct_quantize= dct_quantize_c; if(s->avctx->dct_algo==FF_DCT_FASTINT) s->fdct = fdct_ifast; else s->fdct = ff_jpeg_fdct_islow; //slow/accurate/default +#endif //CONFIG_ENCODERS if(s->avctx->idct_algo==FF_IDCT_INT){ s->idct_put= ff_jref_idct_put; @@ -234,12 +243,15 @@ int DCT_common_init(MpegEncContext *s) MPV_common_init_ppc(s); #endif +#ifdef CONFIG_ENCODERS s->fast_dct_quantize= s->dct_quantize; if(s->flags&CODEC_FLAG_TRELLIS_QUANT){ s->dct_quantize= dct_quantize_trellis_c; //move before MPV_common_init_* } +#endif //CONFIG_ENCODERS + switch(s->idct_permutation_type){ case FF_NO_IDCT_PERM: for(i=0; i<64; i++) @@ -544,6 +556,8 @@ void MPV_common_end(MpegEncContext *s) s->context_initialized = 0; } +#ifdef CONFIG_ENCODERS + /* init video encoder */ int MPV_encode_init(AVCodecContext *avctx) { @@ -810,6 +824,8 @@ int MPV_encode_end(AVCodecContext *avctx) return 0; } +#endif //CONFIG_ENCODERS + void init_rl(RLTable *rl) { int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1]; @@ -1019,6 +1035,8 @@ void MPV_frame_end(MpegEncContext *s) } } +#ifdef CONFIG_ENCODERS + static int get_sae(uint8_t *src, int ref, int stride){ int x,y; int acc=0; @@ -1323,6 +1341,8 @@ int MPV_encode_picture(AVCodecContext *avctx, return pbBufPtr(&s->pb) - s->pb.buf; } +#endif //CONFIG_ENCODERS + static inline void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dest_offset, @@ -2188,6 +2208,8 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) } } +#ifdef CONFIG_ENCODERS + static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold) { static const char tab[64]= @@ -2391,6 +2413,8 @@ static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move #endif +#endif //CONFIG_ENCODERS + void ff_draw_horiz_band(MpegEncContext *s){ if ( s->avctx->draw_horiz_band && (s->last_picture.data[0] || s->low_delay) ) { @@ -2422,6 +2446,8 @@ void ff_draw_horiz_band(MpegEncContext *s){ } } +#ifdef CONFIG_ENCODERS + static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { const int mb_x= s->mb_x; @@ -2658,7 +2684,6 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale; } -#ifdef CONFIG_ENCODERS /* huffman encode */ switch(s->codec_id){ //FIXME funct ptr could be slightly faster case CODEC_ID_MPEG1VIDEO: @@ -2682,9 +2707,10 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) default: assert(0); } -#endif } +#endif //CONFIG_ENCODERS + /** * combines the (truncated) bitstream to a complete frame * @returns -1 if no complete frame could be created @@ -2714,6 +2740,7 @@ int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size) return 0; } +#ifdef CONFIG_ENCODERS void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) { int bytes= length>>4; @@ -3819,6 +3846,8 @@ static int dct_quantize_c(MpegEncContext *s, return last_non_zero; } +#endif //CONFIG_ENCODERS + static void dct_unquantize_mpeg1_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { @@ -3988,6 +4017,7 @@ static void dct_unquantize_h263_c(MpegEncContext *s, } } + char ff_get_pict_type_char(int pict_type){ switch(pict_type){ case I_TYPE: return 'I'; @@ -4022,6 +4052,8 @@ static const AVOption mpeg4_options[] = AVOPTION_END() }; +#ifdef CONFIG_ENCODERS + AVCodec mpeg1video_encoder = { "mpeg1video", CODEC_TYPE_VIDEO, @@ -4126,3 +4158,6 @@ AVCodec mjpeg_encoder = { MPV_encode_picture, MPV_encode_end, }; + +#endif //CONFIG_ENCODERS + |