Skip to content

Commit

Permalink
Port to most recent API4 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
myrsloik committed Jul 11, 2021
1 parent 4a07931 commit 50194b4
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 123 deletions.
16 changes: 8 additions & 8 deletions FFT3DFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static void Pattern2Dto3D(const float *pattern2d, int bh, int outwidth, int outp
}
}

const VSFrameRef *VS_CC FFT3DFilter::GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi) {
const VSFrame *VS_CC FFT3DFilter::GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi) {
FFT3DFilter *data = reinterpret_cast<FFT3DFilter *>(instance_data);
if (activation_reason == arInitial) {
int btcur = data->bt; /* bt used for current frame */
Expand Down Expand Up @@ -214,7 +214,7 @@ FFT3DFilter::FFT3DFilter
int _pframe, int _px, int _py, bool pshow, float _pcutoff, float _pfactor,
float _sigma2, float _sigma3, float _sigma4, float _degrid,
float _dehalo, float _hr, float _ht, int _ncpu,
VSNodeRef *_node, VSCore *core, const VSAPI *vsapi
VSNode *_node, VSCore *core, const VSAPI *vsapi
) : sigma(_sigma), beta(_beta), plane(_plane), bw(_bw), bh(_bh), bt(_bt), ow(_ow), oh(_oh),
kratio(_kratio), sharpen(_sharpen), scutoff(_scutoff), svr(_svr), smin(_smin), smax(_smax),
pframe(_pframe), px(_px), py(_py), pfactor(_pfactor),
Expand Down Expand Up @@ -298,15 +298,15 @@ template < int btcur >
void FFT3DFilter::Wiener3D
(
int n,
VSNodeRef *node,
VSFrameRef *dst,
VSNode *node,
VSFrame *dst,
VSFrameContext *frame_ctx,
const VSAPI *vsapi
) {
int fromframe = n - btcur / 2;
int outcenter = btcur / 2;
const fftwf_complex *frames[btcur] = {};
const VSFrameRef *frefs[btcur] = {};
const VSFrame *frefs[btcur] = {};

for (int i = 0; i < btcur; i++) {
frefs[i] = vsapi->getFrameFilter(fromframe + i, node, frame_ctx);
Expand Down Expand Up @@ -335,14 +335,14 @@ void FFT3DFilter::Wiener3D
vsapi->freeFrame(frefs[i]);
}

const VSFrameRef *FFT3DFilter::ApplyFilter
const VSFrame *FFT3DFilter::ApplyFilter
(
int n,
VSFrameContext *frame_ctx,
VSCore *core,
const VSAPI *vsapi
) {
const VSFrameRef *src = vsapi->getFrameFilter(n, node, frame_ctx);
const VSFrame *src = vsapi->getFrameFilter(n, node, frame_ctx);

int btcur = bt; /* bt used for current frame */

Expand All @@ -353,7 +353,7 @@ const VSFrameRef *FFT3DFilter::ApplyFilter
if (btcur == 0 && n == 0)
return src;

VSFrameRef *dst = (btcur == 0) ? vsapi->newVideoFrame(vsapi->getVideoFrameFormat(src), vsapi->getFrameWidth(src, 0), vsapi->getFrameHeight(src, 0), src, core) : vsapi->copyFrame(src, core);
VSFrame *dst = (btcur == 0) ? vsapi->newVideoFrame(vsapi->getVideoFrameFormat(src), vsapi->getFrameWidth(src, 0), vsapi->getFrameHeight(src, 0), src, core) : vsapi->copyFrame(src, core);

if (btcur > 0) /* Wiener */
{
Expand Down
42 changes: 21 additions & 21 deletions FFT3DFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FFT3DFilterTransform {
float pcutoff;
float degrid;
bool interlaced;
VSNodeRef *node;
VSNode *node;

std::unique_ptr<uint8_t[]> coverbuf; /* block buffer covering the frame without remainders (with sufficient width and heigth) */
int coverwidth;
Expand Down Expand Up @@ -94,14 +94,14 @@ class FFT3DFilterTransform {
public:
const VSVideoInfo *GetOutputVI() const { return &outvi; };

FFT3DFilterTransform(bool pshow, VSNodeRef *node, int plane, int wintype, int bw, int bh, int ow, int oh, int px, int py, float pcutoff, float degrid, bool interlaced, bool measure, int ncpu, VSCore *core, const VSAPI *vsapi);
const VSFrameRef *GetGridSample(VSCore *core, const VSAPI *vsapi);
VSFrameRef *GetFrame(const VSFrameRef *src, VSCore *core, const VSAPI *vsapi);
FFT3DFilterTransform(bool pshow, VSNode *node, int plane, int wintype, int bw, int bh, int ow, int oh, int px, int py, float pcutoff, float degrid, bool interlaced, bool measure, int ncpu, VSCore *core, const VSAPI *vsapi);
const VSFrame *GetGridSample(VSCore *core, const VSAPI *vsapi);
VSFrame *GetFrame(const VSFrame *src, VSCore *core, const VSAPI *vsapi);
void GetNoisePattern(int n, int &px, int &py, float *pattern2d, float &psigma, const fftwf_complex *gridsample, VSCore *core, const VSAPI *vsapi);
VSFrameRef *GetPShowInfo(const VSFrameRef *src, VSCore *core, const VSAPI *vsapi);
VSFrame *GetPShowInfo(const VSFrame *src, VSCore *core, const VSAPI *vsapi);

static const VSFrameRef *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrameRef *VS_CC GetPShowFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrame *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrame *VS_CC GetPShowFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static void VS_CC Free(void *instance_data, VSCore *core, const VSAPI *vsapi);
};

Expand All @@ -113,7 +113,7 @@ class FFT3DFilterInvTransform {
int ow;
int oh;
bool interlaced;
VSNodeRef *node;
VSNode *node;

std::unique_ptr<uint8_t[]> coverbuf; /* block buffer covering the frame without remainders (with sufficient width and heigth) */
int coverwidth;
Expand Down Expand Up @@ -141,13 +141,13 @@ class FFT3DFilterInvTransform {
std::unique_ptr<float[], decltype(&fftw_free)> in;
std::unique_ptr<fftwf_plan_s, decltype(&fftwf_destroy_plan)> planinv;

VSFrameRef *GetFrame(const VSFrameRef *src, VSCore *core, const VSAPI *vsapi);
VSFrame *GetFrame(const VSFrame *src, VSCore *core, const VSAPI *vsapi);
public:
const VSVideoInfo *GetOutputVI() const { return &dstvi; };

FFT3DFilterInvTransform(VSNodeRef *node, const VSVideoInfo *vi, int plane, int wintype, int bw, int bh, int ow, int oh, bool interlaced, bool measure, int ncpu, VSCore *core, const VSAPI *vsapi);
FFT3DFilterInvTransform(VSNode *node, const VSVideoInfo *vi, int plane, int wintype, int bw, int bh, int ow, int oh, bool interlaced, bool measure, int ncpu, VSCore *core, const VSAPI *vsapi);

static const VSFrameRef *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrame *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static void VS_CC Free(void *instance_data, VSCore *core, const VSAPI *vsapi);
};

Expand All @@ -159,15 +159,15 @@ class FFT3DFilterPShow {
int bh;
int ow;
int oh;
VSNodeRef *node;
VSNode *node;

const VSVideoInfo *vi;

public:
FFT3DFilterPShow(VSNodeRef *node, int plane, int bw, int bh, int ow, int oh, bool interlaced, VSCore *core, const VSAPI *vsapi);
VSFrameRef *GetFrame(const VSFrameRef *src, VSCore *core, const VSAPI *vsapi);
FFT3DFilterPShow(VSNode *node, int plane, int bw, int bh, int ow, int oh, bool interlaced, VSCore *core, const VSAPI *vsapi);
VSFrame *GetFrame(const VSFrame *src, VSCore *core, const VSAPI *vsapi);

static const VSFrameRef *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrame *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static void VS_CC Free(void *instance_data, VSCore *core, const VSAPI *vsapi);
};

Expand Down Expand Up @@ -202,7 +202,7 @@ class FFT3DFilter {

/* additional parameterss */

const VSFrameRef *gridsample;
const VSFrame *gridsample;
int nox, noy;
int outwidth;
ptrdiff_t outpitch;
Expand Down Expand Up @@ -230,13 +230,13 @@ class FFT3DFilter {
std::unique_ptr<float[], decltype(&fftw_free)> pattern3d;

const VSVideoInfo *vi;
VSNodeRef *node;
VSNode *node;

template < int btcur >
void Wiener3D(int n, VSNodeRef *node, VSFrameRef *dst, VSFrameContext *frame_ctx, const VSAPI *vsapi);
void Wiener3D(int n, VSNode *node, VSFrame *dst, VSFrameContext *frame_ctx, const VSAPI *vsapi);

public:
const VSFrameRef *ApplyFilter(int n, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
const VSFrame *ApplyFilter(int n, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);

/* Constructor */
FFT3DFilter
Expand All @@ -247,9 +247,9 @@ class FFT3DFilter {
int _pframe, int _px, int _py, bool _pshow, float _pcutoff, float _pfactor,
float _sigma2, float _sigma3, float _sigma4, float _degrid,
float _dehalo, float _hr, float _ht, int _ncpu,
VSNodeRef *node, VSCore *core, const VSAPI *vsapi
VSNode *node, VSCore *core, const VSAPI *vsapi
);

static const VSFrameRef *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static const VSFrame *VS_CC GetFrame(int n, int activation_reason, void *instance_data, void **frame_data, VSFrameContext *frame_ctx, VSCore *core, const VSAPI *vsapi);
static void VS_CC Free(void *instance_data, VSCore *core, const VSAPI *vsapi);
};
Loading

0 comments on commit 50194b4

Please sign in to comment.