diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-22 03:39:16 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-04 16:28:54 +0100 |
commit | 3867b18120e11174b3d775699ce74339b0b1bc4c (patch) | |
tree | fe9f70c6fc7b24ce4ac8abe27cee2ca803db44e3 | |
parent | 8a0981d0131e648c84e9996bd024d5cdbd791599 (diff) | |
download | ffmpeg-3867b18120e11174b3d775699ce74339b0b1bc4c.tar.gz |
avcodec/mjpegenc_common: Don't call function unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mjpegenc_common.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/mjpegenc_common.c b/libavcodec/mjpegenc_common.c index d75ae6b6a7..27438df5eb 100644 --- a/libavcodec/mjpegenc_common.c +++ b/libavcodec/mjpegenc_common.c @@ -188,10 +188,6 @@ static void jpeg_put_comments(AVCodecContext *avctx, PutBitContext *p) void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4]) { - int chroma_h_shift, chroma_v_shift; - - av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, - &chroma_v_shift); if (avctx->codec->id == AV_CODEC_ID_LJPEG && ( avctx->pix_fmt == AV_PIX_FMT_BGR0 || avctx->pix_fmt == AV_PIX_FMT_BGRA @@ -204,6 +200,9 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[4], int vsample[4 vsample[0] = vsample[1] = vsample[2] = 2; hsample[0] = hsample[1] = hsample[2] = 1; } else { + int chroma_h_shift, chroma_v_shift; + av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, + &chroma_v_shift); vsample[0] = 2; vsample[1] = 2 >> chroma_v_shift; vsample[2] = 2 >> chroma_v_shift; |