diff --git a/README.md b/README.md index 5d7771b..2c46ae4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ psm.PlaneStatsMod(vnode clip[, float minthr=0, float maxthr=0, int plane=0]) ### Parameters: - clip\ - A clip to process. + A clip to process.\ + Gets frame props named ``psmMin`` and ``psmMax``. - minthr\ Amount of the smallest pixels dropped before pick the PlaneStatsMin.\ Should be a float between 0.0 and 1.0 diff --git a/src/PlaneMinMax.cpp b/src/PlaneMinMax.cpp index 316f923..846defc 100644 --- a/src/PlaneMinMax.cpp +++ b/src/PlaneMinMax.cpp @@ -79,10 +79,10 @@ static const VSFrame* VS_CC planeMinMaxGetFrame(int n, int activationReason, voi if (pixelsize == 4) { double retvalminf = retvalmin / 65535.0; - vsapi->mapSetFloat(dstProps, "PlaneStatsMin", retvalminf, maReplace); + vsapi->mapSetFloat(dstProps, "psmMin", retvalminf, maReplace); } else { - vsapi->mapSetInt(dstProps, "PlaneStatsMin", retvalmin, maReplace); + vsapi->mapSetInt(dstProps, "psmMin", retvalmin, maReplace); } } @@ -101,10 +101,10 @@ static const VSFrame* VS_CC planeMinMaxGetFrame(int n, int activationReason, voi if (pixelsize == 4) { double retvalmaxf = retvalmax / 65535.0; - vsapi->mapSetFloat(dstProps, "PlaneStatsMax", retvalmaxf, maReplace); + vsapi->mapSetFloat(dstProps, "psmMax", retvalmaxf, maReplace); } else { - vsapi->mapSetInt(dstProps, "PlaneStatsMax", retvalmax, maReplace); + vsapi->mapSetInt(dstProps, "psmMax", retvalmax, maReplace); } } @@ -160,18 +160,6 @@ static void VS_CC planeMinMaxCreate(const VSMap* in, VSMap* out, [[maybe_unused] return; } - if (d->minthr == 0 || d->maxthr == 0) { - VSMap* args = vsapi->createMap(); - vsapi->mapConsumeNode(args, "clipa", d->node, maAppend); - vsapi->mapSetInt(args, "plane", d->plane, maAppend); - vsapi->mapSetData(args, "prop", "PlaneStats", -1, dtUtf8, maAppend); - VSPlugin* stdplugin = vsapi->getPluginByID(VSH_STD_PLUGIN_ID, core); - VSMap* ret = vsapi->invoke(stdplugin, "PlaneStats", args); - d->node = vsapi->mapGetNode(ret, "clip", 0, nullptr); - vsapi->freeMap(args); - vsapi->freeMap(ret); - } - VSFilterDependency deps[] = { {d->node, rpStrictSpatial} }; vsapi->createVideoFilter(out, "PlaneMinMax", vi, planeMinMaxGetFrame, planeMinMaxFree, fmParallel, deps, 1, d.get(), core); d.release();