Skip to content

Commit

Permalink
update sRGBtoLinearRGB
Browse files Browse the repository at this point in the history
  • Loading branch information
dnjulek committed Sep 27, 2024
1 parent f373ad4 commit e63c8ca
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/vapoursynth/metrics.zig
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,28 @@ pub fn sRGBtoLinearRGB(node: ?*vs.Node, core: ?*vs.Core, vsapi: ?*const vs.API)
const frame = vsapi.?.getFrame.?(0, node, null, 0);
defer vsapi.?.freeFrame.?(frame);
const transfer_in = vsapi.?.mapGetInt.?(vsapi.?.getFramePropertiesRO.?(frame), "_Transfer", 0, &err);
const reszplugin = vsapi.?.getPluginByID.?(vsh.RESIZE_PLUGIN_ID, core);
if (transfer_in == 8) {
return in;
}

const reszplugin = vsapi.?.getPluginByID.?(vsh.RESIZE_PLUGIN_ID, core);
const args = vsapi.?.createMap.?();
var ret: ?*vs.Map = null;

if (transfer_in != 8) {
_ = vsapi.?.mapConsumeNode.?(args, "clip", in, .Replace);
_ = vsapi.?.mapSetData.?(args, "prop", "_Transfer", -1, .Utf8, .Replace);
_ = vsapi.?.mapSetInt.?(args, "intval", 13, .Replace);
const stdplugin = vsapi.?.getPluginByID.?(vsh.STD_PLUGIN_ID, core);
ret = vsapi.?.invoke.?(stdplugin, "SetFrameProp", args);
in = vsapi.?.mapGetNode.?(ret, "clip", 0, null);
vsapi.?.freeMap.?(ret);
vsapi.?.clearMap.?(args);
}
_ = vsapi.?.mapConsumeNode.?(args, "clip", in, .Replace);
_ = vsapi.?.mapSetData.?(args, "prop", "_Transfer", -1, .Utf8, .Replace);
_ = vsapi.?.mapSetInt.?(args, "intval", 13, .Replace);
const stdplugin = vsapi.?.getPluginByID.?(vsh.STD_PLUGIN_ID, core);
ret = vsapi.?.invoke.?(stdplugin, "SetFrameProp", args);
in = vsapi.?.mapGetNode.?(ret, "clip", 0, null);
vsapi.?.freeMap.?(ret);
vsapi.?.clearMap.?(args);

_ = vsapi.?.mapConsumeNode.?(args, "clip", in, .Replace);
_ = vsapi.?.mapSetInt.?(args, "transfer", 8, .Replace);
ret = vsapi.?.invoke.?(reszplugin, "Bicubic", args);
const out = vsapi.?.mapGetNode.?(ret, "clip", 0, null);
vsapi.?.freeMap.?(ret);
vsapi.?.freeMap.?(args);

return out;
}

0 comments on commit e63c8ca

Please sign in to comment.