comparison h264.c @ 7395:08e81ea44a38 libavcodec

Removing yet another weird field pic special case, now related to SHORT2LONG MMCOs.
author michael
date Fri, 25 Jul 2008 13:40:13 +0000
parents 4ac8769cbb01
children 9f765ea6d6df
comparison
equal deleted inserted replaced
7394:4ac8769cbb01 7395:08e81ea44a38
3451 for(i=0; i<mmco_count; i++){ 3451 for(i=0; i<mmco_count; i++){
3452 int structure, frame_num; 3452 int structure, frame_num;
3453 if(s->avctx->debug&FF_DEBUG_MMCO) 3453 if(s->avctx->debug&FF_DEBUG_MMCO)
3454 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); 3454 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);
3455 3455
3456 if( mmco[i].opcode == MMCO_SHORT2UNUSED
3457 || mmco[i].opcode == MMCO_SHORT2LONG){
3458 frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure);
3459 pic = find_short(h, frame_num, &j);
3460 if(!pic){
3461 av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
3462 continue;
3463 }
3464 }
3465
3456 switch(mmco[i].opcode){ 3466 switch(mmco[i].opcode){
3457 case MMCO_SHORT2UNUSED: 3467 case MMCO_SHORT2UNUSED:
3458 if(s->avctx->debug&FF_DEBUG_MMCO) 3468 if(s->avctx->debug&FF_DEBUG_MMCO)
3459 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count); 3469 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count);
3460 frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure);
3461 pic = find_short(h, frame_num, &j);
3462 if (pic) {
3463 if (unreference_pic(h, pic, structure ^ PICT_FRAME)) 3470 if (unreference_pic(h, pic, structure ^ PICT_FRAME))
3464 remove_short_at_index(h, j); 3471 remove_short_at_index(h, j);
3465 } else if(s->avctx->debug&FF_DEBUG_MMCO)
3466 av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short failure\n");
3467 break; 3472 break;
3468 case MMCO_SHORT2LONG: 3473 case MMCO_SHORT2LONG:
3469 if (FIELD_PICTURE && mmco[i].long_arg < h->long_ref_count && 3474 if (h->long_ref[mmco[i].long_arg] != pic)
3470 h->long_ref[mmco[i].long_arg]->frame_num == 3475 remove_long(h, mmco[i].long_arg, 0);
3471 mmco[i].short_pic_num / 2) {
3472 /* do nothing, we've already moved this field pair. */
3473 } else {
3474 int frame_num = mmco[i].short_pic_num >> FIELD_PICTURE;
3475
3476 remove_long(h, mmco[i].long_arg, 0);
3477 3476
3478 h->long_ref[ mmco[i].long_arg ]= remove_short(h, frame_num); 3477 h->long_ref[ mmco[i].long_arg ]= remove_short(h, frame_num);
3479 if (h->long_ref[ mmco[i].long_arg ]){ 3478 if (h->long_ref[ mmco[i].long_arg ]){
3480 h->long_ref[ mmco[i].long_arg ]->long_ref=1; 3479 h->long_ref[ mmco[i].long_arg ]->long_ref=1;
3481 h->long_ref_count++; 3480 h->long_ref_count++;
3482 } 3481 }
3483 }
3484 break; 3482 break;
3485 case MMCO_LONG2UNUSED: 3483 case MMCO_LONG2UNUSED:
3486 j = pic_num_extract(h, mmco[i].long_arg, &structure); 3484 j = pic_num_extract(h, mmco[i].long_arg, &structure);
3487 pic = h->long_ref[j]; 3485 pic = h->long_ref[j];
3488 if (pic) { 3486 if (pic) {