summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/h263dec.c4
-rw-r--r--libavcodec/mpeg12.c8
-rw-r--r--libavcodec/mpegvideo.c17
-rw-r--r--libavcodec/mpegvideo.h2
4 files changed, 19 insertions, 12 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 3fd7fb3ab6..e1ee79a166 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 4107e7a5fa..bee03d2876 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 12385c9646..a0c9e6e50b 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 04a576d0c0..899956a5b5 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);