# HG changeset patch # User andoma # Date 1191335720 0 # Node ID db5a041fd77ce400a8384e93b7b6ac05569242c5 # Parent b45894d869dad4ae0aaa75f855eba92a91de6924 Rename MMCO stuff to prepare for h264/PAFF implementation. patch by Jeff Downs, heydowns a borg d com original thread: Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264 Date: 18/09/07 20:30 diff -r b45894d869da -r db5a041fd77c h264.c --- a/h264.c Tue Oct 02 14:25:47 2007 +0000 +++ b/h264.c Tue Oct 02 14:35:20 2007 +0000 @@ -3228,47 +3228,47 @@ for(i=0; iavctx->debug&FF_DEBUG_MMCO) - av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index); + av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg); switch(mmco[i].opcode){ case MMCO_SHORT2UNUSED: - pic= remove_short(h, mmco[i].short_frame_num); + pic= remove_short(h, mmco[i].short_pic_num); if(pic) unreference_pic(h, pic); else if(s->avctx->debug&FF_DEBUG_MMCO) av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_short() failure\n"); break; case MMCO_SHORT2LONG: - pic= remove_long(h, mmco[i].long_index); + pic= remove_long(h, mmco[i].long_arg); if(pic) unreference_pic(h, pic); - h->long_ref[ mmco[i].long_index ]= remove_short(h, mmco[i].short_frame_num); - if (h->long_ref[ mmco[i].long_index ]){ - h->long_ref[ mmco[i].long_index ]->long_ref=1; + h->long_ref[ mmco[i].long_arg ]= remove_short(h, mmco[i].short_pic_num); + if (h->long_ref[ mmco[i].long_arg ]){ + h->long_ref[ mmco[i].long_arg ]->long_ref=1; h->long_ref_count++; } break; case MMCO_LONG2UNUSED: - pic= remove_long(h, mmco[i].long_index); + pic= remove_long(h, mmco[i].long_arg); if(pic) unreference_pic(h, pic); else if(s->avctx->debug&FF_DEBUG_MMCO) av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: remove_long() failure\n"); break; case MMCO_LONG: - pic= remove_long(h, mmco[i].long_index); + pic= remove_long(h, mmco[i].long_arg); if(pic) unreference_pic(h, pic); - h->long_ref[ mmco[i].long_index ]= s->current_picture_ptr; - h->long_ref[ mmco[i].long_index ]->long_ref=1; + h->long_ref[ mmco[i].long_arg ]= s->current_picture_ptr; + h->long_ref[ mmco[i].long_arg ]->long_ref=1; h->long_ref_count++; current_is_long=1; break; case MMCO_SET_MAX_LONG: - assert(mmco[i].long_index <= 16); + assert(mmco[i].long_arg <= 16); // just remove the long term which index is greater than new max - for(j = mmco[i].long_index; j<16; j++){ + for(j = mmco[i].long_arg; j<16; j++){ pic = remove_long(h, j); if (pic) unreference_pic(h, pic); } @@ -3313,8 +3313,8 @@ if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields s->broken_link= get_bits1(gb) -1; - h->mmco[0].long_index= get_bits1(gb) - 1; // current_long_term_idx - if(h->mmco[0].long_index == -1) + h->mmco[0].long_arg= get_bits1(gb) - 1; // current_long_term_idx + if(h->mmco[0].long_arg == -1) h->mmco_index= 0; else{ h->mmco[0].opcode= MMCO_LONG; @@ -3327,19 +3327,19 @@ h->mmco[i].opcode= opcode; if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ - h->mmco[i].short_frame_num= (h->frame_num - get_ue_golomb(gb) - 1) & ((1<sps.log2_max_frame_num)-1); //FIXME fields -/* if(h->mmco[i].short_frame_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_frame_num ] == NULL){ + h->mmco[i].short_pic_num= (h->frame_num - get_ue_golomb(gb) - 1) & ((1<sps.log2_max_frame_num)-1); //FIXME fields +/* if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){ av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); return -1; }*/ } if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ unsigned int long_index= get_ue_golomb(gb); - if(/*h->mmco[i].long_index >= h->long_ref_count || h->long_ref[ h->mmco[i].long_index ] == NULL*/ long_index >= 16){ + if(/*h->mmco[i].long_arg >= h->long_ref_count || h->long_ref[ h->mmco[i].long_arg ] == NULL*/ long_index >= 16){ av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); return -1; } - h->mmco[i].long_index= long_index; + h->mmco[i].long_arg= long_index; } if(opcode > (unsigned)MMCO_LONG){ @@ -3355,7 +3355,7 @@ if(h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count){ //FIXME fields h->mmco[0].opcode= MMCO_SHORT2UNUSED; - h->mmco[0].short_frame_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; + h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; h->mmco_index= 1; }else h->mmco_index= 0; diff -r b45894d869da -r db5a041fd77c h264.h --- a/h264.h Tue Oct 02 14:25:47 2007 +0000 +++ b/h264.h Tue Oct 02 14:35:20 2007 +0000 @@ -151,8 +151,8 @@ */ typedef struct MMCO{ MMCOOpcode opcode; - int short_frame_num; - int long_index; + int short_pic_num; ///< pic_num without wrapping (pic_num & max_pic_num) + int long_arg; ///< index, pic_num, or num long refs depending on opcode } MMCO; /**