avcodec/h264_redundant_pps_bsf: Inline constant

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-11-30 19:19:06 +01:00
parent 5892a55d55
commit b574fb472e
1 changed files with 3 additions and 8 deletions

View File

@ -27,11 +27,10 @@
#include "cbs_h264.h" #include "cbs_h264.h"
#include "h264.h" #include "h264.h"
#define NEW_GLOBAL_PIC_INIT_QP 26
typedef struct H264RedundantPPSContext { typedef struct H264RedundantPPSContext {
CBSBSFContext common; CBSBSFContext common;
int global_pic_init_qp;
} H264RedundantPPSContext; } H264RedundantPPSContext;
@ -50,7 +49,7 @@ static int h264_redundant_pps_fixup_pps(H264RedundantPPSContext *ctx,
pps = unit->content; pps = unit->content;
// Overwrite pic_init_qp with the global value. // Overwrite pic_init_qp with the global value.
pps->pic_init_qp_minus26 = ctx->global_pic_init_qp - 26; pps->pic_init_qp_minus26 = NEW_GLOBAL_PIC_INIT_QP - 26;
// Some PPSs have this set, so it must be set in all of them. // Some PPSs have this set, so it must be set in all of them.
// (Slices which do not use such a PPS on input will still have // (Slices which do not use such a PPS on input will still have
@ -69,7 +68,7 @@ static int h264_redundant_pps_fixup_slice(H264RedundantPPSContext *ctx,
// We modified the PPS's qp value, now offset this by applying // We modified the PPS's qp value, now offset this by applying
// the negative offset to the slices. // the negative offset to the slices.
slice->slice_qp_delta += pps->pic_init_qp_minus26 slice->slice_qp_delta += pps->pic_init_qp_minus26
- (ctx->global_pic_init_qp - 26); - (NEW_GLOBAL_PIC_INIT_QP - 26);
return 0; return 0;
} }
@ -119,10 +118,6 @@ static const CBSBSFType h264_redundant_pps_type = {
static int h264_redundant_pps_init(AVBSFContext *bsf) static int h264_redundant_pps_init(AVBSFContext *bsf)
{ {
H264RedundantPPSContext *ctx = bsf->priv_data;
ctx->global_pic_init_qp = 26;
return ff_cbs_bsf_generic_init(bsf, &h264_redundant_pps_type); return ff_cbs_bsf_generic_init(bsf, &h264_redundant_pps_type);
} }