summaryrefslogtreecommitdiff
path: root/libavcodec/amfenc_h264.c
diff options
context:
space:
mode:
authorMironov, Mikhail <Mikhail.Mironov@amd.com>2017-12-08 19:23:38 +0000
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-09 23:12:30 +0100
commitf20c8f6ec9ec982d15a8acc0a38103919780b48a (patch)
tree60699c630c00299d4dc43bb01bc56d5560d5ef65 /libavcodec/amfenc_h264.c
parent6bf5d69b2ffa8de1b6548eec6ba761118175b216 (diff)
amf: fix wrong profile level after auto-correction in H264 and HEVC
Moved bitrate parameters set before Init() call because bitrate is used in profile level correction code inside Init(). Signed-off-by: Mikhail Mironov <mikhail.mironov@amd.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/amfenc_h264.c')
-rw-r--r--libavcodec/amfenc_h264.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 3cacf320e3..96e4e952da 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -213,7 +213,6 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
}
}
-
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP) {
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_RATE_CONTROL_PREANALYSIS_ENABLE, AMF_VIDEO_ENCODER_PREENCODE_DISABLED);
if (ctx->preanalysis)
@@ -224,10 +223,6 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUALITY_PRESET, ctx->quality);
- // Initialize Encoder
- res = ctx->encoder->pVtbl->Init(ctx->encoder, ctx->format, avctx->width, avctx->height);
- AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_BUG, "encoder->Init() failed with error %d\n", res);
-
// Dynamic parmaters
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD, ctx->rate_control_mode);
@@ -279,6 +274,11 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
} else if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR) {
av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n");
}
+
+ // Initialize Encoder
+ res = ctx->encoder->pVtbl->Init(ctx->encoder, ctx->format, avctx->width, avctx->height);
+ AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_BUG, "encoder->Init() failed with error %d\n", res);
+
// Enforce HRD, Filler Data, VBAQ, Frame Skipping, Deblocking Filter
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENFORCE_HRD, !!ctx->enforce_hrd);
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FILLER_DATA_ENABLE, !!ctx->filler_data);