Mercurial > libavcodec.hg
comparison motion_est.c @ 1426:b0f89a7855aa libavcodec
100l (forget to reset me.skip for b frames)
author | michaelni |
---|---|
date | Tue, 26 Aug 2003 22:26:18 +0000 |
parents | efeed6e29f9b |
children | 3ee63c12ea30 |
comparison
equal
deleted
inserted
replaced
1425:f53d31c5eac9 | 1426:b0f89a7855aa |
---|---|
26 * Motion estimation. | 26 * Motion estimation. |
27 */ | 27 */ |
28 | 28 |
29 #include <stdlib.h> | 29 #include <stdlib.h> |
30 #include <stdio.h> | 30 #include <stdio.h> |
31 #include <limits.h> | |
31 #include "avcodec.h" | 32 #include "avcodec.h" |
32 #include "dsputil.h" | 33 #include "dsputil.h" |
33 #include "mpegvideo.h" | 34 #include "mpegvideo.h" |
34 | 35 |
35 //#undef NDEBUG | 36 //#undef NDEBUG |
1492 { | 1493 { |
1493 const int penalty_factor= s->me.mb_penalty_factor; | 1494 const int penalty_factor= s->me.mb_penalty_factor; |
1494 int fmin, bmin, dmin, fbmin; | 1495 int fmin, bmin, dmin, fbmin; |
1495 int type=0; | 1496 int type=0; |
1496 | 1497 |
1497 dmin= direct_search(s, mb_x, mb_y); | 1498 s->me.skip=0; |
1498 | 1499 if (s->codec_id == CODEC_ID_MPEG4) |
1500 dmin= direct_search(s, mb_x, mb_y); | |
1501 else | |
1502 dmin= INT_MAX; | |
1503 | |
1504 s->me.skip=0; | |
1499 fmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, &s->last_picture, s->f_code) + 3*penalty_factor; | 1505 fmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, &s->last_picture, s->f_code) + 3*penalty_factor; |
1506 | |
1507 s->me.skip=0; | |
1500 bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, &s->next_picture, s->b_code) + 2*penalty_factor; | 1508 bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, &s->next_picture, s->b_code) + 2*penalty_factor; |
1501 //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); | 1509 //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); |
1502 | 1510 |
1511 s->me.skip=0; | |
1503 fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; | 1512 fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; |
1504 //printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin); | 1513 //printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin); |
1505 { | 1514 { |
1506 int score= fmin; | 1515 int score= fmin; |
1507 type = MB_TYPE_FORWARD; | 1516 type = MB_TYPE_FORWARD; |
1508 | 1517 |
1509 // RAL: No MB_TYPE_DIRECT in MPEG-1 video (only MPEG-4) | 1518 if (dmin <= score){ |
1510 if (s->codec_id == CODEC_ID_MPEG4 && dmin <= score){ | |
1511 score = dmin; | 1519 score = dmin; |
1512 type = MB_TYPE_DIRECT; | 1520 type = MB_TYPE_DIRECT; |
1513 } | 1521 } |
1514 if(bmin<score){ | 1522 if(bmin<score){ |
1515 score=bmin; | 1523 score=bmin; |