# HG changeset patch # User michael # Date 1217894912 0 # Node ID 13937730e79d73c79ed8706c3bed45c1edef1df0 # Parent a52ba8daad18e71a31eaf871cec537381ef8bf1d 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. diff -r a52ba8daad18 -r 13937730e79d h264.c --- a/h264.c Mon Aug 04 23:29:34 2008 +0000 +++ b/h264.c Tue Aug 05 00:08:32 2008 +0000 @@ -920,7 +920,7 @@ for(list=0; list<2; list++){ cur->ref_count[sidx][list] = h->ref_count[list]; for(j=0; jref_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 @@ return; for(list=0; list<2; list++){ for(i=0; iref_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; jref_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; }