diff --git a/src/CommonMacros.h b/src/CommonMacros.h new file mode 100644 index 0000000..a004201 --- /dev/null +++ b/src/CommonMacros.h @@ -0,0 +1,6 @@ +#ifndef __COMMON_M__ +#define __COMMON_M__ + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) + +#endif // __COMMON_M__ diff --git a/src/MVAnalyse.c b/src/MVAnalyse.c index ef6c14e..f3986c5 100644 --- a/src/MVAnalyse.c +++ b/src/MVAnalyse.c @@ -11,6 +11,7 @@ #include "DCTFFTW.h" #include "GroupOfPlanes.h" #include "MVAnalysisData.h" +#include "CommonMacros.h" typedef struct MVAnalyseData { @@ -630,7 +631,7 @@ static void VS_CC mvanalyseCreate(const VSMap *in, VSMap *out, void *userData, V {data->node, rpGeneral} //super }; - vsapi->createVideoFilter(out, "Analyse", data->vi, mvanalyseGetFrame, mvanalyseFree, fmParallel, deps, 1, data, core); + vsapi->createVideoFilter(out, "Analyse", data->vi, mvanalyseGetFrame, mvanalyseFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVBlockFPS.c b/src/MVBlockFPS.c index dd56c29..c8ccf56 100644 --- a/src/MVBlockFPS.c +++ b/src/MVBlockFPS.c @@ -32,6 +32,8 @@ #include "MVAnalysisData.h" #include "Overlap.h" #include "SimpleResize.h" +#include "CommonMacros.h" + typedef struct MVBlockFPSData { @@ -982,7 +984,7 @@ static void VS_CC mvblockfpsCreate(const VSMap *in, VSMap *out, void *userData, {data->mvbw, rpGeneral}, {data->mvfw, rpGeneral}, }; - vsapi->createVideoFilter(out, "BlockFPS", &data->vi, mvblockfpsGetFrame, mvblockfpsFree, fmParallel, deps, 4, data, core); + vsapi->createVideoFilter(out, "BlockFPS", &data->vi, mvblockfpsGetFrame, mvblockfpsFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); // AssumeFPS sets the _DurationNum and _DurationDen properties. VSNode *node = vsapi->mapGetNode(out, "clip", 0, NULL); diff --git a/src/MVCompensate.c b/src/MVCompensate.c index 33088b1..3caf755 100644 --- a/src/MVCompensate.c +++ b/src/MVCompensate.c @@ -27,6 +27,8 @@ #include "Overlap.h" #include "MaskFun.h" #include "MVAnalysisData.h" +#include "CommonMacros.h" + typedef struct MVCompensateData { @@ -569,7 +571,7 @@ static void VS_CC mvcompensateCreate(const VSMap *in, VSMap *out, void *userData {data->vectors, rpGeneral}, }; - vsapi->createVideoFilter(out, "Compensate", data->vi, mvcompensateGetFrame, mvcompensateFree, fmParallel, deps, 3, data, core); + vsapi->createVideoFilter(out, "Compensate", data->vi, mvcompensateGetFrame, mvcompensateFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVDegrains.cpp b/src/MVDegrains.cpp index 6c6ef26..57be230 100644 --- a/src/MVDegrains.cpp +++ b/src/MVDegrains.cpp @@ -32,6 +32,8 @@ #include "MVDegrains.h" #include "MVFrame.h" #include "Overlap.h" +#include "CommonMacros.h" + struct MVDegrainData { VSNode *node; diff --git a/src/MVDepan.cpp b/src/MVDepan.cpp index 3a46ec6..f419c4f 100644 --- a/src/MVDepan.cpp +++ b/src/MVDepan.cpp @@ -9,6 +9,8 @@ #include "Fakery.h" #include "MVAnalysisData.h" +#include "CommonMacros.h" + #define prop_DepanAnalyse_info "DepanAnalyse_info" @@ -597,7 +599,7 @@ static void VS_CC depanAnalyseCreate(const VSMap *in, VSMap *out, void *userData {data->mask, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "DepanAnalyse", data->vi, depanAnalyseGetFrame, depanAnalyseFree, fmParallel, deps, 1, data, core); + vsapi->createVideoFilter(out, "DepanAnalyse", data->vi, depanAnalyseGetFrame, depanAnalyseFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); if (vsapi->mapGetError(out)) { depanAnalyseFree(data, core, vsapi); @@ -1454,7 +1456,7 @@ static void VS_CC depanEstimateCreate(const VSMap *in, VSMap *out, void *userDat {data1->clip, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "DepanEstimateStage1", data1->vi, depanEstimateStage1GetFrame, depanEstimateFree, fmParallel, deps1, 1, data1, core); + vsapi->createVideoFilter(out, "DepanEstimateStage1", data1->vi, depanEstimateStage1GetFrame, depanEstimateFree, fmParallel, deps1, ARRAY_SIZE(deps1), data1, core); if (vsapi->mapGetError(out)) { depanEstimateFree(data1, core, vsapi); @@ -1470,7 +1472,7 @@ static void VS_CC depanEstimateCreate(const VSMap *in, VSMap *out, void *userDat {data2->clip, rpGeneral}, }; - vsapi->createVideoFilter(out, "DepanEstimateStage2", data2->vi, depanEstimateStage2GetFrame, depanEstimateFree, fmParallel, deps2, 1, data2, core); + vsapi->createVideoFilter(out, "DepanEstimateStage2", data2->vi, depanEstimateStage2GetFrame, depanEstimateFree, fmParallel, deps2, ARRAY_SIZE(deps2), data2, core); if (vsapi->mapGetError(out)) { depanEstimateFree(data2, core, vsapi); @@ -1485,7 +1487,7 @@ static void VS_CC depanEstimateCreate(const VSMap *in, VSMap *out, void *userDat {data3->clip, rpGeneral}, }; - vsapi->createVideoFilter(out, "DepanEstimateStage3", data3->vi, depanEstimateStage3GetFrame, depanEstimateFree, fmParallel, deps3, 1, data3, core); + vsapi->createVideoFilter(out, "DepanEstimateStage3", data3->vi, depanEstimateStage3GetFrame, depanEstimateFree, fmParallel, deps3, ARRAY_SIZE(deps3), data3, core); if (vsapi->mapGetError(out)) { depanEstimateFree(data3, core, vsapi); @@ -2863,7 +2865,7 @@ static void VS_CC depanCompensateCreate(const VSMap *in, VSMap *out, void *userD {data->data, rpGeneral}, }; - vsapi->createVideoFilter(out, "DepanCompensate", data->vi, depanCompensateGetFrame, depanCompensateFree, fmParallel, deps, 2, data, core); + vsapi->createVideoFilter(out, "DepanCompensate", data->vi, depanCompensateGetFrame, depanCompensateFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); if (vsapi->mapGetError(out)) { depanCompensateFree(data, core, vsapi); @@ -4190,7 +4192,7 @@ static void VS_CC depanStabiliseCreate(const VSMap *in, VSMap *out, void *userDa {d->data, rpGeneral}, }; - vsapi->createVideoFilter(out, "DepanStabilise", d->vi, getframe_functions[d->method], depanStabiliseFree, fmParallel, deps, 2, d, core); + vsapi->createVideoFilter(out, "DepanStabilise", d->vi, getframe_functions[d->method], depanStabiliseFree, fmParallel, deps, ARRAY_SIZE(deps), d, core); if (vsapi->mapGetError(out)) { depanStabiliseFree(d, core, vsapi); diff --git a/src/MVFinest.c b/src/MVFinest.c index 4edd3e9..c4c6f79 100644 --- a/src/MVFinest.c +++ b/src/MVFinest.c @@ -22,6 +22,8 @@ #include #include "MaskFun.h" +#include "CommonMacros.h" + typedef struct MVFinestData { @@ -204,7 +206,7 @@ static void VS_CC mvfinestCreate(const VSMap *in, VSMap *out, void *userData, VS {data->super, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "Finest", &data->vi, mvfinestGetFrame, mvfinestFree, fmParallel, deps, 1, data, core); + vsapi->createVideoFilter(out, "Finest", &data->vi, mvfinestGetFrame, mvfinestFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVFlow.cpp b/src/MVFlow.cpp index 79d1742..962e5cf 100644 --- a/src/MVFlow.cpp +++ b/src/MVFlow.cpp @@ -31,6 +31,8 @@ #include "MaskFun.h" #include "MVAnalysisData.h" #include "SimpleResize.h" +#include "CommonMacros.h" + enum FlowModes { @@ -587,7 +589,7 @@ static void VS_CC mvflowCreate(const VSMap *in, VSMap *out, void *userData, VSCo {data->vectors, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "Flow", data->vi, mvflowGetFrame, mvflowFree, fmParallel, deps, 3, data, core); + vsapi->createVideoFilter(out, "Flow", data->vi, mvflowGetFrame, mvflowFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVFlowBlur.c b/src/MVFlowBlur.c index 4cb92cd..41f6103 100644 --- a/src/MVFlowBlur.c +++ b/src/MVFlowBlur.c @@ -31,6 +31,8 @@ #include "MaskFun.h" #include "MVAnalysisData.h" #include "SimpleResize.h" +#include "CommonMacros.h" + typedef struct MVFlowBlurData { @@ -545,7 +547,7 @@ static void VS_CC mvflowblurCreate(const VSMap *in, VSMap *out, void *userData, {data->mvfw, rpGeneral}, }; - vsapi->createVideoFilter(out, "FlowBlur", data->vi, mvflowblurGetFrame, mvflowblurFree, fmParallel, deps, 4, data, core); + vsapi->createVideoFilter(out, "FlowBlur", data->vi, mvflowblurGetFrame, mvflowblurFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVFlowFPS.c b/src/MVFlowFPS.c index 2fa6ac4..0e40252 100644 --- a/src/MVFlowFPS.c +++ b/src/MVFlowFPS.c @@ -32,6 +32,8 @@ #include "SimpleResize.h" #include "MVFlowFPSHelper.h" +#include "CommonMacros.h" + typedef struct MVFlowFPSData { @@ -858,11 +860,11 @@ static void VS_CC mvflowfpsCreate(const VSMap *in, VSMap *out, void *userData, V {hf->vectors, rpStrictSpatial} }; - vsapi->createVideoFilter(out, "FlowFPSHelper", hb->vi, mvflowfpshelperGetFrame, mvflowfpshelperFree, fmParallel, hb_deps, 1, hb, core); + vsapi->createVideoFilter(out, "FlowFPSHelper", hb->vi, mvflowfpshelperGetFrame, mvflowfpshelperFree, fmParallel, hb_deps, ARRAY_SIZE(hb_deps), hb, core); d.mvbw = vsapi->mapGetNode(out, "clip", 0, NULL); vsapi->clearMap(out); - vsapi->createVideoFilter(out, "FlowFPSHelper", hf->vi, mvflowfpshelperGetFrame, mvflowfpshelperFree, fmParallel, hf_deps, 1, hf, core); + vsapi->createVideoFilter(out, "FlowFPSHelper", hf->vi, mvflowfpshelperGetFrame, mvflowfpshelperFree, fmParallel, hf_deps, ARRAY_SIZE(hf_deps), hf, core); d.mvfw = vsapi->mapGetNode(out, "clip", 0, NULL); vsapi->clearMap(out); @@ -876,7 +878,7 @@ static void VS_CC mvflowfpsCreate(const VSMap *in, VSMap *out, void *userData, V {data->mvbw, rpGeneral}, {data->mvfw, rpGeneral}, }; - vsapi->createVideoFilter(out, "FlowFPS", &data->vi, mvflowfpsGetFrame, mvflowfpsFree, fmParallel, deps, 4, data, core); + vsapi->createVideoFilter(out, "FlowFPS", &data->vi, mvflowfpsGetFrame, mvflowfpsFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); VSPlugin *std_plugin = vsapi->getPluginByID("com.vapoursynth.std", core); diff --git a/src/MVFlowInter.c b/src/MVFlowInter.c index de569f6..ec17c07 100644 --- a/src/MVFlowInter.c +++ b/src/MVFlowInter.c @@ -30,6 +30,8 @@ #include "MaskFun.h" #include "MVAnalysisData.h" #include "SimpleResize.h" +#include "CommonMacros.h" + typedef struct MVFlowInterData { @@ -690,7 +692,7 @@ static void VS_CC mvflowinterCreate(const VSMap *in, VSMap *out, void *userData, {data->mvfw, rpGeneral}, }; - vsapi->createVideoFilter(out, "FlowInter", data->vi, mvflowinterGetFrame, mvflowinterFree, fmParallel, deps, 4, data, core); + vsapi->createVideoFilter(out, "FlowInter", data->vi, mvflowinterGetFrame, mvflowinterFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVMask.c b/src/MVMask.c index 418272f..75a75f5 100644 --- a/src/MVMask.c +++ b/src/MVMask.c @@ -27,6 +27,8 @@ #include "MaskFun.h" #include "MVAnalysisData.h" #include "SimpleResize.h" +#include "CommonMacros.h" + typedef struct MVMaskData { @@ -340,7 +342,7 @@ static void VS_CC mvmaskCreate(const VSMap *in, VSMap *out, void *userData, VSCo {data->vectors, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "Mask", &data->vi, mvmaskGetFrame, mvmaskFree, fmParallel, deps, 2, data, core); + vsapi->createVideoFilter(out, "Mask", &data->vi, mvmaskGetFrame, mvmaskFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVRecalculate.c b/src/MVRecalculate.c index 3d5f71f..4a3faba 100644 --- a/src/MVRecalculate.c +++ b/src/MVRecalculate.c @@ -11,6 +11,8 @@ #include "Fakery.h" #include "GroupOfPlanes.h" #include "MVAnalysisData.h" +#include "CommonMacros.h" + typedef struct MVRecalculateData { @@ -547,7 +549,7 @@ static void VS_CC mvrecalculateCreate(const VSMap *in, VSMap *out, void *userDat {data->vectors, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "Recalculate", data->vi, mvrecalculateGetFrame, mvrecalculateFree, fmParallel, deps, 2, data, core); + vsapi->createVideoFilter(out, "Recalculate", data->vi, mvrecalculateGetFrame, mvrecalculateFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVSCDetection.c b/src/MVSCDetection.c index aee87a4..7326485 100644 --- a/src/MVSCDetection.c +++ b/src/MVSCDetection.c @@ -22,6 +22,8 @@ #include "Fakery.h" #include "MVAnalysisData.h" +#include "CommonMacros.h" + @@ -130,7 +132,7 @@ static void VS_CC mvscdetectionCreate(const VSMap *in, VSMap *out, void *userDat {data->node, rpStrictSpatial}, {data->vectors, rpStrictSpatial}, }; - vsapi->createVideoFilter(out, "SCDetection", data->vi, mvscdetectionGetFrame, mvscdetectionFree, fmParallel, deps, 2, data, core); + vsapi->createVideoFilter(out, "SCDetection", data->vi, mvscdetectionGetFrame, mvscdetectionFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); } diff --git a/src/MVSuper.c b/src/MVSuper.c index cd4d195..9a80549 100644 --- a/src/MVSuper.c +++ b/src/MVSuper.c @@ -6,6 +6,8 @@ #include #include "MVFrame.h" +#include "CommonMacros.h" + typedef struct MVSuperData { @@ -269,7 +271,7 @@ static void VS_CC mvsuperCreate(const VSMap *in, VSMap *out, void *userData, VSC {data->node, rpStrictSpatial} }; - vsapi->createVideoFilter(out, "Super", &data->vi, mvsuperGetFrame, mvsuperFree, fmParallel, deps, 1, data, core); + vsapi->createVideoFilter(out, "Super", &data->vi, mvsuperGetFrame, mvsuperFree, fmParallel, deps, ARRAY_SIZE(deps), data, core); }