[FFmpeg-cvslog] avcodec/nvenc: Add bluray_compat basic implementation
Miroslav Slugen
git at videolan.org
Sun Jan 1 15:52:04 EET 2017
ffmpeg | branch: master | Miroslav Slugen <thunder.m at email.cz> | Fri Dec 30 22:04:31 2016 +0100| [9b425bd24c48085b0d96bc0698af82bd46e57d03] | committer: Timo Rothenpieler
avcodec/nvenc: Add bluray_compat basic implementation
Signed-off-by: Timo Rothenpieler <timo at rothenpieler.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b425bd24c48085b0d96bc0698af82bd46e57d03
---
libavcodec/nvenc.c | 15 +++++++++++++++
libavcodec/nvenc.h | 1 +
libavcodec/nvenc_h264.c | 1 +
libavcodec/nvenc_hevc.c | 1 +
libavcodec/version.h | 2 +-
5 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 93979f3..4ee99a9 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -958,6 +958,21 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
ctx->init_encode_params.enableEncodeAsync = 0;
ctx->init_encode_params.enablePTD = 1;
+ if (ctx->bluray_compat) {
+ ctx->aud = 1;
+ avctx->refs = FFMIN(FFMAX(avctx->refs, 0), 6);
+ avctx->max_b_frames = FFMIN(avctx->max_b_frames, 3);
+ switch (avctx->codec->id) {
+ case AV_CODEC_ID_H264:
+ /* maximum level depends on used resolution */
+ break;
+ case AV_CODEC_ID_HEVC:
+ ctx->level = NV_ENC_LEVEL_HEVC_51;
+ ctx->tier = NV_ENC_TIER_HEVC_HIGH;
+ break;
+ }
+ }
+
if (avctx->gop_size > 0) {
if (avctx->max_b_frames >= 0) {
/* 0 is intra-only, 1 is I/P only, 2 is one B-Frame, 3 two B-frames, and so on. */
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index c435e05..ab48cf7 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -154,6 +154,7 @@ typedef struct NvencContext
int aq_strength;
int quality;
int aud;
+ int bluray_compat;
} NvencContext;
int ff_nvenc_encode_init(AVCodecContext *avctx);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index cae27aa..76dc48b 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -108,6 +108,7 @@ static const AVOption options[] = {
{ "cq", "Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control",
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ NULL }
};
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index e44ca7e..cd1dcb9 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -105,6 +105,7 @@ static const AVOption options[] = {
{ "cq", "Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control",
OFFSET(quality), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 51, VE },
{ "aud", "Use access unit delimiters", OFFSET(aud), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+ { "bluray-compat", "Bluray compatibility workarounds", OFFSET(bluray_compat),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ NULL }
};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index fce4add..8f37ebd 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 70
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list