fprintf(stderr, "illegal short term buffer state detected\n");
av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n");
static int execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){    MpegEncContext * const s = &h->s;    int i;    int current_is_long=0;    Picture *pic;        if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0)        printf("no mmco here\n");            for(i=0; i<mmco_count; i++){        if(s->avctx->debug&FF_DEBUG_MMCO)            printf("mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_frame_num, h->mmco[i].long_index);        switch(mmco[i].opcode){        case MMCO_SHORT2UNUSED:            pic= remove_short(h, mmco[i].short_frame_num);            if(pic==NULL) return -1;            pic->reference= 0;            break;        case MMCO_SHORT2LONG:            pic= remove_long(h, mmco[i].long_index);            if(pic) pic->reference=0;                        h->long_ref[ mmco[i].long_index ]= remove_short(h, mmco[i].short_frame_num);            h->long_ref[ mmco[i].long_index ]->long_ref=1;            break;        case MMCO_LONG2UNUSED:            pic= remove_long(h, mmco[i].long_index);            if(pic==NULL) return -1;            pic->reference= 0;            break;        case MMCO_LONG:            pic= remove_long(h, mmco[i].long_index);            if(pic) pic->reference=0;                        h->long_ref[ mmco[i].long_index ]= s->current_picture_ptr;            h->long_ref[ mmco[i].long_index ]->long_ref=1;            h->long_ref_count++;                        current_is_long=1;            break;        case MMCO_SET_MAX_LONG:            assert(mmco[i].long_index <= 16);            while(mmco[i].long_index < h->long_ref_count){                pic= remove_long(h, mmco[i].long_index);                pic->reference=0;            }            while(mmco[i].long_index > h->long_ref_count){                h->long_ref[ h->long_ref_count++ ]= NULL;            }            break;        case MMCO_RESET:            while(h->short_ref_count){                pic= remove_short(h, h->short_ref[0]->frame_num);                pic->reference=0;            }            while(h->long_ref_count){                pic= remove_long(h, h->long_ref_count-1);                pic->reference=0;            }            break;        default: assert(0);        }    }        if(!current_is_long){        pic= remove_short(h, s->current_picture_ptr->frame_num);        if(pic){            pic->reference=0;            fprintf(stderr, "illegal short term buffer state detected\n");        }                if(h->short_ref_count)            memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count*sizeof(Picture*));        h->short_ref[0]= s->current_picture_ptr;        h->short_ref[0]->long_ref=0;        h->short_ref_count++;    }        return 0; }