summaryrefslogtreecommitdiff
path: root/libavcodec/amfenc_hevc.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_hevc.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_hevc.c')
-rw-r--r--libavcodec/amfenc_hevc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index ced57b1e9a..3956b2d178 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -204,10 +204,6 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL, ctx->me_half_pel);
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL, ctx->me_quarter_pel);
- // init 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);
-
// init dynamic rate control params
if (ctx->max_au_size)
ctx->enforce_hrd = 1;
@@ -225,6 +221,10 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n");
}
+ // init 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);
+
// init dynamic picture control params
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_MAX_AU_SIZE, ctx->max_au_size);