summaryrefslogtreecommitdiff
path: root/libavcodec/libx265.c
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2021-08-29 19:06:14 +0300
committerJan Ekström <jeebjp@gmail.com>2021-08-29 21:09:21 +0300
commit06ce821bc7622c1394c5179fb69cabf02dd24869 (patch)
tree1348313a532c5bde9055d9e3654ce0fe4a85f179 /libavcodec/libx265.c
parent133b2767cf5a7cc3cd09ba9b58de62d981c0f453 (diff)
avcodec/libx265: only call av_pix_fmt_desc_get once in init
Now both current usages utilize an already found descriptor.
Diffstat (limited to 'libavcodec/libx265.c')
-rw-r--r--libavcodec/libx265.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index b5c94b64a3..71affbf61b 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -124,9 +124,10 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
{
libx265Context *ctx = avctx->priv_data;
AVCPBProperties *cpb_props = NULL;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
int ret;
- ctx->api = x265_api_get(av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth);
+ ctx->api = x265_api_get(desc->comp[0].depth);
if (!ctx->api)
ctx->api = x265_api_get(0);
@@ -186,7 +187,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
avctx->color_range == AVCOL_RANGE_JPEG;
else
ctx->params->vui.bEnableVideoFullRangeFlag =
- (av_pix_fmt_desc_get(avctx->pix_fmt)->flags & AV_PIX_FMT_FLAG_RGB) ||
+ (desc->flags & AV_PIX_FMT_FLAG_RGB) ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ444P;