2023-02-28 01:15:26 +00:00
|
|
|
// AUTOGENERATED COPYRIGHT HEADER START
|
|
|
|
// Copyright (C) 2021-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
2021-07-04 01:56:20 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "nvidia-vfx.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda-obs.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda-stream.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda.hpp"
|
|
|
|
#include "nvidia/cv/nvidia-cv-image.hpp"
|
|
|
|
#include "nvidia/cv/nvidia-cv-texture.hpp"
|
|
|
|
#include "nvidia/cv/nvidia-cv.hpp"
|
|
|
|
#include "nvidia/vfx/nvidia-vfx.hpp"
|
|
|
|
|
2022-08-29 10:29:44 +00:00
|
|
|
#include "warning-disable.hpp"
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include "warning-enable.hpp"
|
|
|
|
|
2021-07-04 01:56:20 +00:00
|
|
|
namespace streamfx::nvidia::vfx {
|
|
|
|
using namespace ::streamfx::nvidia;
|
|
|
|
|
|
|
|
class effect {
|
2021-10-23 15:12:06 +00:00
|
|
|
protected:
|
2021-07-04 01:56:20 +00:00
|
|
|
std::shared_ptr<cuda::obs> _nvcuda;
|
|
|
|
std::shared_ptr<cv::cv> _nvcvi;
|
|
|
|
std::shared_ptr<vfx> _nvvfx;
|
2021-10-26 20:59:31 +00:00
|
|
|
std::shared_ptr<void> _fx;
|
|
|
|
std::string _model_path;
|
2021-07-04 01:56:20 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
~effect();
|
|
|
|
effect(effect_t name);
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
::streamfx::nvidia::vfx::handle_t get()
|
|
|
|
{
|
|
|
|
return _fx.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* Int32 */:
|
|
|
|
inline cv::result set(parameter_t param, uint32_t const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetU32(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, uint32_t& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetU32(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result set(parameter_t param, int32_t const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetS32(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, int32_t& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetS32(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* Int64 */:
|
|
|
|
inline cv::result set(parameter_t param, uint64_t const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetU64(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, uint64_t& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetU64(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* Float32 */:
|
|
|
|
inline cv::result set(parameter_t param, float const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetF32(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, float& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetF32(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* Float64 */:
|
|
|
|
inline cv::result set(parameter_t param, double const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetF64(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, double& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetF64(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* String */:
|
|
|
|
inline cv::result set(parameter_t param, const char* const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetString(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get(parameter_t param, const char*& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetString(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result set(parameter_t param, std::string_view const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetString(_fx.get(), param, value.data());
|
|
|
|
};
|
|
|
|
cv::result get(parameter_t param, std::string_view& value);
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result set(parameter_t param, std::string const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetString(_fx.get(), param, value.c_str());
|
|
|
|
};
|
|
|
|
cv::result get(parameter_t param, std::string& value);
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* CUDA Stream */:
|
|
|
|
inline cv::result set(parameter_t param, cuda::stream_t const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetCudaStream(_fx.get(), param, value);
|
|
|
|
};
|
2021-10-23 15:12:06 +00:00
|
|
|
inline cv::result get(parameter_t param, cuda::stream_t& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetCudaStream(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result set(parameter_t param, std::shared_ptr<cuda::stream> const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetCudaStream(_fx.get(), param, value->get());
|
|
|
|
};
|
|
|
|
//cv::result get_stream(parameter_t param, std::shared_ptr<cuda::stream>& value);
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* CV Image */:
|
|
|
|
inline cv::result set(parameter_t param, cv::image_t* value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
2021-10-26 20:59:31 +00:00
|
|
|
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value);
|
2021-07-04 01:56:20 +00:00
|
|
|
};
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result get(parameter_t param, cv::image_t* value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
2021-10-26 20:59:31 +00:00
|
|
|
return _nvvfx->NvVFX_GetImage(_fx.get(), param, value);
|
2021-07-04 01:56:20 +00:00
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
inline cv::result set(parameter_t param, std::shared_ptr<cv::image> const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value->get_image());
|
|
|
|
};
|
2021-10-23 15:12:06 +00:00
|
|
|
inline cv::result get(parameter_t param, std::shared_ptr<cv::image>& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetImage(_fx.get(), param, value->get_image());
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* CV Texture */:
|
|
|
|
inline cv::result set(parameter_t param, std::shared_ptr<cv::texture> const& value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetImage(_fx.get(), param, value->get_image());
|
|
|
|
};
|
|
|
|
//cv::result get(parameter_t param, std::shared_ptr<cv::texture>& value);
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* Objects */:
|
|
|
|
inline cv::result set_object(parameter_t param, void* const value)
|
2021-07-04 01:56:20 +00:00
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_SetObject(_fx.get(), param, value);
|
|
|
|
};
|
|
|
|
inline cv::result get_object(parameter_t param, void*& value)
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_GetObject(_fx.get(), param, &value);
|
|
|
|
};
|
|
|
|
|
2021-10-26 20:59:31 +00:00
|
|
|
public /* Control */:
|
2021-07-04 01:56:20 +00:00
|
|
|
inline cv::result load()
|
|
|
|
{
|
|
|
|
return _nvvfx->NvVFX_Load(_fx.get());
|
|
|
|
};
|
|
|
|
|
|
|
|
inline cv::result run(bool async = false)
|
|
|
|
{
|
2021-10-23 15:12:06 +00:00
|
|
|
return _nvvfx->NvVFX_Run(_fx.get(), async ? 1 : 0);
|
2021-07-04 01:56:20 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
} // namespace streamfx::nvidia::vfx
|