avcodec/nvenc: add support for unidirectional b-frames
This commit is contained in:
		
							parent
							
								
									a270966118
								
							
						
					
					
						commit
						21b4708969
					
				| @ -613,6 +613,14 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
| #ifdef NVENC_HAVE_UNIDIR_B | ||||
|     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_UNIDIRECTIONAL_B); | ||||
|     if(ctx->unidir_b && ret <= 0) { | ||||
|         av_log(avctx, AV_LOG_WARNING, "Unidirectional B-Frames not supported by the device\n"); | ||||
|         return AVERROR(ENOSYS); | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     ctx->support_dyn_bitrate = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); | ||||
| 
 | ||||
|     return 0; | ||||
| @ -1658,6 +1666,10 @@ FF_DISABLE_DEPRECATION_WARNINGS | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | ||||
|     } | ||||
| 
 | ||||
| #ifdef NVENC_HAVE_UNIDIR_B | ||||
|     ctx->init_encode_params.enableUniDirectionalB = ctx->unidir_b; | ||||
| #endif | ||||
| 
 | ||||
|     ctx->init_encode_params.enableEncodeAsync = 0; | ||||
|     ctx->init_encode_params.enablePTD = 1; | ||||
| 
 | ||||
|  | ||||
| @ -89,6 +89,7 @@ typedef void ID3D11Device; | ||||
| #define NVENC_HAVE_TEMPORAL_FILTER | ||||
| #define NVENC_HAVE_LOOKAHEAD_LEVEL | ||||
| #define NVENC_HAVE_UHQ_TUNING | ||||
| #define NVENC_HAVE_UNIDIR_B | ||||
| #endif | ||||
| 
 | ||||
| typedef struct NvencSurface | ||||
| @ -276,6 +277,7 @@ typedef struct NvencContext | ||||
|     int rgb_mode; | ||||
|     int tf_level; | ||||
|     int lookahead_level; | ||||
|     int unidir_b; | ||||
| } NvencContext; | ||||
| 
 | ||||
| int ff_nvenc_encode_init(AVCodecContext *avctx); | ||||
|  | ||||
| @ -213,6 +213,9 @@ static const AVOption options[] = { | ||||
|     { "1",            "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_1 }, 0, 0, VE, .unit = "lookahead_level" }, | ||||
|     { "2",            "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_2 }, 0, 0, VE, .unit = "lookahead_level" }, | ||||
|     { "3",            "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LOOKAHEAD_LEVEL_3 }, 0, 0, VE, .unit = "lookahead_level" }, | ||||
| #endif | ||||
| #ifdef NVENC_HAVE_UNIDIR_B | ||||
|     { "unidir_b",     "Enable use of unidirectional B-Frames.", OFFSET(unidir_b), AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE }, | ||||
| #endif | ||||
|     { NULL } | ||||
| }; | ||||
|  | ||||
| @ -29,7 +29,7 @@ | ||||
| 
 | ||||
| #include "version_major.h" | ||||
| 
 | ||||
| #define LIBAVCODEC_VERSION_MINOR   4 | ||||
| #define LIBAVCODEC_VERSION_MINOR   5 | ||||
| #define LIBAVCODEC_VERSION_MICRO 100 | ||||
| 
 | ||||
| #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user