Also add a NULL check and use directly frames instead of pictures.
---
This is done so that svq3 will be able to use this function directly instead
going through mpegvideo.
Vittorio
libavcodec/h264.c | 25 ++++++++++++++++---------
libavcodec/h264.h | 4 +++-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c76abf7..6b3374d 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -209,14 +209,19 @@ static void h264_er_decode_mb(void *opaque, int ref, int
mv_dir, int mv_type,
ff_h264_hl_decode_mb(h);
}
-void ff_h264_draw_horiz_band(H264Context *h, int y, int height)
+void ff_h264_draw_horiz_band(H264Context *h,
+ AVFrame *cur, AVFrame *last,
+ int y, int height, int first_field)
{
AVCodecContext *avctx = h->avctx;
- Picture *cur = &h->cur_pic;
- Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
- int vshift = desc->log2_chroma_h;
const int field_pic = h->picture_structure != PICT_FRAME;
+ int vshift;
+
+ if (!desc)
+ return;
+
+ vshift = desc->log2_chroma_h;
if (field_pic) {
height <<= 1;
y <<= 1;
@@ -224,7 +229,7 @@ void ff_h264_draw_horiz_band(H264Context *h, int y, int
height)
height = FFMIN(height, avctx->height - y);
- if (field_pic && h->first_field && !(avctx->slice_flags &
SLICE_FLAG_ALLOW_FIELD))
+ if (field_pic && first_field && !(avctx->slice_flags &
SLICE_FLAG_ALLOW_FIELD))
return;
if (avctx->draw_horiz_band) {
@@ -232,11 +237,11 @@ void ff_h264_draw_horiz_band(H264Context *h, int y, int
height)
int offset[AV_NUM_DATA_POINTERS];
int i;
- if (cur->f.pict_type == AV_PICTURE_TYPE_B || h->low_delay ||
+ if (cur->pict_type == AV_PICTURE_TYPE_B || h->low_delay ||
(avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
- src = &cur->f;
+ src = cur;
else if (last)
- src = &last->f;
+ src = last;
else
return;
@@ -4318,7 +4323,9 @@ static void decode_finish_row(H264Context *h)
top = 0;
}
- ff_h264_draw_horiz_band(h, top, height);
+ ff_h264_draw_horiz_band(h, &h->cur_pic.f,
+ h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0].f
: NULL,
+ top, height, h->first_field);
if (h->droppable)
return;
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index f29bc6a..815ae77 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -974,7 +974,9 @@ static av_always_inline int get_dct8x8_allowed(H264Context
*h)
0x0001000100010001ULL));
}
-void ff_h264_draw_horiz_band(H264Context *h, int y, int height);
+void ff_h264_draw_horiz_band(H264Context *h,
+ AVFrame *cur, AVFrame *last,
+ int y, int height, int first_field);
int ff_init_poc(H264Context *h, int pic_field_poc[2], int *pic_poc);
int ff_pred_weight_table(H264Context *h);
int ff_set_ref_count(H264Context *h);
--
1.8.3.4 (Apple Git-47)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel