-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmoothSkip.h
56 lines (48 loc) · 2.26 KB
/
SmoothSkip.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SmoothSkip: AVISynth filter for processing stuttering clips
// Copyright (C) 2015 Jonas Tingeborn
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
#pragma once
#include "3rd-party/avisynth.h"
#include "cycle.h"
#include "CycleCache.h"
#include "FrameDiff.h"
#define VERSION "2.0.1"
class SmoothSkip : public GenericVideoFilter {
PClip altclip; // The super clip from MVTools2
bool debug; // debug arg
int offset; // frame offset used to get frame from the alternate clip.
std::mutex mutex;
public:
CycleCache* cycles;
SmoothSkip(PClip _child, PClip _altclip, int cycleLen, int creates, int offset,
double sceneThreshold, bool _debug, IScriptEnvironment* env);
~SmoothSkip();
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
private:
void updateCycle(IScriptEnvironment* env, int n, VideoInfo cvi, Cycle& cycle);
PVideoFrame info(IScriptEnvironment* env, PVideoFrame src, char* msg, int x, int y);
float GetDiffFromPrevious(IScriptEnvironment* env, int n);
FrameMap SmoothSkip::getFrameMapping(IScriptEnvironment* env, int n);
};
AVSValue __cdecl Create_SmoothSkip(AVSValue args, void* user_data, IScriptEnvironment* env);
const AVS_Linkage* AVS_linkage = 0;
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
AVS_linkage = vectors;
env->AddFunction("SmoothSkip", "cc[CYCLE]i[CREATE]i[OFFSET]f[SCENE]i[DEBUG]b", Create_SmoothSkip, 0);
return "'SmoothSkip' plugin v" VERSION ", author: tinjon[at]gmail.com";
}
void DrawString(PVideoFrame &dst, int x, int y, const char *s, int bIsYUY2);