Skip to content

Commit

Permalink
Fix multiple use of plugin in same script
Browse files Browse the repository at this point in the history
It is now possible to use the plugin more than once in the same avs
script.
  • Loading branch information
jojje committed Sep 11, 2021
1 parent 82bb3be commit 38408b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions SmoothSkip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

void raiseError(IScriptEnvironment* env, const char* msg);
double GetFps(PClip clip);
std::mutex frameMappingMutex;

// ==========================================================================
// PUBLIC methods
Expand Down Expand Up @@ -179,7 +178,7 @@ FrameMap SmoothSkip::getFrameMapping(IScriptEnvironment* env, int n) {
int ccsf = cycleCount * cycle.length; // Child cycle start frame

{
std::lock_guard<std::mutex> lockGuard(frameMappingMutex); // Ensure only one thread updates the frame map at a time to optimize disk I/O and Avisynth cache use.
std::lock_guard<std::mutex> lockGuard(mutex); // Ensure only one thread updates the frame map at a time to optimize disk I/O and Avisynth cache use.
if (!cycle.includes(ccsf)) { // Cycle stats have not been computed, so try to update the cycle.
#ifdef DEBUG
printf("Frame %d not in cycle, updating!\n", n);
Expand Down
1 change: 1 addition & 0 deletions SmoothSkip.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ 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;
Expand Down

0 comments on commit 38408b8

Please sign in to comment.