Skip to content

Commit

Permalink
Merge pull request #62 from sekrit-twc/eotf
Browse files Browse the repository at this point in the history
Fix #56, fix #61.
  • Loading branch information
sekrit-twc authored Jan 4, 2017
2 parents d1eff45 + ce8ac09 commit de3dfb6
Show file tree
Hide file tree
Showing 23 changed files with 571 additions and 612 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ libzimg_internal_la_SOURCES = \
src/zimg/colorspace/colorspace.h \
src/zimg/colorspace/colorspace_param.cpp \
src/zimg/colorspace/colorspace_param.h \
src/zimg/colorspace/gamma.cpp \
src/zimg/colorspace/gamma.h \
src/zimg/colorspace/graph.cpp \
src/zimg/colorspace/graph.h \
src/zimg/colorspace/matrix3.cpp \
Expand Down
2 changes: 2 additions & 0 deletions _msvc/zimg/zimg.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<ClInclude Include="..\..\src\zimg\api\zimg.h" />
<ClInclude Include="..\..\src\zimg\colorspace\colorspace.h" />
<ClInclude Include="..\..\src\zimg\colorspace\colorspace_param.h" />
<ClInclude Include="..\..\src\zimg\colorspace\gamma.h" />
<ClInclude Include="..\..\src\zimg\colorspace\graph.h" />
<ClInclude Include="..\..\src\zimg\colorspace\matrix3.h" />
<ClInclude Include="..\..\src\zimg\colorspace\operation.h" />
Expand Down Expand Up @@ -188,6 +189,7 @@
<ClCompile Include="..\..\src\zimg\api\zimg.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\colorspace.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\colorspace_param.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\gamma.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\graph.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\matrix3.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\operation_impl_avx.cpp">
Expand Down
6 changes: 6 additions & 0 deletions _msvc/zimg/zimg.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
<ClInclude Include="..\..\src\zimg\depth\hexfloat.h">
<Filter>Header Files\depth</Filter>
</ClInclude>
<ClInclude Include="..\..\src\zimg\colorspace\gamma.h">
<Filter>Header Files\colorspace</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\zimg\api\zimg.cpp">
Expand Down Expand Up @@ -311,5 +314,8 @@
<ClCompile Include="..\..\src\zimg\depth\quantize.cpp">
<Filter>Source Files\depth</Filter>
</ClCompile>
<ClCompile Include="..\..\src\zimg\colorspace\gamma.cpp">
<Filter>Source Files\colorspace</Filter>
</ClCompile>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions _msvc/zimg_universal/zimg_universal.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<ClCompile Include="..\..\src\zimg\api\zimg.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\colorspace.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\colorspace_param.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\gamma.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\graph.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\matrix3.cpp" />
<ClCompile Include="..\..\src\zimg\colorspace\operation.cpp" />
Expand Down Expand Up @@ -59,6 +60,7 @@
<ClInclude Include="..\..\src\zimg\api\zimg.h" />
<ClInclude Include="..\..\src\zimg\colorspace\colorspace.h" />
<ClInclude Include="..\..\src\zimg\colorspace\colorspace_param.h" />
<ClInclude Include="..\..\src\zimg\colorspace\gamma.h" />
<ClInclude Include="..\..\src\zimg\colorspace\graph.h" />
<ClInclude Include="..\..\src\zimg\colorspace\matrix3.h" />
<ClInclude Include="..\..\src\zimg\colorspace\operation.h" />
Expand Down
6 changes: 6 additions & 0 deletions _msvc/zimg_universal/zimg_universal.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@
<ClCompile Include="..\..\src\zimg\depth\quantize.cpp">
<Filter>Source Files\depth</Filter>
</ClCompile>
<ClCompile Include="..\..\src\zimg\colorspace\gamma.cpp">
<Filter>Source Files\colorspace</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\zimg\api\zimg++.hpp">
Expand Down Expand Up @@ -309,5 +312,8 @@
<ClInclude Include="..\..\src\zimg\depth\hexfloat.h">
<Filter>Header Files\depth</Filter>
</ClInclude>
<ClInclude Include="..\..\src\zimg\colorspace\gamma.h">
<Filter>Header Files\colorspace</Filter>
</ClInclude>
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions src/testapp/colorspaceapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct Arguments {
char fullrange_out;
double peak_luminance;
char approximate_gamma;
char scene_referred;
const char *visualise_path;
unsigned times;
zimg::CPUClass cpu;
Expand All @@ -82,6 +83,7 @@ const ArgparseOption program_switches[] = {
{ OPTION_FLAG, nullptr, "fullrange-out", offsetof(Arguments, fullrange_out), nullptr, "output is PC range" },
{ OPTION_FLOAT, nullptr, "peak-luminance", offsetof(Arguments, peak_luminance), nullptr, "nominal peak luminance for SDR (cd/m^2)" },
{ OPTION_FLAG, nullptr, "lut", offsetof(Arguments, approximate_gamma), nullptr, "use LUT to evaluate transfer functions" },
{ OPTION_FLAG, "s", "scene-referred", offsetof(Arguments, scene_referred), nullptr, "use scene-referred transfer functions" },
{ OPTION_STRING, nullptr, "visualise", offsetof(Arguments, visualise_path), nullptr, "path to BMP file for visualisation" },
{ OPTION_UINT, nullptr, "times", offsetof(Arguments, times), nullptr, "number of benchmark cycles" },
{ OPTION_USER1, nullptr, "cpu", offsetof(Arguments, cpu), arg_decode_cpu, "select CPU type" },
Expand Down Expand Up @@ -134,6 +136,7 @@ int colorspace_main(int argc, char **argv)
conv.set_csp_in(args.csp_in)
.set_csp_out(args.csp_out)
.set_approximate_gamma(!!args.approximate_gamma)
.set_scene_referred(!!args.scene_referred)
.set_cpu(args.cpu);
if (!std::isnan(args.peak_luminance))
conv.set_peak_luminance(args.peak_luminance);
Expand Down
2 changes: 2 additions & 0 deletions src/testapp/graphapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ void read_graph_params(zimg::graph::GraphBuilder::params *params, const json::Ob
params->peak_luminance = val.number();
if (const auto &val = obj["approximate_gamma"])
params->approximate_gamma = val.boolean();
if (const auto &val = obj["scene_referred"])
params->scene_referred = val.boolean();
if (const auto &val = obj["cpu"])
params->cpu = g_cpu_table[val.string().c_str()];
}
Expand Down
4 changes: 3 additions & 1 deletion src/zimg/colorspace/colorspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ ColorspaceConversion::ColorspaceConversion(unsigned width, unsigned height) :
csp_out{},
peak_luminance{ 100.0 },
approximate_gamma{},
scene_referred{},
cpu{ CPUClass::NONE }
{}

std::unique_ptr<graph::ImageFilter> ColorspaceConversion::create() const try
{
OperationParams params;
params.set_peak_luminance(peak_luminance)
.set_approximate_gamma(approximate_gamma);
.set_approximate_gamma(approximate_gamma)
.set_scene_referred(scene_referred);

if (csp_in == csp_out)
return ztd::make_unique<graph::MuxFilter>(ztd::make_unique<graph::CopyFilter>(width, height, PixelType::FLOAT));
Expand Down
1 change: 1 addition & 0 deletions src/zimg/colorspace/colorspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct ColorspaceConversion {
BUILDER_MEMBER(ColorspaceDefinition, csp_out)
BUILDER_MEMBER(double, peak_luminance)
BUILDER_MEMBER(bool, approximate_gamma)
BUILDER_MEMBER(bool, scene_referred)
BUILDER_MEMBER(CPUClass, cpu)
#undef BUILDER_MEMBER

Expand Down
Loading

0 comments on commit de3dfb6

Please sign in to comment.