i=-1;
static int is_intra_more_likely(MpegEncContext *s){    int is_intra_likely, i, j, undamaged_count, skip_amount, mb_x, mb_y;        if(s->last_picture_ptr==NULL) return 1; //no previous frame available -> use spatial prediction    undamaged_count=0;    for(i=0; i<s->mb_num; i++){        int error= s->error_status_table[i];        if(!((error&DC_ERROR) && (error&MV_ERROR)))            undamaged_count++;    }        if(undamaged_count < 5) return 0; //allmost all MBs damaged -> use temporal prediction        skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs     is_intra_likely=0;    j=0;    i=-1;    for(mb_y= 0; mb_y<s->mb_height-1; mb_y++){        for(mb_x= 0; mb_x<s->mb_width; mb_x++){            int error;            i++;            error= s->error_status_table[i];            if((error&DC_ERROR) && (error&MV_ERROR))                continue; //skip damaged                    j++;                if((j%skip_amount) != 0) continue; //skip a few to speed things up                if(s->pict_type==I_TYPE){                uint8_t *mb_ptr     = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;                uint8_t *last_mb_ptr= s->last_picture.data   [0] + mb_x*16 + mb_y*16*s->linesize;    		is_intra_likely += s->dsp.pix_abs16x16(last_mb_ptr, mb_ptr                    , s->linesize);                is_intra_likely -= s->dsp.pix_abs16x16(last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize);            }else{                if(s->mbintra_table[i]) //HACK (this is allways inited but we should use mb_type[])                   is_intra_likely++;                else                   is_intra_likely--;            }        }    }//printf("is_intra_likely: %d type:%d\n", is_intra_likely, s->pict_type);    return is_intra_likely > 0;    }