int64_t d;
for(i=1;i<14;i++) {
- int64_t n0= 1001LL/frame_rate_tab[i].den*frame_rate_tab[i].num*s->avctx->frame_rate_base;
- int64_t n1= 1001LL*s->avctx->frame_rate;
- if(s->avctx->strict_std_compliance >= 0 && i>=9) break;
+ int64_t n0= 1001LL/frame_rate_tab[i].den*frame_rate_tab[i].num*s->avctx->time_base.num;
+ int64_t n1= 1001LL*s->avctx->time_base.den;
+ if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break;
d = ABS(n0 - n1);
if(d < dmin){
return -1;
if(find_frame_rate_index(s) < 0){
- if(s->strict_std_compliance >=0){
- av_log(avctx, AV_LOG_ERROR, "MPEG1/2 doesnt support %d/%d fps\n", avctx->frame_rate, avctx->frame_rate_base);
+ if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
+ av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num);
return -1;
}else{
- av_log(avctx, AV_LOG_INFO, "MPEG1/2 doesnt support %d/%d fps, there may be AV sync issues\n", avctx->frame_rate, avctx->frame_rate_base);
+ av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num);
}
}
put_bits(&s->pb, 1, s->intra_vlc_format);
put_bits(&s->pb, 1, s->alternate_scan);
put_bits(&s->pb, 1, s->repeat_first_field);
- put_bits(&s->pb, 1, s->chroma_420_type=1);
s->progressive_frame = s->progressive_sequence;
+ put_bits(&s->pb, 1, s->chroma_420_type=s->progressive_frame);
put_bits(&s->pb, 1, s->progressive_frame);
put_bits(&s->pb, 1, 0); //composite_display_flag
}
dprintf("decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
- assert(s->mb_skiped==0);
+ assert(s->mb_skipped==0);
if (s->mb_skip_run-- != 0) {
if(s->pict_type == I_TYPE){
- av_log(s->avctx, AV_LOG_ERROR, "skiped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
+ av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0;
s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0;
s->field_select[0][0]= s->picture_structure - 1;
- s->mb_skiped = 1;
+ s->mb_skipped = 1;
s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
} else {
int mb_type;
// assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8));
if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0)
- s->mb_skiped = 1;
+ s->mb_skipped = 1;
}
return 0;
RLTable *rl = &rl_mpeg1;
uint8_t * const scantable= s->intra_scantable.permutated;
const int qscale= s->qscale;
- int v;
OPEN_READER(re, &s->gb);
i = -1;
{
if (s1->mpeg_enc_ctx_allocated) {
+ ParseContext pc= s->parse_context;
+ s->parse_context.buffer=0;
MPV_common_end(s);
+ s->parse_context= pc;
}
if( (s->width == 0 )||(s->height == 0))
if(avctx->sub_id==1){//s->codec_id==avctx->codec_id==CODEC_ID
//mpeg1 fps
- avctx->frame_rate = frame_rate_tab[s->frame_rate_index].num;
- avctx->frame_rate_base= frame_rate_tab[s->frame_rate_index].den;
+ avctx->time_base.den = frame_rate_tab[s->frame_rate_index].num;
+ avctx->time_base.num= frame_rate_tab[s->frame_rate_index].den;
//mpeg1 aspect
avctx->sample_aspect_ratio= av_d2q(
1.0/mpeg1_aspect[s->aspect_ratio_info], 255);
}else{//mpeg2
//mpeg2 fps
av_reduce(
- &s->avctx->frame_rate,
- &s->avctx->frame_rate_base,
+ &s->avctx->time_base.den,
+ &s->avctx->time_base.num,
frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num,
frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
1<<30);
if (s->pict_type == P_TYPE || s->pict_type == B_TYPE) {
s->full_pel[0] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if (f_code == 0)
+ if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[0][0] = f_code;
s->mpeg_f_code[0][1] = f_code;
if (s->pict_type == B_TYPE) {
s->full_pel[1] = get_bits1(&s->gb);
f_code = get_bits(&s->gb, 3);
- if (f_code == 0)
+ if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT)
return -1;
s->mpeg_f_code[1][0] = f_code;
s->mpeg_f_code[1][1] = f_code;
s->current_picture.motion_val[dir][xy + 1][1] = motion_y;
s->current_picture.ref_index [dir][xy ]=
s->current_picture.ref_index [dir][xy + 1]= s->field_select[dir][i];
+ assert(s->field_select[dir][i]==0 || s->field_select[dir][i]==1);
}
xy += wrap;
}
/* find start next code */
start_code = find_start_code(&buf_ptr, buf_end);
if (start_code < 0){
- if(s2->pict_type != B_TYPE || avctx->hurry_up==0){
+ if(s2->pict_type != B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
if(avctx->thread_count > 1){
int i;
start_code <= SLICE_MAX_START_CODE) {
int mb_y= start_code - SLICE_MIN_START_CODE;
+ if(s2->last_picture_ptr==NULL){
/* skip b frames if we dont have reference frames */
- if(s2->last_picture_ptr==NULL && s2->pict_type==B_TYPE) break;
+ if(s2->pict_type==B_TYPE) break;
+ /* skip P frames if we dont have reference frame no valid header */
+ if(s2->pict_type==P_TYPE && !s2->first_slice) break;
+ }
/* skip b frames if we are in a hurry */
if(avctx->hurry_up && s2->pict_type==B_TYPE) break;
+ if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==B_TYPE)
+ ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=I_TYPE)
+ || avctx->skip_frame >= AVDISCARD_ALL)
+ break;
/* skip everything if we are in a hurry>=5 */
if(avctx->hurry_up>=5) break;