Skip to content

Commit 7117c28

Browse files
committed
Update to 0.9.1
1 parent 3e6d4a0 commit 7117c28

File tree

12 files changed

+1543
-173
lines changed

12 files changed

+1543
-173
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
##### 0.9.1:
2+
Changed MT mode from MT_NICE_FILTER to MT_MULTI_INSTANCE.
3+
Added support for 10..16-bit clips.
4+
Added AVX2 and AVX512 code.
5+
Added parameter opt.
6+
Added support for frame properties passthrough.
7+
Added version.
8+
9+
##### 0.9.0:
10+
Initial release.

CMakeLists.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
project(libvinverse LANGUAGES CXX)
4+
5+
add_library(vinverse SHARED
6+
vinverse/vinverse.cpp
7+
vinverse/vinverse_sse2.cpp
8+
vinverse/vinverse_avx2.cpp
9+
vinverse/vinverse_avx512.cpp
10+
)
11+
12+
target_include_directories(vinverse PRIVATE
13+
${CMAKE_CURRENT_SOURCE_DIR}/vinverse
14+
/usr/local/include/avisynth
15+
)
16+
17+
if (NOT CMAKE_BUILD_TYPE)
18+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
19+
endif()
20+
21+
string(TOLOWER ${CMAKE_BUILD_TYPE} build_type)
22+
if (build_type STREQUAL debug)
23+
target_compile_definitions(vinverse PRIVATE DEBUG_BUILD)
24+
else (build_type STREQUAL release)
25+
target_compile_definitions(vinverse PRIVATE RELEASE_BUILD)
26+
endif ()
27+
28+
message(STATUS "Build type - ${CMAKE_BUILD_TYPE}")
29+
30+
target_compile_features(vinverse PRIVATE cxx_std_17)
31+
32+
set_source_files_properties(vinverse/vinverse_sse2.cpp PROPERTIES COMPILE_OPTIONS "-mfpmath=sse;-msse2")
33+
set_source_files_properties(vinverse/vinverse_avx2.cpp PROPERTIES COMPILE_OPTIONS "-mavx2;-mfma")
34+
set_source_files_properties(vinverse/vinverse_avx512.cpp PROPERTIES COMPILE_OPTIONS "-mavx512f;-mavx512bw;-mavx512dq;-mavx512vl;-mfma")
35+
36+
find_package (Git)
37+
38+
if (GIT_FOUND)
39+
execute_process (COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0
40+
OUTPUT_VARIABLE ver
41+
OUTPUT_STRIP_TRAILING_WHITESPACE
42+
)
43+
set_target_properties(vinverse PROPERTIES OUTPUT_NAME "vinverse.${ver}")
44+
else ()
45+
message (STATUS "GIT not found")
46+
endif ()
47+
48+
include(GNUInstallDirs)
49+
50+
INSTALL(TARGETS vinverse LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/avisynth")
51+
52+
# uninstall target
53+
if(NOT TARGET uninstall)
54+
configure_file(
55+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
56+
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
57+
IMMEDIATE @ONLY)
58+
59+
add_custom_target(uninstall
60+
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
61+
endif()

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## Description
2+
3+
Vinverse is a simple filter to remove residual combing, based on an AviSynth script by Didée and originally written by tritical.
4+
5+
This plugin also includes a fast implementation of [Vinverse2 function](https://forum.doom9.org/showthread.php?p=1584186#post1584186).
6+
7+
### Requirements:
8+
9+
- AviSynth 2.60 / AviSynth+ 3.4 or later
10+
11+
- Microsoft VisualC++ Redistributable Package 2022 (can be downloaded from [here](https://github.com/abbodi1406/vcredist/releases)) (Windows only)
12+
13+
### Usage:
14+
15+
```
16+
vinverse (clip input, float "sstr", int "amnt", int "uv", float "scl", int "opt")
17+
```
18+
```
19+
vinverse2 (clip input, float "sstr", int "amnt", int "uv", float "scl", int "opt")
20+
```
21+
22+
### Parameters:
23+
24+
- input\
25+
A clip to process.\
26+
Must be in YUV 8..16-bit planar format.
27+
28+
- sstr\
29+
Strength of contra sharpening.\
30+
Default: 2.7.
31+
32+
- amnt\
33+
Change no pixel by more than this.\
34+
Default: range_max ((2 ^ bit_depth) - 1).
35+
36+
- uv\
37+
Chroma mode.\
38+
1: Return garbage.\
39+
2: Copy plane.\
40+
3: Process plane.\
41+
Default: 3.
42+
43+
- scl\
44+
Scale factor for `VshrpD*VblurD < 0`.\
45+
Default: 0.25.
46+
47+
- opt\
48+
Sets which cpu optimizations to use.\
49+
-1: Auto-detect.\
50+
0: Use C++ code.\
51+
1: Use SSE2 code.\
52+
2: Use AVX2 code.\
53+
3: Use AVX512 code.\
54+
Default: -1.
55+
56+
57+
### Building:
58+
59+
- Windows\
60+
Use solution files.
61+
62+
- Linux
63+
```
64+
Requirements:
65+
- Git
66+
- C++17 compiler
67+
- CMake >= 3.16
68+
```
69+
```
70+
git clone https://github.com/Asd-g/vinverse && \
71+
cd vinverse && \
72+
mkdir build && \
73+
cd build && \
74+
75+
cmake ..
76+
make -j$(nproc)
77+
sudo make install
78+
```

cmake_uninstall.cmake.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
2+
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
3+
endif()
4+
5+
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
6+
string(REGEX REPLACE "\n" ";" files "${files}")
7+
foreach(file ${files})
8+
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9+
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10+
exec_program(
11+
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12+
OUTPUT_VARIABLE rm_out
13+
RETURN_VALUE rm_retval
14+
)
15+
if(NOT "${rm_retval}" STREQUAL 0)
16+
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17+
endif()
18+
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19+
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20+
endif()
21+
endforeach()

msvc/vinverse.vcxproj

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
<PlatformToolset>v142</PlatformToolset>
3232
</PropertyGroup>
3333
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
34-
<ConfigurationType>Application</ConfigurationType>
34+
<ConfigurationType>DynamicLibrary</ConfigurationType>
3535
<UseDebugLibraries>false</UseDebugLibraries>
36-
<PlatformToolset>v142</PlatformToolset>
36+
<PlatformToolset>llvm</PlatformToolset>
3737
</PropertyGroup>
3838
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3939
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -43,7 +43,7 @@
4343
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4444
<ConfigurationType>DynamicLibrary</ConfigurationType>
4545
<UseDebugLibraries>false</UseDebugLibraries>
46-
<PlatformToolset>v142</PlatformToolset>
46+
<PlatformToolset>llvm</PlatformToolset>
4747
</PropertyGroup>
4848
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4949
<ImportGroup Label="ExtensionSettings">
@@ -67,7 +67,8 @@
6767
<LinkIncremental>true</LinkIncremental>
6868
</PropertyGroup>
6969
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
70-
<LinkIncremental>true</LinkIncremental>
70+
<LinkIncremental>false</LinkIncremental>
71+
<IncludePath>..\..\AviSynthPlus\avs_core\include;$(IncludePath)</IncludePath>
7172
</PropertyGroup>
7273
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
7374
<IncludePath>..\..\AviSynthPlus\avs_core\include;$(IncludePath)</IncludePath>
@@ -76,6 +77,16 @@
7677
<LinkIncremental>false</LinkIncremental>
7778
<IncludePath>..\..\AviSynthPlus\avs_core\include;$(IncludePath)</IncludePath>
7879
</PropertyGroup>
80+
<PropertyGroup Label="LLVM" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
81+
<UseLldLink>true</UseLldLink>
82+
<LldLinkAdditionalOptions>
83+
</LldLinkAdditionalOptions>
84+
<ClangClAdditionalOptions>
85+
</ClangClAdditionalOptions>
86+
</PropertyGroup>
87+
<PropertyGroup Label="LLVM" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
88+
<UseLldLink>true</UseLldLink>
89+
</PropertyGroup>
7990
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
8091
<ClCompile>
8192
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -96,12 +107,19 @@
96107
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
97108
<WarningLevel>Level3</WarningLevel>
98109
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
110+
<LanguageStandard>stdcpp17</LanguageStandard>
111+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
112+
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
113+
<IntrinsicFunctions>true</IntrinsicFunctions>
114+
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
115+
<WholeProgramOptimization>true</WholeProgramOptimization>
116+
<FunctionLevelLinking>true</FunctionLevelLinking>
117+
<FloatingPointModel>Precise</FloatingPointModel>
99118
</ClCompile>
100119
<Link>
101120
<TargetMachine>MachineX86</TargetMachine>
102121
<GenerateDebugInformation>true</GenerateDebugInformation>
103122
<SubSystem>Windows</SubSystem>
104-
<EnableCOMDATFolding>true</EnableCOMDATFolding>
105123
<OptimizeReferences>true</OptimizeReferences>
106124
</Link>
107125
</ItemDefinitionGroup>
@@ -127,20 +145,20 @@
127145
<Link>
128146
<EnableCOMDATFolding>true</EnableCOMDATFolding>
129147
</Link>
130-
<Link>
131-
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
132-
</Link>
148+
<Link />
133149
</ItemDefinitionGroup>
134150
<ItemGroup>
135151
<ClCompile Include="..\vinverse\vcl2\instrset_detect.cpp" />
136152
<ClCompile Include="..\vinverse\vinverse.cpp" />
137153
<ClCompile Include="..\vinverse\vinverse_avx2.cpp">
138154
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
139155
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
156+
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
140157
</ClCompile>
141158
<ClCompile Include="..\vinverse\vinverse_avx512.cpp">
142159
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
143160
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
161+
<EnableEnhancedInstructionSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
144162
</ClCompile>
145163
<ClCompile Include="..\vinverse\vinverse_sse2.cpp" />
146164
</ItemGroup>
@@ -167,6 +185,9 @@
167185
<ClInclude Include="..\vinverse\vcl2\vector_convert.h" />
168186
<ClInclude Include="..\vinverse\vinverse.h" />
169187
</ItemGroup>
188+
<ItemGroup>
189+
<ResourceCompile Include="..\vinverse\vinverse.rc" />
190+
</ItemGroup>
170191
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
171192
<ImportGroup Label="ExtensionTargets">
172193
</ImportGroup>

msvc/vinverse.vcxproj.filters

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,9 @@
9696
<Filter>Header Files</Filter>
9797
</ClInclude>
9898
</ItemGroup>
99+
<ItemGroup>
100+
<ResourceCompile Include="..\vinverse\vinverse.rc">
101+
<Filter>Resource Files</Filter>
102+
</ResourceCompile>
103+
</ItemGroup>
99104
</Project>

0 commit comments

Comments
 (0)