Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nnedi3/PlanarFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ class PlanarFrame
int GetPitch(uint8_t plane);
int getCPUFlags(void) {return cpu;}
inline void BitBlt(uint8_t *dstp,int dst_pitch,const uint8_t *srcp,int src_pitch,int row_size,int height);
PlanarFrame& PlanarFrame::operator=(PlanarFrame &ob2);
PlanarFrame& operator=(PlanarFrame &ob2);
void convYUY2to422(const uint8_t *src,uint8_t *py,uint8_t *pu,uint8_t *pv,int pitch1,int pitch2Y,int pitch2UV,
int width,int height);
void convRGB24to444(const uint8_t *src,uint8_t *py,uint8_t *pu,uint8_t *pv,int pitch1,int pitch2Y,int pitch2UV,
int width,int height);
};

#endif
#endif
2 changes: 1 addition & 1 deletion nnedi3/ThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef __ThreadPool_H__
#define __ThreadPool_H__

#include <Windows.h>
#include <windows.h>

#include "./ThreadPoolDef.h"

Expand Down
2 changes: 1 addition & 1 deletion nnedi3/ThreadPoolInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifndef __ThreadPoolInterface_H__
#define __ThreadPoolInterface_H__

#include <Windows.h>
#include <windows.h>
#include <vector>

#include "./ThreadPoolDef.h"
Expand Down
4 changes: 2 additions & 2 deletions nnedi3/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define __Internal_H__

#define AVS_VERSION 2.56
#define AVS_VERSTR "AviSynth 2.56, build:"__DATE__" ["__TIME__"]"
#define AVS_VERSTR "AviSynth 2.56, build:\"__DATE__\" [\"__TIME__\"]"


// env->ManageCache() Non user keys definition
Expand All @@ -47,7 +47,7 @@


#include "./avisynth.h"

#include <cstring>


int RGB2YUV(int rgb);
Expand Down
15 changes: 10 additions & 5 deletions nnedi3/nnedi3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
** Modified by JPSDR
*/

#include "./nnedi3.h"
#include "nnedi3.h"

#if _MSC_VER >= 1900
#define AVX2_BUILD_POSSIBLE
Expand Down Expand Up @@ -427,7 +427,7 @@ nnedi3::nnedi3(PClip _child,int _field,bool _dh,bool _Y,bool _U,bool _V,bool _A,
#endif

char buf[512];
sprintf_s(buf,512,"nnedi3: auto-detected opt setting = %d (%d)\n",opt,CPUF);
snprintf(buf,512,"nnedi3: auto-detected opt setting = %d (%d)\n",opt,CPUF);
OutputDebugString(buf);
}

Expand Down Expand Up @@ -554,7 +554,7 @@ nnedi3::nnedi3(PClip _child,int _field,bool _dh,bool _Y,bool _U,bool _V,bool _A,
}

// 16 bit pixels will be shifted by 1 for the prescreener.
const int prescreener_bits = min(bits_per_pixel,15);
const int prescreener_bits = min((int)bits_per_pixel,15);
const double half = (((int)1 << prescreener_bits)-1)/2.0;

// Factor mean removal and 1.0/half scaling
Expand Down Expand Up @@ -598,7 +598,7 @@ nnedi3::nnedi3(PClip _child,int _field,bool _dh,bool _Y,bool _U,bool _V,bool _A,
float *wf = (float *)&ws[4*48];

// 16 bit pixels will be shifted by 1 for the prescreener.
const int prescreener_bits = min(bits_per_pixel,15);
const int prescreener_bits = min((int)bits_per_pixel,15);
const double half = (((int)1 << prescreener_bits)-1)/2.0;

// Factor mean removal and 1.0/half scaling
Expand Down Expand Up @@ -4708,8 +4708,13 @@ AVSValue __cdecl Create_nnedi3_rpow2(AVSValue args, void* user_data, IScriptEnvi

const AVS_Linkage *AVS_linkage = nullptr;

#ifdef _MSC_VER
#define EXPORT extern "C" __declspec(dllexport)
#else
#define EXPORT extern "C" __stdcall
#endif

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors)
EXPORT const char* AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors)
{
AVS_linkage = vectors;

Expand Down
15 changes: 14 additions & 1 deletion nnedi3/nnedi3.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@
#include "./avisynth.h"
#include "./PlanarFrame.h"
#include "./ThreadPoolInterface.h"
#ifndef _MSC_VER
#define _strnicmp strncasecmp
#endif

#include <stdlib.h>

using namespace std;

#ifndef _MSC_VER
#define _aligned_malloc(size, alignment) aligned_alloc(size, alignment)
// Note: This is safe on Unix. see `man 3 aligned_alloc`
#define _aligned_free(m) free(m)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpsdr You might be right about this on Windows but using free on aligned memory is fine on Unix.

#endif

#define NUM_NSIZE 7
#define NUM_NNS 5
Expand Down Expand Up @@ -99,7 +112,7 @@ class nnedi3 : public GenericVideoFilter
nnedi3(PClip _child,int _field,bool _dh,bool _Y,bool _U,bool _V,bool _A,int _nsize,int _nns,int _qual,int _etype,
int _pscrn,uint8_t _threads,int _opt,int _fapprox,bool _sleep,int range_mode, bool negativePrefetch,bool _asvp,IScriptEnvironment *env);
virtual ~nnedi3();
PVideoFrame __stdcall nnedi3::GetFrame(int n,IScriptEnvironment *env);
PVideoFrame __stdcall GetFrame(int n,IScriptEnvironment *env);

int __stdcall SetCacheHints(int cachehints, int frame_range);
};