6#include <mxvk/mxvk_exception.hpp>
14#ifdef ACMXVK_WITH_CUDA
17#ifdef ACMXVK_WITH_DEEP_DREAM
29#include <opencv2/core.hpp>
30#include <opencv2/imgcodecs.hpp>
35int main(
int argc,
char **argv) {
37 for (
int index = 1; index < argc; ++index) {
38 if (argv[index] !=
nullptr &&
39 (std::string_view(argv[index]) ==
"--unbuffered" ||
40 std::string_view(argv[index]) ==
"--silent" ||
41 std::string_view(argv[index]) ==
"--headless")) {
42 std::cout << std::unitbuf;
43 std::cerr << std::unitbuf;
68 std::cout <<
"AUDIO: enabled\n";
70 std::cout <<
"AUDIO: disabled\n";
76 std::cout <<
"MIDI: enabled\n";
78 std::cout <<
"MIDI: disabled\n";
83#ifdef ACMXVK_WITH_MXVK_CUDA
84 std::cout <<
"MXVK CUDA interop: enabled\n";
86 std::cout <<
"MXVK CUDA interop: disabled\n";
88#ifdef ACMXVK_WITH_CUDA
89 std::cout <<
"acidcam-gpu filters: enabled\n";
91 std::cout <<
"acidcam-gpu filters: disabled\n";
97 std::cout <<
"OpenCV DNN effects: enabled\n";
99 std::cout <<
"OpenCV DNN effects: disabled\n";
104#ifdef ACMXVK_WITH_DEEP_DREAM
116 std::cout, std::cerr)
121 std::cerr <<
"Deep Dream model inspection requires an ACMXVK "
122 "build configured with -DWITH_DEEP_DREAM=ON\n";
125 std::cout <<
"Deep Dream: disabled\n";
133 std::cerr <<
"acmxvk: unable to probe HDR metadata: "
147 throw std::runtime_error(
148 "--list-devices requires an ACMXVK build configured with -DAUDIO=ON");
156 throw std::runtime_error(
157 "--list-midi requires an ACMXVK build configured with -DMIDI=ON");
161#ifdef ACMXVK_WITH_CUDA
165 throw std::runtime_error(
166 "--list-filters requires an ACMXVK build configured with "
171#ifdef ACMXVK_WITH_MXVK_CUDA
172 acmxvk::list_cuda_devices(std::cout);
175 throw std::runtime_error(
176 "--list-cuda-devices requires a CUDA-enabled MXVK installation");
181 throw std::runtime_error(
182 "--enable-audio requires an ACMXVK build configured with -DAUDIO=ON");
188 throw std::runtime_error(
189 "MIDI input requires an ACMXVK build configured with -DMIDI=ON");
192#ifndef ACMXVK_WITH_DEEP_DREAM
194 throw std::runtime_error(
195 "--dream-model requires an ACMXVK build configured with "
196 "-DWITH_DEEP_DREAM=ON");
199#ifndef ACMXVK_WITH_CUDA
201 throw std::runtime_error(
202 "CUDA filters require an ACMXVK build configured with "
206#ifndef ACMXVK_WITH_MXVK_CUDA
208 throw std::runtime_error(
209 "--cuda-device requires a CUDA-enabled MXVK installation");
212#ifndef ACMXVK_WITH_DNN
217 throw std::runtime_error(
218 "DNN effects require an ACMXVK build configured with "
219 "-DWITH_OPENCV_DNN=ON");
236 throw std::runtime_error(
237 "unable to install Ctrl+C handler for headless mode");
240#ifdef ACMXVK_WITH_CUDA
246#ifdef ACMXVK_WITH_MXVK_CUDA
253 const cv::Mat image = cv::imread(options.
graphic_file, cv::IMREAD_UNCHANGED);
254 if (!image.empty()) {
255 options.
width = image.cols;
256 options.
height = image.rows;
265 }
catch (
const mxvk::Exception &error) {
266 std::cerr <<
"acmxvk: MXVK exception: " << error.text() <<
'\n';
268 }
catch (
const std::exception &error) {
269 std::cerr <<
"acmxvk: exception: " << error.what() <<
'\n';
int main(int argc, char **argv)
Application entry point.
static void list_devices()
static void validate_filter_indices(const std::vector< int > &filter_indices)
static void list_filters(std::ostream &output)
bool probe(int cuda_device, std::string_view model_file, std::string_view layer, int iterations, float strength, float feedback, float zoom, float rotation_degrees, int max_dimension, bool use_half, int target_channel, int octaves, float octave_scale, int jitter, int smoothing, std::ostream &output, std::ostream &error)
void printEncoders(std::ostream &output)
bool rotationSwapsDimensions(FrameRotation rotation)
void printHelp(std::ostream &output)
void printVideoHdrInfo(const VideoHdrInfo &info, std::ostream &output)
void request_headless_shutdown(int signal_number) noexcept
bool printEncoderOptions(std::string_view encoder_name, std::ostream &output, std::ostream &error_output)
VideoHdrInfo probeVideoHdrInfo(const std::string &filename)
bool listCameraDevices(std::ostream &output, std::ostream &error)
Print native camera device indices and names as tab-separated records.
Options parseOptions(int argc, char **argv)
bool probeCameraDevice(int device_index, std::ostream &output, std::ostream &error)
Print the native capture formats, resolutions, and frame rates exposed by a camera device.
int buildShaderLibrary(const Options &options)
bool midi_device_specified
double dream_octave_scale
bool cuda_device_specified
std::string build_manifest
FrameRotation frame_rotation
std::string midi_map_file
std::vector< int > gpu_filter_indices
std::vector< std::string > midi_cc_mappings
std::string onnx_configuration
int enumerate_camera_device
std::string list_encoder_options
bool resolution_specified
std::string probe_hdr_file
bool human_white_specified
bool human_black_specified