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-06-02 21:37:33 +00:00
|
|
|
|
|
|
|
#pragma once
|
2021-10-26 23:02:41 +00:00
|
|
|
#include "nvidia-vfx-effect.hpp"
|
2021-06-02 21:37:33 +00:00
|
|
|
#include "nvidia-vfx.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda-gs-texture.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda-obs.hpp"
|
|
|
|
#include "nvidia/cuda/nvidia-cuda.hpp"
|
|
|
|
#include "nvidia/cv/nvidia-cv-image.hpp"
|
|
|
|
#include "nvidia/cv/nvidia-cv-texture.hpp"
|
|
|
|
#include "obs/gs/gs-texture.hpp"
|
|
|
|
|
|
|
|
namespace streamfx::nvidia::vfx {
|
2021-10-26 23:02:41 +00:00
|
|
|
class superresolution : protected effect {
|
|
|
|
bool _dirty;
|
2021-06-02 21:37:33 +00:00
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::texture> _input;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::image> _convert_to_fp32;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::image> _source;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::image> _destination;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::image> _convert_to_u8;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::texture> _output;
|
|
|
|
std::shared_ptr<::streamfx::nvidia::cv::image> _tmp;
|
|
|
|
|
|
|
|
float _strength;
|
|
|
|
float _scale;
|
|
|
|
|
2021-10-06 02:11:26 +00:00
|
|
|
std::pair<uint32_t, uint32_t> _cache_input_size;
|
|
|
|
std::pair<uint32_t, uint32_t> _cache_output_size;
|
|
|
|
float _cache_scale;
|
|
|
|
|
2021-06-02 21:37:33 +00:00
|
|
|
public:
|
|
|
|
~superresolution();
|
|
|
|
superresolution();
|
|
|
|
|
|
|
|
void set_strength(float strength);
|
|
|
|
float strength();
|
|
|
|
|
|
|
|
void set_scale(float scale);
|
|
|
|
float scale();
|
|
|
|
|
2023-05-13 12:35:46 +00:00
|
|
|
void size(std::pair<uint32_t, uint32_t> const& size, std::pair<uint32_t, uint32_t>& input_size, std::pair<uint32_t, uint32_t>& output_size);
|
2021-06-02 21:37:33 +00:00
|
|
|
|
|
|
|
std::shared_ptr<::streamfx::obs::gs::texture> process(std::shared_ptr<::streamfx::obs::gs::texture> in);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void resize(uint32_t width, uint32_t height);
|
|
|
|
|
|
|
|
void load();
|
|
|
|
};
|
|
|
|
} // namespace streamfx::nvidia::vfx
|