[FFmpeg-cvslog] avcodec/mpegutils: Return early in ff_draw_horiz_band()
Andreas Rheinhardt
git at videolan.org
Thu Oct 20 08:04:49 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Oct 16 22:15:05 2022 +0200| [678f1b1cf4e637be9393b717d057125b93bbabf4] | committer: Andreas Rheinhardt
avcodec/mpegutils: Return early in ff_draw_horiz_band()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=678f1b1cf4e637be9393b717d057125b93bbabf4
---
libavcodec/mpegutils.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index ff9418232b..afbb16e201 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -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)
More information about the ffmpeg-cvslog
mailing list