2
0
mirror of https://github.com/boostorg/gil.git synced 2026-01-30 07:52:09 +00:00
Commit Graph

278 Commits

Author SHA1 Message Date
Olzhas Zhumabek
cf897c5969 Implementation of lanczos down scaling (#309)
* Simple implementation of lanczos scaling

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Add Jamfile for ip test directory

Add Jamfile for image_processing
test directory and build-project
from outer test directory

* Add IP test directory to ci build

This commit adds a line at the end
of .ci/build-and-test.sh to include
image processing tests in CI builds

* Remove redundant lines from Jamfile

Simplify Jamfile at
test/image_processing

* Rewrite range condition

x > -a && x < a exchange with
-a < x && x < a in lanczos

* Add newline at the end of files

* Add math and lexical_cast to get-boost

As math and lexical_cast are used
in lanczos scaling, both were added
to get-boost

* Revert "Add newline at the end of files"

Since Boost.Math.Constants is
overengineered for use case by
requiring Boost.lexical_cast or
a global define, it is removed

This reverts commit 0743ab072ff3455421853697f7f46aee7d22382c.

* Define pi and use in lanczos

Value of pi is moved out into detail
and used by lanczos

* Move image_processing to test/core

* formatting fixes

* Adjust CMakeLists for moved IP tests

This commit removes image_processing as
subdirectory from test/ and adds to
test/core's CMakeLists

* Remove unused from get-boost

Since lanczos scaling no longer uses
boost.math.constants, lexical_cast
has been removed as well

* Downgrade math to transitive dep

This is a stray change left from
my incorrect resetting of the HEAD
on lanczos branch

* Remove unnecessary includes

io includes are not used in lanczos
scaling test, and they break build

* Fix ambiguous overload issue for min

Since width() and height()  now return
std::ptrdiff_t, call to std::min needs
a cast. There was also shadowing of
pi declared in detail/math.hpp,
which is also fixed

* Apply mloskot's patch

The patch provided by Mateusz changes
all usages of long int into ptrdiff_t,
which is returned by width() and
height() functions of image_view

* Apply .editorconfig rules

This commit is a simple reformat of
affected files

* Use aliases x_coord_t and y_coord_t

The change converges integer handling
in arguments, using view' type aliases.
View arguments have to come first to
avoid non-deduced context problem.
Also replaced long int with ptrdiff_t
in lanczos, in numeric.hpp file

* Apply alias usage for rest of the code

Some places with ptrdiff_t were
left out from previous commit, so they
are changed in this one. Plus a fix for
max call being ambiguous.

* Replace all literals with casted vars

This commit takes extreme stance of
never using an integer literal due to
problems in ambiguity of deduction of
min and max functions

* Fix unenclosed foreach

During rebase of gsoc2019 onto develop,
I didn't enclose first foreach with
matching endforeach, hence tests failed
2019-06-23 13:14:23 +03:00
MIRAL SHAH
716fe9ad8c Implement algorithms for binary and binary inverse thresholding (#313)
Add public functions threshold_binary and threshold_truncate.
Add tests and example.
Closes #310
2019-06-18 21:42:43 +02:00
Mateusz Łoskot
3e043a41a2 Define WIN32 macro to make LibRaw happy (#303)
Apparently, for some not entirely clear reasons, possibly historical
use of `.vcproj`, LibRaw uses (not defines!) `WIN32` macro, instead of
C standard compliant `_WIN32` common to majority of compilers on Windows.

This patch is required if GIL IO is used with Boost.Build or custom
Makefile, without this custom `WIN32` hand-rolled in build configuration.

Hopefully, LibRaw may accept some clean up for this in near future:
https://github.com/LibRaw/LibRaw/pull/206
2019-05-31 22:41:22 +02:00
Mateusz Łoskot
d36a2c8edf Add SFINAE-friendly version of std::common_type (#298)
It should help to improve uses of SFINAE like the one from #295
and fix #289 for MSVC 14.0 (VS2015) for good.

Copied from Boost.Hana.
2019-05-02 14:38:21 +02:00
Mateusz Łoskot
e0c27a337a Disable free operator* of point<T> for non-arithmetic operand (#295)
Add Boost.Build-only test to verify compilation failure.

Fixes #289 as much better solution than #294 workaround.
Closes #294
2019-04-29 20:59:51 +02:00
Mateusz Łoskot
c9ccc83551 Officially drop support for GCC <= 4.8 (#296)
Although GCC 4.8 is labelled as C++11 compatible, the reasons are:

* GCC 4.8 is buggy enough to prevent reasonable use of Boost.MP11
* GCC 4.8 is dying

Closes #282
2019-04-28 15:50:56 +02:00
Mateusz Łoskot
3747846acb GCC 4.8/4.9 define std::is_trivially_destructible (#292) 2019-04-20 14:33:50 +02:00
Mateusz Łoskot
a123653127 Add internal version of std::is_trivially_default_constructible (#291)
Add similar for std::is_trivially_destructible.
This should help to restore support for GCC<5 (credit to @pdimov).

Partially fixes #282
2019-04-18 17:30:49 +02:00
Mateusz Łoskot
5af7a959f8 Restore value_type access from std::iterator_traits
Lost in 5611bd5807 from #274 merge
Credit for catching this goes to @stefanseefeld
2019-04-18 12:30:37 +02:00
Mateusz Łoskot
555c4cc7b5 Fix UB due is_trivially_default_constructible specializations (#284)
C++11 / 20.11.2 Header <type_traits> synopsis
   1 The behavior of a program that adds specializations for any
   of the class templates defined in this subclause is undefined
   unless otherwise specified.

The specializations are not used anywhere, so they are safe to remove
without providing a replacement.

Fixes #283
2019-04-15 23:00:16 +02:00
Mateusz Łoskot
5611bd5807 Replace Boost.MPL with Boost.MP11 (#274)
Use type traits and features of C++11, then use Boost.MP11.
Remove unused and unnecessary metafunctions in `detail` namespace.
Remove explicit access to ::type as no longer necessary with MP11.
Clean up and reformat code according to the current guidelines.

Legacy tests have been updated where necessary to accommodate
switch to MP11.

Replace std::is_integral with gil::detail::is_channel_integral
Replacing boost::is_integral with std::is_integral is C++ UB:

    C++11 / 20.11.2 Header <type_traits> synopsis
    1 The behavior of a program that adds specializations for any
    of the class templates defined in this subclause is undefined
    unless otherwise specified.


Implements also proposal in #93
Closes #229
2019-04-14 22:13:45 +02:00
Mateusz Łoskot
c6c5336cc0 Value-initialize channel and pixel value members (#273)
Add tests to ensure member values of channel and pixel classes are
determined, zero-initialized.
Fixes #270

Tidy up formatting.
2019-04-01 17:19:22 +01:00
Mateusz Łoskot
89ce280c6f Fix warning about unused variable 2019-03-29 23:33:21 +01:00
Mateusz Łoskot
fc70dafa9e Fix warning: unused variable 'src_p' [-Wunused-variable] 2019-03-21 21:14:10 +01:00
Mateusz Łoskot
d9e7ff588f Comment unused parameter of channel_premultiply call operator (#264)
Fix warning: unused parameter `c` [-Wunused-parameter].
Clean up typographic quotation marks.
2019-03-21 18:54:06 +01:00
Mateusz Łoskot
5427e60dcc Add missing #include <sstream> 2019-03-21 18:41:24 +01:00
Nikita Kniazev
33d4ac05ae Use just ::value where is possible (#262)
The ::value member is common convention of all MPL and TypeTraits metafunctions.

Fixes VS2015 failures (#261)
2019-03-19 20:34:11 +01:00
Mateusz Łoskot
af8dcac47e Add missing #include <boost/mpl/and.hpp> 2019-03-18 22:11:05 +01:00
Mateusz Łoskot
f81952e115 Fix gray_t and gray_color_t mismatch in default_color_converter_impl (#250)
Add number of static assertions to test indices used to access
elements of color mapping sequence are in range.

Fixes #249
2019-03-04 17:33:03 +01:00
Mateusz Łoskot
52ed09f0bc Add missing #include <boost/config.hpp> 2019-02-21 00:41:30 +01:00
Mateusz Łoskot
21139476e5 Include all public headers in gil.hpp (#237) 2019-02-20 19:02:58 +00:00
Mateusz Łoskot
22baac5367 Add dynamic_step.hpp for base templates declaration (#238)
Replace all scattered around forward declarations of
`dynamic_{x,y,xy}_step_type` with this common header,
where the templates are also documented.

Refine documentation of `transposed_type` - this is kept
in locator.hpp as it is not just related to the dynamic step.
2019-02-19 16:34:20 +00:00
Mateusz Łoskot
b78a762fdd Fix clang and GCC warning on unsequenced access 2019-02-06 22:26:09 +01:00
Mateusz Łoskot
545bd85677 Ignore warning -Wunused-but-set-variable in concepts 2019-02-06 22:24:11 +01:00
Mateusz Łoskot
f4133c8068 Ignore warning -Wuninitialized in concepts 2019-02-06 22:23:38 +01:00
Mateusz Łoskot
db28b19959 Ignore GCC warning -Wunused-but-set-variable 2019-02-06 22:02:08 +01:00
Mateusz Łoskot
6763a8cd98 Build core tests with BOOST_GIL_USE_CONCEPT_CHECK defined (#230)
when building tests with both, Boost.Build and CMake.

Disable concepts check for tests where range (e.g. std::array)
used as image pixel - not fully specialised as acceptable pixel type.

Ignore warnings from boost/concept_check.hpp
Rationalise uses of GCC and clang diagnostic push/pop,
with adding constraint for GCC 4.6+ as minimum version
where the pragma was introduced.

Closes #228
2019-02-05 22:19:35 +00:00
Samuel Debionne
2308a1a85a Use Boost.Variant instead of GIL's own variant implementation (#231)
Adds support C++11 decltype(auto)

Fixes #131
2019-02-05 00:47:08 +00:00
Mateusz Łoskot
cd2ad3b75b Replace boost::is_pointer with std::is_pointer in static_assert 2019-01-27 23:37:39 +01:00
Mateusz Łoskot
12e68d4d2c Tidy up uses of Boost.Filesystem in IO (#226)
Remove unused #include-s and leave io/test/paths.hpp as sole
place of #include <boost/filesystem.hpp> for IO tests.
Silence annoying -Wconversion or -Wshorten-64-to-32 warning
from Boost.SmartPtr via Boost.Filesystem:
  conversion to 'std::atomic<int>::__integral_type {aka int}'
    from 'long int' may alter its value
2019-01-27 22:11:03 +00:00
Mateusz Łoskot
45ca507ca3 Replace some uses of boost::is_same with std::is_same (#225)
Those are places boost::is_same can be replaced in non-intrusive way.
Remaining are types derived from boost::is_same, where the replacing
would affect all their uses - effectively switching from boost::true_/false_ types
to std::true_type and std::false_type.
Such change needs to come along with Boost.MPL to MP11 migration.
2019-01-27 10:54:05 +00:00
Mateusz Loskot
83a735a09c Fix GCC -Wunused-parameter warnings (#221) 2019-01-20 09:37:31 +01:00
Mateusz Loskot
54f1817e99 Replace boost::enable_if with std::enable_if (#215)
Replace boost::disable_if with std::enable_if and negated condition.
Update mpl::and_ expressions to yield value convertible to bool, instead of type.
Format std::enable_if expressions and nearby code they are nested in.
Replace complex template-based leading return type of functions
  with auto and trailing return type for greater readability.
Replace some Boost type traits with <type_traits> features.
Replace 0 with nullptr where modernize-use-nullptr missed (updates #180).

Notice, boost::lazy_enable_if in extension/toolbox has not been replaced,
but it seems it could have been - need verification with number of compilers.
2019-01-18 09:31:58 +01:00
Mateusz Loskot
40e158b26b Fix warning: suggest parentheses around assignment used as truth value (#214)
Tidy up around the fix.
2019-01-16 12:29:36 +01:00
Mateusz Łoskot
e3ef52bb80 Correct order of constexpr and type specifier
The constexpr belongs to the declaration specifiers (like static) and
not just the type specifiers (like cv-qualifiers), so it binds to
the declaration (like static), not the type (like const).

Refines #211
2019-01-15 00:42:20 +01:00
Mateusz Loskot
da6acc6cca Remove uses of Boost.Function (#213)
Remove uses of boost::mem_fn (missing from Bind.Bind removal in #212).
2019-01-13 06:32:20 +01:00
Mateusz Loskot
78b7dcfeca Remove uses of Boost.Bind and Boost.Lambda (#212)
Replace with std::bind and C++11 lambda functions.
The two Boost libraries should no longer be a direct
dependency of Boost.GIL.
2019-01-13 02:03:25 +01:00
Mateusz Loskot
a2b2ca977a Replace BOOST_STATIC_CONSTANT with constexpr (#211)
Tidy up formatting of refactored parts of code.
2019-01-12 23:57:35 +01:00
Mateusz Loskot
f578a8be9c Replace assert() macro with BOOST_ASSERT() macro (#208)
Add #include <boost/assert.hpp> where necessary.
Apply minor clean-up near the macro replacements.

Closes #96
2019-01-12 10:21:01 +01:00
Mateusz Loskot
6e3ccc00b1 Remove dependency on Boost.StaticAssert (#207)
Replaced BOOST_STATIC_ASSERT with C++11 binary static_assert,
with empty message.

In future, this should make it possible to automatically refactor
into C++17 unary static_assert using clang-tidy and
its modernize-unary-static-assert check.

Closes #106
2019-01-11 10:33:09 +01:00
Mateusz Loskot
a4185bcea2 Remove Boost.Bind from extension/dynamic_image (#202)
Replace boost::bind with std::bind from C++11.
Move template parameter comments to Doxygen \tparam-s,
so they are captured as proper documentation.
Tidy up code formatting.
2018-12-20 16:51:20 +01:00
Mateusz Loskot
2233fb166a Remove Boost.Bind from io (#203)
Replace Boost.MPL boolean constants with C++11 equivalents.
Replace `throw()` with `noexcept`.
Replace empty constructor body with `default`.
Rename private class members to avoid leading underscore
(too easy to confuse as reserved identifier).
Tidy up with compact formatting.
2018-12-18 18:50:57 +01:00
Mateusz Loskot
06d1dbb066 Fix hard-wired use of Boost.Array static_size member (#200)
Fixes #142
2018-12-18 11:57:32 +01:00
Mateusz Łoskot
149b4c8605 Remove reference instantiation
Introduced in recent SHA-1 c065671e01
2018-12-17 23:47:07 +01:00
Mateusz Łoskot
c9d5ce6d43 Replace typedef with using in comments [ci skip]
Left-overs from previous modernize-use-using refactoring.
2018-12-17 19:35:13 +01:00
Mateusz Loskot
abfa519b00 Apply clang-tidy modernize-use-using to extension/toolbox (#198)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/toolbox/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/toolbox/*.hpp should return no matches.
2018-12-17 19:25:19 +01:00
Mateusz Łoskot
c065671e01 Ignore warning: unused type alias [-Wunused-local-typedef]
Typically, in concepts, unused aliases are nothing uncommon.

Add TODO about some member aliaseis that perhaps should be concept-checked.
2018-12-17 14:33:46 +01:00
Mateusz Loskot
5340a352c4 Apply clang-tidy modernize-use-using to extension/io (#197)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/io/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/io/*.hpp should return no matches.
2018-12-17 01:24:30 +01:00
Mateusz Loskot
fbd056baf0 Apply clang-tidy modernize-use-using to io (#195)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/io/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all io/*.hpp should return no matches.
2018-12-17 00:48:58 +01:00
Mateusz Loskot
a33523f868 Apply clang-tidy modernize-use-using to extension/numeric (#196)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/numeric/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/numeric/*.hpp should return no matches,
2018-12-17 00:17:23 +01:00