comparison h264.c @ 7487:13937730e79d libavcodec

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.
author michael
date Tue, 05 Aug 2008 00:08:32 +0000
parents a52ba8daad18
children a5bc797cbc49
comparison
equal deleted inserted replaced
7486:a52ba8daad18 7487:13937730e79d
918 int sidx= s->picture_structure&1; 918 int sidx= s->picture_structure&1;
919 int ref1sidx= ref1->reference&1; 919 int ref1sidx= ref1->reference&1;
920 for(list=0; list<2; list++){ 920 for(list=0; list<2; list++){
921 cur->ref_count[sidx][list] = h->ref_count[list]; 921 cur->ref_count[sidx][list] = h->ref_count[list];
922 for(j=0; j<h->ref_count[list]; j++) 922 for(j=0; j<h->ref_count[list]; j++)
923 cur->ref_poc[sidx][list][j] = h->ref_list[list][j].poc; 923 cur->ref_poc[sidx][list][j] = 4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3);
924 } 924 }
925 if(s->picture_structure == PICT_FRAME){ 925 if(s->picture_structure == PICT_FRAME){
926 memcpy(cur->ref_count[0], cur->ref_count[1], sizeof(cur->ref_count[0])); 926 memcpy(cur->ref_count[0], cur->ref_count[1], sizeof(cur->ref_count[0]));
927 memcpy(cur->ref_poc [0], cur->ref_poc [1], sizeof(cur->ref_poc [0])); 927 memcpy(cur->ref_poc [0], cur->ref_poc [1], sizeof(cur->ref_poc [0]));
928 } 928 }
929 if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred) 929 if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred)
930 return; 930 return;
931 for(list=0; list<2; list++){ 931 for(list=0; list<2; list++){
932 for(i=0; i<ref1->ref_count[ref1sidx][list]; i++){ 932 for(i=0; i<ref1->ref_count[ref1sidx][list]; i++){
933 const int poc = ref1->ref_poc[ref1sidx][list][i]; 933 int poc = ref1->ref_poc[ref1sidx][list][i];
934 if(((poc&3) == 3) != (s->picture_structure == PICT_FRAME))
935 poc= (poc&~3) + s->picture_structure;
934 h->map_col_to_list0[list][i] = 0; /* bogus; fills in for missing frames */ 936 h->map_col_to_list0[list][i] = 0; /* bogus; fills in for missing frames */
935 for(j=0; j<h->ref_count[list]; j++) 937 for(j=0; j<h->ref_count[list]; j++)
936 if(h->ref_list[list][j].poc == poc){ 938 if(4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3) == poc){
937 h->map_col_to_list0[list][i] = j; 939 h->map_col_to_list0[list][i] = j;
938 break; 940 break;
939 } 941 }
940 } 942 }
941 } 943 }