Skip to content

Commit

Permalink
vsort/vs_onnxruntime.cpp: add output_format param
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframRhodium committed Apr 19, 2024
1 parent 6b33f0e commit f439a9c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion vsort/vs_onnxruntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,14 @@ static void VS_CC vsOrtCreate(
use_cuda_graph = false;
}

int output_format = int64ToIntS(vsapi->propGetInt(in, "output_format", 0, &error));
if (error) {
output_format = 1;
}
if (output_format != 0 && output_format != 1) {
return set_error("\"output_format\" must be 0 or 1");
}

std::string_view path_view;
std::string path;
if (path_is_serialization) {
Expand Down Expand Up @@ -988,7 +996,13 @@ static void VS_CC vsOrtCreate(
fp16_blacklist_ops.emplace(vsapi->propGetData(in, "fp16_blacklist_ops", i, nullptr));
}
}
convert_float_to_float16(onnx_model, false, fp16_blacklist_ops);
convert_float_to_float16(
onnx_model,
false,
fp16_blacklist_ops,
in_vis.front()->format->bytesPerSample == 4,
output_format == 0
);
}

rename(onnx_model);
Expand Down Expand Up @@ -1292,6 +1306,7 @@ VS_EXTERNAL_API(void) VapourSynthPluginInit(
"use_cuda_graph:int:opt;"
"fp16_blacklist_ops:data[]:opt;"
"prefer_nhwc:int:opt;"
"output_format:int:opt;"
, vsOrtCreate,
nullptr,
plugin
Expand Down

0 comments on commit f439a9c

Please sign in to comment.