diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-08-05 00:08:32 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-08-05 00:08:32 +0000 |
commit | 42de393dcb354c2981cdd39aa52992dc77594feb (patch) | |
tree | afa8385521db86fd674708380fcda5128729c719 /libavcodec/h264.c | |
parent | 6c86c44b8326b40d119bc8997a59de7f328f21c7 (diff) |
Use frame_num and reference instead of poc for matching frames for direct
mode MBs, this seems to work better with field/frame mixes. POC of both
can be the same and can be different that makes its use tricky.
Originally committed as revision 14545 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index ad34b75f22..dc4eb7c518 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -920,7 +920,7 @@ static inline void direct_ref_list_init(H264Context * const h){ for(list=0; list<2; list++){ cur->ref_count[sidx][list] = h->ref_count[list]; for(j=0; j<h->ref_count[list]; j++) - cur->ref_poc[sidx][list][j] = h->ref_list[list][j].poc; + cur->ref_poc[sidx][list][j] = 4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3); } if(s->picture_structure == PICT_FRAME){ memcpy(cur->ref_count[0], cur->ref_count[1], sizeof(cur->ref_count[0])); @@ -930,10 +930,12 @@ static inline void direct_ref_list_init(H264Context * const h){ return; for(list=0; list<2; list++){ for(i=0; i<ref1->ref_count[ref1sidx][list]; i++){ - const int poc = ref1->ref_poc[ref1sidx][list][i]; + int poc = ref1->ref_poc[ref1sidx][list][i]; + if(((poc&3) == 3) != (s->picture_structure == PICT_FRAME)) + poc= (poc&~3) + s->picture_structure; h->map_col_to_list0[list][i] = 0; /* bogus; fills in for missing frames */ for(j=0; j<h->ref_count[list]; j++) - if(h->ref_list[list][j].poc == poc){ + if(4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3) == poc){ h->map_col_to_list0[list][i] = j; break; } |