Index: avcodec.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/avcodec.h,v retrieving revision 1.269 diff -u -r1.269 avcodec.h --- avcodec.h 22 Jan 2004 19:48:28 -0000 1.269 +++ avcodec.h 1 Feb 2004 04:42:16 -0000 @@ -15,6 +15,13 @@ #include "rational.h" #include /* size_t */ +/* FIXME: We cannot use ffmpeg's XvMC capabilities, since that would require + * linking the ffmpeg plugin against XvMC libraries, which is a bad thing, + * since they are output dependend. + * The correct fix would be to reimplement the XvMC functions libavcodec uses + * and do the necessary talking with our XvMC output plugin there. */ +#undef HAVE_XVMC + #define FFMPEG_VERSION_INT 0x000408 #define FFMPEG_VERSION "0.4.8" #define LIBAVCODEC_BUILD 4699 Index: common.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/common.c,v retrieving revision 1.48 diff -u -r1.48 common.c --- common.c 31 Jan 2004 20:37:46 -0000 1.48 +++ common.c 1 Feb 2004 04:42:17 -0000 @@ -102,7 +102,7 @@ #endif } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void put_string(PutBitContext * pbc, char *s) { Index: common.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/common.h,v retrieving revision 1.114 diff -u -r1.114 common.h --- common.h 26 Jan 2004 19:09:47 -0000 1.114 +++ common.h 1 Feb 2004 04:42:19 -0000 @@ -199,7 +199,9 @@ /* debug stuff */ # ifndef DEBUG +# ifndef NDEBUG # define NDEBUG +# endif # endif # include @@ -210,11 +212,19 @@ # else -# ifdef DEBUG -# define dprintf(fmt,...) printf(fmt, __VA_ARGS__) -# else -# define dprintf(fmt,...) -# endif +#if __GNUC__ +#ifdef DEBUG +#define dprintf(fmt,args...) printf(fmt, ## args) +#else +#define dprintf(fmt,args...) +#endif +#else +#ifdef DEBUG +#define dprintf(...) printf(__VA_ARGS__) +#else +#define dprintf(...) +#endif +#endif # endif /* !CONFIG_WIN32 */ Index: dsputil.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/dsputil.h,v retrieving revision 1.86 diff -u -r1.86 dsputil.h --- dsputil.h 29 Jan 2004 01:15:25 -0000 1.86 +++ dsputil.h 1 Feb 2004 04:42:21 -0000 @@ -31,6 +31,9 @@ #include "common.h" #include "avcodec.h" +#if defined(ARCH_X86) +#define HAVE_MMX 1 +#endif //#define DEBUG /* dct code */ Index: fastmemcpy.h =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Attic/fastmemcpy.h,v retrieving revision 1.1 diff -u -r1.1 fastmemcpy.h --- fastmemcpy.h 2 Aug 2001 08:29:38 -0000 1.1 +++ fastmemcpy.h 1 Feb 2004 04:42:21 -0000 @@ -1 +1,4 @@ -#include "../libvo/fastmemcpy.h" +#if 0 +extern void *xine_fast_memcpy(void *to, const void *from, size_t len); +#define memcpy(a,b,c) xine_fast_memcpy(a,b,c) +#endif Index: mpeg12.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpeg12.c,v retrieving revision 1.172 diff -u -r1.172 mpeg12.c --- mpeg12.c 22 Jan 2004 19:48:28 -0000 1.172 +++ mpeg12.c 1 Feb 2004 04:42:41 -0000 @@ -52,7 +52,7 @@ #define MB_BTYPE_VLC_BITS 6 #define TEX_VLC_BITS 9 -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void mpeg1_encode_block(MpegEncContext *s, DCTELEM *block, int component); @@ -80,7 +80,7 @@ extern void XVMC_init_block(MpegEncContext *s);//set s->block #endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static uint8_t (*mv_penalty)[MAX_MV*2+1]= NULL; static uint8_t fcode_tab[MAX_MV*2+1]; @@ -134,7 +134,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void init_uni_ac_vlc(RLTable *rl, uint32_t *uni_ac_vlc_bits, uint8_t *uni_ac_vlc_len){ int i; @@ -358,7 +358,7 @@ memset(s->last_mv, 0, sizeof(s->last_mv)); } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_mpeg1_encode_slice_header(MpegEncContext *s){ put_header(s, SLICE_MIN_START_CODE + s->mb_y); @@ -2713,7 +2713,7 @@ .flush= ff_mpeg_flush, }; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) AVCodec mpeg1video_encoder = { "mpeg1video", Index: mpegvideo.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mpegvideo.c,v retrieving revision 1.359 diff -u -r1.359 mpegvideo.c --- mpegvideo.c 29 Jan 2004 15:50:54 -0000 1.359 +++ mpegvideo.c 1 Feb 2004 04:42:42 -0000 @@ -38,7 +38,7 @@ //#undef NDEBUG //#include -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void encode_picture(MpegEncContext *s, int picture_number); #endif //CONFIG_ENCODERS static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, @@ -54,7 +54,7 @@ static void dct_unquantize_h263_inter_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 +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) 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); static int sse_mb(MpegEncContext *s); @@ -101,7 +101,7 @@ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static uint8_t (*default_mv_penalty)[MAX_MV*2+1]=NULL; static uint8_t default_fcode_tab[MAX_MV*2+1]; @@ -195,7 +195,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){ int i; @@ -219,7 +219,7 @@ s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) s->dct_quantize= dct_quantize_c; s->denoise_dct= denoise_dct_c; #endif @@ -243,7 +243,7 @@ MPV_common_init_ppc(s); #endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) s->fast_dct_quantize= s->dct_quantize; if(s->flags&CODEC_FLAG_TRELLIS_QUANT){ @@ -680,7 +680,7 @@ av_free(s->visualization_buffer[i]); } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) /* init video encoder */ int MPV_encode_init(AVCodecContext *avctx) @@ -831,6 +831,7 @@ s->low_delay= 0; //s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= 0; //s->max_b_frames ? 0 : 1; @@ -952,6 +953,7 @@ s->low_delay=1; break; #endif +#endif default: return -1; } @@ -991,18 +993,20 @@ ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) ff_init_me(s); +#endif -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if (s->out_format == FMT_H263) h263_encode_init(s); if(s->msmpeg4_version) ff_msmpeg4_encode_init(s); #endif +#endif if (s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); -#endif /* init default q matrix */ for(i=0;i<64;i++) { @@ -1059,8 +1063,10 @@ ff_rate_control_uninit(s); MPV_common_end(s); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if (s->out_format == FMT_MJPEG) mjpeg_close(s); +#endif av_freep(&avctx->extradata); @@ -1644,7 +1650,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static int get_sae(uint8_t *src, int ref, int stride){ int x,y; @@ -1930,8 +1936,10 @@ MPV_frame_end(s); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if (s->out_format == FMT_MJPEG) mjpeg_picture_trailer(s); +#endif if(s->flags&CODEC_FLAG_PASS1) ff_write_pass1_stats(s); @@ -3113,7 +3121,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold) { @@ -3262,7 +3270,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { @@ -3524,6 +3532,7 @@ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY case CODEC_ID_MPEG4: mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; @@ -3541,6 +3550,7 @@ #endif case CODEC_ID_MJPEG: mjpeg_encode_mb(s, s->block); break; +#endif default: assert(0); } @@ -3628,7 +3638,7 @@ s->parse_context.last_index= 0; } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length) { int bytes= length>>4; @@ -3817,12 +3827,14 @@ s->current_picture.mb_var_sum = 0; s->current_picture.mc_mb_var_sum = 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY /* we need to initialize some time vars before we can encode b-frames */ // RAL: Condition added for MPEG1VIDEO if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4)) ff_set_mpeg4_time(s, s->picture_number); #endif +#endif s->scene_change_score=0; @@ -3839,6 +3851,7 @@ /* Estimate motion for every MB */ s->mb_intra=0; //for the rate distoration & bit compare functions if(s->pict_type != I_TYPE){ +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if(s->pict_type != B_TYPE){ if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){ s->me.pre_pass=1; @@ -3876,6 +3889,7 @@ ff_estimate_p_frame_motion(s, mb_x, mb_y); } } +#endif }else /* if(s->pict_type == I_TYPE) */{ /* I-Frame */ for(i=0; imb_stride*s->mb_height; i++) @@ -3909,6 +3923,7 @@ //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); } +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) if(!s->umvplus){ if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER); @@ -3961,11 +3976,13 @@ } } } - +#endif + if (!s->fixed_qscale) s->current_picture.quality = ff_rate_estimate_qscale(s); if(s->adaptive_quant){ +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY switch(s->codec_id){ case CODEC_ID_MPEG4: @@ -3978,6 +3995,7 @@ break; } #endif +#endif s->lambda= s->lambda_table[0]; //FIXME broken @@ -4010,6 +4028,7 @@ s->last_bits= get_bit_count(&s->pb); switch(s->out_format) { +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) case FMT_MJPEG: mjpeg_picture_header(s); break; @@ -4028,6 +4047,15 @@ else h263_encode_picture_header(s, picture_number); break; +#else + case FMT_H263: + break; +#endif +#else + case FMT_MJPEG: + break; + case FMT_H263: + break; #endif case FMT_MPEG1: mpeg1_encode_picture_header(s, picture_number); @@ -4061,6 +4089,7 @@ s->last_mv_dir = 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY switch(s->codec_id){ case CODEC_ID_H263: @@ -4074,6 +4103,7 @@ break; } #endif +#endif s->resync_mb_x=0; s->resync_mb_y=0; @@ -4097,6 +4127,7 @@ ff_update_block_index(s); /* write gob / video packet header */ +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if(s->rtp_mode){ int current_packet_size, is_gob_start; @@ -4177,6 +4208,7 @@ } } #endif +#endif if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ @@ -4275,9 +4307,11 @@ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY ff_mpeg4_set_direct_mv(s, mx, my); #endif +#endif encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } @@ -4465,9 +4499,11 @@ s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY ff_mpeg4_set_direct_mv(s, motion_x, motion_y); #endif +#endif break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; @@ -4575,6 +4611,7 @@ } emms_c(); +#if defined(CONFIG_ENCODERS) || !defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY if(s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame) ff_mpeg4_merge_partitions(s); @@ -4585,6 +4622,7 @@ if(s->codec_id==CODEC_ID_MPEG4) ff_mpeg4_stuffing(&s->pb); #endif +#endif /* Send the last GOB if RTP */ if (s->avctx->rtp_callback) { @@ -4621,7 +4659,7 @@ } } -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, @@ -5252,7 +5290,7 @@ AVOPTION_END() }; -#ifdef CONFIG_ENCODERS +#if defined(CONFIG_ENCODERS) || defined(XINE_MPEG_ENCODER) #ifdef CONFIG_RISKY AVCodec h263_encoder = { "h263", Index: mlib/dsputil_mlib.c =================================================================== RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/mlib/dsputil_mlib.c,v retrieving revision 1.14 diff -u -r1.14 dsputil_mlib.c --- mlib/dsputil_mlib.c 11 Oct 2003 16:43:51 -0000 1.14 +++ mlib/dsputil_mlib.c 1 Feb 2004 04:42:48 -0000 @@ -20,6 +20,8 @@ #include "../dsputil.h" #include "../mpegvideo.h" +#include "../../../xine-utils/xineutils.h" + #include #include #include @@ -419,6 +419,7 @@ void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx) { + if (xine_mm_accel() & MM_ACCEL_MLIB) { c->get_pixels = get_pixels_mlib; c->diff_pixels = diff_pixels_mlib; c->add_pixels_clamped = add_pixels_clamped_mlib; @@ -445,10 +446,12 @@ c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib; c->bswap_buf = bswap_buf_mlib; + } } void MPV_common_init_mlib(MpegEncContext *s) { + if (xine_mm_accel() & MM_ACCEL_MLIB) { if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){ s->dsp.fdct = ff_fdct_mlib; } @@ -459,4 +462,5 @@ s->dsp.idct = ff_idct_mlib; s->dsp.idct_permutation_type= FF_NO_IDCT_PERM; } + } }