Re: [FFmpeg-devel] [PATCH 4/4] avcodec/nvenc: Add support for nvenc api version 5

2014-12-25 Thread Hendrik Leppkes
On Dec 25, 2014 2:57 PM, t...@rothenpieler.org wrote:

 From: Timo Rothenpieler t...@rothenpieler.org

 ---
  libavcodec/nvenc.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

 diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
 index ebc3249..76f9aa6 100644
 --- a/libavcodec/nvenc.c
 +++ b/libavcodec/nvenc.c
 @@ -50,6 +50,10 @@
  #define DL_CLOSE_FUNC(l) dlclose(l)
  #endif

 +#if NVENCAPI_MAJOR_VERSION  5
 +#define NVENC_NEED_LICENSE 1
 +#endif
 +

I would skip the separate license define and just check the version in the
two places where its used right now.

  typedef enum cudaError_enum {
  CUDA_SUCCESS = 0
  } CUresult;
 @@ -67,7 +71,9 @@ typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);

  typedef NVENCSTATUS (NVENCAPI*
PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTION_LIST *functionList);

 +#ifdef NVENC_NEED_LICENSE
  static const GUID dummy_license = { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0 } };
 +#endif

  typedef struct NvencInputSurface
  {
 @@ -465,7 +471,6 @@ static av_cold int nvenc_encode_init(AVCodecContext
*avctx)
  CUcontext cu_context_curr;
  CUresult cu_res;
  GUID encoder_preset = NV_ENC_PRESET_HQ_GUID;
 -GUID license = dummy_license;
  NVENCSTATUS nv_status = NV_ENC_SUCCESS;
  int surfaceCount = 0;
  int i, num_mbs;
 @@ -473,6 +478,10 @@ static av_cold int nvenc_encode_init(AVCodecContext
*avctx)
  int res = 0;
  int dw, dh;

 +#ifdef NVENC_NEED_LICENSE
 +GUID license = dummy_license;
 +#endif
 +
  NvencContext *ctx = avctx-priv_data;
  NvencDynLoadFunctions *dl_fn = ctx-nvenc_dload_funcs;
  NV_ENCODE_API_FUNCTION_LIST *p_nvenc = dl_fn-nvenc_funcs;
 @@ -494,7 +503,10 @@ static av_cold int nvenc_encode_init(AVCodecContext
*avctx)
  preset_config.presetCfg.version = NV_ENC_CONFIG_VER;
  encode_session_params.version =
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER;
  encode_session_params.apiVersion = NVENCAPI_VERSION;
 +
 +#ifdef NVENC_NEED_LICENSE
  encode_session_params.clientKeyPtr = license;
 +#endif

  if (ctx-gpu = dl_fn-nvenc_device_count) {
  av_log(avctx, AV_LOG_FATAL, Requested GPU %d, but only %d GPUs
are available!\n, ctx-gpu, dl_fn-nvenc_device_count);
 @@ -1066,7 +1078,10 @@ static int nvenc_encode_frame(AVCodecContext
*avctx, AVPacket *pkt,
  pic_params.inputDuration = 0;
  pic_params.codecPicParams.h264PicParams.sliceMode =
ctx-encode_config.encodeCodecConfig.h264Config.sliceMode;
  pic_params.codecPicParams.h264PicParams.sliceModeData =
ctx-encode_config.encodeCodecConfig.h264Config.sliceModeData;
 +
 +#if NVENCAPI_MAJOR_VERSION  5
  memcpy(pic_params.rcParams, ctx-encode_config.rcParams,
sizeof(NV_ENC_RC_PARAMS));
 +#endif

  res = timestamp_queue_enqueue(ctx-timestamp_list, frame-ptr);

Otherwise, LGTM if tested.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/nvenc: Add support for nvenc api version 5

2014-12-25 Thread Jean-Baptiste Kempf
On 25 Dec, t...@rothenpieler.org wrote :
 +#if NVENCAPI_MAJOR_VERSION  5
 +#define NVENC_NEED_LICENSE 1
 +#endif

Why not just drop old versions?

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/nvenc: Add support for nvenc api version 5

2014-12-25 Thread Timo Rothenpieler

Why not just drop old versions?


The newest SDK only works with the very latest nvidia driver.
So supporting the older SDK versions is neccessary if you want to use 
nvenc without the very latest nvidia driver.




signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel