comparison mpegvideo.c @ 321:2b00e171b1d4 libavcodec

- ME method compatibility with legacy apps. - Please use AVCodecContext's me_method now.
author pulento
date Sun, 14 Apr 2002 22:17:40 +0000
parents cda7d0857baf
children 9c6f056f0e41
comparison
equal deleted inserted replaced
320:cda7d0857baf 321:2b00e171b1d4
48 /* enable all paranoid tests for rounding, overflows, etc... */ 48 /* enable all paranoid tests for rounding, overflows, etc... */
49 //#define PARANOID 49 //#define PARANOID
50 50
51 //#define DEBUG 51 //#define DEBUG
52 52
53
53 /* for jpeg fast DCT */ 54 /* for jpeg fast DCT */
54 #define CONST_BITS 14 55 #define CONST_BITS 14
55 56
56 static const unsigned short aanscales[64] = { 57 static const unsigned short aanscales[64] = {
57 /* precomputed values scaled up by 14 bits */ 58 /* precomputed values scaled up by 14 bits */
70 }; 71 };
71 72
72 static UINT16 default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1]; 73 static UINT16 default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
73 static UINT8 default_fcode_tab[MAX_MV*2+1]; 74 static UINT8 default_fcode_tab[MAX_MV*2+1];
74 75
76 extern UINT8 zigzag_end[64];
77
75 /* default motion estimation */ 78 /* default motion estimation */
76 int motion_estimation_method = ME_LOG; 79 int motion_estimation_method = ME_EPZS;
77
78 extern UINT8 zigzag_end[64];
79 80
80 static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale) 81 static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale)
81 { 82 {
82 int i; 83 int i;
83 84
313 } else { 314 } else {
314 s->intra_only = 0; 315 s->intra_only = 0;
315 } 316 }
316 317
317 /* ME algorithm */ 318 /* ME algorithm */
318 s->me_method = avctx->me_method; 319 if (avctx->me_method == 0)
320 /* For compatibility */
321 s->me_method = motion_estimation_method;
322 else
323 s->me_method = avctx->me_method;
324
319 /* Fixed QSCALE */ 325 /* Fixed QSCALE */
320 s->fixed_qscale = (avctx->flags & CODEC_FLAG_QSCALE); 326 s->fixed_qscale = (avctx->flags & CODEC_FLAG_QSCALE);
321 327
322 switch(avctx->codec->id) { 328 switch(avctx->codec->id) {
323 case CODEC_ID_MPEG1VIDEO: 329 case CODEC_ID_MPEG1VIDEO:
413 h263_encode_init(s); 419 h263_encode_init(s);
414 else if (s->out_format == FMT_MPEG1) 420 else if (s->out_format == FMT_MPEG1)
415 mpeg1_encode_init(s); 421 mpeg1_encode_init(s);
416 422
417 /* dont use mv_penalty table for crap MV as it would be confused */ 423 /* dont use mv_penalty table for crap MV as it would be confused */
418 if (s->me_method < 0) s->mv_penalty = default_mv_penalty; 424 if (s->me_method < 5) s->mv_penalty = default_mv_penalty;
419 425
420 s->encoding = 1; 426 s->encoding = 1;
421 427
422 /* init */ 428 /* init */
423 if (MPV_common_init(s) < 0) 429 if (MPV_common_init(s) < 0)
1344 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height); 1350 memset(s->mb_type , MB_TYPE_INTRA, sizeof(UINT8)*s->mb_width*s->mb_height);
1345 //printf("Scene change detected, encoding as I Frame\n"); 1351 //printf("Scene change detected, encoding as I Frame\n");
1346 } 1352 }
1347 1353
1348 /* find best f_code for ME which do unlimited searches */ 1354 /* find best f_code for ME which do unlimited searches */
1349 if(s->pict_type == P_TYPE && s->me_method >= 0){ 1355 if(s->pict_type == P_TYPE && s->me_method >= 5){
1350 int mv_num[8]; 1356 int mv_num[8];
1351 int i; 1357 int i;
1352 int loose=0; 1358 int loose=0;
1353 UINT8 * fcode_tab= s->fcode_tab; 1359 UINT8 * fcode_tab= s->fcode_tab;
1354 1360