Commit 63ccd466 authored by Luca Barbato's avatar Luca Barbato

lavc: introduce ER_MB_END and ER_MB_ERROR

Simplify a little error resilience calls
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 5bf2ac2b
...@@ -250,8 +250,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st ...@@ -250,8 +250,8 @@ static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
int right_status= s->error_status_table[((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride]; int right_status= s->error_status_table[((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride];
int left_intra = IS_INTRA(s->current_picture.f.mb_type[( b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride]); int left_intra = IS_INTRA(s->current_picture.f.mb_type[( b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride]);
int right_intra = IS_INTRA(s->current_picture.f.mb_type[((b_x + 1) >> is_luma) + (b_y >> is_luma) * s->mb_stride]); int right_intra = IS_INTRA(s->current_picture.f.mb_type[((b_x + 1) >> is_luma) + (b_y >> is_luma) * s->mb_stride]);
int left_damage = left_status&(ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); int left_damage = left_status&ER_MB_ERROR;
int right_damage= right_status&(ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); int right_damage= right_status&ER_MB_ERROR;
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
int16_t *left_mv= s->current_picture.f.motion_val[0][mvy_stride*b_y + mvx_stride* b_x ]; int16_t *left_mv= s->current_picture.f.motion_val[0][mvy_stride*b_y + mvx_stride* b_x ];
int16_t *right_mv= s->current_picture.f.motion_val[0][mvy_stride*b_y + mvx_stride*(b_x+1)]; int16_t *right_mv= s->current_picture.f.motion_val[0][mvy_stride*b_y + mvx_stride*(b_x+1)];
...@@ -313,8 +313,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st ...@@ -313,8 +313,8 @@ static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int st
int bottom_status= s->error_status_table[(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride]; int bottom_status= s->error_status_table[(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride];
int top_intra = IS_INTRA(s->current_picture.f.mb_type[(b_x >> is_luma) + ( b_y >> is_luma) * s->mb_stride]); int top_intra = IS_INTRA(s->current_picture.f.mb_type[(b_x >> is_luma) + ( b_y >> is_luma) * s->mb_stride]);
int bottom_intra = IS_INTRA(s->current_picture.f.mb_type[(b_x >> is_luma) + ((b_y + 1) >> is_luma) * s->mb_stride]); int bottom_intra = IS_INTRA(s->current_picture.f.mb_type[(b_x >> is_luma) + ((b_y + 1) >> is_luma) * s->mb_stride]);
int top_damage = top_status&(ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); int top_damage = top_status&ER_MB_ERROR;
int bottom_damage= bottom_status&(ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); int bottom_damage= bottom_status&ER_MB_ERROR;
int offset= b_x*8 + b_y*stride*8; int offset= b_x*8 + b_y*stride*8;
int16_t *top_mv = s->current_picture.f.motion_val[0][mvy_stride * b_y + mvx_stride * b_x]; int16_t *top_mv = s->current_picture.f.motion_val[0][mvy_stride * b_y + mvx_stride * b_x];
int16_t *bottom_mv = s->current_picture.f.motion_val[0][mvy_stride * (b_y + 1) + mvx_stride * b_x]; int16_t *bottom_mv = s->current_picture.f.motion_val[0][mvy_stride * (b_y + 1) + mvx_stride * b_x];
...@@ -705,7 +705,7 @@ static int is_intra_more_likely(MpegEncContext *s){ ...@@ -705,7 +705,7 @@ static int is_intra_more_likely(MpegEncContext *s){
void ff_er_frame_start(MpegEncContext *s){ void ff_er_frame_start(MpegEncContext *s){
if(!s->err_recognition) return; if(!s->err_recognition) return;
memset(s->error_status_table, ER_MV_ERROR|ER_AC_ERROR|ER_DC_ERROR|VP_START|ER_AC_END|ER_DC_END|ER_MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t)); memset(s->error_status_table, ER_MB_ERROR|VP_START|ER_MB_END, s->mb_stride*s->mb_height*sizeof(uint8_t));
s->error_count= 3*s->mb_num; s->error_count= 3*s->mb_num;
s->error_occurred = 0; s->error_occurred = 0;
} }
...@@ -747,7 +747,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en ...@@ -747,7 +747,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en
s->error_count -= end_i - start_i + 1; s->error_count -= end_i - start_i + 1;
} }
if(status & (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)) { if(status & ER_MB_ERROR) {
s->error_occurred = 1; s->error_occurred = 1;
s->error_count= INT_MAX; s->error_count= INT_MAX;
} }
...@@ -870,14 +870,14 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -870,14 +870,14 @@ void ff_er_frame_end(MpegEncContext *s){
if(error1&VP_START) if(error1&VP_START)
end_ok=1; end_ok=1;
if( error2==(VP_START|ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR|ER_AC_END|ER_DC_END|ER_MV_END) if( error2==(VP_START|ER_MB_ERROR|ER_MB_END)
&& error1!=(VP_START|ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR|ER_AC_END|ER_DC_END|ER_MV_END) && error1!=(VP_START|ER_MB_ERROR|ER_MB_END)
&& ((error1&ER_AC_END) || (error1&ER_DC_END) || (error1&ER_MV_END))){ //end & uninit && ((error1&ER_AC_END) || (error1&ER_DC_END) || (error1&ER_MV_END))){ //end & uninit
end_ok=0; end_ok=0;
} }
if(!end_ok) if(!end_ok)
s->error_status_table[mb_xy]|= ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR; s->error_status_table[mb_xy]|= ER_MB_ERROR;
} }
} }
...@@ -913,9 +913,9 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -913,9 +913,9 @@ void ff_er_frame_end(MpegEncContext *s){
int old_error= s->error_status_table[mb_xy]; int old_error= s->error_status_table[mb_xy];
if(old_error&VP_START) if(old_error&VP_START)
error= old_error& (ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); error= old_error& ER_MB_ERROR;
else{ else{
error|= old_error& (ER_DC_ERROR|ER_AC_ERROR|ER_MV_ERROR); error|= old_error& ER_MB_ERROR;
s->error_status_table[mb_xy]|= error; s->error_status_table[mb_xy]|= error;
} }
} }
...@@ -925,8 +925,8 @@ void ff_er_frame_end(MpegEncContext *s){ ...@@ -925,8 +925,8 @@ void ff_er_frame_end(MpegEncContext *s){
for(i=0; i<s->mb_num; i++){ for(i=0; i<s->mb_num; i++){
const int mb_xy= s->mb_index2xy[i]; const int mb_xy= s->mb_index2xy[i];
error= s->error_status_table[mb_xy]; error= s->error_status_table[mb_xy];
if(error&(ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)) if(error&ER_MB_ERROR)
error|= ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR; error|= ER_MB_ERROR;
s->error_status_table[mb_xy]= error; s->error_status_table[mb_xy]= error;
} }
} }
......
...@@ -184,7 +184,7 @@ static int decode_slice(MpegEncContext *s){ ...@@ -184,7 +184,7 @@ static int decode_slice(MpegEncContext *s){
/* per-row end of slice checks */ /* per-row end of slice checks */
if(s->msmpeg4_version){ if(s->msmpeg4_version){
if(s->resync_mb_y + s->slice_height == s->mb_y){ if(s->resync_mb_y + s->slice_height == s->mb_y){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_END|ER_DC_END|ER_MV_END); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
return 0; return 0;
} }
...@@ -225,7 +225,7 @@ static int decode_slice(MpegEncContext *s){ ...@@ -225,7 +225,7 @@ static int decode_slice(MpegEncContext *s){
ff_h263_loop_filter(s); ff_h263_loop_filter(s);
//printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24)); //printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
s->padding_bug_score--; s->padding_bug_score--;
...@@ -238,11 +238,11 @@ static int decode_slice(MpegEncContext *s){ ...@@ -238,11 +238,11 @@ static int decode_slice(MpegEncContext *s){
return 0; return 0;
}else if(ret==SLICE_NOEND){ }else if(ret==SLICE_NOEND){
av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy); av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, ER_MB_END&part_mask);
return -1; return -1;
} }
av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy); av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
return -1; return -1;
} }
...@@ -321,7 +321,7 @@ static int decode_slice(MpegEncContext *s){ ...@@ -321,7 +321,7 @@ static int decode_slice(MpegEncContext *s){
else if(left<0){ else if(left<0){
av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left); av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
}else }else
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_END|ER_DC_END|ER_MV_END); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
return 0; return 0;
} }
...@@ -330,7 +330,7 @@ static int decode_slice(MpegEncContext *s){ ...@@ -330,7 +330,7 @@ static int decode_slice(MpegEncContext *s){
get_bits_left(&s->gb), get_bits_left(&s->gb),
show_bits(&s->gb, 24), s->padding_bug_score); show_bits(&s->gb, 24), s->padding_bug_score);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
return -1; return -1;
} }
...@@ -661,7 +661,7 @@ retry: ...@@ -661,7 +661,7 @@ retry:
if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type==AV_PICTURE_TYPE_I) if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type==AV_PICTURE_TYPE_I)
if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){ if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
s->error_status_table[s->mb_num-1]= ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR; s->error_status_table[s->mb_num-1]= ER_MB_ERROR;
} }
assert(s->bitstream_buffer_size==0); assert(s->bitstream_buffer_size==0);
......
...@@ -3595,13 +3595,13 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ ...@@ -3595,13 +3595,13 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
eos = get_cabac_terminate( &h->cabac ); eos = get_cabac_terminate( &h->cabac );
if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){ if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
if (s->mb_x >= lf_x_start) loop_filter(h, lf_x_start, s->mb_x + 1); if (s->mb_x >= lf_x_start) loop_filter(h, lf_x_start, s->mb_x + 1);
return 0; return 0;
} }
if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) { if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
return -1; return -1;
} }
...@@ -3619,7 +3619,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ ...@@ -3619,7 +3619,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if( eos || s->mb_y >= s->mb_height ) { if( eos || s->mb_y >= s->mb_height ) {
tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits); tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x); if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
return 0; return 0;
} }
...@@ -3641,7 +3641,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ ...@@ -3641,7 +3641,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if(ret<0){ if(ret<0){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
return -1; return -1;
} }
...@@ -3659,11 +3659,11 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ ...@@ -3659,11 +3659,11 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits); tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
if(get_bits_count(&s->gb) == s->gb.size_in_bits ) { if(get_bits_count(&s->gb) == s->gb.size_in_bits ) {
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
return 0; return 0;
}else{ }else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_END&part_mask);
return -1; return -1;
} }
...@@ -3673,12 +3673,12 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){ ...@@ -3673,12 +3673,12 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run<=0){ if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run<=0){
tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits); tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
if(get_bits_count(&s->gb) == s->gb.size_in_bits ){ if(get_bits_count(&s->gb) == s->gb.size_in_bits ){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END&part_mask);
if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x); if (s->mb_x > lf_x_start) loop_filter(h, lf_x_start, s->mb_x);
return 0; return 0;
}else{ }else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)&part_mask); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, ER_MB_ERROR&part_mask);
return -1; return -1;
} }
......
...@@ -784,6 +784,6 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_of ...@@ -784,6 +784,6 @@ int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_of
error: error:
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
(s->mb_x>>1)-1, (s->mb_y>>1)-1, (s->mb_x>>1)-1, (s->mb_y>>1)-1,
(ER_AC_END|ER_DC_END|ER_MV_END) ); ER_MB_END );
return 0; return 0;
} }
...@@ -481,6 +481,9 @@ typedef struct MpegEncContext { ...@@ -481,6 +481,9 @@ typedef struct MpegEncContext {
#define ER_DC_END 32 #define ER_DC_END 32
#define ER_MV_END 64 #define ER_MV_END 64
#define ER_MB_ERROR (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR)
#define ER_MB_END (ER_AC_END|ER_DC_END|ER_MV_END)
int resync_mb_x; ///< x position of last resync marker int resync_mb_x; ///< x position of last resync marker
int resync_mb_y; ///< y position of last resync marker int resync_mb_y; ///< y position of last resync marker
GetBitContext last_resync_gb; ///< used to search for the next resync marker GetBitContext last_resync_gb; ///< used to search for the next resync marker
......
...@@ -609,7 +609,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, ...@@ -609,7 +609,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
if(ret == SLICE_END) break; if(ret == SLICE_END) break;
} }
ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_END|ER_DC_END|ER_MV_END); ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
return s->gb.size_in_bits; return s->gb.size_in_bits;
} }
......
...@@ -1278,7 +1278,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int ...@@ -1278,7 +1278,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
s->dsp.clear_blocks(s->block[0]); s->dsp.clear_blocks(s->block[0]);
if(rv34_decode_macroblock(r, r->intra_types + s->mb_x * 4 + 4) < 0){ if(rv34_decode_macroblock(r, r->intra_types + s->mb_x * 4 + 4) < 0){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_ERROR);
return -1; return -1;
} }
if (++s->mb_x == s->mb_width) { if (++s->mb_x == s->mb_width) {
...@@ -1296,7 +1296,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int ...@@ -1296,7 +1296,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int
s->first_slice_line=0; s->first_slice_line=0;
s->mb_num_left--; s->mb_num_left--;
} }
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_AC_END|ER_DC_END|ER_MV_END); ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, ER_MB_END);
return s->mb_y == s->mb_height; return s->mb_y == s->mb_height;
} }
......
...@@ -4548,7 +4548,7 @@ static void vc1_decode_i_blocks(VC1Context *v) ...@@ -4548,7 +4548,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq); if (v->s.loop_filter) vc1_loop_filter_iblk(v, v->pq);
if (get_bits_count(&s->gb) > v->bits) { if (get_bits_count(&s->gb) > v->bits) {
ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, ER_MB_END);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n",
get_bits_count(&s->gb), v->bits); get_bits_count(&s->gb), v->bits);
return; return;
...@@ -4563,7 +4563,7 @@ static void vc1_decode_i_blocks(VC1Context *v) ...@@ -4563,7 +4563,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
} }
if (v->s.loop_filter) if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16); ff_draw_horiz_band(s, (s->mb_height - 1) * 16, 16);
ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, ER_MB_END);
} }
/** Decode blocks of I-frame for advanced profile /** Decode blocks of I-frame for advanced profile
...@@ -4673,7 +4673,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) ...@@ -4673,7 +4673,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
if (get_bits_count(&s->gb) > v->bits) { if (get_bits_count(&s->gb) > v->bits) {
// TODO: may need modification to handle slice coding // TODO: may need modification to handle slice coding
ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_END);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n",
get_bits_count(&s->gb), v->bits); get_bits_count(&s->gb), v->bits);
return; return;
...@@ -4698,7 +4698,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v) ...@@ -4698,7 +4698,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
if (v->s.loop_filter) if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16); ff_draw_horiz_band(s, (s->end_mb_y-1)*16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, (ER_AC_END|ER_DC_END|ER_MV_END)); (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
} }
static void vc1_decode_p_blocks(VC1Context *v) static void vc1_decode_p_blocks(VC1Context *v)
...@@ -4749,7 +4749,7 @@ static void vc1_decode_p_blocks(VC1Context *v) ...@@ -4749,7 +4749,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
vc1_apply_p_loop_filter(v); vc1_apply_p_loop_filter(v);
if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
// TODO: may need modification to handle slice coding // TODO: may need modification to handle slice coding
ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_END);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n",
get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
return; return;
...@@ -4773,7 +4773,7 @@ static void vc1_decode_p_blocks(VC1Context *v) ...@@ -4773,7 +4773,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
if (s->end_mb_y >= s->start_mb_y) if (s->end_mb_y >= s->start_mb_y)
ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, (ER_AC_END|ER_DC_END|ER_MV_END)); (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
} }
static void vc1_decode_b_blocks(VC1Context *v) static void vc1_decode_b_blocks(VC1Context *v)
...@@ -4818,7 +4818,7 @@ static void vc1_decode_b_blocks(VC1Context *v) ...@@ -4818,7 +4818,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
vc1_decode_b_mb(v); vc1_decode_b_mb(v);
if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) { if (get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
// TODO: may need modification to handle slice coding // TODO: may need modification to handle slice coding
ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_x, s->mb_y, ER_MB_END);
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n",
get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y); get_bits_count(&s->gb), v->bits, s->mb_x, s->mb_y);
return; return;
...@@ -4834,14 +4834,14 @@ static void vc1_decode_b_blocks(VC1Context *v) ...@@ -4834,14 +4834,14 @@ static void vc1_decode_b_blocks(VC1Context *v)
if (v->s.loop_filter) if (v->s.loop_filter)
ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16); ff_draw_horiz_band(s, (s->end_mb_y - 1) * 16, 16);
ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1, ff_er_add_slice(s, 0, s->start_mb_y << v->field_mode, s->mb_width - 1,
(s->end_mb_y << v->field_mode) - 1, (ER_AC_END|ER_DC_END|ER_MV_END)); (s->end_mb_y << v->field_mode) - 1, ER_MB_END);
} }
static void vc1_decode_skip_blocks(VC1Context *v) static void vc1_decode_skip_blocks(VC1Context *v)
{ {
MpegEncContext *s = &v->s; MpegEncContext *s = &v->s;
ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, (ER_AC_END|ER_DC_END|ER_MV_END)); ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END);
s->first_slice_line = 1; s->first_slice_line = 1;
for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
s->mb_x = 0; s->mb_x = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment