[x264-devel] AvxSynth: Remove a bunch of unused cruft

Henrik Gramner git at videolan.org
Sat Dec 20 21:10:42 CET 2014


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Fri Nov 21 23:47:20 2014 +0100| [6a301b6ee0ae8c78fb704e1cd86f4e861070f641] | committer: Henrik Gramner

AvxSynth: Remove a bunch of unused cruft

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=6a301b6ee0ae8c78fb704e1cd86f4e861070f641
---

 extras/avxsynth_c.h                            |   12 ++--
 extras/windowsPorts/basicDataTypeConversions.h |   85 ------------------------
 extras/windowsPorts/windows2linux.h            |   77 ---------------------
 input/avs.c                                    |   10 +--
 4 files changed, 10 insertions(+), 174 deletions(-)

diff --git a/extras/avxsynth_c.h b/extras/avxsynth_c.h
index 2375dd2..a899ca8 100644
--- a/extras/avxsynth_c.h
+++ b/extras/avxsynth_c.h
@@ -33,8 +33,12 @@
 #ifndef __AVXSYNTH_C__
 #define __AVXSYNTH_C__
   
-#include "windowsPorts/windows2linux.h"
 #include <stdarg.h>
+#include <stdint.h>
+
+typedef int64_t INT64;
+#define __stdcall
+#define __declspec(x)
 
 #ifdef __cplusplus
 #  define EXTERN_C extern "C"
@@ -64,12 +68,6 @@
 #  endif
 #endif
 
-#ifdef __GNUC__
-typedef long long int INT64;
-#else
-typedef __int64 INT64;
-#endif
-
 
 /////////////////////////////////////////////////////////////////////
 //
diff --git a/extras/windowsPorts/basicDataTypeConversions.h b/extras/windowsPorts/basicDataTypeConversions.h
deleted file mode 100644
index b757ee7..0000000
--- a/extras/windowsPorts/basicDataTypeConversions.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __DATA_TYPE_CONVERSIONS_H__
-#define __DATA_TYPE_CONVERSIONS_H__
-
-#include <stdint.h>
-#include <wchar.h>
-
-#ifdef __cplusplus
-namespace avxsynth {
-#endif // __cplusplus
-
-typedef int64_t __int64;
-typedef int32_t __int32;
-#ifdef __cplusplus
-typedef bool	BOOL;
-#else
-typedef uint32_t BOOL;
-#endif // __cplusplus
-typedef void* HMODULE;
-typedef void* LPVOID;
-typedef void* PVOID;
-typedef PVOID HANDLE;
-typedef HANDLE HWND;
-typedef HANDLE HINSTANCE;
-typedef void* HDC;
-typedef void* HBITMAP;
-typedef void* HICON;
-typedef void* HFONT;
-typedef void* HGDIOBJ;
-typedef void* HBRUSH;
-typedef void* HMMIO;
-typedef void* HACMSTREAM;
-typedef void* HACMDRIVER;
-typedef void* HIC;
-typedef void* HACMOBJ;
-typedef HACMSTREAM* LPHACMSTREAM;
-typedef void* HACMDRIVERID;
-typedef void* LPHACMDRIVER;
-typedef unsigned char BYTE;
-typedef BYTE* LPBYTE;
-typedef char TCHAR;
-typedef TCHAR* LPTSTR;
-typedef const TCHAR* LPCTSTR;
-typedef char* LPSTR;
-typedef LPSTR LPOLESTR;
-typedef const char* LPCSTR;
-typedef LPCSTR LPCOLESTR;
-typedef wchar_t WCHAR;
-typedef unsigned short WORD;
-typedef unsigned int UINT;
-typedef UINT MMRESULT;
-typedef uint32_t DWORD;
-typedef DWORD COLORREF;
-typedef DWORD FOURCC;
-typedef DWORD HRESULT;
-typedef DWORD* LPDWORD;
-typedef DWORD* DWORD_PTR;
-typedef int32_t LONG;
-typedef int32_t* LONG_PTR;
-typedef LONG_PTR LRESULT;
-typedef uint32_t ULONG;
-typedef uint32_t* ULONG_PTR;
-//typedef __int64_t intptr_t;
-typedef uint64_t _fsize_t;
-
-
-//
-// Structures
-//
-
-typedef struct _GUID {
-  DWORD Data1;
-  WORD  Data2;
-  WORD  Data3;
-  BYTE  Data4[8];
-} GUID;
-
-typedef GUID REFIID;
-typedef GUID CLSID;
-typedef CLSID* LPCLSID;
-typedef GUID IID;
-
-#ifdef __cplusplus
-}; // namespace avxsynth
-#endif // __cplusplus
-#endif //  __DATA_TYPE_CONVERSIONS_H__
diff --git a/extras/windowsPorts/windows2linux.h b/extras/windowsPorts/windows2linux.h
deleted file mode 100644
index fd2948a..0000000
--- a/extras/windowsPorts/windows2linux.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __WINDOWS2LINUX_H__
-#define __WINDOWS2LINUX_H__
-
-/*
- * LINUX SPECIFIC DEFINITIONS
-*/
-//
-// Data types conversions
-//
-#include <stdlib.h>
-#include <string.h>
-#include "basicDataTypeConversions.h"
-
-#ifdef __cplusplus
-namespace avxsynth {
-#endif // __cplusplus
-//
-// purposefully define the following MSFT definitions 
-// to mean nothing (as they do not mean anything on Linux)
-//
-#define __stdcall
-#define __cdecl
-#define noreturn
-#define __declspec(x)
-#define STDAPI       extern "C" HRESULT
-#define STDMETHODIMP HRESULT __stdcall
-#define STDMETHODIMP_(x) x __stdcall
-
-#define STDMETHOD(x)    virtual HRESULT x
-#define STDMETHOD_(a, x) virtual a x
-
-#ifndef TRUE
-#define TRUE  true
-#endif 
-
-#ifndef FALSE
-#define FALSE false
-#endif
-
-#define S_OK                (0x00000000)
-#define S_FALSE             (0x00000001)
-#define E_NOINTERFACE       (0X80004002)
-#define E_POINTER           (0x80004003)
-#define E_FAIL              (0x80004005)
-#define E_OUTOFMEMORY       (0x8007000E)
-
-#define INVALID_HANDLE_VALUE    ((HANDLE)((LONG_PTR)-1))
-#define FAILED(hr)              ((hr) & 0x80000000)
-#define SUCCEEDED(hr)           (!FAILED(hr))
-
-
-// 
-// Functions
-//
-#define MAKEDWORD(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | (d))
-#define MAKEWORD(a,b) ((a << 8) | (b))
-
-#define lstrlen                             strlen
-#define lstrcpy                             strcpy
-#define lstrcmpi                            strcasecmp
-#define _stricmp                            strcasecmp
-#define InterlockedIncrement(x)             __sync_fetch_and_add((x), 1)
-#define InterlockedDecrement(x)             __sync_fetch_and_sub((x), 1)
-// Windows uses (new, old) ordering but GCC has (old, new)
-#define InterlockedCompareExchange(x,y,z)   __sync_val_compare_and_swap(x,z,y)
-
-#define UInt32x32To64(a, b)                 ( (uint64_t) ( ((uint64_t)((uint32_t)(a))) * ((uint32_t)(b))  ) ) 
-#define Int64ShrlMod32(a, b)                ( (uint64_t) ( (uint64_t)(a) >> (b) ) )
-#define Int32x32To64(a, b)                  ((__int64)(((__int64)((long)(a))) * ((long)(b))))
-
-#define MulDiv(nNumber, nNumerator, nDenominator)   (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator))
-
-#ifdef __cplusplus
-}; // namespace avxsynth
-#endif // __cplusplus
-
-#endif //  __WINDOWS2LINUX_H__
diff --git a/input/avs.c b/input/avs.c
index c1c3992..f5d6a3f 100644
--- a/input/avs.c
+++ b/input/avs.c
@@ -27,15 +27,15 @@
 #if USE_AVXSYNTH
 #include <dlfcn.h>
 #if SYS_MACOSX
-#define avs_open dlopen( "libavxsynth.dylib", RTLD_NOW )
+#define avs_open() dlopen( "libavxsynth.dylib", RTLD_NOW )
 #else
-#define avs_open dlopen( "libavxsynth.so", RTLD_NOW )
+#define avs_open() dlopen( "libavxsynth.so", RTLD_NOW )
 #endif
 #define avs_close dlclose
 #define avs_address dlsym
 #else
 #include <windows.h>
-#define avs_open LoadLibraryW( L"avisynth" )
+#define avs_open() LoadLibraryW( L"avisynth" )
 #define avs_close FreeLibrary
 #define avs_address GetProcAddress
 #endif
@@ -80,7 +80,7 @@ typedef struct
 {
     AVS_Clip *clip;
     AVS_ScriptEnvironment *env;
-    HMODULE library;
+    void *library;
     int num_frames;
     struct
     {
@@ -102,7 +102,7 @@ typedef struct
 /* load the library and functions we require from it */
 static int x264_avs_load_library( avs_hnd_t *h )
 {
-    h->library = avs_open;
+    h->library = avs_open();
     if( !h->library )
         return -1;
     LOAD_AVS_FUNC( avs_clip_get_error, 0 );



More information about the x264-devel mailing list