Skip to content

Commit

Permalink
Merge branch 'feature/update_nitro' into develop/jdsmith
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Aug 11, 2020
2 parents aac9d2c + f0e51d4 commit 52001ee
Show file tree
Hide file tree
Showing 273 changed files with 3,960 additions and 9,124 deletions.
8 changes: 7 additions & 1 deletion externals/nitro/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@

# Build artifacts
target/
install/
**/install-*/
out/build/
out/install/
test_package/build/
*.pyc
*.swp
.depproj
.vs
*.vcxproj.user
**/Debug/
**/Release/

# Drivers
modules/c/j2k/external/openjpeg/openjpeg-2.0.0/
modules/c/j2k/external/jasper/jasper-1.900.1-mod/

2 changes: 1 addition & 1 deletion externals/nitro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)
project(nitro)

set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)

if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
Expand Down
5 changes: 5 additions & 0 deletions externals/nitro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,8 @@ to make sure NITRO can find them.

* If you wish to use a custom TRE location, you can also specify that
with `NITF_PLUGIN_PATH`.

Contact
---------

July 2020, Dan.Smith@maxar.com
24 changes: 12 additions & 12 deletions externals/nitro/modules/c++/nitf/apps/show_nitf++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void printTRE(nitf::TRE tre)


// This is so you know how long the TRE is
nitf_Uint32 treLength = tre.getCurrentSize();
uint32_t treLength = tre.getCurrentSize();

/*
* This is the name for the description that was selected to field
Expand Down Expand Up @@ -235,7 +235,7 @@ void showImageSubheader(nitf::ImageSubheader imsub)
SHOW( imsub.getImageCoordinateSystem().toString() );
SHOW( imsub.getCornerCoordinates().toString() );

SHOW( (nitf::Uint32)imsub.getNumImageComments() );
SHOW( (uint32_t)imsub.getNumImageComments() );
nitf::List comments = imsub.getImageComments();
for (nitf::ListIterator it = comments.begin(); it != comments.end(); ++it)
SHOW(((nitf::Field)*it).toString());
Expand All @@ -244,25 +244,25 @@ void showImageSubheader(nitf::ImageSubheader imsub)
SHOW( imsub.getCompressionRate().toString() );

SHOW( imsub.getNumImageBands().toString() );
SHOW( (nitf::Uint32)imsub.getNumMultispectralImageBands() );
SHOW( (uint32_t)imsub.getNumMultispectralImageBands() );

for (i = 0; i < (unsigned int)imsub.getNumImageBands(); i++)
{
SHOW( imsub.getBandInfo(i).getRepresentation().toString());
SHOW( imsub.getBandInfo(i).getSubcategory().toString() );
SHOW( imsub.getBandInfo(i).getImageFilterCondition().toString() );
SHOW( imsub.getBandInfo(i).getImageFilterCode().toString() );
SHOW( (nitf::Uint32)imsub.getBandInfo(i).getNumLUTs() );
SHOW( (nitf::Uint32)imsub.getBandInfo(i).getBandEntriesPerLUT() );
SHOW( (uint32_t)imsub.getBandInfo(i).getNumLUTs() );
SHOW( (uint32_t)imsub.getBandInfo(i).getBandEntriesPerLUT() );
}

SHOW( imsub.getImageSyncCode().toString() );
SHOW( imsub.getImageMode().toString() );
SHOW( (nitf::Uint32)imsub.getNumBlocksPerRow() );
SHOW( (nitf::Uint32)imsub.getNumBlocksPerCol() );
SHOW( (nitf::Uint32)imsub.getNumPixelsPerHorizBlock() );
SHOW( (nitf::Uint32)imsub.getNumPixelsPerVertBlock() );
SHOW( (nitf::Uint32)imsub.getNumBitsPerPixel() );
SHOW( (uint32_t)imsub.getNumBlocksPerRow() );
SHOW( (uint32_t)imsub.getNumBlocksPerCol() );
SHOW( (uint32_t)imsub.getNumPixelsPerHorizBlock() );
SHOW( (uint32_t)imsub.getNumPixelsPerVertBlock() );
SHOW( (uint32_t)imsub.getNumBitsPerPixel() );
SHOW( imsub.getImageDisplayLevel().toString() );
SHOW( imsub.getImageAttachmentLevel().toString() );
SHOW( imsub.getImageLocation().toString() );
Expand All @@ -277,7 +277,7 @@ void showImageSubheader(nitf::ImageSubheader imsub)
// nitf::HashTable htUd = udExts.getHash();
// htUd.forEach(showTRE);

SHOW( (nitf::Uint32)imsub.getExtendedHeaderLength() );
SHOW( (uint32_t)imsub.getExtendedHeaderLength() );
SHOW( imsub.getExtendedHeaderOverflow().toString() );

nitf::Extensions exExts = imsub.getExtendedSection();
Expand Down Expand Up @@ -475,7 +475,7 @@ void showDESubheader(nitf::DESubheader sub)
* It is only valid if the subheader fields length > 0; otherwise, it will
* throw an Exception since there is no TRE defining the subheader fields.
*/
if (((nitf::Uint32)sub.getSubheaderFieldsLength()) > 0)
if (((uint32_t)sub.getSubheaderFieldsLength()) > 0)
{
nitf::TRE tre = sub.getSubheaderFields();
printTRE( tre );
Expand Down
4 changes: 2 additions & 2 deletions externals/nitro/modules/c++/nitf/include/nitf/BandInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ DECLARE_CLASS(BandInfo)
const std::string& subcategory,
const std::string& imageFilterCondition,
const std::string& imageFilterCode,
nitf::Uint32 numLUTs,
nitf::Uint32 bandEntriesPerLUT,
uint32_t numLUTs,
uint32_t bandEntriesPerLUT,
nitf::LookupTable& lut);

/*!
Expand Down
26 changes: 13 additions & 13 deletions externals/nitro/modules/c++/nitf/include/nitf/BandSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,51 +108,51 @@ struct RowSourceCallback
{
}

virtual void nextRow(nitf::Uint32 band, void* buf) = 0;
virtual void nextRow(uint32_t band, void* buf) = 0;
};

class RowSource : public BandSource
{
public:
RowSource(nitf::Uint32 band, nitf::Uint32 numRows, nitf::Uint32 numCols,
nitf::Uint32 pixelSize, RowSourceCallback *callback);
RowSource(uint32_t band, uint32_t numRows, uint32_t numCols,
uint32_t pixelSize, RowSourceCallback *callback);

private:
static
NITF_BOOL nextRow(void* algorithm,
nitf_Uint32 band,
uint32_t band,
NITF_DATA* buffer,
nitf_Error* error);

private:
nitf::Uint32 mBand, mNumRows, mNumCols, mPixelSize;
uint32_t mBand, mNumRows, mNumCols, mPixelSize;
};

class DirectBlockSource : public BandSource
{
public:
DirectBlockSource(nitf::ImageReader& imageReader,
nitf::Uint32 numBands);
uint32_t numBands);

protected:
virtual void nextBlock(void* buf,
const void* block,
nitf::Uint32 blockNumber,
nitf::Uint64 blockSize) = 0;
uint32_t blockNumber,
uint64_t blockSize) = 0;
private:
static
NITF_BOOL nextBlock(void *algorithm,
void* buf,
const void* block,
nitf_Uint32 blockNumber,
nitf_Uint64 blockSize,
uint32_t blockNumber,
uint64_t blockSize,
nitf_Error * error);
};

class CopyBlockSource: public ::nitf::DirectBlockSource
{
public:
CopyBlockSource(nitf::ImageReader& imageReader, nitf::Uint32 numBands) :
CopyBlockSource(nitf::ImageReader& imageReader, uint32_t numBands) :
nitf::DirectBlockSource(imageReader, numBands)
{}

Expand All @@ -161,8 +161,8 @@ class CopyBlockSource: public ::nitf::DirectBlockSource
protected:
virtual void nextBlock(void* buf,
const void* block,
nitf::Uint32 /*blockNumber*/,
nitf::Uint64 blockSize)
uint32_t /*blockNumber*/,
uint64_t blockSize)
{
memcpy(buf, block, blockSize);
}
Expand Down
16 changes: 8 additions & 8 deletions externals/nitro/modules/c++/nitf/include/nitf/BlockingInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,28 @@ DECLARE_CLASS(BlockingInfo)
~BlockingInfo();

//! Get the number of blocks per row
nitf::Uint32 getNumBlocksPerRow() const;
uint32_t getNumBlocksPerRow() const;

//! Set the number of blocks per row
void setNumBlocksPerRow(nitf::Uint32 value);
void setNumBlocksPerRow(uint32_t value);

//! Get the number of blocks per column
nitf::Uint32 getNumBlocksPerCol() const;
uint32_t getNumBlocksPerCol() const;

//! Set the number of blocks per column
void setNumBlocksPerCol(nitf::Uint32 value);
void setNumBlocksPerCol(uint32_t value);

//! Get the number of rows per block
nitf::Uint32 getNumRowsPerBlock() const;
uint32_t getNumRowsPerBlock() const;

//! Set the number of rows per block
void setNumRowsPerBlock(nitf::Uint32 value);
void setNumRowsPerBlock(uint32_t value);

//! Get the number of columns per block
nitf::Uint32 getNumColsPerBlock() const;
uint32_t getNumColsPerBlock() const;

//! Set the number of columns per block
void setNumColsPerBlock(nitf::Uint32 value);
void setNumColsPerBlock(uint32_t value);

//! Get the length
size_t getLength() const;
Expand Down
14 changes: 7 additions & 7 deletions externals/nitro/modules/c++/nitf/include/nitf/BufferedWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ class BufferedWriter : public CustomIO

void flushBuffer();

nitf::Uint64 getTotalWritten() const
uint64_t getTotalWritten() const
{
return mTotalWritten;
}

nitf::Uint64 getNumBlocksWritten() const
uint64_t getNumBlocksWritten() const
{
return mBlocksWritten;
}

nitf::Uint64 getNumPartialBlocksWritten() const
uint64_t getNumPartialBlocksWritten() const
{
return mPartialBlocks;
}
Expand Down Expand Up @@ -87,10 +87,10 @@ class BufferedWriter : public CustomIO
const mem::ScopedArray<char> mScopedBuffer;
char* const mBuffer;

nitf::Uint64 mPosition;
nitf::Uint64 mTotalWritten;
nitf::Uint64 mBlocksWritten;
nitf::Uint64 mPartialBlocks;
uint64_t mPosition;
uint64_t mTotalWritten;
uint64_t mBlocksWritten;
uint64_t mPartialBlocks;
double mElapsedTime;

// NOTE: This is at the end to give us a chance to adopt the buffer
Expand Down
17 changes: 10 additions & 7 deletions externals/nitro/modules/c++/nitf/include/nitf/ByteProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
#ifndef __NITF_BYTE_PROVIDER_HPP__
#define __NITF_BYTE_PROVIDER_HPP__
#pragma once

#include <vector>
#include <utility>
Expand All @@ -34,6 +35,8 @@
#include <nitf/ImageSegmentComputer.h>
#include <io/ByteStream.h>

#include "cstddef.h"

namespace nitf
{
/*!
Expand Down Expand Up @@ -127,7 +130,7 @@ class ByteProvider
}

//! \return The raw file header bytes
const std::vector<sys::byte>& getFileHeader() const
const std::vector<std::byte>& getFileHeader() const
{
return mFileHeader;
}
Expand All @@ -136,7 +139,7 @@ class ByteProvider
* \return The raw bytes for each image subheader. Vector size matches the
* number of image segments.
*/
const std::vector<std::vector<sys::byte> >& getImageSubheaders() const
const std::vector<std::vector<std::byte> >& getImageSubheaders() const
{
return mImageSubheaders;
}
Expand All @@ -145,7 +148,7 @@ class ByteProvider
* \return The raw bytes for each DES (subheader immediately followed by
* raw DES data). Vector size matches the number of data extension segments.
*/
const std::vector<sys::byte>& getDesSubheaderAndData() const
const std::vector<std::byte>& getDesSubheaderAndData() const
{
return mDesSubheaderAndData;
}
Expand Down Expand Up @@ -260,7 +263,7 @@ class ByteProvider
size_t numColsPerBlock = 0);

static void copyFromStreamAndClear(io::ByteStream& stream,
std::vector<sys::byte>& rawBytes);
std::vector<std::byte>& rawBytes);

size_t countPadRows(
size_t seg, size_t numRowsToWrite,
Expand Down Expand Up @@ -348,11 +351,11 @@ class ByteProvider

std::vector<SegmentInfo> mImageSegmentInfo; // Per segment

std::vector<sys::byte> mFileHeader;
std::vector<std::vector<sys::byte> > mImageSubheaders; // Per segment
std::vector<std::byte> mFileHeader;
std::vector<std::vector<std::byte> > mImageSubheaders; // Per segment

// All DES subheaders and data together contiguously
std::vector<sys::byte> mDesSubheaderAndData;
std::vector<std::byte> mDesSubheaderAndData;

std::vector<nitf::Off> mImageSubheaderFileOffsets; // Per segment
nitf::Off mDesSubheaderFileOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ DECLARE_CLASS(ComponentInfo)
* \param subHeaderSize The size of the subheader
* \param dataSize The size of the data
*/
ComponentInfo(nitf::Uint32 subHeaderSize = 0, nitf::Uint64 dataSize = 0);
ComponentInfo(uint32_t subHeaderSize = 0, uint64_t dataSize = 0);

private:
nitf_Error error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#ifndef __NITF_COMPRESSED_BYTE_PROVIDER_HPP__
#define __NITF_COMPRESSED_BYTE_PROVIDER_HPP__
#pragma once

#include <vector>
#include <utility>
Expand All @@ -35,6 +36,7 @@
#include <nitf/NITFBufferList.hpp>
#include <nitf/ImageSegmentComputer.h>

#include "cstddef.h"

namespace nitf
{
Expand Down Expand Up @@ -173,7 +175,7 @@ class CompressedByteProvider : public ByteProvider
size_t seg,
size_t startRow,
size_t numRowsToWrite,
const sys::byte* imageData,
const std::byte* imageData,
nitf::Off& fileOffset,
NITFBufferList& buffers) const;

Expand Down
Loading

0 comments on commit 52001ee

Please sign in to comment.