if(dc_pred_dir) dir|=1;
}
s->pred_dir_table[xy]= dir;
-
- s->error_status_table[xy]= AC_ERROR;
}else{ /* P/S_TYPE */
int mx, my, pred_x, pred_y, bits;
int16_t * const mot_val= s->motion_val[s->block_index[0]];
if(s->mbintra_table[xy])
ff_clean_intra_table_entries(s);
-
- s->error_status_table[xy]= AC_ERROR;
continue;
}
cbpc = get_vlc2(&s->gb, inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
mot_val[0+stride]= mot_val[2+stride]= 0;
mot_val[1 ]= mot_val[3 ]=
mot_val[1+stride]= mot_val[3+stride]= 0;
- s->error_status_table[xy]= DC_ERROR|AC_ERROR;
}else{
if(s->mbintra_table[xy])
ff_clean_intra_table_entries(s);
mot_val[1] = my;
}
}
- s->error_status_table[xy]= AC_ERROR;
}
}
}
s->cbp_table[xy]&= 3; //remove dquant
s->cbp_table[xy]|= cbpy<<2;
s->pred_dir_table[xy]= dir | (ac_pred<<7);
- s->error_status_table[xy]&= ~DC_ERROR;
}else if(s->mb_type[xy]&MB_TYPE_SKIPED){
s->current_picture.qscale_table[xy]= s->qscale;
s->cbp_table[xy]= 0;
int ff_mpeg4_decode_partitions(MpegEncContext *s)
{
int mb_num;
+ const int part_a_error= s->pict_type==I_TYPE ? (DC_ERROR|MV_ERROR) : MV_ERROR;
+ const int part_a_end = s->pict_type==I_TYPE ? (DC_END |MV_END) : MV_END;
mb_num= mpeg4_decode_partition_a(s);
- if(mb_num<0)
+ if(mb_num<0){
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
return -1;
+ }
if(s->resync_mb_x + s->resync_mb_y*s->mb_width + mb_num > s->mb_num){
fprintf(stderr, "slice below monitor ...\n");
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
return -1;
}
if(get_bits(&s->gb, 19)!=DC_MARKER){
fprintf(stderr, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y);
return -1;
- }else
- s->error_status_table[s->mb_x + s->mb_y*s->mb_width-1]|= MV_END|DC_END;
+ }
}else{
if(get_bits(&s->gb, 17)!=MOTION_MARKER){
fprintf(stderr, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y);
return -1;
- }else
- s->error_status_table[s->mb_x + s->mb_y*s->mb_width-1]|= MV_END;
+ }
}
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, part_a_end);
if( mpeg4_decode_partition_b(s, mb_num) < 0){
+ if(s->pict_type==P_TYPE)
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, DC_ERROR);
return -1;
+ }else{
+ if(s->pict_type==P_TYPE)
+ ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, DC_END);
}
-
- s->error_status_table[s->mb_x + s->mb_y*s->mb_width-1]|= DC_END;
return 0;
}
}
}
- s->error_status_table[xy]&= ~AC_ERROR;
-
/* per-MB end of slice check */
if(--s->mb_num_left <= 0){
int16_t *mot_val;
static int8_t quant_tab[4] = { -1, -2, 1, 2 };
- s->error_status_table[s->mb_x + s->mb_y*s->mb_width]= 0;
-
if(s->mb_x==0) PRINT_MB_TYPE("\n");
if (s->pict_type == P_TYPE || s->pict_type==S_TYPE) {
s->data_partitioning= get_bits1(gb);
if(s->data_partitioning){
s->rvlc= get_bits1(gb);
- if(s->rvlc){
- printf("reversible vlc not supported\n");
- }
}
if(vo_ver_id != 1) {
int i;
int e;
int ver, build, ver2, ver3;
+ char last;
buf[0]= show_bits(gb, 8);
for(i=1; i<256; i++){
skip_bits(gb, 8);
}
buf[255]=0;
-
+
/* divx detection */
- e=sscanf(buf, "DivX%dBuild%d", &ver, &build);
- if(e!=2)
- e=sscanf(buf, "DivX%db%d", &ver, &build);
- if(e==2){
+ e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
+ if(e<2)
+ e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
+ if(e>=2){
s->divx_version= ver;
s->divx_build= build;
+ s->divx_packed= e==3 && last=='p';
if(s->picture_number==0){
- printf("This file was encoded with DivX%d Build%d\n", ver, build);
+ printf("This file was encoded with DivX%d Build%d", ver, build);
+ if(s->divx_packed)
+ printf("p\n");
+ else
+ printf("\n");
}
}
s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; //FIXME add short header support
s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
- if(s->divx_version==0 || s->divx_version < 500){
+ if(!(s->workaround_bugs&FF_BUG_EDGE)){
s->h_edge_pos= s->width;
s->v_edge_pos= s->height;
}