summaryrefslogtreecommitdiff
path: root/src/libffmpeg/diff_to_ffmpeg_cvs.txt
blob: b70c4479741ed92135fcf6fb60c5f89612b9ad48 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
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 <sys/types.h> /* 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 <assert.h>
 
@@ -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 <assert.h>
 
-#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; i<s->mb_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 <mlib_types.h>
 #include <mlib_status.h>
 #include <mlib_sys.h>
@@ -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;
     }
+  }
 }