提交 9f3902f1 编写于 作者: T Timo Rothenpieler

avcodec/nv{enc,dec}: use sane version checking macro

For some odd reason, the Nvidia version macros puts the minor version in
the msb, so comparing against it is impossible.
上级 987026ad
...@@ -32,6 +32,15 @@ ...@@ -32,6 +32,15 @@
#include "avcodec.h" #include "avcodec.h"
#if defined(NVDECAPI_MAJOR_VERSION) && defined(NVDECAPI_MINOR_VERSION)
# define NVDECAPI_CHECK_VERSION(major, minor) \
((major) < NVDECAPI_MAJOR_VERSION || ((major) == NVDECAPI_MAJOR_VERSION && (minor) <= NVDECAPI_MINOR_VERSION))
#else
/* version macros were added in SDK 8.1 ffnvcodec */
# define NVDECAPI_CHECK_VERSION(major, minor) \
((major) < 8 || ((major) == 8 && (minor) <= 0))
#endif
typedef struct NVDECFrame { typedef struct NVDECFrame {
unsigned int idx; unsigned int idx;
AVBufferRef *idx_ref; AVBufferRef *idx_ref;
......
...@@ -107,7 +107,7 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx, ...@@ -107,7 +107,7 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx,
.log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size, .log2_diff_max_min_pcm_luma_coding_block_size = sps->pcm.log2_max_pcm_cb_size - sps->pcm.log2_min_pcm_cb_size,
.pcm_sample_bit_depth_luma_minus1 = sps->pcm_enabled_flag ? sps->pcm.bit_depth - 1 : 0, .pcm_sample_bit_depth_luma_minus1 = sps->pcm_enabled_flag ? sps->pcm.bit_depth - 1 : 0,
.pcm_sample_bit_depth_chroma_minus1 = sps->pcm_enabled_flag ? sps->pcm.bit_depth_chroma - 1 : 0, .pcm_sample_bit_depth_chroma_minus1 = sps->pcm_enabled_flag ? sps->pcm.bit_depth_chroma - 1 : 0,
#if defined(NVDECAPI_VERSION) && NVDECAPI_VERSION >= 0x01000008 #if NVDECAPI_CHECK_VERSION(8, 1)
.log2_max_transform_skip_block_size_minus2 = pps->log2_max_transform_skip_block_size - 2, .log2_max_transform_skip_block_size_minus2 = pps->log2_max_transform_skip_block_size - 2,
.log2_sao_offset_scale_luma = pps->log2_sao_offset_scale_luma, .log2_sao_offset_scale_luma = pps->log2_sao_offset_scale_luma,
.log2_sao_offset_scale_chroma = pps->log2_sao_offset_scale_chroma, .log2_sao_offset_scale_chroma = pps->log2_sao_offset_scale_chroma,
......
...@@ -119,7 +119,7 @@ static int nvenc_print_error(void *log_ctx, NVENCSTATUS err, ...@@ -119,7 +119,7 @@ static int nvenc_print_error(void *log_ctx, NVENCSTATUS err,
static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level) static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
{ {
#if NVENCAPI_VERSION >= 0x01000008 #if NVENCAPI_CHECK_VERSION(8, 1)
# if defined(_WIN32) || defined(__CYGWIN__) # if defined(_WIN32) || defined(__CYGWIN__)
const char *minver = "390.77"; const char *minver = "390.77";
# else # else
......
...@@ -40,8 +40,11 @@ typedef void ID3D11Device; ...@@ -40,8 +40,11 @@ typedef void ID3D11Device;
#define RC_MODE_DEPRECATED 0x800000 #define RC_MODE_DEPRECATED 0x800000
#define RCD(rc_mode) ((rc_mode) | RC_MODE_DEPRECATED) #define RCD(rc_mode) ((rc_mode) | RC_MODE_DEPRECATED)
#define NVENCAPI_CHECK_VERSION(major, minor) \
((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION))
// SDK 8.1 compile time feature checks // SDK 8.1 compile time feature checks
#if NVENCAPI_VERSION >= 0x01000008 #if NVENCAPI_CHECK_VERSION(8, 1)
#define NVENC_HAVE_BFRAME_REF_MODE #define NVENC_HAVE_BFRAME_REF_MODE
#define NVENC_HAVE_QP_MAP_MODE #define NVENC_HAVE_QP_MAP_MODE
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册