From: Yogender Gupta <ygu...@nvidia.com>

They match the x264 terminology.
---
 libavcodec/nvenc.c      | 3 +++
 libavcodec/nvenc.h      | 7 ++++++-
 libavcodec/nvenc_h264.c | 5 ++++-
 libavcodec/nvenc_hevc.c | 5 ++++-
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 2baa9ba..bd45722 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -463,6 +463,9 @@ static int nvec_map_preset(NVENCContext *ctx)
 {
     GUIDTuple presets[] = {
         { NV_ENC_PRESET_DEFAULT_GUID },
+        { NV_ENC_PRESET_HQ_GUID,                  NVENC_TWO_PASSES }, /* slow 
*/
+        { NV_ENC_PRESET_HQ_GUID,                  NVENC_ONE_PASS }, /* medium 
*/
+        { NV_ENC_PRESET_HP_GUID,                  NVENC_ONE_PASS }, /* fast */
         { NV_ENC_PRESET_HP_GUID },
         { NV_ENC_PRESET_HQ_GUID },
         { NV_ENC_PRESET_BD_GUID },
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index e7e6182..26c6515 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -91,6 +91,9 @@ typedef struct NVENCLibraryContext
 
 enum {
     PRESET_DEFAULT,
+    PRESET_SLOW,
+    PRESET_MEDIUM,
+    PRESET_FAST,
     PRESET_HP,
     PRESET_HQ,
     PRESET_BD ,
@@ -111,7 +114,9 @@ enum {
 
 enum {
     NVENC_LOWLATENCY = 1,
-    NVENC_LOSSLESS,
+    NVENC_LOSSLESS   = 2,
+    NVENC_ONE_PASS   = 4,
+    NVENC_TWO_PASSES = 8,
 };
 
 enum {
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index ea91e07..d58ee88 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -27,8 +27,11 @@
 #define OFFSET(x) offsetof(NVENCContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "preset",   "Set the encoding preset",              OFFSET(preset),      
AV_OPT_TYPE_INT,    { .i64 = PRESET_HQ }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, 
VE, "preset" },
+    { "preset",   "Set the encoding preset",              OFFSET(preset),      
AV_OPT_TYPE_INT,    { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, 
PRESET_LOSSLESS_HP, VE, "preset" },
     { "default",    "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_DEFAULT }, 0, 0, VE, "preset" },
+    { "slow",       "hq 2 passes",                        0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_SLOW }, 0, 0, VE, "preset" },
+    { "medium",     "hq 1 pass",                          0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_MEDIUM }, 0, 0, VE, "preset" },
+    { "fast",       "hp 1 pass",                          0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_FAST }, 0, 0, VE, "preset" },
     { "hp",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_HP }, 0, 0, VE, "preset" },
     { "hq",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_HQ }, 0, 0, VE, "preset" },
     { "bd",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_BD }, 0, 0, VE, "preset" },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 6ff3506..f129826 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -27,8 +27,11 @@
 #define OFFSET(x) offsetof(NVENCContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "preset",   "Set the encoding preset",              OFFSET(preset),      
AV_OPT_TYPE_INT,    { .i64 = PRESET_HQ }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, 
VE, "preset" },
+    { "preset",   "Set the encoding preset",              OFFSET(preset),      
AV_OPT_TYPE_INT,    { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, 
PRESET_LOSSLESS_HP, VE, "preset" },
     { "default",    "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_DEFAULT }, 0, 0, VE, "preset" },
+    { "slow",       "hq 2 passes",                        0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_SLOW }, 0, 0, VE, "preset" },
+    { "medium",     "hq 1 pass",                          0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_MEDIUM }, 0, 0, VE, "preset" },
+    { "fast",       "hp 1 pass",                          0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_FAST }, 0, 0, VE, "preset" },
     { "hp",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_HP }, 0, 0, VE, "preset" },
     { "hq",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_HQ }, 0, 0, VE, "preset" },
     { "bd",         "",                                   0,                   
AV_OPT_TYPE_CONST,  { .i64 = PRESET_BD }, 0, 0, VE, "preset" },
-- 
2.8.3

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

Reply via email to