avcodec/mpegutils: Return early in ff_draw_horiz_band()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-10-16 22:15:05 +02:00
parent 85f02c300f
commit 678f1b1cf4
1 changed files with 10 additions and 8 deletions

View File

@ -53,9 +53,14 @@ void ff_draw_horiz_band(AVCodecContext *avctx,
int y, int h, int picture_structure,
int first_field, int low_delay)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int vshift = desc->log2_chroma_h;
const int field_pic = picture_structure != PICT_FRAME;
const AVFrame *src;
int offset[AV_NUM_DATA_POINTERS];
int i;
if (!avctx->draw_horiz_band)
return;
if (field_pic) {
h <<= 1;
y <<= 1;
@ -67,11 +72,6 @@ void ff_draw_horiz_band(AVCodecContext *avctx,
!(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD))
return;
if (avctx->draw_horiz_band) {
const AVFrame *src;
int offset[AV_NUM_DATA_POINTERS];
int i;
if (cur->pict_type == AV_PICTURE_TYPE_B || low_delay ||
(avctx->slice_flags & SLICE_FLAG_CODED_ORDER))
src = cur;
@ -86,6 +86,9 @@ void ff_draw_horiz_band(AVCodecContext *avctx,
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
offset[i] = 0;
} else {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int vshift = desc->log2_chroma_h;
offset[0]= y * src->linesize[0];
offset[1]=
offset[2]= (y >> vshift) * src->linesize[1];
@ -97,7 +100,6 @@ void ff_draw_horiz_band(AVCodecContext *avctx,
avctx->draw_horiz_band(avctx, src, offset,
y, picture_structure, h);
}
}
static char get_type_mv_char(int mb_type)