diff mbox series

[FFmpeg-devel,18/35] lavc/libvpxenc: remove unneeded context variable

Message ID 20220111204610.14262-18-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/35] lavu/fifo: disallow overly large fifo sizes | expand

Checks

Context Check Description
andriy/configurex86 warning Failed to apply patch
andriy/configureppc warning Failed to apply patch
andriy/configureaarch64_jetson warning Failed to apply patch

Commit Message

Anton Khirnov Jan. 11, 2022, 8:45 p.m. UTC
discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test
for the latter and avoid an extra variable.
---
 libavcodec/libvpxenc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

James Zern Jan. 12, 2022, 6:15 p.m. UTC | #1
On Tue, Jan 11, 2022 at 12:49 PM Anton Khirnov <anton@khirnov.net> wrote:
>
> discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test
> for the latter and avoid an extra variable.
> ---
>  libavcodec/libvpxenc.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>

lgtm.
diff mbox series

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 55f587c490..6bb19289ff 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -127,7 +127,6 @@  typedef struct VPxEncoderContext {
     int tune_content;
     int corpus_complexity;
     int tpl_model;
-    int discard_hdr10_plus;
     AVFifoBuffer *hdr10_plus_fifo;
     /**
      * If the driver does not support ROI then warn the first time we
@@ -899,7 +898,6 @@  static av_cold int vpx_init(AVCodecContext *avctx,
 #endif
     AVDictionaryEntry* en = NULL;
 
-    ctx->discard_hdr10_plus = 1;
     av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
     av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
 
@@ -919,7 +917,6 @@  static av_cold int vpx_init(AVCodecContext *avctx,
         // Keep HDR10+ if it has bit depth higher than 8 and
         // it has PQ trc (SMPTE2084).
         if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) {
-            ctx->discard_hdr10_plus = 0;
             ctx->hdr10_plus_fifo = av_fifo_alloc2(1, sizeof(FrameHDR10Plus),
                                                   AV_FIFO_FLAG_AUTO_GROW);
             if (!ctx->hdr10_plus_fifo)
@@ -1289,7 +1286,7 @@  static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
     }
     if (cx_frame->frame_number != -1) {
         VPxContext *ctx = avctx->priv_data;
-        if (!ctx->discard_hdr10_plus) {
+        if (ctx->hdr10_plus_fifo) {
             int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
             if (err < 0)
                 return err;
@@ -1704,7 +1701,7 @@  static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
             }
         }
 
-        if (!ctx->discard_hdr10_plus) {
+        if (ctx->hdr10_plus_fifo) {
             AVFrameSideData *hdr10_plus_metadata;
             // Add HDR10+ metadata to queue.
             hdr10_plus_metadata = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);