Major changes on code

Remove Qt4 support
Change include headers
Change the include of QCustomPlot lib and updated code based on upstream
This commit is contained in:
jfmcarreira committed 2017-12-06 03:11:02 +00:00
1 parent 73d843abf5
commit 430bdc09cd
66 files changed
+38551 -29387

No files matched your search

+52 -99
View File
@@ -49,8 +49,7 @@ std::vector<String> PlaYUVerFrame::supportedColorSpacesListNames()
std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames()
{
std::vector<String> formatsList;
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ )
{
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) {
formatsList.push_back( g_PlaYUVerPixFmtDescriptorsList[i].name );
}
return formatsList;
@@ -59,8 +58,7 @@ std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames()
std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace )
{
std::vector<String> formatsList;
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ )
{
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) {
if( g_PlaYUVerPixFmtDescriptorsList[i].colorSpace == colorSpace )
formatsList.push_back( g_PlaYUVerPixFmtDescriptorsList[i].name );
}
@@ -69,8 +67,7 @@ std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace
Int PlaYUVerFrame::findPixelFormat( const String& name )
{
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ )
{
for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) {
if( g_PlaYUVerPixFmtDescriptorsList[i].name == name )
return i;
}
@@ -92,8 +89,7 @@ static Int getImgMemory( Pel**** array3D, Int dim1, Int dim2, Int log2ChromaHeig
total_mem_size += mem_size * sizeof( Pel );
// Luma
for( i = 1; i < dim1; i++ )
( *array3D )[0][i] = ( *array3D )[0][i - 1] + dim2;
for( i = 1; i < dim1; i++ ) ( *array3D )[0][i] = ( *array3D )[0][i - 1] + dim2;
// Chroma
( *array3D )[1][0] = ( *array3D )[0][0] + dim2 * dim1;
@@ -101,12 +97,10 @@ static Int getImgMemory( Pel**** array3D, Int dim1, Int dim2, Int log2ChromaHeig
dim1 = CHROMASHIFT( dim1, log2ChromaHeight );
dim2 = CHROMASHIFT( dim2, log2ChromaWidth );
for( i = 1; i < dim1; i++ )
( *array3D )[1][i] = ( *array3D )[1][i - 1] + dim2;
for( i = 1; i < dim1; i++ ) ( *array3D )[1][i] = ( *array3D )[1][i - 1] + dim2;
( *array3D )[2][0] = ( *array3D )[1][0] + dim2 * dim1;
for( i = 1; i < dim1; i++ )
( *array3D )[2][i] = ( *array3D )[2][i - 1] + dim2;
for( i = 1; i < dim1; i++ ) ( *array3D )[2][i] = ( *array3D )[2][i - 1] + dim2;
return total_mem_size;
}
@@ -425,13 +419,11 @@ Void PlaYUVerFrame::clear()
Pel uiValue = 128;
Int ratioH, ratioW;
UInt i;
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
pPel = d->m_pppcInputPel[ch][0];
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ ) {
*pPel++ = uiValue;
}
}
@@ -468,8 +460,7 @@ UChar* PlaYUVerFrame::getRGBBuffer()
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos )
{
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace, d->m_uiHalfPelValue, d->m_uiHalfPelValue, d->m_uiHalfPelValue );
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
PixelValue[ch] = d->m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )];
@@ -480,8 +471,7 @@ PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos )
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos, PlaYUVerPixel::ColorSpace eColorSpace )
{
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace );
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
PixelValue[ch] = d->m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )];
@@ -492,8 +482,7 @@ PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos, PlaYUVerPixel::C
Void PlaYUVerFrame::setPixelValue( Int xPos, Int yPos, PlaYUVerPixel pixel )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
d->m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )] = pixel.Components()[ch];
@@ -522,12 +511,10 @@ Void PlaYUVerFrame::copyFrom( const PlaYUVerFrame& other, UInt xPos, UInt yPos )
if( haveSameFmt( other, MATCH_ALL ) )
return;
Pel*** pInput = other.getPelBufferYUV();
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
for( UInt i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ); i++ )
{
for( UInt i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ); i++ ) {
memcpy( d->m_pppcInputPel[ch][i], &( pInput[ch][( yPos >> ratioH ) + i][( xPos >> ratioW )] ), ( d->m_uiWidth >> ratioW ) * sizeof( Pel ) );
}
}
@@ -571,15 +558,13 @@ Void PlaYUVerFrame::frameFromBuffer( Byte* Buff, Int iEndianness )
}
ppBuff[0] = Buff;
for( i = 1; i < MAX_NUMBER_PLANES; i++ )
{
for( i = 1; i < MAX_NUMBER_PLANES; i++ ) {
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
}
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
step = d->m_pcPelFormat->comp[ch].step_minus1;
@@ -587,11 +572,9 @@ Void PlaYUVerFrame::frameFromBuffer( Byte* Buff, Int iEndianness )
pPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 );
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ ) {
*pPel = 0;
for( b = startByte; b != endByte; b += incByte )
{
for( b = startByte; b != endByte; b += incByte ) {
*pPel += *pTmpBuff << ( b * 8 );
pTmpBuff++;
// Check max value and bound it to "maxval" to prevent segfault when
@@ -629,15 +612,13 @@ Void PlaYUVerFrame::frameToBuffer( Byte* output_buffer, Int iEndianness )
}
ppBuff[0] = output_buffer;
for( Int i = 1; i < MAX_NUMBER_PLANES; i++ )
{
for( Int i = 1; i < MAX_NUMBER_PLANES; i++ ) {
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
}
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) {
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
step = d->m_pcPelFormat->comp[ch].step_minus1;
@@ -645,10 +626,8 @@ Void PlaYUVerFrame::frameToBuffer( Byte* output_buffer, Int iEndianness )
pTmpPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane];
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{
for( b = startByte; b != endByte; b += incByte )
{
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ ) {
for( b = startByte; b != endByte; b += incByte ) {
*pTmpBuff = *pTmpPel >> ( 8 * b );
pTmpBuff++;
}
@@ -665,7 +644,9 @@ Void PlaYUVerFrame::fillRGBBuffer()
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \
iB = iY + ( ( 1812 * ( iU - 128 ) ) >> 10 ); \
CLAMP_YUV2RGB( iR ) CLAMP_YUV2RGB( iG ) CLAMP_YUV2RGB( iB )
CLAMP_YUV2RGB( iR ) \
CLAMP_YUV2RGB( iG ) \
CLAMP_YUV2RGB( iB )
if( d->m_bHasRGBPel )
return;
@@ -676,8 +657,7 @@ Void PlaYUVerFrame::fillRGBBuffer()
{
Pel* pY = d->m_pppcInputPel[LUMA][0];
Int iY;
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
{
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) {
iY = *pY++;
iY >>= shiftBits;
iR = iY;
@@ -692,8 +672,7 @@ Void PlaYUVerFrame::fillRGBBuffer()
Pel* pG = d->m_pppcInputPel[COLOR_G][0];
Pel* pB = d->m_pppcInputPel[COLOR_B][0];
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
{
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) {
iR = *pR++;
iG = *pG++;
iB = *pB++;
@@ -715,22 +694,18 @@ Void PlaYUVerFrame::fillRGBBuffer()
UInt y, x;
Int i, j;
for( y = 0; y<d->m_uiHeight>> d->m_pcPelFormat->log2ChromaHeight; y++ )
{
for( i = 0; i < 1 << d->m_pcPelFormat->log2ChromaHeight; i++ )
{
for( y = 0; y<d->m_uiHeight>> d->m_pcPelFormat->log2ChromaHeight; y++ ) {
for( i = 0; i < 1 << d->m_pcPelFormat->log2ChromaHeight; i++ ) {
pY = pLineY;
pU = pLineU;
pV = pLineV;
pARGB = pARGBLine;
for( x = 0; x<d->m_uiWidth>> d->m_pcPelFormat->log2ChromaWidth; x++ )
{
for( x = 0; x<d->m_uiWidth>> d->m_pcPelFormat->log2ChromaWidth; x++ ) {
iU = *pU++;
iU >>= shiftBits;
iV = *pV++;
iV >>= shiftBits;
for( j = 0; j < ( 1 << d->m_pcPelFormat->log2ChromaWidth ); j++ )
{
for( j = 0; j < ( 1 << d->m_pcPelFormat->log2ChromaWidth ); j++ ) {
iY = *pY++;
iY >>= shiftBits;
YUV2RGB( iY, iU, iV, iR, iG, iB );
@@ -776,15 +751,12 @@ Void PlaYUVerFrame::calcHistogram()
data[LUMA] = d->m_pppcInputPel[LUMA][0];
data[CHROMA_U] = d->m_pppcInputPel[CHROMA_U][0];
data[CHROMA_V] = d->m_pppcInputPel[CHROMA_V][0];
for( i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
{
for( i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) {
d->m_puiHistogram[*( data[LUMA] ) + LUMA * d->m_uiHistoSegments]++;
data[LUMA] += 1;
}
for( i = 0; ( i < getChromaLength() ); i++ )
{
for( j = 1; j < numberChannels; j++ )
{
for( i = 0; ( i < getChromaLength() ); i++ ) {
for( j = 1; j < numberChannels; j++ ) {
d->m_puiHistogram[*( data[j] ) + j * d->m_uiHistoSegments]++;
data[j] += 1;
}
@@ -798,10 +770,8 @@ Void PlaYUVerFrame::calcHistogram()
data[COLOR_G] = d->m_pppcInputPel[COLOR_G][0];
data[COLOR_B] = d->m_pppcInputPel[COLOR_B][0];
for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ); i++ )
{
for( j = 0; j < numberChannels; j++ )
{
for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ); i++ ) {
for( j = 0; j < numberChannels; j++ ) {
d->m_puiHistogram[*( data[j] ) + j * d->m_uiHistoSegments]++;
}
if( ( colorSpace == PlaYUVerPixel::COLOR_RGB || colorSpace == PlaYUVerPixel::COLOR_ARGB ) )
@@ -810,8 +780,7 @@ Void PlaYUVerFrame::calcHistogram()
luma = currPixel.ConvertPixel( PlaYUVerPixel::COLOR_YUV ).Y();
d->m_puiHistogram[luma + j * d->m_uiHistoSegments]++;
}
for( j = 0; j < numberChannels; j++ )
data[j] += 1;
for( j = 0; j < numberChannels; j++ ) data[j] += 1;
}
}
d->m_bHasHistogram = true;
@@ -905,8 +874,7 @@ UInt PlaYUVerFrame::getMin( Int channel )
indexStart = histoChannel * d->m_uiHistoSegments;
for( value = 0; value <= d->m_uiHistoSegments; value++ )
{
for( value = 0; value <= d->m_uiHistoSegments; value++ ) {
if( d->m_puiHistogram[indexStart + value] > 0 )
{
break;
@@ -935,8 +903,7 @@ UInt PlaYUVerFrame::getMax( Int channel )
indexStart = histoChannel * d->m_uiHistoSegments;
for( value = d->m_uiHistoSegments - 1; value >= 0; value-- )
{
for( value = d->m_uiHistoSegments - 1; value >= 0; value-- ) {
if( d->m_puiHistogram[indexStart + value] > 0 )
{
break;
@@ -966,8 +933,7 @@ UInt PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
indexStart = histoChannel * d->m_uiHistoSegments;
for( i = start; i <= end; i++ )
{
for( i = start; i <= end; i++ ) {
count += d->m_puiHistogram[indexStart + i];
}
return count;
@@ -994,8 +960,7 @@ Double PlaYUVerFrame::getMean( Int channel, UInt start, UInt end )
indexStart = histoChannel * d->m_uiHistoSegments;
for( UInt i = start; i <= end; i++ )
{
for( UInt i = start; i <= end; i++ ) {
mean += i * d->m_puiHistogram[indexStart + i];
}
@@ -1032,8 +997,7 @@ Int PlaYUVerFrame::getMedian( Int channel, UInt start, UInt end )
count = getCount( channel, start, end );
for( UInt i = start; i <= end; i++ )
{
for( UInt i = start; i <= end; i++ ) {
sum += d->m_puiHistogram[indexStart + i];
if( sum * 2 > count )
return i;
@@ -1080,8 +1044,7 @@ Double PlaYUVerFrame::getStdDev( Int channel, UInt start, UInt end )
-----------------------*/
for( UInt i = start; i <= end; i++ )
{
for( UInt i = start; i <= end; i++ ) {
dev += ( i * i ) * d->m_puiHistogram[indexStart + i];
}
@@ -1130,8 +1093,7 @@ Double PlaYUVerFrame::getMaximum( Int channel )
indexStart = histoChannel * d->m_uiHistoSegments;
for( UInt x = 0; x < d->m_uiHistoSegments; x++ )
{
for( UInt x = 0; x < d->m_uiHistoSegments; x++ ) {
if( d->m_puiHistogram[indexStart + x] > max )
{
max = d->m_puiHistogram[indexStart + x];
@@ -1162,8 +1124,7 @@ Bool PlaYUVerFrame::toMat( cv::Mat& cvMat, Bool convertToGray )
{
fillRGBBuffer();
UChar* pARGB = d->m_pcARGB32;
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
{
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ ) {
*pCvPel++ = *pARGB++;
*pCvPel++ = *pARGB++;
*pCvPel++ = *pARGB++;
@@ -1174,8 +1135,7 @@ Bool PlaYUVerFrame::toMat( cv::Mat& cvMat, Bool convertToGray )
else if( convertToGray || d->m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_GRAY )
{
Pel* pPel = d->m_pppcInputPel[LUMA][0];
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
{
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ ) {
*pCvPel++ = *pPel++;
}
bRet = true;
@@ -1220,8 +1180,7 @@ Bool PlaYUVerFrame::fromMat( cv::Mat& cvMat )
Pel* pInputPelR = d->m_pppcInputPel[COLOR_R][0];
Pel* pInputPelG = d->m_pppcInputPel[COLOR_G][0];
Pel* pInputPelB = d->m_pppcInputPel[COLOR_B][0];
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
{
for( UInt i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) {
*pInputPelB++ = *pCvPel++;
*pInputPelG++ = *pCvPel++;
*pInputPelR++ = *pCvPel++;
@@ -1231,8 +1190,7 @@ Bool PlaYUVerFrame::fromMat( cv::Mat& cvMat )
else
{
Pel* pPel = d->m_pppcInputPel[LUMA][0];
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
{
for( UInt i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ ) {
*pPel++ = *pCvPel++;
}
bRet = true;
@@ -1294,8 +1252,7 @@ Double PlaYUVerFrame::getMSE( PlaYUVerFrame* Org, Int component )
numberOfPixels = getChromaLength();
}
for( UInt i = 0; i < numberOfPixels; i++ )
{
for( UInt i = 0; i < numberOfPixels; i++ ) {
aux_pel_1 = *pPelYUV++;
aux_pel_2 = *pOrgPelYUV++;
diff = aux_pel_1 - aux_pel_2;
@@ -1340,20 +1297,16 @@ float compute_ssim( Pel** refImg, Pel** encImg, Int width, Int height, Int win_w
C1 = K1 * K1 * max_pix_value_sqd;
C2 = K2 * K2 * max_pix_value_sqd;
for( j = 0; j <= height - win_height; j += overlapSize )
{
for( i = 0; i <= width - win_width; i += overlapSize )
{
for( j = 0; j <= height - win_height; j += overlapSize ) {
for( i = 0; i <= width - win_width; i += overlapSize ) {
imeanOrg = 0;
imeanEnc = 0;
ivarOrg = 0;
ivarEnc = 0;
icovOrgEnc = 0;
for( n = j; n < j + win_height; n++ )
{
for( m = i; m < i + win_width; m++ )
{
for( n = j; n < j + win_height; n++ ) {
for( m = i; m < i + win_width; m++ ) {
imeanOrg += refImg[n][m];
imeanEnc += encImg[n][m];
ivarOrg += refImg[n][m] * refImg[n][m];