Mercurial > libavcodec.hg
changeset 1688:04b759af8bd4 libavcodec
error concealment regression test
author | michael |
---|---|
date | Sun, 14 Dec 2003 01:42:00 +0000 |
parents | cdc3d4106fb6 |
children | 1a2db2073848 |
files | avcodec.h mpegvideo.c |
diffstat | 2 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/avcodec.h Sat Dec 13 20:41:33 2003 +0000 +++ b/avcodec.h Sun Dec 14 01:42:00 2003 +0000 @@ -17,7 +17,7 @@ #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 @@ * - 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;
--- a/mpegvideo.c Sat Dec 13 20:41:33 2003 +0000 +++ b/mpegvideo.c Sun Dec 14 01:42:00 2003 +0000 @@ -4002,6 +4002,18 @@ 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);