Skip to content

Commit

Permalink
Path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Maverick Tse authored and Maverick Tse committed Oct 29, 2016
1 parent 50c5e30 commit b89b49b
Show file tree
Hide file tree
Showing 11 changed files with 621 additions and 194 deletions.
59 changes: 36 additions & 23 deletions SigColorFastAviUtl/LUT.cpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,57 @@
#include "LUT.h"

//#define NOMINMAX
//#include <Windows.h>


LUT::LUT(): table{}, kmin{0}, kmax{0}, kstep{1}
{ // Nothing todo
}


LUT::~LUT()
{
//MessageBox(NULL, "~LUT", "Dtor", MB_OK | MB_ICONINFORMATION);
}




int LUT::lookup(int key)
{
/* Clamp to min max */
if (key > kmax)
///* Clamp to min max */
//if (key > kmax)
//{
// key = kmax;
//}
//else if (key < kmin)
//{
// key = kmin;
//}
//else
//{
// //OK
//}
///** quantize key to the nearest valid value **/
//key = ((key - kmin) / kstep)*kstep + kmin;
///* lookup */
//int ret;
//try
//{
// ret = table.at(key);
//}
//catch (std::out_of_range e)
//{
// ret = kmin;
//}
//return ret;
auto result = table.lower_bound(key);
if (result != table.end())
{
key = kmax;
}
else if (key < kmin)
{
key = kmin;
return result->second;
}
else
{
//OK
}
/** quantize key to the nearest valid value **/
key = ((key - kmin) / kstep)*kstep + kmin;
/* lookup */
int ret;
try
{
ret = table.at(key);
}
catch (std::out_of_range e)
{
ret = kmin;
return table.rbegin()->second;
}
return ret;
}

int LUT::min() const
Expand Down
3 changes: 2 additions & 1 deletion SigColorFastAviUtl/LUT.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class LUT
{
public:
LUT();
~LUT();
virtual ~LUT();
int lookup(int key);
//Getter
int min() const;
Expand All @@ -24,5 +24,6 @@ class LUT
protected:
std::map<int, int> table;
int kmin, kmax, kstep;

};

47 changes: 47 additions & 0 deletions SigColorFastAviUtl/RSigmoidTable.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "RSigmoidTable.h"
#include <xmmintrin.h>
//#define NOMINMAX
//#include <Windows.h>



RSigmoidTable::RSigmoidTable(float midtone, float strength, int bin, float multiplier)
{
kstep = static_cast<int>(multiplier / static_cast<float>(bin));
kmin = kstep / 2;
kmax = kmin + kstep*bin;

for (int x = kmin; x <= kmax; x += kstep)
{
float u = static_cast<float>(x) / multiplier;
float a = midtone;
float b = strength;
//float e1, e2, e3, e4;
float result[4]{ 0 };
result[0] = std::expf(b*(a - u));
result[1] = std::expf(a*b);
result[2] = std::expf(b*(a - 1));
result[3] = result[1];

__m128 ei = _mm_loadu_ps(result);
__m128 v1 = _mm_set1_ps(1.0f);
__m128 dst = _mm_add_ps(ei, v1);
ei = _mm_div_ps(v1, dst);

_mm_storeu_ps(result, ei);
float y = (result[0] - result[1]) / (result[2] - result[3]);
y *= multiplier;
table.insert({ static_cast<int>(y), x });
}
kmin = table.begin()->first;
kmax = table.rbegin()->first;
kstep = (table.begin()++)->first - kmin;
}

RSigmoidTable::~RSigmoidTable()
{
table.clear();

//MessageBox(NULL, "~RSigTable", "Dtor", MB_OK | MB_ICONINFORMATION);
}

10 changes: 10 additions & 0 deletions SigColorFastAviUtl/RSigmoidTable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include "LUT.h"
class RSigmoidTable :
public LUT
{
public:
RSigmoidTable(float midtone, float strength, int bin, float multiplier);
~RSigmoidTable();
};

21 changes: 13 additions & 8 deletions SigColorFastAviUtl/SigColorFastAviUtl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<LinkIncremental>true</LinkIncremental>
<OutDir>$(UtlPath)</OutDir>
<TargetExt>.auf</TargetExt>
<TargetName>$(ProjectName)d</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
Expand Down Expand Up @@ -81,6 +82,8 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>Fast</FloatingPointModel>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<AdditionalOptions>/Qpar-report:1 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -92,16 +95,18 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\filter.h" />
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\Histogram.h" />
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\LUT.h" />
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\SigmoidTable.h" />
<ClInclude Include="filter.h" />
<ClInclude Include="Histogram.h" />
<ClInclude Include="LUT.h" />
<ClInclude Include="RSigmoidTable.h" />
<ClInclude Include="SigmoidTable.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\Histogram.cpp" />
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\LUT.cpp" />
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\sigcolorfastaviutl.cpp" />
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\SigmoidTable.cpp" />
<ClCompile Include="Histogram.cpp" />
<ClCompile Include="LUT.cpp" />
<ClCompile Include="RSigmoidTable.cpp" />
<ClCompile Include="sigcolorfastaviutl.cpp" />
<ClCompile Include="SigmoidTable.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
22 changes: 14 additions & 8 deletions SigColorFastAviUtl/SigColorFastAviUtl.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,36 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\filter.h">
<ClInclude Include="filter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\LUT.h">
<ClInclude Include="Histogram.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\Histogram.h">
<ClInclude Include="LUT.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\SigmoidTable.h">
<ClInclude Include="SigmoidTable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RSigmoidTable.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\sigcolorfastaviutl.cpp">
<ClCompile Include="Histogram.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LUT.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\LUT.cpp">
<ClCompile Include="sigcolorfastaviutl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\Histogram.cpp">
<ClCompile Include="SigmoidTable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\maverick tse%27s documents\visual studio 2015\Projects\SigColorFastAviUtl\SigColorFastAviUtl\SigmoidTable.cpp">
<ClCompile Include="RSigmoidTable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions SigColorFastAviUtl/SigColorFastAviUtl.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
<LocalDebuggerAttach>false</LocalDebuggerAttach>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>$(UtlPath)aviutl.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(UtlPath)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
8 changes: 8 additions & 0 deletions SigColorFastAviUtl/SigmoidTable.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "SigmoidTable.h"
#include <cmath>
#include <xmmintrin.h>
//#define NOMINMAX
//#include <Windows.h>



Expand Down Expand Up @@ -32,3 +34,9 @@ SigmoidTable::SigmoidTable(float midtone, float strength, int bin, float multipl
table.insert({ x, static_cast<int>(y) });
}
}

SigmoidTable::~SigmoidTable()
{
table.clear();
//MessageBox(NULL, "~SigTable", "Dtor", MB_OK | MB_ICONINFORMATION);
}
2 changes: 1 addition & 1 deletion SigColorFastAviUtl/SigmoidTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ class SigmoidTable :
{
public:
SigmoidTable(float midtone, float strength, int bin, float multiplier);
~SigmoidTable()=default;
~SigmoidTable();
};

18 changes: 13 additions & 5 deletions SigColorFastAviUtl/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,19 @@ typedef struct {

#define MID_FILTER_BUTTON 12004

BOOL func_proc(FILTER *fp, FILTER_PROC_INFO *fpip);
BOOL func_init(FILTER *fp);
BOOL func_exit(FILTER *fp);
BOOL func_update(FILTER *fp, int status);
BOOL func_WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, void *editp, FILTER *fp);
BOOL func_proc_con(FILTER *fp, FILTER_PROC_INFO *fpip);
BOOL func_init_con(FILTER *fp);
BOOL func_exit_con(FILTER *fp);
BOOL func_update_con(FILTER *fp, int status);
BOOL func_WndProc_con(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, void *editp, FILTER *fp);

BOOL func_proc_sd(FILTER *fp, FILTER_PROC_INFO *fpip);
BOOL func_init_sd(FILTER *fp);
BOOL func_exit_sd(FILTER *fp);
BOOL func_update_sd(FILTER *fp, int status);
BOOL func_WndProc_sd(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, void *editp, FILTER *fp);


BOOL func_save_start(FILTER *fp, int s, int e, void *editp);
BOOL func_save_end(FILTER *fp, void *editp);
BOOL func_is_saveframe(FILTER *fp, void *editp, int saveno, int frame, int fps, int edit_flag, int inter);
Expand Down
Loading

0 comments on commit b89b49b

Please sign in to comment.