aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-12-14 01:42:00 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-12-14 01:42:00 +0000
commit7ebfc0ea630e38a9c9653cdc9fe46f8b00e915a9 (patch)
tree4d99bbf321f7947c990d171ecf0deb1f9a4de730 /libavcodec
parentd55f7b6521016250c2f22397454c05fc8ace600a (diff)
downloadffmpeg-7ebfc0ea630e38a9c9653cdc9fe46f8b00e915a9.tar.gz
error concealment regression test
Originally committed as revision 2606 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h9
-rw-r--r--libavcodec/mpegvideo.c12
2 files changed, 20 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 77942872fe..de4c3f03d8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -17,7 +17,7 @@ extern "C" {
#define FFMPEG_VERSION_INT 0x000408
#define FFMPEG_VERSION "0.4.8"
-#define LIBAVCODEC_BUILD 4695
+#define LIBAVCODEC_BUILD 4696
#define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT
#define LIBAVCODEC_VERSION FFMPEG_VERSION
@@ -1461,6 +1461,13 @@ typedef struct AVCodecContext {
* - decoding: set by user.
*/
int flags2;
+
+ /**
+ * simulates errors in the bitstream to test error concealment.
+ * - encoding: set by user.
+ * - decoding: unused.
+ */
+ int error_rate;
} AVCodecContext;
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 7c515aa7fc..5dbe9be91b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -4002,6 +4002,18 @@ static void encode_picture(MpegEncContext *s, int picture_number)
assert((get_bit_count(&s->pb)&7) == 0);
current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob;
+
+ if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
+ int r= get_bit_count(&s->pb)/8 + s->picture_number + s->codec_id + s->mb_x + s->mb_y;
+ int d= 100 / s->avctx->error_rate;
+ if(r % d == 0){
+ current_packet_size=0;
+#ifndef ALT_BITSTREAM_WRITER
+ s->pb.buf_ptr= s->ptr_lastgob;
+#endif
+ assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
+ }
+ }
if (s->avctx->rtp_callback)
s->avctx->rtp_callback(s->ptr_lastgob, current_packet_size, 0);