ci: Add patch for updated AMF
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
From a440dce6b5c8b90e80660641d632c60a4cc1c1bd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Mon, 10 Jan 2022 03:08:48 +0100
|
||||
Subject: [PATCH 1/5] avcodec: Require AMF SDK v1.4.23 or newer
|
||||
|
||||
Increasing the minimum AMF SDK version allows us to support
|
||||
more recent hardware and drivers, which is necessary to fix
|
||||
some of the discrepancies between older and newer drivers on
|
||||
AMD hardware with FFmpeg.
|
||||
---
|
||||
configure | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 1413122d87..515ec1a50f 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -6969,7 +6969,7 @@ fi
|
||||
|
||||
enabled amf &&
|
||||
check_cpp_condition amf "AMF/core/Version.h" \
|
||||
- "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
|
||||
+ "AMF_FULL_VERSION >= AMF_MAKE_FULL_VERSION(1, 4, 23, 0)"
|
||||
|
||||
# Funny iconv installations are not unusual, so check it after all flags have been set
|
||||
if enabled libc_iconv; then
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
From d6a48f863ffe0ae2968aa487b571a1a68412522d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d6a48f863ffe0ae2968aa487b571a1a68412522d.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:15:59 +0100
|
||||
Subject: [PATCH 2/5] avcodec/amfenc: Set all color metadata for AMF
|
||||
|
||||
Fixes the color information in the output from the AMD encoder
|
||||
being wrong, which led to weird transcoding results. This
|
||||
problem appeared out of thin air, and I've been unable to tie
|
||||
it to a specific driver that supports my hardware. Unfortunately
|
||||
this requires AMF SDK version 1.4.23 or later, but it should
|
||||
still work fine on older drivers.
|
||||
|
||||
Theoretical support for HDR encoding is also now possible,
|
||||
although the implementation is not complete. I have no clear
|
||||
idea on how to generate AMFs HDR metadata structure, or where
|
||||
to even take this information from.
|
||||
---
|
||||
libavcodec/amfenc.h | 1 +
|
||||
libavcodec/amfenc_h264.c | 48 +++++++++++++++++++++++++++++++++++++-
|
||||
libavcodec/amfenc_hevc.c | 50 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 98 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 358b2ef778..951e529362 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <AMF/core/Factory.h>
|
||||
|
||||
+#include <AMF/components/ColorSpace.h>
|
||||
#include <AMF/components/VideoEncoderVCE.h>
|
||||
#include <AMF/components/VideoEncoderHEVC.h>
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index aeca99f7c6..009378e9f1 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -137,6 +137,8 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -194,10 +196,54 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
- /// Color Range (Partial/TV/MPEG or Full/PC/JPEG)
|
||||
+ // Color Metadata
|
||||
+ /// Color Range (Support for older Drivers)
|
||||
if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 1);
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 0);
|
||||
+ }
|
||||
+ /// Color Space & Depth
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ // !FIXME: Verify that this is correct on Hardware supporting it.
|
||||
+ // !FIXME: Figure out how to decide on bit depth.
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+ break;
|
||||
}
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ /// Color Transfer Characteristics (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ /// Color Primaries (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ /// !TODO: AMF HDR Metadata generation
|
||||
|
||||
// autodetect rate control method
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN) {
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 79541b9b2f..900e1482b4 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -104,6 +104,8 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -152,6 +154,54 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMFRatio ratio = AMFConstructRatio(avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO, ratio);
|
||||
}
|
||||
+
|
||||
+ // Color Metadata
|
||||
+ /// Color Range (Support for older Drivers)
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 1);
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 0);
|
||||
+ }
|
||||
+ /// Color Space & Depth
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ // !FIXME: Verify that this is correct on Hardware supporting it.
|
||||
+ // !FIXME: Figure out how to decide on bit depth.
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ /// Color Transfer Characteristics (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ /// Color Primaries (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
|
||||
// Picture control properties
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From d622fed60be525e5ff814f1eb703c67d3be0ed0e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d622fed60be525e5ff814f1eb703c67d3be0ed0e.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:22:16 +0100
|
||||
Subject: [PATCH 3/5] avcodec/amfenc: Add the new usage presets
|
||||
|
||||
These enable some new features that otherwise require another
|
||||
AMF component to be loaded. Requires AMF SDK 1.4.23 or newer.
|
||||
---
|
||||
libavcodec/amfenc_h264.c | 12 +++++++-----
|
||||
libavcodec/amfenc_hevc.c | 6 ++++--
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 009378e9f1..afac97a968 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -28,11 +28,13 @@
|
||||
static const AVOption options[] = {
|
||||
// Static
|
||||
/// Usage
|
||||
- { "usage", "Encoder Usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING }, AMF_VIDEO_ENCODER_USAGE_TRANSCONDING, AMF_VIDEO_ENCODER_USAGE_WEBCAM, VE, "usage" },
|
||||
- { "transcoding", "Generic Transcoding", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING }, 0, 0, VE, "usage" },
|
||||
- { "ultralowlatency","", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
- { "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
- { "webcam", "Webcam", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "usage", "Encoder Usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCODING }, AMF_VIDEO_ENCODER_USAGE_TRANSCODING, AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY, VE, "usage" },
|
||||
+ { "transcoding", "Generic Transcoding", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCODING }, 0, 0, VE, "usage" },
|
||||
+ { "ultralowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
+ { "webcam", "Webcam", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "highquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
/// Profile,
|
||||
{ "profile", "Profile", OFFSET(profile),AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 900e1482b4..b7fee950f6 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -24,11 +24,13 @@
|
||||
#define OFFSET(x) offsetof(AmfContext, x)
|
||||
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
|
||||
static const AVOption options[] = {
|
||||
- { "usage", "Set the encoding usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING }, AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING, AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM, VE, "usage" },
|
||||
- { "transcoding", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING }, 0, 0, VE, "usage" },
|
||||
+ { "usage", "Set the encoding usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING }, AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING, AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY, VE, "usage" },
|
||||
+ { "transcoding", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING }, 0, 0, VE, "usage" },
|
||||
{ "ultralowlatency","", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
{ "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
{ "webcam", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "highquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
{ "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, VE, "profile" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 9cbaf2a700356682713bd01b2a6df3bc8d85c228 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9cbaf2a700356682713bd01b2a6df3bc8d85c228.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:23:37 +0100
|
||||
Subject: [PATCH 4/5] avcodec/amfenc: Add "High Motion Quality Boost" option
|
||||
|
||||
This option was missing from amfenc, and is now available.
|
||||
---
|
||||
libavcodec/amfenc.h | 3 +++
|
||||
libavcodec/amfenc_h264.c | 2 ++
|
||||
libavcodec/amfenc_hevc.c | 3 ++-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 951e529362..f47e6a1200 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -108,6 +108,9 @@ typedef struct AmfContext {
|
||||
int me_quarter_pel;
|
||||
int aud;
|
||||
|
||||
+ // Unclear options, have different behavior based on codec.
|
||||
+ int hmqb;
|
||||
+
|
||||
// HEVC - specific options
|
||||
|
||||
int gops_per_idr;
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index afac97a968..87a3bb6a73 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -86,6 +86,7 @@ static const AVOption options[] = {
|
||||
{ "filler_data", "Filler Data Enable", OFFSET(filler_data), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "vbaq", "Enable VBAQ", OFFSET(enable_vbaq), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "frame_skipping", "Rate Control Based Frame Skip", OFFSET(skip_frame), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
+ { "hmqb", "High Motion Quality Boost", OFFSET(hmqb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
|
||||
/// QP Values
|
||||
{ "qp_i", "Quantization Parameter for I-Frame", OFFSET(qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||
@@ -331,6 +332,7 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
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);
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_RATE_CONTROL_SKIP_FRAME_ENABLE, !!ctx->skip_frame);
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE, !!ctx->hmqb);
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_VBAQ, 0);
|
||||
if (ctx->enable_vbaq)
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index b7fee950f6..565be9bad9 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -74,6 +74,7 @@ static const AVOption options[] = {
|
||||
{ "gops_per_idr", "GOPs per IDR 0-no IDR will be inserted", OFFSET(gops_per_idr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, VE },
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "vbaq", "Enable VBAQ", OFFSET(enable_vbaq), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
+ { "hmqb", "High Motion Quality Boost", OFFSET(hmqb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "enforce_hrd", "Enforce HRD", OFFSET(enforce_hrd), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "filler_data", "Filler Data Enable", OFFSET(filler_data), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "max_au_size", "Maximum Access Unit Size for rate control (in bits)", OFFSET(max_au_size), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, VE},
|
||||
@@ -231,7 +232,6 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD, ctx->rate_control_mode);
|
||||
if (avctx->rc_buffer_size) {
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE, avctx->rc_buffer_size);
|
||||
@@ -253,6 +253,7 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
} else {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ, !!ctx->enable_vbaq);
|
||||
}
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_HIGH_MOTION_QUALITY_BOOST_ENABLE, !!ctx->hmqb);
|
||||
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);
|
||||
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From ebf6229908e96c3f8d6144b19fc42f5346e3b628 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ebf6229908e96c3f8d6144b19fc42f5346e3b628.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:24:11 +0100
|
||||
Subject: [PATCH 5/5] avcodec/amfenc: Add missing profiles
|
||||
|
||||
Adds the missing profiles to the '-help encoder=xxx_amf' list,
|
||||
even if the user may never need these.
|
||||
---
|
||||
libavcodec/amfenc_h264.c | 11 ++++++-----
|
||||
libavcodec/amfenc_hevc.c | 1 +
|
||||
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 87a3bb6a73..ae21c60357 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -37,11 +37,12 @@ static const AVOption options[] = {
|
||||
{ "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
/// Profile,
|
||||
- { "profile", "Profile", OFFSET(profile),AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
- { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
- { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_HIGH }, 0, 0, VE, "profile" },
|
||||
- { "constrained_baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE }, 0, 0, VE, "profile" },
|
||||
- { "constrained_high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH }, 0, 0, VE, "profile" },
|
||||
+ { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
+ { "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_BASELINE }, 0, 0, VE, "profile" },
|
||||
+ { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
+ { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_HIGH }, 0, 0, VE, "profile" },
|
||||
+ { "constrained_baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE }, 0, 0, VE, "profile" },
|
||||
+ { "constrained_high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH }, 0, 0, VE, "profile" },
|
||||
|
||||
/// Profile Level
|
||||
{ "level", "Profile Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 62, VE, "level" },
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 565be9bad9..a69f37e7b1 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -34,6 +34,7 @@ static const AVOption options[] = {
|
||||
|
||||
{ "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, VE, "profile" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
+ { "main10", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, "profile" },
|
||||
|
||||
{ "profile_tier", "Set the profile tier (default main)", OFFSET(tier), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, AMF_VIDEO_ENCODER_HEVC_TIER_MAIN, AMF_VIDEO_ENCODER_HEVC_TIER_HIGH, VE, "tier" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, 0, 0, VE, "tier" },
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From a440dce6b5c8b90e80660641d632c60a4cc1c1bd Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Mon, 10 Jan 2022 03:08:48 +0100
|
||||
Subject: [PATCH 1/5] avcodec: Require AMF SDK v1.4.23 or newer
|
||||
|
||||
Increasing the minimum AMF SDK version allows us to support
|
||||
more recent hardware and drivers, which is necessary to fix
|
||||
some of the discrepancies between older and newer drivers on
|
||||
AMD hardware with FFmpeg.
|
||||
---
|
||||
configure | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 1413122d87..515ec1a50f 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -6969,7 +6969,7 @@ fi
|
||||
|
||||
enabled amf &&
|
||||
check_cpp_condition amf "AMF/core/Version.h" \
|
||||
- "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400090000"
|
||||
+ "AMF_FULL_VERSION >= AMF_MAKE_FULL_VERSION(1, 4, 23, 0)"
|
||||
|
||||
# Funny iconv installations are not unusual, so check it after all flags have been set
|
||||
if enabled libc_iconv; then
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
From d6a48f863ffe0ae2968aa487b571a1a68412522d Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d6a48f863ffe0ae2968aa487b571a1a68412522d.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:15:59 +0100
|
||||
Subject: [PATCH 2/5] avcodec/amfenc: Set all color metadata for AMF
|
||||
|
||||
Fixes the color information in the output from the AMD encoder
|
||||
being wrong, which led to weird transcoding results. This
|
||||
problem appeared out of thin air, and I've been unable to tie
|
||||
it to a specific driver that supports my hardware. Unfortunately
|
||||
this requires AMF SDK version 1.4.23 or later, but it should
|
||||
still work fine on older drivers.
|
||||
|
||||
Theoretical support for HDR encoding is also now possible,
|
||||
although the implementation is not complete. I have no clear
|
||||
idea on how to generate AMFs HDR metadata structure, or where
|
||||
to even take this information from.
|
||||
---
|
||||
libavcodec/amfenc.h | 1 +
|
||||
libavcodec/amfenc_h264.c | 48 +++++++++++++++++++++++++++++++++++++-
|
||||
libavcodec/amfenc_hevc.c | 50 ++++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 98 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 358b2ef778..951e529362 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <AMF/core/Factory.h>
|
||||
|
||||
+#include <AMF/components/ColorSpace.h>
|
||||
#include <AMF/components/VideoEncoderVCE.h>
|
||||
#include <AMF/components/VideoEncoderHEVC.h>
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index aeca99f7c6..009378e9f1 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -137,6 +137,8 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -194,10 +196,54 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_ASPECT_RATIO, ratio);
|
||||
}
|
||||
|
||||
- /// Color Range (Partial/TV/MPEG or Full/PC/JPEG)
|
||||
+ // Color Metadata
|
||||
+ /// Color Range (Support for older Drivers)
|
||||
if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 1);
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_FULL_RANGE_COLOR, 0);
|
||||
+ }
|
||||
+ /// Color Space & Depth
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ // !FIXME: Verify that this is correct on Hardware supporting it.
|
||||
+ // !FIXME: Figure out how to decide on bit depth.
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+ break;
|
||||
}
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ /// Color Transfer Characteristics (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ /// Color Primaries (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_INPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ /// !TODO: AMF HDR Metadata generation
|
||||
|
||||
// autodetect rate control method
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN) {
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 79541b9b2f..900e1482b4 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -104,6 +104,8 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMFRate framerate;
|
||||
AMFSize framesize = AMFConstructSize(avctx->width, avctx->height);
|
||||
int deblocking_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0;
|
||||
+ amf_int64 color_depth;
|
||||
+ amf_int64 color_profile;
|
||||
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
@@ -152,6 +154,54 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
AMFRatio ratio = AMFConstructRatio(avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
|
||||
AMF_ASSIGN_PROPERTY_RATIO(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO, ratio);
|
||||
}
|
||||
+
|
||||
+ // Color Metadata
|
||||
+ /// Color Range (Support for older Drivers)
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 1);
|
||||
+ } else {
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE, 0);
|
||||
+ }
|
||||
+ /// Color Space & Depth
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_8;
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
|
||||
+ switch (avctx->colorspace) {
|
||||
+ case AVCOL_SPC_SMPTE170M:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_601;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT709:
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709;
|
||||
+ }
|
||||
+ break;
|
||||
+ case AVCOL_SPC_BT2020_NCL:
|
||||
+ case AVCOL_SPC_BT2020_CL:
|
||||
+ // !FIXME: Verify that this is correct on Hardware supporting it.
|
||||
+ // !FIXME: Figure out how to decide on bit depth.
|
||||
+ if (avctx->color_range == AVCOL_RANGE_JPEG) {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ } else {
|
||||
+ color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020;
|
||||
+ color_depth = AMF_COLOR_BIT_DEPTH_10;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH, color_depth);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PROFILE, color_profile);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE, color_profile);
|
||||
+ /// Color Transfer Characteristics (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC, (amf_int64)avctx->color_trc);
|
||||
+ /// Color Primaries (AMF matches ISO/IEC)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES, (amf_int64)avctx->color_primaries);
|
||||
|
||||
// Picture control properties
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From d622fed60be525e5ff814f1eb703c67d3be0ed0e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d622fed60be525e5ff814f1eb703c67d3be0ed0e.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:22:16 +0100
|
||||
Subject: [PATCH 3/5] avcodec/amfenc: Add the new usage presets
|
||||
|
||||
These enable some new features that otherwise require another
|
||||
AMF component to be loaded. Requires AMF SDK 1.4.23 or newer.
|
||||
---
|
||||
libavcodec/amfenc_h264.c | 12 +++++++-----
|
||||
libavcodec/amfenc_hevc.c | 6 ++++--
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 009378e9f1..afac97a968 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -28,11 +28,13 @@
|
||||
static const AVOption options[] = {
|
||||
// Static
|
||||
/// Usage
|
||||
- { "usage", "Encoder Usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING }, AMF_VIDEO_ENCODER_USAGE_TRANSCONDING, AMF_VIDEO_ENCODER_USAGE_WEBCAM, VE, "usage" },
|
||||
- { "transcoding", "Generic Transcoding", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING }, 0, 0, VE, "usage" },
|
||||
- { "ultralowlatency","", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
- { "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
- { "webcam", "Webcam", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "usage", "Encoder Usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCODING }, AMF_VIDEO_ENCODER_USAGE_TRANSCODING, AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY, VE, "usage" },
|
||||
+ { "transcoding", "Generic Transcoding", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_TRANSCODING }, 0, 0, VE, "usage" },
|
||||
+ { "ultralowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
+ { "webcam", "Webcam", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "highquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
/// Profile,
|
||||
{ "profile", "Profile", OFFSET(profile),AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 900e1482b4..b7fee950f6 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -24,11 +24,13 @@
|
||||
#define OFFSET(x) offsetof(AmfContext, x)
|
||||
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
|
||||
static const AVOption options[] = {
|
||||
- { "usage", "Set the encoding usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING }, AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING, AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM, VE, "usage" },
|
||||
- { "transcoding", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING }, 0, 0, VE, "usage" },
|
||||
+ { "usage", "Set the encoding usage", OFFSET(usage), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING }, AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING, AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY, VE, "usage" },
|
||||
+ { "transcoding", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING }, 0, 0, VE, "usage" },
|
||||
{ "ultralowlatency","", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
{ "lowlatency", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY }, 0, 0, VE, "usage" },
|
||||
{ "webcam", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM }, 0, 0, VE, "usage" },
|
||||
+ { "highquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
+ { "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
{ "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, VE, "profile" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 9cbaf2a700356682713bd01b2a6df3bc8d85c228 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9cbaf2a700356682713bd01b2a6df3bc8d85c228.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:23:37 +0100
|
||||
Subject: [PATCH 4/5] avcodec/amfenc: Add "High Motion Quality Boost" option
|
||||
|
||||
This option was missing from amfenc, and is now available.
|
||||
---
|
||||
libavcodec/amfenc.h | 3 +++
|
||||
libavcodec/amfenc_h264.c | 2 ++
|
||||
libavcodec/amfenc_hevc.c | 3 ++-
|
||||
3 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 951e529362..f47e6a1200 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -108,6 +108,9 @@ typedef struct AmfContext {
|
||||
int me_quarter_pel;
|
||||
int aud;
|
||||
|
||||
+ // Unclear options, have different behavior based on codec.
|
||||
+ int hmqb;
|
||||
+
|
||||
// HEVC - specific options
|
||||
|
||||
int gops_per_idr;
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index afac97a968..87a3bb6a73 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -86,6 +86,7 @@ static const AVOption options[] = {
|
||||
{ "filler_data", "Filler Data Enable", OFFSET(filler_data), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "vbaq", "Enable VBAQ", OFFSET(enable_vbaq), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "frame_skipping", "Rate Control Based Frame Skip", OFFSET(skip_frame), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
+ { "hmqb", "High Motion Quality Boost", OFFSET(hmqb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
|
||||
/// QP Values
|
||||
{ "qp_i", "Quantization Parameter for I-Frame", OFFSET(qp_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 51, VE },
|
||||
@@ -331,6 +332,7 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
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);
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_RATE_CONTROL_SKIP_FRAME_ENABLE, !!ctx->skip_frame);
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE, !!ctx->hmqb);
|
||||
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP) {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_VBAQ, 0);
|
||||
if (ctx->enable_vbaq)
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index b7fee950f6..565be9bad9 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -74,6 +74,7 @@ static const AVOption options[] = {
|
||||
{ "gops_per_idr", "GOPs per IDR 0-no IDR will be inserted", OFFSET(gops_per_idr), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, INT_MAX, VE },
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "vbaq", "Enable VBAQ", OFFSET(enable_vbaq), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
+ { "hmqb", "High Motion Quality Boost", OFFSET(hmqb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "enforce_hrd", "Enforce HRD", OFFSET(enforce_hrd), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "filler_data", "Filler Data Enable", OFFSET(filler_data), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE},
|
||||
{ "max_au_size", "Maximum Access Unit Size for rate control (in bits)", OFFSET(max_au_size), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, VE},
|
||||
@@ -231,7 +232,6 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD, ctx->rate_control_mode);
|
||||
if (avctx->rc_buffer_size) {
|
||||
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE, avctx->rc_buffer_size);
|
||||
@@ -253,6 +253,7 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
} else {
|
||||
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ, !!ctx->enable_vbaq);
|
||||
}
|
||||
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_HIGH_MOTION_QUALITY_BOOST_ENABLE, !!ctx->hmqb);
|
||||
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);
|
||||
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
From ebf6229908e96c3f8d6144b19fc42f5346e3b628 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <ebf6229908e96c3f8d6144b19fc42f5346e3b628.1642029358.git.info@xaymar.com>
|
||||
In-Reply-To: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
References: <a440dce6b5c8b90e80660641d632c60a4cc1c1bd.1642029358.git.info@xaymar.com>
|
||||
From: Michael Fabian 'Xaymar' Dirks <michael.dirks@xaymar.com>
|
||||
Date: Tue, 11 Jan 2022 08:24:11 +0100
|
||||
Subject: [PATCH 5/5] avcodec/amfenc: Add missing profiles
|
||||
|
||||
Adds the missing profiles to the '-help encoder=xxx_amf' list,
|
||||
even if the user may never need these.
|
||||
---
|
||||
libavcodec/amfenc_h264.c | 11 ++++++-----
|
||||
libavcodec/amfenc_hevc.c | 1 +
|
||||
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 87a3bb6a73..ae21c60357 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -37,11 +37,12 @@ static const AVOption options[] = {
|
||||
{ "lowlatency_highqquality", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY }, 0, 0, VE, "usage" },
|
||||
|
||||
/// Profile,
|
||||
- { "profile", "Profile", OFFSET(profile),AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
- { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
- { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_HIGH }, 0, 0, VE, "profile" },
|
||||
- { "constrained_baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE }, 0, 0, VE, "profile" },
|
||||
- { "constrained_high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH }, 0, 0, VE, "profile" },
|
||||
+ { "profile", "Profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, AMF_VIDEO_ENCODER_PROFILE_BASELINE, AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH, VE, "profile" },
|
||||
+ { "baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_BASELINE }, 0, 0, VE, "profile" },
|
||||
+ { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
+ { "high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_HIGH }, 0, 0, VE, "profile" },
|
||||
+ { "constrained_baseline", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE }, 0, 0, VE, "profile" },
|
||||
+ { "constrained_high", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH }, 0, 0, VE, "profile" },
|
||||
|
||||
/// Profile Level
|
||||
{ "level", "Profile Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 62, VE, "level" },
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 565be9bad9..a69f37e7b1 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -34,6 +34,7 @@ static const AVOption options[] = {
|
||||
|
||||
{ "profile", "Set the profile (default main)", OFFSET(profile), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN, VE, "profile" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" },
|
||||
+ { "main10", "", 0, AV_OPT_TYPE_CONST,{ .i64 = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, "profile" },
|
||||
|
||||
{ "profile_tier", "Set the profile tier (default main)", OFFSET(tier), AV_OPT_TYPE_INT,{ .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, AMF_VIDEO_ENCODER_HEVC_TIER_MAIN, AMF_VIDEO_ENCODER_HEVC_TIER_HIGH, VE, "tier" },
|
||||
{ "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN }, 0, 0, VE, "tier" },
|
||||
--
|
||||
2.34.1.windows.1
|
||||
|
||||
Reference in New Issue
Block a user