diff mbox series

[FFmpeg-devel,1/2] avcodec/libx265: only call av_pix_fmt_desc_get once in init

Message ID 20210829164323.62565-1-jeebjp@gmail.com
State Accepted
Commit 06ce821bc7622c1394c5179fb69cabf02dd24869
Headers show
Series [FFmpeg-devel,1/2] avcodec/libx265: only call av_pix_fmt_desc_get once in init | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Jan Ekström Aug. 29, 2021, 4:43 p.m. UTC
Now both current usages utilize an already found descriptor.
---
 libavcodec/libx265.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Paul B Mahol Aug. 29, 2021, 5:12 p.m. UTC | #1
LGTM
Jan Ekström Aug. 29, 2021, 6:14 p.m. UTC | #2
On Sun, Aug 29, 2021 at 8:12 PM Paul B Mahol <onemda@gmail.com> wrote:
>
> LGTM

Thanks, applied this patch as 06ce821bc7622c1394c5179fb69cabf02dd24869 .

Now it's just the chroma location coding bits.

Jan
diff mbox series

Patch

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;