Change includes and minor fixes

This commit is contained in:
jfmcarreira committed 2021-07-10 12:33:27 +01:00
1 parent 2a1b0abb2f
commit eaa9987314
16 files changed
+98 -146

No files matched your search

+2 -4
View File
@@ -218,10 +218,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
# Compiler options
# ####################################################################################################################################################
SET(CMAKE_CXX_STANDARD 14)
IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-std=gnu++0x)
ENDIF()
SET(CMAKE_CXX_STANDARD 20)
ADD_DEFINITIONS(-std=gnu++20)
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "No build type selected, default to Release")
+5 -7
View File
@@ -26,16 +26,14 @@
#ifndef __CALYPDEFS_H__
#define __CALYPDEFS_H__
#include <algorithm>
#include <iterator>
#include <memory>
#include <string>
#include <vector>
typedef unsigned short ClpPel; ///< 16-bit pixel type
typedef unsigned char ClpByte;
typedef unsigned long long ClpULong;
typedef std::string ClpString;
using ClpByte = std::uint8_t;
using ClpPel = std::uint16_t;
using ClpULong = std::uint64_t;
using ClpString = std::string;
enum CLP_LOG_LEVEL
{
+33 -48
View File
@@ -26,6 +26,10 @@
#include <cassert>
#include <cmath>
#include <cstdint>
#include <memory>
#include <span>
#include <vector>
#include "LibMemory.h"
#include "PixelFormats.h"
@@ -88,7 +92,7 @@ int CalypFrame::pelformatColorSpace( const int idx )
return g_CalypPixFmtDescriptorsMap.at( idx ).colorSpace;
}
struct CalypFramePrivate
class CalypFrame::CalypFramePrivate
{
public:
bool m_bInit;
@@ -106,14 +110,14 @@ public:
ClpPel*** m_pppcInputPel;
bool m_bHasRGBPel; //!< Flag indicating that the ARGB buffer was computed
unsigned char* m_pcARGB32; //!< Buffer with the ARGB pixels used in Qt libs
bool m_bHasRGBPel; //!< Flag indicating that the ARGB buffer was computed
std::vector<std::uint8_t> m_pcARGB32; //!< Buffer with the ARGB pixels used in Qt libs
/** Histogram control variables **/
bool m_bHasHistogram;
bool m_bHistogramRunning;
/** The histogram data.*/
unsigned int* m_puiHistogram;
std::vector<unsigned int> m_puiHistogram;
/** If the image is RGB and calcLuma is true, we have 1 more channel */
unsigned int m_uiHistoChannels;
/** Numbers of histogram segments depending of image bytes depth*/
@@ -124,8 +128,6 @@ public:
m_bInit = false;
m_bHasRGBPel = false;
m_pppcInputPel = nullptr;
m_pcARGB32 = nullptr;
m_puiHistogram = nullptr;
}
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
@@ -144,7 +146,7 @@ public:
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == -1 || bitsPixel > 16 )
{
throw CalypFailure( "CalypFrame", "Cannot create a PlYUVerFrame of this type" );
throw CalypFailure( "CalypFrame", "Cannot create a CalypFrame of this type" );
}
m_pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( pel_format ) );
@@ -181,9 +183,8 @@ public:
}
/* Alloc ARGB memory */
getMem1D( &m_pcARGB32, m_uiHeight * m_uiWidth * 4 );
m_pcARGB32.resize( m_uiHeight * m_uiWidth * 4 );
m_puiHistogram = NULL;
m_bHasHistogram = false;
m_bHistogramRunning = false;
@@ -195,7 +196,7 @@ public:
else
m_uiHistoChannels = m_pcPelFormat->numberChannels;
getMem1D<unsigned int>( &( m_puiHistogram ), m_uiHistoSegments * m_uiHistoChannels );
m_puiHistogram.resize( m_uiHistoSegments * m_uiHistoChannels );
m_cPelFmtName = CalypFrame::supportedPixelFormatListNames()[m_iPixelFormat].c_str();
@@ -247,15 +248,10 @@ public:
{
while( m_bHistogramRunning )
;
if( m_puiHistogram )
freeMem1D( m_puiHistogram );
m_bHasHistogram = false;
if( m_pppcInputPel )
xFreeMem( m_pppcInputPel );
if( m_pcARGB32 )
freeMem1D( m_pcARGB32 );
}
};
@@ -264,26 +260,25 @@ public:
*/
CalypFrame::CalypFrame()
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
}
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
d->init( width, height, pelFormat, bitsPixel );
}
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
d->init( width, height, pelFormat, bitsPixel, has_negative_values );
}
CalypFrame::CalypFrame( CalypFrame&& other ) noexcept
: d( other.d )
: d{ std::move( other.d ) }
{
other.d = nullptr; // we'll talk more about this line below
}
CalypFrame& CalypFrame::operator=( CalypFrame&& other ) noexcept
@@ -292,25 +287,21 @@ CalypFrame& CalypFrame::operator=( CalypFrame&& other ) noexcept
if( &other == this )
return *this;
// Release any resource we're holding
delete d;
// Transfer ownership of a.m_ptr to m_ptr
d = other.d;
other.d = nullptr;
d = std::move( other.d );
return *this;
}
CalypFrame::CalypFrame( const CalypFrame& other )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
copyFrom( &other );
}
CalypFrame::CalypFrame( const CalypFrame* other )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
if( other )
{
@@ -325,11 +316,8 @@ CalypFrame& CalypFrame::operator=( const CalypFrame& other )
if( &other == this )
return *this;
// Release any resource we're holding
delete d;
// Copy the resource
d = new CalypFramePrivate;
d = std::make_unique<CalypFramePrivate>();
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
copyFrom( &other );
@@ -337,7 +325,7 @@ CalypFrame& CalypFrame::operator=( const CalypFrame& other )
}
CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( other.getPelFormat() ) );
if( pcPelFormat->log2ChromaWidth )
@@ -362,7 +350,7 @@ CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y,
}
CalypFrame::CalypFrame( const CalypFrame* other, unsigned int posX, unsigned int posY, unsigned int areaWidth, unsigned int areaHeight )
: d( new CalypFramePrivate )
: d{ std::make_unique<CalypFramePrivate>() }
{
if( !other )
return;
@@ -389,10 +377,7 @@ CalypFrame::CalypFrame( const CalypFrame* other, unsigned int posX, unsigned int
copyFrom( other, posX, posY );
}
CalypFrame::~CalypFrame()
{
delete d;
}
CalypFrame::~CalypFrame() = default;
bool CalypFrame::haveSameFmt( const CalypFrame& other, unsigned int match ) const
{
@@ -544,7 +529,7 @@ unsigned char* CalypFrame::getRGBBuffer() const
{
if( d->m_bHasRGBPel )
{
return d->m_pcARGB32;
return d->m_pcARGB32.data();
}
return NULL;
}
@@ -663,7 +648,7 @@ void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y )
copyTo( *other, x, y );
}
void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long uiBuffSize )
void CalypFrame::frameFromBuffer( const std::vector<ClpByte>& Buff, int iEndianness, unsigned long uiBuffSize )
{
if( uiBuffSize != getBytesPerFrame() )
return;
@@ -671,9 +656,9 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long
frameFromBuffer( Buff, iEndianness );
}
void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
void CalypFrame::frameFromBuffer( const std::vector<ClpByte>& Buff, int iEndianness )
{
ClpByte* ppBuff[MAX_NUMBER_PLANES];
const ClpByte* ppBuff[MAX_NUMBER_PLANES];
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
int startByte = 0;
int endByte = bytesPixel;
@@ -687,7 +672,7 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
incByte = -1;
}
ppBuff[0] = Buff;
ppBuff[0] = Buff.data();
for( unsigned i = 1; i < MAX_NUMBER_PLANES; i++ )
{
int ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
@@ -704,7 +689,7 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
int step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
ClpPel* pPel = d->m_pppcInputPel[ch][0];
ClpByte* pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
const ClpByte* pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
for( unsigned p = 0; p < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); p++ )
{
@@ -724,7 +709,7 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
d->m_bHasHistogram = false;
}
void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
void CalypFrame::frameToBuffer( std::vector<ClpByte>& output_buffer, int iEndianness )
{
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
ClpByte* ppBuff[MAX_NUMBER_PLANES];
@@ -744,7 +729,7 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
incByte = -1;
}
ppBuff[0] = output_buffer;
ppBuff[0] = output_buffer.data();
for( int i = 1; i < MAX_NUMBER_PLANES; i++ )
{
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
@@ -826,7 +811,7 @@ void CalypFrame::fillRGBBuffer()
d->m_bHasRGBPel = true;
// 4 bytes for A, R, G and B
uint32_t* pARGB = (uint32_t*)d->m_pcARGB32;
uint32_t* pARGB = (uint32_t*)d->m_pcARGB32.data();
if( d->m_pcPelFormat->colorSpace == CLP_COLOR_GRAY )
{
ClpPel* pY = d->m_pppcInputPel[CLP_LUMA][0];
@@ -911,12 +896,12 @@ void CalypFrame::fillRGBBuffer()
void CalypFrame::calcHistogram()
{
if( d->m_bHasHistogram || !d->m_puiHistogram )
if( d->m_bHasHistogram || d->m_puiHistogram.empty() )
return;
d->m_bHistogramRunning = true;
xMemSet( unsigned int, d->m_uiHistoSegments * d->m_uiHistoChannels, d->m_puiHistogram );
std::fill( d->m_puiHistogram.begin(), d->m_puiHistogram.end(), 0 );
unsigned int numberChannels = d->m_pcPelFormat->numberChannels;
for( unsigned int ch = 0; ch < numberChannels; ch++ )
+9 -5
View File
@@ -26,6 +26,8 @@
#ifndef __CALYPFRAME_H__
#define __CALYPFRAME_H__
#include <span>
#include "CalypDefs.h"
namespace cv
@@ -73,7 +75,8 @@ public:
CalypPixel convertPixel( CalypColorSpace eOutputSpace );
private:
struct CalypPixelPrivate* d;
class CalypPixelPrivate;
std::unique_ptr<CalypPixelPrivate> d;
};
/**
@@ -369,9 +372,9 @@ public:
void copyTo( const CalypFrame& other, unsigned x, unsigned y );
void copyTo( const CalypFrame* other, unsigned x, unsigned y );
void frameFromBuffer( ClpByte*, int, unsigned long );
void frameFromBuffer( ClpByte*, int );
void frameToBuffer( ClpByte*, int );
void frameFromBuffer( const std::vector<ClpByte>&, int, unsigned long );
void frameFromBuffer( const std::vector<ClpByte>&, int );
void frameToBuffer( std::vector<ClpByte>&, int );
void fillRGBBuffer();
@@ -443,7 +446,8 @@ public:
/** @} */
private:
struct CalypFramePrivate* d;
class CalypFramePrivate;
std::unique_ptr<CalypFramePrivate> d;
};
#endif // __CALYPFRAME_H__
+2
View File
@@ -34,6 +34,8 @@
* @}
*/
#include <vector>
#include "CalypFrame.h"
#include "CalypOptions.h"
+11 -10
View File
@@ -22,14 +22,17 @@
* \brief Video Frame handling
*/
#include <memory>
#include "CalypFrame.h"
#include "PixelFormats.h"
#include "config.h"
#define MAX_NUMBER_COMPONENTS 4
struct CalypPixelPrivate
class CalypPixel::CalypPixelPrivate
{
public:
CalypPixelPrivate( const int& ColorSpace )
{
iColorSpace = ColorSpace == CLP_COLOR_GRAY ?
@@ -71,18 +74,18 @@ int CalypPixel::getMaxNumberOfComponents()
}
CalypPixel::CalypPixel( const int& ColorSpace )
: d( new CalypPixelPrivate( ColorSpace ) )
: d{ std::make_unique<CalypPixelPrivate>( ColorSpace ) }
{
}
CalypPixel::CalypPixel( const int& ColorSpace, const ClpPel& c0 )
: d( new CalypPixelPrivate( ColorSpace ) )
: d{ std::make_unique<CalypPixelPrivate>( ColorSpace ) }
{
d->PelComp[0] = c0;
}
CalypPixel::CalypPixel( const int& ColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2 )
: d( new CalypPixelPrivate( ColorSpace ) )
: d{ std::make_unique<CalypPixelPrivate>( ColorSpace ) }
{
d->PelComp[0] = c0;
d->PelComp[1] = c1;
@@ -90,7 +93,7 @@ CalypPixel::CalypPixel( const int& ColorSpace, const ClpPel& c0, const ClpPel& c
}
CalypPixel::CalypPixel( const int& ColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2, const ClpPel& c3 )
: d( new CalypPixelPrivate( ColorSpace ) )
: d{ std::make_unique<CalypPixelPrivate>( ColorSpace ) }
{
d->PelComp[0] = c0;
d->PelComp[1] = c1;
@@ -99,7 +102,8 @@ CalypPixel::CalypPixel( const int& ColorSpace, const ClpPel& c0, const ClpPel& c
}
CalypPixel::CalypPixel( const CalypPixel& other )
: d( new CalypPixelPrivate( other.colorSpace() ) )
: d{ std::make_unique<CalypPixelPrivate>( other.colorSpace() ) }
{
for( int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
{
@@ -107,10 +111,7 @@ CalypPixel::CalypPixel( const CalypPixel& other )
}
}
CalypPixel::~CalypPixel()
{
delete d;
}
CalypPixel::~CalypPixel() = default;
int CalypPixel::colorSpace() const
{
+3 -2
View File
@@ -25,6 +25,8 @@
#ifndef __CALYPSTREAMHANDLERIF_H__
#define __CALYPSTREAMHANDLERIF_H__
#include <vector>
#include "CalypStream.h"
#define INI_REGIST_CALYP_SUPPORTED_FMT \
@@ -78,7 +80,6 @@ public:
, m_dFrameRate( 30 )
, m_uiCurrFrameFileIdx( 0 )
, m_uiTotalNumberFrames( 0 )
, m_pStreamBuffer( NULL )
, m_uiNBytesPerFrame( 0 )
, m_isEOF( false )
{
@@ -114,7 +115,7 @@ protected:
double m_dFrameRate;
ClpULong m_uiCurrFrameFileIdx;
ClpULong m_uiTotalNumberFrames;
ClpByte* m_pStreamBuffer;
std::vector<ClpByte> m_pStreamBuffer;
ClpULong m_uiNBytesPerFrame;
bool m_isEOF;
};
+13 -44
View File
@@ -40,7 +40,7 @@
#endif
#define xMemSet( type, len, ptr ) memset( ptr, 0, ( len ) * sizeof( type ) )
static inline void* xMallocMem( size_t nitems )
[[deprecated]] static inline void* xMallocMem( size_t nitems )
{
void* d;
if( ( d = xMalloc( nitems ) ) == NULL )
@@ -51,7 +51,7 @@ static inline void* xMallocMem( size_t nitems )
return d;
}
static inline void* xCallocMem( size_t nitems, size_t size )
[[deprecated]] static inline void* xCallocMem( size_t nitems, size_t size )
{
size_t padded_size = nitems * size;
void* d = xMallocMem( padded_size );
@@ -61,7 +61,7 @@ static inline void* xCallocMem( size_t nitems, size_t size )
}
template <typename T>
int getMem1D( T** array1D, int dim0 )
[[deprecated]] int getMem1D( T** array1D, int dim0 )
{
if( ( *array1D = (T*)xCallocMem( dim0, sizeof( T ) ) ) == NULL )
return 0;
@@ -69,6 +69,16 @@ int getMem1D( T** array1D, int dim0 )
return ( sizeof( T* ) + dim0 * sizeof( T ) );
}
template <typename T>
[[deprecated]] void freeMem1D( T*& array1D )
{
if( array1D )
{
xFreeMem( array1D );
array1D = NULL;
}
}
template <typename T>
int getMem2D( T*** array2D, int dim0, int dim1 )
{
@@ -85,32 +95,6 @@ int getMem2D( T*** array2D, int dim0, int dim1 )
return dim0 * ( sizeof( T* ) + dim1 * sizeof( T ) );
}
template <typename T>
int getMem3D( T**** array3D, int dim0, int dim1, int dim2 )
{
int i, mem_size = dim0 * sizeof( T** );
if( ( ( *array3D ) = (T***)xMallocMem( dim0 * sizeof( T** ) ) ) == NULL )
printf( "get_mem3Dint: array3D" );
mem_size += getMem2D( *array3D, dim0 * dim1, dim2 );
for( i = 1; i < dim0; i++ )
( *array3D )[i] = ( *array3D )[i - 1] + dim1;
return mem_size;
}
template <typename T>
void freeMem1D( T*& array1D )
{
if( array1D )
{
xFreeMem( array1D );
array1D = NULL;
}
}
template <typename T>
void freeMem2D( T**& array2D )
{
@@ -130,19 +114,4 @@ void freeMem2D( T**& array2D )
}
}
template <typename T>
void freeMem3D( T***& array3D )
{
if( array3D )
{
freeMem2D( *array3D );
xFreeMem( array3D );
array3D = NULL;
}
else
{
printf( "free_mem3Dint: trying to free unused memory" );
}
}
#endif // __LIBMEMORY_H__
+3 -5
View File
@@ -323,14 +323,12 @@ void StreamHandlerLibav::closeHandler()
av_free( m_cFrame );
}
m_bHasStream = false;
if( m_pStreamBuffer )
freeMem1D( m_pStreamBuffer );
}
bool StreamHandlerLibav::configureBuffer( CalypFrame* pcFrame )
{
return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
return true;
}
void StreamHandlerLibav::calculateFrameNumber()
@@ -427,7 +425,7 @@ bool StreamHandlerLibav::read( CalypFrame* pcFrame )
decFrame = m_cConvertedFrame;
}
av_image_copy_to_buffer( m_pStreamBuffer, m_uiFrameBufferSize, decFrame->data,
av_image_copy_to_buffer( m_pStreamBuffer.data(), m_uiFrameBufferSize, decFrame->data,
decFrame->linesize, AVPixelFormat( m_ffPixFmt ), m_uiWidth, m_uiHeight, 1 );
pcFrame->frameFromBuffer( m_pStreamBuffer, m_iEndianness );
+4 -6
View File
@@ -124,14 +124,12 @@ void StreamHandlerPortableMap::closeHandler()
{
if( m_pFile )
fclose( m_pFile );
if( m_pStreamBuffer )
freeMem1D( m_pStreamBuffer );
}
bool StreamHandlerPortableMap::configureBuffer( CalypFrame* pcFrame )
{
return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
return true;
}
bool StreamHandlerPortableMap::seek( ClpULong iFrameNum )
@@ -142,7 +140,7 @@ bool StreamHandlerPortableMap::seek( ClpULong iFrameNum )
bool StreamHandlerPortableMap::read( CalypFrame* pcFrame )
{
unsigned long long int processed_bytes = fread( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
unsigned long long int processed_bytes = fread( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
pcFrame->frameFromBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN );
@@ -162,7 +160,7 @@ bool StreamHandlerPortableMap::write( CalypFrame* pcFrame )
fprintf( m_pFile, "%d\n", m_iMaxValue );
}
pcRGBFrame.frameToBuffer( m_pStreamBuffer, m_iEndianness );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
return true;
+5 -6
View File
@@ -64,13 +64,12 @@ void StreamHandlerRaw::closeHandler()
{
if( m_pFile )
fclose( m_pFile );
if( m_pStreamBuffer )
freeMem1D( m_pStreamBuffer );
}
bool StreamHandlerRaw::configureBuffer( CalypFrame* pcFrame )
{
return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() );
m_pStreamBuffer.resize( pcFrame->getBytesPerFrame() );
return true;
}
void StreamHandlerRaw::calculateFrameNumber()
@@ -97,9 +96,9 @@ bool StreamHandlerRaw::seek( ClpULong iFrameNum )
bool StreamHandlerRaw::read( CalypFrame* pcFrame )
{
if( !m_pFile || !m_pStreamBuffer || m_uiNBytesPerFrame == 0 )
if( !m_pFile || m_pStreamBuffer.empty() || m_uiNBytesPerFrame == 0 )
return false;
unsigned long long int processed_bytes = fread( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
unsigned long long int processed_bytes = fread( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
m_uiCurrFrameFileIdx++;
@@ -110,7 +109,7 @@ bool StreamHandlerRaw::read( CalypFrame* pcFrame )
bool StreamHandlerRaw::write( CalypFrame* pcFrame )
{
pcFrame->frameToBuffer( m_pStreamBuffer, m_iEndianness );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer.data(), sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame )
return false;
return true;
+2 -4
View File
@@ -52,7 +52,6 @@ HEVCIntraPrediction::HEVCIntraPrediction()
;
m_pcPredBlock = NULL;
m_referenceMem = NULL;
m_uiMode = 26;
m_iBlockSize = 4;
@@ -66,7 +65,8 @@ bool HEVCIntraPrediction::create( std::vector<CalypFrame*> apcFrameList )
m_pcPredBlock = NULL;
m_pcPredBlock = new CalypFrame( m_iBlockSize * 2 + 1, m_iBlockSize * 2 + 1, CLP_GRAY, apcFrameList[0]->getBitsPel() );
getMem1D( &m_referenceMem, m_iBlockSize * 4 );
m_referenceMem.resize( m_iBlockSize * 4 );
return true;
}
@@ -210,7 +210,5 @@ void HEVCIntraPrediction::destroy()
{
if( m_pcPredBlock )
delete m_pcPredBlock;
if( m_referenceMem )
freeMem1D( m_referenceMem );
m_pcPredBlock = NULL;
}
+1 -1
View File
@@ -39,7 +39,7 @@ private:
unsigned int m_uiYpel;
bool m_bShowResidue;
int m_iBlockSize;
ClpPel* m_referenceMem;
std::vector<ClpPel> m_referenceMem;
public:
HEVCIntraPrediction();
+1 -4
View File
@@ -62,11 +62,10 @@ bool OptimiseDisplay::create( std::vector<CalypFrame*> apcFrameList )
CalypFrame* OptimiseDisplay::process( std::vector<CalypFrame*> apcFrameList )
{
unsigned numValues = 1u << apcFrameList[0]->getBitsPel();
ClpPel* lookUpTable;
std::vector<ClpPel> lookUpTable( numValues, 0 );
const ClpPel* pInput1PelYUV = apcFrameList[0]->getPelBufferYUV()[0][0];
ClpPel* pOutputPelYUV = m_pcOptimisedFrame->getPelBufferYUV()[0][0];
getMem1D( &lookUpTable, numValues );
apcFrameList[0]->calcHistogram();
m_pcOptimisedFrame->reset();
@@ -92,8 +91,6 @@ CalypFrame* OptimiseDisplay::process( std::vector<CalypFrame*> apcFrameList )
}
}
}
freeMem1D( lookUpTable );
return m_pcOptimisedFrame;
}
+2
View File
@@ -44,6 +44,8 @@
*
*/
#include <vector>
#include "CalypToolsCmdParser.h"
#include "lib/CalypFrame.h"
+2
View File
@@ -25,6 +25,8 @@
#ifndef __CALYPTOOLSCMDPARSER_H__
#define __CALYPTOOLSCMDPARSER_H__
#include <vector>
#include "config.h"
#include "lib/CalypOptions.h"