Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] libavcodec/qsvenc_hevc: add tier option
@ 2022-11-01 17:57 nyanmisaka
  0 siblings, 0 replies; 3+ messages in thread
From: nyanmisaka @ 2022-11-01 17:57 UTC (permalink / raw)
  To: ffmpeg-devel

Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the -level is specified.
Also, according to the HEVC specs, only level >= 4 can support High Tier.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
---
 libavcodec/qsvenc.c      | 5 ++++-
 libavcodec/qsvenc.h      | 1 +
 libavcodec/qsvenc_hevc.c | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 15e6936a65..5250717f0b 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -614,8 +614,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         return AVERROR_BUG;
     q->param.mfx.CodecId = ret;
 
-    if (avctx->level > 0)
+    if (avctx->level > 0) {
         q->param.mfx.CodecLevel = avctx->level;
+        if (avctx->codec_id == AV_CODEC_ID_HEVC && avctx->level >= MFX_LEVEL_HEVC_4)
+            q->param.mfx.CodecLevel |= q->tier;
+    }
 
     if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
         avctx->compression_level = q->preset;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index d77bc0aee1..d64af90235 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -180,6 +180,7 @@ typedef struct QSVEncContext {
     int async_depth;
     int idr_interval;
     int profile;
+    int tier;
     int preset;
     int avbr_accuracy;
     int avbr_convergence;
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 2a3f34b915..845fb93e9d 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -258,6 +258,9 @@ static const AVOption options[] = {
 #if QSV_VERSION_ATLEAST(1, 32)
     { "scc",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_SCC     }, INT_MIN, INT_MAX,     VE, "profile" },
 #endif
+    { "tier",    "Set the encoding tier (only level >= 4 can support high tier)", OFFSET(qsv.tier), AV_OPT_TYPE_INT, { .i64 = MFX_TIER_HEVC_HIGH }, MFX_TIER_HEVC_MAIN, MFX_TIER_HEVC_HIGH, VE, "tier" },
+    { "main",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_MAIN       }, INT_MIN, INT_MAX,     VE, "tier" },
+    { "high",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_HIGH       }, INT_MIN, INT_MAX,     VE, "tier" },
 
     { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE},
 
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] libavcodec/qsvenc_hevc: add tier option
  2022-11-01 17:58 nyanmisaka
@ 2022-11-07  3:07 ` Xiang, Haihao
  0 siblings, 0 replies; 3+ messages in thread
From: Xiang, Haihao @ 2022-11-07  3:07 UTC (permalink / raw)
  To: ffmpeg-devel

On Wed, 2022-11-02 at 01:58 +0800, nyanmisaka wrote:
> Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the
> -level is specified.
> Also, according to the HEVC specs, only level >= 4 can support High Tier.
> 
> Signed-off-by: nyanmisaka <nst799610810@gmail.com>
> ---
>  libavcodec/qsvenc.c      | 5 ++++-
>  libavcodec/qsvenc.h      | 1 +
>  libavcodec/qsvenc_hevc.c | 3 +++
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index 15e6936a65..5250717f0b 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -614,8 +614,11 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          return AVERROR_BUG;
>      q->param.mfx.CodecId = ret;
>  
> -    if (avctx->level > 0)
> +    if (avctx->level > 0) {
>          q->param.mfx.CodecLevel = avctx->level;
> +        if (avctx->codec_id == AV_CODEC_ID_HEVC && avctx->level >=
> MFX_LEVEL_HEVC_4)
> +            q->param.mfx.CodecLevel |= q->tier;
> +    }
>  
>      if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
>          avctx->compression_level = q->preset;
> diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
> index d77bc0aee1..d64af90235 100644
> --- a/libavcodec/qsvenc.h
> +++ b/libavcodec/qsvenc.h
> @@ -180,6 +180,7 @@ typedef struct QSVEncContext {
>      int async_depth;
>      int idr_interval;
>      int profile;
> +    int tier;
>      int preset;
>      int avbr_accuracy;
>      int avbr_convergence;
> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
> index 2a3f34b915..845fb93e9d 100644
> --- a/libavcodec/qsvenc_hevc.c
> +++ b/libavcodec/qsvenc_hevc.c
> @@ -258,6 +258,9 @@ static const AVOption options[] = {
>  #if QSV_VERSION_ATLEAST(1, 32)
>      { "scc",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> MFX_PROFILE_HEVC_SCC     }, INT_MIN, INT_MAX,     VE, "profile" },
>  #endif
> +    { "tier",    "Set the encoding tier (only level >= 4 can support high
> tier)", OFFSET(qsv.tier), AV_OPT_TYPE_INT, { .i64 = MFX_TIER_HEVC_HIGH },
> MFX_TIER_HEVC_MAIN, MFX_TIER_HEVC_HIGH, VE, "tier" },
> +    { "main",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> MFX_TIER_HEVC_MAIN       }, INT_MIN, INT_MAX,     VE, "tier" },
> +    { "high",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 =
> MFX_TIER_HEVC_HIGH       }, INT_MIN, INT_MAX,     VE, "tier" },
>  
>      { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame",
> OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE},

Patchset applied, thx

-Haihao
 
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [FFmpeg-devel] [PATCH 1/2] libavcodec/qsvenc_hevc: add tier option
@ 2022-11-01 17:58 nyanmisaka
  2022-11-07  3:07 ` Xiang, Haihao
  0 siblings, 1 reply; 3+ messages in thread
From: nyanmisaka @ 2022-11-01 17:58 UTC (permalink / raw)
  To: ffmpeg-devel

Without this change, MSDK/VPL always defaults the HEVC tier to MAIN if the -level is specified.
Also, according to the HEVC specs, only level >= 4 can support High Tier.

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
---
 libavcodec/qsvenc.c      | 5 ++++-
 libavcodec/qsvenc.h      | 1 +
 libavcodec/qsvenc_hevc.c | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 15e6936a65..5250717f0b 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -614,8 +614,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         return AVERROR_BUG;
     q->param.mfx.CodecId = ret;
 
-    if (avctx->level > 0)
+    if (avctx->level > 0) {
         q->param.mfx.CodecLevel = avctx->level;
+        if (avctx->codec_id == AV_CODEC_ID_HEVC && avctx->level >= MFX_LEVEL_HEVC_4)
+            q->param.mfx.CodecLevel |= q->tier;
+    }
 
     if (avctx->compression_level == FF_COMPRESSION_DEFAULT) {
         avctx->compression_level = q->preset;
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
index d77bc0aee1..d64af90235 100644
--- a/libavcodec/qsvenc.h
+++ b/libavcodec/qsvenc.h
@@ -180,6 +180,7 @@ typedef struct QSVEncContext {
     int async_depth;
     int idr_interval;
     int profile;
+    int tier;
     int preset;
     int avbr_accuracy;
     int avbr_convergence;
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 2a3f34b915..845fb93e9d 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -258,6 +258,9 @@ static const AVOption options[] = {
 #if QSV_VERSION_ATLEAST(1, 32)
     { "scc",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_SCC     }, INT_MIN, INT_MAX,     VE, "profile" },
 #endif
+    { "tier",    "Set the encoding tier (only level >= 4 can support high tier)", OFFSET(qsv.tier), AV_OPT_TYPE_INT, { .i64 = MFX_TIER_HEVC_HIGH }, MFX_TIER_HEVC_MAIN, MFX_TIER_HEVC_HIGH, VE, "tier" },
+    { "main",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_MAIN       }, INT_MIN, INT_MAX,     VE, "tier" },
+    { "high",    NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_TIER_HEVC_HIGH       }, INT_MIN, INT_MAX,     VE, "tier" },
 
     { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE},
 
-- 
2.25.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-07  3:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 17:57 [FFmpeg-devel] [PATCH 1/2] libavcodec/qsvenc_hevc: add tier option nyanmisaka
2022-11-01 17:58 nyanmisaka
2022-11-07  3:07 ` Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git