mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-27 02:42:26 -04:00
nv-filters: Enable new logger function for Video Effects
This enables a new logger function introduced in SDK >= 0.7.5, which gives much more details about what is going on during the effect processing. Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -275,6 +275,12 @@ static bool nvvfx_filter_create_internal(struct nvvfx_data *filter)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void nvvfx_logger_callback(void *data, const char *msg)
|
||||
{
|
||||
UNUSED_PARAMETER(data);
|
||||
blog(LOG_ERROR, "[NVIDIA Video Effect: '%s']", msg);
|
||||
}
|
||||
|
||||
static void *nvvfx_filter_create(obs_data_t *settings, obs_source_t *context, enum nvvfx_fx_id id)
|
||||
{
|
||||
struct nvvfx_data *filter = (struct nvvfx_data *)bzalloc(sizeof(*filter));
|
||||
@@ -349,6 +355,10 @@ static void *nvvfx_filter_create(obs_data_t *settings, obs_source_t *context, en
|
||||
|
||||
nvvfx_filter_update(filter, settings);
|
||||
|
||||
/* Setup NVIDIA logger */
|
||||
if (nvvfx_new_sdk)
|
||||
vfxErr = NvVFX_ConfigureLogger(NVCV_LOG_ERROR, NULL, &nvvfx_logger_callback, filter);
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
@@ -1151,6 +1161,10 @@ bool load_nvidia_vfx(void)
|
||||
LOAD_SYM(NvVFX_Load);
|
||||
LOAD_SYM(NvVFX_CudaStreamCreate);
|
||||
LOAD_SYM(NvVFX_CudaStreamDestroy);
|
||||
LOAD_SYM(NvVFX_SetStateObjectHandleArray);
|
||||
LOAD_SYM(NvVFX_AllocateState);
|
||||
LOAD_SYM(NvVFX_DeallocateState);
|
||||
LOAD_SYM(NvVFX_ResetState);
|
||||
old_sdk_loaded = true;
|
||||
#undef LOAD_SYM
|
||||
|
||||
@@ -1183,10 +1197,7 @@ bool load_nvidia_vfx(void)
|
||||
#undef LOAD_SYM
|
||||
|
||||
#define LOAD_SYM(sym) LOAD_SYM_FROM_LIB2(sym, nv_videofx, "NVVideoEffects.dll")
|
||||
LOAD_SYM(NvVFX_SetStateObjectHandleArray);
|
||||
LOAD_SYM(NvVFX_AllocateState);
|
||||
LOAD_SYM(NvVFX_DeallocateState);
|
||||
LOAD_SYM(NvVFX_ResetState);
|
||||
LOAD_SYM(NvVFX_ConfigureLogger);
|
||||
if (!nvvfx_new_sdk) {
|
||||
blog(LOG_INFO, "[NVIDIA VIDEO FX]: sdk loaded but old redistributable detected; please upgrade.");
|
||||
}
|
||||
|
||||
@@ -247,6 +247,14 @@ typedef enum NvCVImage_ComponentType {
|
||||
#define NVVFX_STATE "State" //!< State variable
|
||||
#define NVVFX_STATE_SIZE "StateSize" //!< Number of bytes needed to store state
|
||||
|
||||
/** Logging support **/
|
||||
enum {
|
||||
NVCV_LOG_FATAL, //!< Message to be printed right before aborting due to an unrecoverable error.
|
||||
NVCV_LOG_ERROR, //!< An operation has failed, but it is not fatal.
|
||||
NVCV_LOG_WARNING, //!< Something was not quite right, but we fixed it up, perhaps at a loss in performance.
|
||||
NVCV_LOG_INFO //!< Nothing is wrong, but this information might be of interest.
|
||||
};
|
||||
|
||||
//! Image descriptor.
|
||||
typedef struct
|
||||
#ifdef _MSC_VER
|
||||
@@ -339,6 +347,9 @@ typedef NvCV_Status NvVFX_API (*NvVFX_AllocateState_t)(NvVFX_Handle effect, NvVF
|
||||
typedef NvCV_Status NvVFX_API (*NvVFX_DeallocateState_t)(NvVFX_Handle effect, NvVFX_StateObjectHandle handle);
|
||||
typedef NvCV_Status NvVFX_API (*NvVFX_ResetState_t)(NvVFX_Handle effect, NvVFX_StateObjectHandle handle);
|
||||
|
||||
/* requires SDK version >= 0.7.5 */
|
||||
typedef NvCV_Status NvVFX_API (*NvVFX_ConfigureLogger_t)(int verbosity, const char *file,
|
||||
void (*cb)(void *, const char *), void *cb_data);
|
||||
/* NvCVImage functions */
|
||||
typedef NvCV_Status NvCV_API (*NvCVImage_Init_t)(NvCVImage *im, unsigned width, unsigned height, int pitch,
|
||||
void *pixels, NvCVImage_PixelFormat format,
|
||||
@@ -401,6 +412,7 @@ typedef NvCV_Status NvCV_API (*NvCVImage_FromD3DColorSpace_t)(DXGI_COLOR_SPACE_T
|
||||
unsigned char *pNvcvColorSpace);
|
||||
typedef NvCV_Status NvCV_API (*NvCVImage_InitFromD3D11Texture_t)(NvCVImage *im, struct ID3D11Texture2D *tx);
|
||||
typedef NvCV_Status NvCV_API (*NvCVImage_InitFromD3DTexture_t)(NvCVImage *im, struct ID3D11Texture2D *tx);
|
||||
|
||||
/* cuda runtime */
|
||||
typedef enum cudaError {
|
||||
cudaSuccess = 0,
|
||||
@@ -537,7 +549,7 @@ typedef cudaError_t CUDARTAPI (*cudaFree_t)(void *devPtr);
|
||||
typedef cudaError_t CUDARTAPI (*cudaMemsetAsync_t)(void *devPtr, int value, size_t count, CUstream stream);
|
||||
typedef cudaError_t CUDARTAPI (*cudaMemcpy_t)(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind);
|
||||
|
||||
/* nvvfx */
|
||||
/* NVVFX */
|
||||
static NvVFX_GetVersion_t NvVFX_GetVersion = NULL;
|
||||
static NvVFX_CreateEffect_t NvVFX_CreateEffect = NULL;
|
||||
static NvVFX_DestroyEffect_t NvVFX_DestroyEffect = NULL;
|
||||
@@ -564,12 +576,15 @@ static NvVFX_Load_t NvVFX_Load = NULL;
|
||||
static NvVFX_CudaStreamCreate_t NvVFX_CudaStreamCreate = NULL;
|
||||
static NvVFX_CudaStreamDestroy_t NvVFX_CudaStreamDestroy = NULL;
|
||||
|
||||
/* nvvfx sdk >= 0.7.0 */
|
||||
/* NVVFX SDK >= 0.7.0 */
|
||||
static NvVFX_SetStateObjectHandleArray_t NvVFX_SetStateObjectHandleArray = NULL;
|
||||
static NvVFX_AllocateState_t NvVFX_AllocateState = NULL;
|
||||
static NvVFX_DeallocateState_t NvVFX_DeallocateState = NULL;
|
||||
static NvVFX_ResetState_t NvVFX_ResetState = NULL;
|
||||
|
||||
/* NVVFX SDK >= 0.7.5 */
|
||||
static NvVFX_ConfigureLogger_t NvVFX_ConfigureLogger = NULL;
|
||||
|
||||
/*nvcvimage */
|
||||
static NvCVImage_Init_t NvCVImage_Init = NULL;
|
||||
static NvCVImage_InitView_t NvCVImage_InitView = NULL;
|
||||
@@ -638,6 +653,7 @@ static inline void release_nv_vfx()
|
||||
NvVFX_AllocateState = NULL;
|
||||
NvVFX_DeallocateState = NULL;
|
||||
NvVFX_ResetState = NULL;
|
||||
NvVFX_ConfigureLogger = NULL;
|
||||
if (nv_videofx) {
|
||||
FreeLibrary(nv_videofx);
|
||||
nv_videofx = NULL;
|
||||
|
||||
Reference in New Issue
Block a user