From 640950c700ce17fb6e3a135c5717f35c9c8d48ea Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <michaelni@gmx.at> Date: Wed, 5 Mar 2003 20:03:15 +0000 Subject: [PATCH] mpeg2 field pictures + sliced mode (doesnt work with mplayer though, dunno why) Originally committed as revision 1626 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h263dec.c | 4 ++-- libavcodec/mpeg12.c | 8 +++++++- libavcodec/mpegvideo.c | 17 +++++++++-------- libavcodec/mpegvideo.h | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 3fd7fb3ab68..e1ee79a166f 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -213,7 +213,7 @@ static int decode_slice(MpegEncContext *s){ if(++s->mb_x >= s->mb_width){ s->mb_x=0; - ff_draw_horiz_band(s); + ff_draw_horiz_band(s, s->mb_y*16, 16); s->mb_y++; } return 0; @@ -230,7 +230,7 @@ static int decode_slice(MpegEncContext *s){ } } - ff_draw_horiz_band(s); + ff_draw_horiz_band(s, s->mb_y*16, 16); s->mb_x= 0; } diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 4107e7a5fa3..bee03d2876b 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1875,7 +1875,13 @@ static int mpeg_decode_slice(AVCodecContext *avctx, } if (++s->mb_x >= s->mb_width) { - ff_draw_horiz_band(s); + if(s->picture_structure==PICT_FRAME){ + ff_draw_horiz_band(s, 16*s->mb_y, 16); + }else{ + if(!s->first_field){ + ff_draw_horiz_band(s, 32*s->mb_y, 32); + } + } s->mb_x = 0; s->mb_y++; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 12385c96467..a0c9e6e50be 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2051,7 +2051,7 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) }else s->mb_skiped= 0; - if(s->pict_type==B_TYPE && s->avctx->draw_horiz_band){ + if(s->pict_type==B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME){ //FIXME precalc dest_y = s->current_picture.data[0] + mb_x * 16; dest_cb = s->current_picture.data[1] + mb_x * 8; dest_cr = s->current_picture.data[2] + mb_x * 8; @@ -2356,17 +2356,18 @@ static int pix_diff_vcmp16x8(uint8_t *s1, uint8_t*s2, int stride){ //FIXME move #endif //CONFIG_ENCODERS -void ff_draw_horiz_band(MpegEncContext *s){ +/** + * + * @param h is the normal height, this will be reduced automatically if needed for the last row + */ +void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ if ( s->avctx->draw_horiz_band && (s->last_picture.data[0] || s->low_delay) ) { uint8_t *src_ptr[3]; - int y, h, offset; - y = s->mb_y * 16; - h = s->height - y; - if (h > 16) - h = 16; + int offset; + h= FFMIN(h, s->height - y); - if(s->pict_type==B_TYPE) + if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME) offset = 0; else offset = y * s->linesize; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 04a576d0c04..899956a5b52 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -593,7 +593,7 @@ void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length); void ff_clean_intra_table_entries(MpegEncContext *s); void ff_init_scantable(MpegEncContext *s, ScanTable *st, const uint8_t *src_scantable); void ff_error_resilience(MpegEncContext *s); -void ff_draw_horiz_band(MpegEncContext *s); +void ff_draw_horiz_band(MpegEncContext *s, int y, int h); void ff_emulated_edge_mc(MpegEncContext *s, uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h); char ff_get_pict_type_char(int pict_type); -- GitLab