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 v2] avcodec/amfenc: add smart access video option
@ 2023-11-23  9:41 Evgeny Pavlov
  2023-11-24  8:45 ` Dmitrii Ovchinnikov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Evgeny Pavlov @ 2023-11-23  9:41 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Evgeny Pavlov

This commit adds option for enabling SmartAccess Video (SAV)
in AMF encoders. SAV is an AMD hardware-specific feature which
enables the parallelization of encode and decode streams across
multiple Video Codec Engine (VCN) hardware instances.

Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
---
 libavcodec/amfenc.h      |  1 +
 libavcodec/amfenc_av1.c  | 18 ++++++++++++++++++
 libavcodec/amfenc_h264.c | 18 ++++++++++++++++++
 libavcodec/amfenc_hevc.c | 18 ++++++++++++++++++
 4 files changed, 55 insertions(+)

diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 2dbd378ef8..e8d66164ed 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -89,6 +89,7 @@ typedef struct AmfContext {
     int                 quality;
     int                 b_frame_delta_qp;
     int                 ref_b_frame_delta_qp;
+    int                 smart_access_video;
 
     // Dynamic options, can be set after Init() call
 
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 3f164ccc59..912d6bf020 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -104,6 +104,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{.i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video",     "Enable Smart Access Video",                OFFSET(smart_access_video),             AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -243,6 +245,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    if (ctx->smart_access_video != -1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+        if (res != AMF_OK) {
+            av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+            if (ctx->smart_access_video != 0)
+                return AVERROR(ENOSYS);
+        } else {
+            av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+            // Set low latency mode if Smart Access Video is enabled
+            if (ctx->smart_access_video != 0) {
+                AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY);
+                av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+            }
+        }
+    }
+
     // Pre-Pass, Pre-Analysis, Two-Pass
     if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE, 0);
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index bd544d12df..b0b47645fc 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -136,6 +136,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg)    , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video",     "Enable Smart Access Video",    OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -353,6 +355,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
         av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n");
     }
 
+    if (ctx->smart_access_video != -1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+        if (res != AMF_OK) {
+            av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+            if (ctx->smart_access_video != 0)
+                return AVERROR(ENOSYS);
+        } else {
+            av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+            // Set low latency mode if Smart Access Video is enabled
+            if (ctx->smart_access_video != 0) {
+                AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, true);
+                av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+            }
+        }
+    }
+
     if (ctx->preanalysis != -1) {
         AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true));
     }
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 352564a301..a5b6b15ef7 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -99,6 +99,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video",     "Enable Smart Access Video",        OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -241,6 +243,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    if (ctx->smart_access_video != -1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+        if (res != AMF_OK) {
+            av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+            if (ctx->smart_access_video != 0)
+                return AVERROR(ENOSYS);
+        } else {
+            av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+            // Set low latency mode if Smart Access Video is enabled
+            if (ctx->smart_access_video != 0) {
+                AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE, true);
+                av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+            }
+        }
+    }
+
     // Pre-Pass, Pre-Analysis, Two-Pass
     if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0);
-- 
2.42.0

_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-23  9:41 [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option Evgeny Pavlov
@ 2023-11-24  8:45 ` Dmitrii Ovchinnikov
  2023-11-26 10:32   ` Anton Khirnov
  2023-11-27 13:09 ` Mark Thompson
  2023-11-28 13:52 ` [FFmpeg-devel] [PATCH v3] " Evgeny Pavlov
  2 siblings, 1 reply; 8+ messages in thread
From: Dmitrii Ovchinnikov @ 2023-11-24  8:45 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

 If there are no objections, I would like to merge it in 2-3 days
_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-24  8:45 ` Dmitrii Ovchinnikov
@ 2023-11-26 10:32   ` Anton Khirnov
  2023-11-26 14:40     ` Dmitrii Ovchinnikov
  0 siblings, 1 reply; 8+ messages in thread
From: Anton Khirnov @ 2023-11-26 10:32 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Dmitrii Ovchinnikov (2023-11-24 09:45:14)
>  If there are no objections, I would like to merge it in 2-3 days

The code looks significantly duplicated.

-- 
Anton Khirnov
_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-26 10:32   ` Anton Khirnov
@ 2023-11-26 14:40     ` Dmitrii Ovchinnikov
  2023-11-27 13:14       ` Mark Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitrii Ovchinnikov @ 2023-11-26 14:40 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

>> The code looks significantly duplicated.

This is not moved to amfenc.c since the property has different names
 for different encoders, and many other properties (also common to
different encoders, but with different names) are separated in this way.
_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-23  9:41 [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option Evgeny Pavlov
  2023-11-24  8:45 ` Dmitrii Ovchinnikov
@ 2023-11-27 13:09 ` Mark Thompson
  2023-11-28 13:52 ` [FFmpeg-devel] [PATCH v3] " Evgeny Pavlov
  2 siblings, 0 replies; 8+ messages in thread
From: Mark Thompson @ 2023-11-27 13:09 UTC (permalink / raw)
  To: ffmpeg-devel

On 23/11/2023 09:41, Evgeny Pavlov wrote:
> This commit adds option for enabling SmartAccess Video (SAV)
> in AMF encoders. SAV is an AMD hardware-specific feature which
> enables the parallelization of encode and decode streams across
> multiple Video Codec Engine (VCN) hardware instances.
> 
> Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
> ---
>   libavcodec/amfenc.h      |  1 +
>   libavcodec/amfenc_av1.c  | 18 ++++++++++++++++++
>   libavcodec/amfenc_h264.c | 18 ++++++++++++++++++
>   libavcodec/amfenc_hevc.c | 18 ++++++++++++++++++
>   4 files changed, 55 insertions(+)

Can you explain a bit more about what this option actually does?  I can't find any details about it beyond nebulous "make things better", but presumably there is some tradeoff so you don't always enable it.

Some documentation explaining what it does and hinting when the user might want it on or off would be helpful (can be a separate patch).

Patch itself seems fine for a standalone option, though I would mildly prefer not to put meaningless marketing names in the code if it's possible to have a descriptive name instead.

Thanks,

- Mark
_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-26 14:40     ` Dmitrii Ovchinnikov
@ 2023-11-27 13:14       ` Mark Thompson
  2023-11-28 14:18         ` Evgeny Pavlov
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Thompson @ 2023-11-27 13:14 UTC (permalink / raw)
  To: ffmpeg-devel

On 26/11/2023 14:40, Dmitrii Ovchinnikov wrote:
>>> The code looks significantly duplicated.
> 
> This is not moved to amfenc.c since the property has different names
>   for different encoders, and many other properties (also common to
> different encoders, but with different names) are separated in this way.

Seems like we could template this to avoid the duplication, something like:

#define PER_CODEC_OPTION(name) \
   (ctx->codec == AV1  ? AMF_VIDEO_ENCODER_AV1_  ## name : \
    ctx->codec == HEVC ? AMF_VIDEO_ENCODER_HEVC_ ## name : \
                         AMF_VIDEO_ENCODER_      ## name)

?

Thanks,

- Mark
_______________________________________________
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] 8+ messages in thread

* [FFmpeg-devel] [PATCH v3] avcodec/amfenc: add smart access video option
  2023-11-23  9:41 [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option Evgeny Pavlov
  2023-11-24  8:45 ` Dmitrii Ovchinnikov
  2023-11-27 13:09 ` Mark Thompson
@ 2023-11-28 13:52 ` Evgeny Pavlov
  2 siblings, 0 replies; 8+ messages in thread
From: Evgeny Pavlov @ 2023-11-28 13:52 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Evgeny Pavlov

This commit adds option for enabling SmartAccess Video (SAV)
in AMF encoders. SAV is an AMD hardware-specific feature which
enables the parallelization of encode and decode streams across
multiple Video Codec Engine (VCN) hardware instances.

Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com>
---
 libavcodec/amfenc.c      | 11 +++++++++++
 libavcodec/amfenc.h      |  6 ++++++
 libavcodec/amfenc_av1.c  |  8 ++++++++
 libavcodec/amfenc_h264.c |  8 ++++++++
 libavcodec/amfenc_hevc.c |  8 ++++++++
 5 files changed, 41 insertions(+)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index 061859f85c..c48eb27056 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -369,6 +369,17 @@ static int amf_init_encoder(AVCodecContext *avctx)
     res = ctx->factory->pVtbl->CreateComponent(ctx->factory, ctx->context, codec_id, &ctx->encoder);
     AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_ENCODER_NOT_FOUND, "CreateComponent(%ls) failed with error %d\n", codec_id, res);
 
+    if (ctx->smart_access_video != -1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_PER_CODEC_OPTION(ENABLE_SMART_ACCESS_VIDEO), ctx->smart_access_video != 0);
+        if (res != AMF_OK) {
+            av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+            if (ctx->smart_access_video != 0)
+                return AVERROR(ENOSYS);
+        } else {
+            av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+        }
+    }
+
     return 0;
 }
 
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 2dbd378ef8..9bb3278bc5 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -89,6 +89,7 @@ typedef struct AmfContext {
     int                 quality;
     int                 b_frame_delta_qp;
     int                 ref_b_frame_delta_qp;
+    int                 smart_access_video;
 
     // Dynamic options, can be set after Init() call
 
@@ -179,4 +180,9 @@ extern const enum AVPixelFormat ff_amf_pix_fmts[];
         return ret_value; \
     }
 
+#define AMF_PER_CODEC_OPTION(name) \
+   (avctx->codec->id == AV_CODEC_ID_AV1  ? AMF_VIDEO_ENCODER_AV1_  ## name : \
+    avctx->codec->id == AV_CODEC_ID_HEVC ? AMF_VIDEO_ENCODER_HEVC_ ## name : \
+                                           AMF_VIDEO_ENCODER_      ## name)
+
 #endif //AVCODEC_AMFENC_H
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 3f164ccc59..06ce566f39 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -104,6 +104,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{.i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video",     "Enable parallelization of encode and decode streams across multiple VCN hardware instances",  OFFSET(smart_access_video),  AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -243,6 +245,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    // Set low latency mode if Smart Access Video is enabled
+    if (ctx->smart_access_video == 1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY);
+        av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+    }
+
     // Pre-Pass, Pre-Analysis, Two-Pass
     if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE, 0);
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index bd544d12df..9b36a8b088 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -136,6 +136,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg)    , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video",  "Enable parallelization of encode and decode streams across multiple VCN hardware instances",  OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -353,6 +355,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
         av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n");
     }
 
+    // Set low latency mode if Smart Access Video is enabled
+    if (ctx->smart_access_video == 1) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, true);
+        av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+    }
+
     if (ctx->preanalysis != -1) {
         AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true));
     }
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 352564a301..7ccac37d15 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -99,6 +99,8 @@ static const AVOption options[] = {
 
     { "log_to_dbg",     "Enable AMF logging to debug output",   OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
 
+    { "smart_access_video", "Enable parallelization of encode and decode streams across multiple VCN hardware instances",   OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1  }, -1, 1, VE},
+
     //Pre Analysis options
     { "preanalysis",                            "Enable preanalysis",                                           OFFSET(preanalysis),                            AV_OPT_TYPE_BOOL,   {.i64 = -1 }, -1, 1, VE },
 
@@ -241,6 +243,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    // Set low latency mode if Smart Access Video is enabled
+    if (ctx->smart_access_video != -1 && ctx->smart_access_video != 0) {
+        AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE, true);
+        av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+    }
+
     // Pre-Pass, Pre-Analysis, Two-Pass
     if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) {
         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0);
-- 
2.42.0

_______________________________________________
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] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option
  2023-11-27 13:14       ` Mark Thompson
@ 2023-11-28 14:18         ` Evgeny Pavlov
  0 siblings, 0 replies; 8+ messages in thread
From: Evgeny Pavlov @ 2023-11-28 14:18 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

>
>
> Seems like we could template this to avoid the duplication, something like:
>
> #define PER_CODEC_OPTION(name) \
>    (ctx->codec == AV1  ? AMF_VIDEO_ENCODER_AV1_  ## name : \
>     ctx->codec == HEVC ? AMF_VIDEO_ENCODER_HEVC_ ## name : \
>                          AMF_VIDEO_ENCODER_      ## name)
>

Thanks for the suggestion, I've extracted duplicated code to amfenc.c file,
but can't extract the whole smart_access_video option, because there are
some differences between av1 & hevc/h264 encoders while set low latency
mode.
In addition, I've added a more detailed description for SAV option, I hope
it will be enough for understanding.
Here is an updated version of this patch:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20231128135347.892-2-lucenticus@gmail.com/
_______________________________________________
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] 8+ messages in thread

end of thread, other threads:[~2023-11-28 14:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23  9:41 [FFmpeg-devel] [PATCH v2] avcodec/amfenc: add smart access video option Evgeny Pavlov
2023-11-24  8:45 ` Dmitrii Ovchinnikov
2023-11-26 10:32   ` Anton Khirnov
2023-11-26 14:40     ` Dmitrii Ovchinnikov
2023-11-27 13:14       ` Mark Thompson
2023-11-28 14:18         ` Evgeny Pavlov
2023-11-27 13:09 ` Mark Thompson
2023-11-28 13:52 ` [FFmpeg-devel] [PATCH v3] " Evgeny Pavlov

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