Skip to content

Commit

Permalink
Squashed 'externals/nitro/' changes from c8ecbe9ae..3f01809fa
Browse files Browse the repository at this point in the history
3f01809fa latest from coda-oss (#557)
471fb3fc1 Update test_j2k_loading++.cpp
b12caf2fc latest from CODA-OSS (#556)
0cd432624 use sys::make_span (#555)
05dae18a3 patch to build other projects
8f974e995 NITRO-2.11.3 (#554)
870aa6afd update to coda-oss 2023-06-05 (#553)
2fd7a0bfa latest from coda-oss (#552)
0eecce004 invoke() utility to reduce code duplication (#550)
59fb02fe9 latest from coda-oss (#551)
9fbf2b7b8 Fill out adapter free block which is used for nitf decompression (#549)
089ba0b5b latest from coda-oss
3b52f0025 latest from coda-oss (#547)
90c6263e2 latest from coda-oss (#544)
90d513ac5 latest from coda-oss (#543)

git-subtree-dir: externals/nitro
git-subtree-split: 3f01809fae7d471aa0f1594fc5eec1e3111cd710
  • Loading branch information
Dan Smith authored and Dan Smith committed Jun 19, 2023
1 parent 99bf76e commit ac1ccde
Show file tree
Hide file tree
Showing 98 changed files with 2,542 additions and 589 deletions.
6 changes: 6 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# NITRO (NITF i/o) Release Notes

## [Version 2.11.3](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.3); June 5, 2023
* [coda-oss](https://github.com/mdaus/coda-oss) release [2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05)
* Fix display of [certain TREs](https://github.com/mdaus/nitro/issues/529).
* Adjust compiler flags for clean *CMake* builds.
* Implement `DecompressionInterface::adapterFreeBlock()` to fix decompression.

## [Version 2.11.2](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.2); December 14, 2022
* [coda-oss](https://github.com/mdaus/coda-oss) release [2022-12-14](https://github.com/mdaus/coda-oss/releases/tag/2022-12-14)
* Further work at getting unittests to work better when included elsewhere (e.g., SIX) as **externals**.
Expand Down
18 changes: 9 additions & 9 deletions externals/coda-oss/.github/workflows/build_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
name: ${{ matrix.os }}-${{ matrix.python-version }}-CMake
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
Expand Down Expand Up @@ -46,10 +46,10 @@ jobs:
- name: test
run: |
cd target-Release
ctest -C Release
ctest -C Release --output-on-failure
cd ..
cd target-Debug
ctest -C Debug
ctest -C Debug --output-on-failure
build-linux-cmake:
strategy:
Expand All @@ -59,9 +59,9 @@ jobs:
name: ${{ matrix.os }}-${{ matrix.python-version }}-CMake
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
Expand All @@ -86,7 +86,7 @@ jobs:
- name: test
run: |
cd target
ctest
ctest --output-on-failure
build-waf:
strategy:
Expand All @@ -97,9 +97,9 @@ jobs:
name: ${{ matrix.os }}-${{ matrix.python-version }}-waf
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: configure_with_swig
Expand Down
8 changes: 7 additions & 1 deletion externals/coda-oss/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
```
# coda-oss Release Notes

## [Release 2023-??-??](https://github.com/mdaus/coda-oss/releases/tag/2023-??-??)
## [Release 2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05)
* *zlib* updated to [1.2.13](https://github.com/madler/zlib/releases/tag/v1.2.13).
* new `mem::ComplexView` class to make it easier to process complex data stored in parallel.
* adjust compiler flags for clean *CMake* builds.
* wrap common "file open" routines (e.g., `fopen()`) to support `sys::expandEnvironmentVariables()`.
* add header-only [HighFive](https://github.com/BlueBrain/HighFive) HDF5-wrapper library.
* Added a handful of [HighFive](https://github.com/BlueBrain/HighFive) utility routines.
* `mt::transform_async()` removed, it doesn't match C++17 techniques.'
* Revamp `sys::byteSwap()` for improved type-safety and
[better performance](https://devblogs.microsoft.com/cppblog/a-tour-of-4-msvc-backend-improvements/).
* Added case-insensitive string comparison utilties: `str::eq()` and `str::ne()`;
`xml::lite::Uri`s compare case-insensitive.

## [Release 2022-12-14](https://github.com/mdaus/coda-oss/releases/tag/2022-12-14)
* removed remaining vestiges of `std::auto_ptr`, provide `mem::AutoPtr` for the tiny handful of
Expand Down
10 changes: 8 additions & 2 deletions externals/coda-oss/UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
Expand All @@ -34,7 +33,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down Expand Up @@ -259,6 +257,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\modules\c++\mt\unittests\test_mt_byte_swap.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\modules\c++\mt\unittests\ThreadGroupTest.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -319,6 +321,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\modules\c++\types\unittests\test_complex.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\modules\c++\types\unittests\test_page_row_col.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down
6 changes: 6 additions & 0 deletions externals/coda-oss/UnitTest/UnitTest.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@
<ClCompile Include="..\modules\c++\re\unittests\test_regex.cpp">
<Filter>re</Filter>
</ClCompile>
<ClCompile Include="..\modules\c++\mt\unittests\test_mt_byte_swap.cpp">
<Filter>mt</Filter>
</ClCompile>
<ClCompile Include="..\modules\c++\types\unittests\test_complex.cpp">
<Filter>types</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
Expand Down
4 changes: 4 additions & 0 deletions externals/coda-oss/UnitTest/mt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ TEST_CLASS(work_sharing_balanced_runnable_1d_test){ public:
#include "mt/unittests/work_sharing_balanced_runnable_1d_test.cpp"
};

TEST_CLASS(test_mt_byte_swap){ public:
#include "mt/unittests/test_mt_byte_swap.cpp"
};

}
3 changes: 3 additions & 0 deletions externals/coda-oss/UnitTest/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <types/PageRowCol.h>
#include <types/RangeList.h>
#include <types/Range.h>
#include <types/complex.h>
#include <sys/Conf.h>
#include <sys/Path.h>
#include <except/Exception.h>
Expand All @@ -75,6 +76,7 @@
#include <sys/Thread.h>
#include <sys/Mutex.h>
#include <sys/FileFinder.h>
#include <sys/ByteSwap.h>
#include <import/sys.h>
#include <import/math/linear.h>
#include <import/math/poly.h>
Expand All @@ -87,6 +89,7 @@
#include <mt/RequestQueue.h>
#include <mt/ThreadPoolException.h>
#include <mt/GenerationThreadPool.h>
#include <mt/ThreadedByteSwap.h>
#include <import/mt.h>
#include <avx/extractf.h>
#include <logging/ExceptionLogger.h>
Expand Down
4 changes: 4 additions & 0 deletions externals/coda-oss/UnitTest/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ TEST_CLASS(test_range_list){ public:
#include "types/unittests/test_range_list.cpp"
};

TEST_CLASS(test_complex){ public:
#include "types/unittests/test_complex.cpp"
};

}
2 changes: 2 additions & 0 deletions externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ std::unique_ptr<cli::Results> cli::ArgumentParser::parse(const std::string& prog
std::map<std::string, Argument*> longOptionsFlags;
std::vector<Argument*> positionalArgs;

positionalArgs.reserve(mArgs.size());
for (auto& arg_ : mArgs)
{
cli::Argument* arg = arg_.get();
Expand Down Expand Up @@ -336,6 +337,7 @@ std::unique_ptr<cli::Results> cli::ArgumentParser::parse(const std::string& prog
}

std::vector < std::string > explodedArgs;
explodedArgs.reserve(args.size());
// next, check for combined short options
for (size_t i = 0, s = args.size(); i < s; ++i)
{
Expand Down
9 changes: 6 additions & 3 deletions externals/coda-oss/modules/c++/coda-oss-lite.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<ClInclude Include="coda_oss\include\coda_oss\bit.h" />
<ClInclude Include="coda_oss\include\coda_oss\CPlusPlus.h" />
<ClInclude Include="coda_oss\include\coda_oss\cstddef.h" />
<ClInclude Include="coda_oss\include\coda_oss\memory.h" />
<ClInclude Include="coda_oss\include\coda_oss\namespace_.h" />
<ClInclude Include="coda_oss\include\coda_oss\optional.h" />
<ClInclude Include="coda_oss\include\coda_oss\optional_.h" />
Expand Down Expand Up @@ -149,6 +148,7 @@
<ClInclude Include="mt\include\mt\RequestQueue.h" />
<ClInclude Include="mt\include\mt\Runnable1D.h" />
<ClInclude Include="mt\include\mt\Singleton.h" />
<ClInclude Include="mt\include\mt\ThreadedByteSwap.h" />
<ClInclude Include="mt\include\mt\ThreadGroup.h" />
<ClInclude Include="mt\include\mt\ThreadPlanner.h" />
<ClInclude Include="mt\include\mt\ThreadPoolException.h" />
Expand Down Expand Up @@ -191,6 +191,8 @@
<ClInclude Include="sys\include\sys\AtomicCounter.h" />
<ClInclude Include="sys\include\sys\AtomicCounterCpp11.h" />
<ClInclude Include="sys\include\sys\Backtrace.h" />
<ClInclude Include="sys\include\sys\ByteSwap.h" />
<ClInclude Include="sys\include\sys\ByteSwapValue.h" />
<ClInclude Include="sys\include\sys\ConditionVar.h" />
<ClInclude Include="sys\include\sys\ConditionVarInterface.h" />
<ClInclude Include="sys\include\sys\ConditionVarPosix.h" />
Expand Down Expand Up @@ -228,6 +230,8 @@
<ClInclude Include="sys\include\sys\SemaphoreInterface.h" />
<ClInclude Include="sys\include\sys\SemaphorePosix.h" />
<ClInclude Include="sys\include\sys\SemaphoreWin32.h" />
<ClInclude Include="sys\include\sys\Span.h" />
<ClInclude Include="sys\include\sys\SysInt.h" />
<ClInclude Include="sys\include\sys\StopWatch.h" />
<ClInclude Include="sys\include\sys\String.h" />
<ClInclude Include="sys\include\sys\SystemException.h" />
Expand All @@ -252,6 +256,7 @@
<ClInclude Include="tiff\include\tiff\KnownTags.h" />
<ClInclude Include="tiff\include\tiff\TypeFactory.h" />
<ClInclude Include="tiff\include\tiff\Utils.h" />
<ClInclude Include="types\include\types\complex.h" />
<ClInclude Include="types\include\types\PageRowCol.h" />
<ClInclude Include="types\include\types\Range.h" />
<ClInclude Include="types\include\types\RangeList.h" />
Expand Down Expand Up @@ -421,14 +426,12 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<EnableASAN>true</EnableASAN>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
21 changes: 18 additions & 3 deletions externals/coda-oss/modules/c++/coda-oss-lite.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
<ClInclude Include="coda_oss\include\coda_oss\cstddef.h">
<Filter>coda_oss</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\memory.h">
<Filter>coda_oss</Filter>
</ClInclude>
<ClInclude Include="coda_oss\include\coda_oss\namespace_.h">
<Filter>coda_oss</Filter>
</ClInclude>
Expand Down Expand Up @@ -735,6 +732,24 @@
<ClInclude Include="config\include\config\disable_compiler_warnings.h">
<Filter>config</Filter>
</ClInclude>
<ClInclude Include="sys\include\sys\ByteSwap.h">
<Filter>sys</Filter>
</ClInclude>
<ClInclude Include="sys\include\sys\ByteSwapValue.h">
<Filter>sys</Filter>
</ClInclude>
<ClInclude Include="mt\include\mt\ThreadedByteSwap.h">
<Filter>mt</Filter>
</ClInclude>
<ClInclude Include="sys\include\sys\Span.h">
<Filter>sys</Filter>
</ClInclude>
<ClInclude Include="sys\include\sys\SysInt.h">
<Filter>sys</Filter>
</ClInclude>
<ClInclude Include="types\include\types\complex.h">
<Filter>types</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@
#endif // CODA_OSS_cplusplus

// Define a few macros as that's less verbose than testing against a version number
// https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
#define CODA_OSS_cpp11 (CODA_OSS_cplusplus >= 201103L)
#define CODA_OSS_cpp14 (CODA_OSS_cplusplus >= 201402L)
#define CODA_OSS_cpp17 (CODA_OSS_cplusplus >= 201703L)
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L)
#define CODA_OSS_cpp23 0
#define CODA_OSS_cpp23 (CODA_OSS_cplusplus >= 202302L)

#if !CODA_OSS_cpp14
#error "Must compile with C++14 or greater."
Expand Down
62 changes: 61 additions & 1 deletion externals/coda-oss/modules/c++/coda_oss/include/coda_oss/bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@
* License along with this program; If not, http://www.gnu.org/licenses/.
*
*/
#pragma once
#ifndef CODA_OSS_coda_oss_bit_h_INCLUDED_
#define CODA_OSS_coda_oss_bit_h_INCLUDED_
#pragma once

#include <stdlib.h>
#include <stdint.h>
#ifdef __GNUC__
#include <byteswap.h> // "These functions are GNU extensions."
#endif

#include <type_traits>

#include "coda_oss/namespace_.h"
namespace coda_oss
Expand All @@ -38,6 +46,58 @@ namespace coda_oss
native = __BYTE_ORDER__
#endif
};

// https://en.cppreference.com/w/cpp/numeric/byteswap
namespace details
{
// Overloads for common types
inline constexpr uint8_t byteswap(uint8_t val) noexcept
{
return val; // no-op
}
#if defined(_MSC_VER)
// These routines should generate a single instruction; see
// https://devblogs.microsoft.com/cppblog/a-tour-of-4-msvc-backend-improvements/
inline uint16_t byteswap(uint16_t val) noexcept
{
return _byteswap_ushort(val);
}
inline uint32_t byteswap(uint32_t val) noexcept
{
return _byteswap_ulong(val);
}
inline uint64_t byteswap(uint64_t val) noexcept
{
return _byteswap_uint64(val);
}
#elif defined(__GNUC__)
inline uint16_t byteswap(uint16_t val) noexcept
{
return bswap_16(val);
}
inline uint32_t byteswap(uint32_t val) noexcept
{
return bswap_32(val);
}
inline uint64_t byteswap(uint64_t val) noexcept
{
return bswap_64(val);
}
#else
#error "No platform-specific byteswap()" // TODO: do something else?
#endif
}

template <typename T>
inline T byteswap(T n) noexcept
{
// "std::byteswap participates in overload resolution only if T satisfies integral, i.e., T is an integer type. The program is
// ill-formed if T has padding bits."
static_assert(std::is_integral<T>::value, "T must be integral");

using unsigned_t = std::make_unsigned_t<T>; // "Since C++14" https://en.cppreference.com/w/cpp/types/make_unsigned
return details::byteswap(static_cast<unsigned_t>(n));
}
}

#endif // CODA_OSS_coda_oss_bit_h_INCLUDED_
Loading

0 comments on commit ac1ccde

Please sign in to comment.