summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2007-09-15 11:06:27 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2007-09-15 11:06:27 +0000
commit2a898132a273294eb81925ec68f1277e648bbb2d (patch)
tree6690a0088283c7261ecc8a4e596c734e678d3bf0 /libavcodec
parent2c8c5021828ef3e8dc2835b809efa34dae276387 (diff)
downloadffmpeg-2a898132a273294eb81925ec68f1277e648bbb2d.tar.gz
Enable error resilience in WMV3/VC-1 decoder
Originally committed as revision 10502 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vc1.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index ceb052528f..3be8f01263 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -3438,7 +3438,6 @@ static void vc1_decode_i_blocks(VC1Context *v)
s->mb_x = s->mb_y = 0;
s->mb_intra = 1;
s->first_slice_line = 1;
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
ff_init_block_index(s);
@@ -3498,6 +3497,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
}
if(get_bits_count(&s->gb) > v->bits) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
return;
}
@@ -3505,6 +3505,7 @@ static void vc1_decode_i_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
/** Decode blocks of I-frame for advanced profile
@@ -3550,7 +3551,6 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
s->mb_x = s->mb_y = 0;
s->mb_intra = 1;
s->first_slice_line = 1;
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
ff_init_block_index(s);
@@ -3627,6 +3627,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
}
if(get_bits_count(&s->gb) > v->bits) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
return;
}
@@ -3634,6 +3635,7 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_p_blocks(VC1Context *v)
@@ -3665,7 +3667,6 @@ static void vc1_decode_p_blocks(VC1Context *v)
break;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
s->first_slice_line = 1;
for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
@@ -3675,6 +3676,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
vc1_decode_p_mb(v);
if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
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);
return;
}
@@ -3682,6 +3684,7 @@ static void vc1_decode_p_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_b_blocks(VC1Context *v)
@@ -3713,7 +3716,6 @@ static void vc1_decode_b_blocks(VC1Context *v)
break;
}
- ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
s->first_slice_line = 1;
for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for(s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
@@ -3723,6 +3725,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
vc1_decode_b_mb(v);
if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
+ ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
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);
return;
}
@@ -3730,6 +3733,7 @@ static void vc1_decode_b_blocks(VC1Context *v)
ff_draw_horiz_band(s, s->mb_y * 16, 16);
s->first_slice_line = 0;
}
+ ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
}
static void vc1_decode_skip_blocks(VC1Context *v)
@@ -4071,6 +4075,9 @@ static int vc1_decode_frame(AVCodecContext *avctx,
return -1;
}
+ s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
+ s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
+
ff_er_frame_start(s);
v->bits = buf_size * 8;