1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

lavc/libvpxenc: remove unneeded context variable

discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test
for the latter and avoid an extra variable.
This commit is contained in:
Anton Khirnov
2022-01-06 16:49:45 +01:00
committed by Andreas Rheinhardt
parent 4b066b53b2
commit 9ef4b6699b

View File

@@ -127,7 +127,6 @@ typedef struct VPxEncoderContext {
int tune_content; int tune_content;
int corpus_complexity; int corpus_complexity;
int tpl_model; int tpl_model;
int discard_hdr10_plus;
AVFifo *hdr10_plus_fifo; AVFifo *hdr10_plus_fifo;
/** /**
* If the driver does not support ROI then warn the first time we * If the driver does not support ROI then warn the first time we
@@ -896,7 +895,6 @@ static av_cold int vpx_init(AVCodecContext *avctx,
#endif #endif
AVDictionaryEntry* en = NULL; 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_INFO, "%s\n", vpx_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -916,7 +914,6 @@ static av_cold int vpx_init(AVCodecContext *avctx,
// Keep HDR10+ if it has bit depth higher than 8 and // Keep HDR10+ if it has bit depth higher than 8 and
// it has PQ trc (SMPTE2084). // it has PQ trc (SMPTE2084).
if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_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), ctx->hdr10_plus_fifo = av_fifo_alloc2(1, sizeof(FrameHDR10Plus),
AV_FIFO_FLAG_AUTO_GROW); AV_FIFO_FLAG_AUTO_GROW);
if (!ctx->hdr10_plus_fifo) if (!ctx->hdr10_plus_fifo)
@@ -1286,7 +1283,7 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
} }
if (cx_frame->frame_number != -1) { if (cx_frame->frame_number != -1) {
VPxContext *ctx = avctx->priv_data; 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); int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
if (err < 0) if (err < 0)
return err; return err;
@@ -1701,7 +1698,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
} }
} }
if (!ctx->discard_hdr10_plus) { if (ctx->hdr10_plus_fifo) {
AVFrameSideData *hdr10_plus_metadata; AVFrameSideData *hdr10_plus_metadata;
// Add HDR10+ metadata to queue. // Add HDR10+ metadata to queue.
hdr10_plus_metadata = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS); hdr10_plus_metadata = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);