avcodec/h264dec: Return early in ff_h264_draw_horiz_band()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
1f1abb27f1
commit
b550dd670a
@ -104,9 +104,17 @@ void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl,
|
|||||||
{
|
{
|
||||||
AVCodecContext *avctx = h->avctx;
|
AVCodecContext *avctx = h->avctx;
|
||||||
const AVFrame *src = h->cur_pic.f;
|
const AVFrame *src = h->cur_pic.f;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
const AVPixFmtDescriptor *desc;
|
||||||
int vshift = desc->log2_chroma_h;
|
int offset[AV_NUM_DATA_POINTERS];
|
||||||
|
int vshift;
|
||||||
const int field_pic = h->picture_structure != PICT_FRAME;
|
const int field_pic = h->picture_structure != PICT_FRAME;
|
||||||
|
|
||||||
|
if (!avctx->draw_horiz_band)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (field_pic && h->first_field && !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD))
|
||||||
|
return;
|
||||||
|
|
||||||
if (field_pic) {
|
if (field_pic) {
|
||||||
height <<= 1;
|
height <<= 1;
|
||||||
y <<= 1;
|
y <<= 1;
|
||||||
@ -114,24 +122,19 @@ void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl,
|
|||||||
|
|
||||||
height = FFMIN(height, avctx->height - y);
|
height = FFMIN(height, avctx->height - y);
|
||||||
|
|
||||||
if (field_pic && h->first_field && !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD))
|
desc = av_pix_fmt_desc_get(avctx->pix_fmt);
|
||||||
return;
|
vshift = desc->log2_chroma_h;
|
||||||
|
|
||||||
if (avctx->draw_horiz_band) {
|
|
||||||
int offset[AV_NUM_DATA_POINTERS];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
offset[0] = y * src->linesize[0];
|
offset[0] = y * src->linesize[0];
|
||||||
offset[1] =
|
offset[1] =
|
||||||
offset[2] = (y >> vshift) * src->linesize[1];
|
offset[2] = (y >> vshift) * src->linesize[1];
|
||||||
for (i = 3; i < AV_NUM_DATA_POINTERS; i++)
|
for (int i = 3; i < AV_NUM_DATA_POINTERS; i++)
|
||||||
offset[i] = 0;
|
offset[i] = 0;
|
||||||
|
|
||||||
emms_c();
|
emms_c();
|
||||||
|
|
||||||
avctx->draw_horiz_band(avctx, src, offset,
|
avctx->draw_horiz_band(avctx, src, offset,
|
||||||
y, h->picture_structure, height);
|
y, h->picture_structure, height);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_h264_free_tables(H264Context *h)
|
void ff_h264_free_tables(H264Context *h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user