Remove PlaYUVerFrameStats and put everything in PlaYUVerFrame

This commit is contained in:
jfmcarreira committed 2015-07-30 17:43:47 +01:00
1 parent c4d1589d25
commit b52dc2390d
8 files changed
+495 -613

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ set(plaYUver_Lib_SRCS
# Frame
PlaYUVerFrame.cpp
PlaYUVerFramePixelFormats.cpp
PlaYUVerFrameStats.cpp
# PlaYUVerFrameStats.cpp
# Stream
PlaYUVerStream.cpp
# Command Parser
@@ -28,7 +28,7 @@ ENDIF()
set(plaYUver_Lib_HEADERS
PlaYUVerDefs.h
PlaYUVerProgramOptions.h
PlaYUVerFrameStats.h
# PlaYUVerFrameStats.h
PlaYUVerFrame.h
PlaYUVerStream.h
PlaYUVerModuleIf.h
+353 -1
View File
@@ -209,7 +209,13 @@ Void PlaYUVerFrame::init( UInt width, UInt height, Int pel_format, Int bitsPixel
}
getMem1D( &m_pcARGB32, m_uiHeight * m_uiWidth * 4 );
xSetupStatistics( this );
m_uiHistoSegments = 1 << m_iBitsPel;
if( m_pcPelFormat->colorSpace == PlaYUVerFrame::COLOR_RGB || m_pcPelFormat->colorSpace == PlaYUVerFrame::COLOR_ARGB )
m_uiHistoChannels = m_pcPelFormat->numberChannels + 1;
else
m_uiHistoChannels = m_pcPelFormat->numberChannels;
m_cPelFmtName = PlaYUVerFrame::supportedPixelFormatListNames()[m_iPixelFormat].c_str();
}
@@ -241,6 +247,11 @@ UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelF
return numberBytes * bytesPerPixel;
}
UInt PlaYUVerFrame::getPixels() const
{
return ( m_uiWidth * m_uiHeight );
}
UInt PlaYUVerFrame::getChromaWidth() const
{
if( m_pcPelFormat->colorSpace == GRAY )
@@ -260,6 +271,11 @@ UInt PlaYUVerFrame::getChromaLength() const
return getChromaWidth() * getChromaHeight();
}
UInt PlaYUVerFrame::getChromaSize() const
{
return getChromaWidth() * getChromaHeight();
}
Void PlaYUVerFrame::frameFromBuffer( Byte *Buff, UInt64 uiBuffSize )
{
if( uiBuffSize != getBytesPerFrame() )
@@ -428,6 +444,342 @@ Void PlaYUVerFrame::fillRGBBuffer()
m_bHasRGBPel = true;
}
// statistics
Void PlaYUVerFrame::calcHistogram()
{
if( m_bHasHistogram )
return;
if( !m_puiHistogram )
{
//m_puiHistogram = new UInt[m_uiHistoSegments * histoChannels];
getMem1D<UInt>( &( m_puiHistogram ), m_uiHistoSegments * m_uiHistoChannels );
if( !m_puiHistogram )
{
return;
}
}
m_bRunningFlag = true;
UInt i, j;
UInt numberChannels = m_pcPelFormat->numberChannels;
Int colorSpace = m_pcPelFormat->colorSpace;
if( colorSpace == PlaYUVerFrame::COLOR_YUV )
{
const Pel *data[3];
data[LUMA] = m_pppcInputPel[LUMA][0];
data[CHROMA_U] = m_pppcInputPel[CHROMA_U][0];
data[CHROMA_V] = m_pppcInputPel[CHROMA_V][0];
for( i = 0; i < m_uiHeight * m_uiWidth && m_bRunningFlag; i++ )
{
m_puiHistogram[*( data[LUMA] ) + LUMA * m_uiHistoSegments]++;
data[LUMA] += 1;
}
for( i = 0; ( i < getChromaSize() ) && m_bRunningFlag; i++ )
{
for( j = 1; j < numberChannels; j++ )
{
m_puiHistogram[*( data[j] ) + j * m_uiHistoSegments]++;
data[j] += 1;
}
}
}
else
{
const Pel* data[3];
Pel luma;
data[COLOR_R] = m_pppcInputPel[COLOR_R][0];
data[COLOR_G] = m_pppcInputPel[COLOR_G][0];
data[COLOR_B] = m_pppcInputPel[COLOR_B][0];
for( i = 0; ( i < m_uiHeight * m_uiWidth ) && m_bRunningFlag; i++ )
{
for( j = 0; j < numberChannels; j++ )
{
m_puiHistogram[*( data[j] ) + j * m_uiHistoSegments]++;
}
if( ( colorSpace == PlaYUVerFrame::COLOR_RGB || colorSpace == PlaYUVerFrame::COLOR_ARGB ) )
{
PlaYUVerFrame::Pixel currPixel( colorSpace, *( data[COLOR_R] ), *( data[COLOR_G] ), *( data[COLOR_B] ) );
luma = PlaYUVerFrame::ConvertPixel( currPixel, PlaYUVerFrame::COLOR_YUV ).Y();
m_puiHistogram[luma + j * m_uiHistoSegments]++;
}
for( j = 0; j < numberChannels; j++ )
data[j] += 1;
}
}
m_bHasHistogram = true;
m_bRunningFlag = false;
}
Int PlaYUVerFrame::getHistogramSegment()
{
return m_uiHistoSegments;
}
Int PlaYUVerFrame::getRealHistoChannel( Int channel )
{
Int histoChannel;
switch( getColorSpace() )
{
case PlaYUVerFrame::COLOR_GRAY:
if( channel != LUMA )
{
return -1;
}
histoChannel = 0;
break;
case PlaYUVerFrame::COLOR_RGB:
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != LUMA )
{
return -1;
}
else
{
if( channel == LUMA )
{
histoChannel = 3;
}
else
{
histoChannel = channel;
}
}
break;
case PlaYUVerFrame::COLOR_ARGB:
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A && channel != LUMA )
{
return -1;
}
else
{
if( channel == LUMA )
{
histoChannel = 4;
}
else
{
histoChannel = channel;
}
}
break;
case PlaYUVerFrame::COLOR_YUV:
if( channel != LUMA && channel != CHROMA_U && channel != CHROMA_V )
{
return -1;
}
else
{
histoChannel = channel;
}
break;
default:
histoChannel = -1;
}
return histoChannel;
}
Double PlaYUVerFrame::getCount( Int channel, UInt start, UInt end )
{
UInt i;
Int histoChannel;
Int indexStart;
Double count = 0.0;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( i = start; i <= end; i++ )
{
count += m_puiHistogram[indexStart + i];
}
return count;
}
Double PlaYUVerFrame::getMean( Int channel, UInt start, UInt end )
{
Int indexStart;
Int histoChannel;
Double mean = 0.0;
Double count;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( UInt i = start; i <= end; i++ )
{
mean += i * m_puiHistogram[indexStart + i];
}
count = getCount( channel, start, end );
if( count > 0.0 )
{
return mean / count;
}
return mean;
}
Int PlaYUVerFrame::getMedian( Int channel, UInt start, UInt end )
{
Int histoChannel;
Int indexStart;
Double sum = 0.0;
Double count;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0;
}
indexStart = histoChannel * m_uiHistoSegments;
count = getCount( channel, start, end );
for( UInt i = start; i <= end; i++ )
{
sum += m_puiHistogram[indexStart + i];
if( sum * 2 > count )
return i;
}
return 0;
}
Double PlaYUVerFrame::getStdDev( Int channel, UInt start, UInt end )
{
Int histoChannel;
Int indexStart;
Double dev = 0.0;
Double count;
Double mean;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
mean = getMean( channel, start, end );
count = getCount( channel, start, end );
if( count == 0.0 )
count = 1.0;
/*------------ original
for ( i = start ; i <= end ; i++ )
{
dev += ( i - mean ) * ( i - mean ) * m_puiHistogram[indexStart +i];
}
return sqrt( dev / count );
-----------------------*/
for( UInt i = start; i <= end; i++ )
{
dev += ( i * i ) * m_puiHistogram[indexStart + i];
}
return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) );
}
Double PlaYUVerFrame::getHistogramValue( Int channel, UInt bin )
{
Double value;
Int histoChannel;
Int indexStart;
if( !m_bHasHistogram || bin < 0 || bin > m_uiHistoSegments - 1 )
return 0.0;
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
value = m_puiHistogram[indexStart + bin];
return value;
}
Double PlaYUVerFrame::getMaximum( Int channel )
{
Double max = 0.0;
Int histoChannel;
Int indexStart;
if( !m_bHasHistogram )
return 0.0;
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( UInt x = 0; x < m_uiHistoSegments; x++ )
{
if( m_puiHistogram[indexStart + x] > max )
{
max = m_puiHistogram[indexStart + x];
}
}
return max;
}
Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame )
{
if( m_iPixelFormat != input_frame->getPelFormat() && m_uiWidth == input_frame->getWidth() && m_uiHeight == input_frame->getHeight() )
+55 -1
View File
@@ -51,7 +51,8 @@ struct PlaYUVerPixFmtDescriptor;
* \ingroup PlaYUVerLib PlaYUVerLib_Frame
* \brief Frame handling class
*/
class PlaYUVerFrame: public PlaYUVerFrameStats
class PlaYUVerFrame
//: public PlaYUVerFrameStats
{
public:
@@ -214,15 +215,52 @@ public:
Int getColorSpace() const;
UInt getNumberChannels() const;
UInt getPixels() const;
UInt getChromaWidth() const;
UInt getChromaHeight() const;
UInt getChromaLength() const;
UInt getChromaSize() const;
Void frameFromBuffer( Byte*, UInt64 );
Void frameToBuffer( Byte* );
Void fillRGBBuffer();
Void calcHistogram();
// Methods for to manipulate the histogram data.
Double getCount( Int channel, UInt start, UInt end );
Double getMean( Int channel, UInt start, UInt end );
Int getMedian( Int channel, UInt start, UInt end );
/**
* @return Number of image pixels
*/
Double getStdDev( Int channel, UInt start, UInt end );
Double getHistogramValue( Int channel, UInt bin );
Double getMaximum( Int channel );
/**
* @return Number of histogram segments: 256 or 65536 for 8 or 16 bits per
* sample.
*/
Int getHistogramSegment();
/**
* Control calculation
*/
Void setRunningFlag( Bool bFlag )
{
m_bRunningFlag = bFlag;
}
Bool getHasHistogram()
{
return m_bHasHistogram;
}
Void copyFrom( PlaYUVerFrame* );
Void copyFrom( PlaYUVerFrame*, UInt, UInt );
@@ -350,6 +388,22 @@ private:
Bool m_bHasRGBPel; //!< Flag indicating that the ARGB buffer was computed
UChar* m_pcARGB32; //!< Buffer with the ARGB pixels used in Qt libs
/** The histogram data.*/
UInt* m_puiHistogram;
/** If the image is RGB and calcLuma is true, we have 1 more channel */
UInt m_uiHistoChannels;
/** Numbers of histogram segments depending of image bytes depth*/
UInt m_uiHistoSegments;
/** Used to stop thread during calculations.*/
Bool m_bRunningFlag;
Int getRealHistoChannel( Int channel );
Bool m_bHasHistogram;
/**
* Common constructor function of a frame
*
-415
View File
@@ -1,415 +0,0 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file PlaYUVerFrameStats.cpp
* \ingroup PlaYUVerLib
* \brief Measure PlaYUVerFrame statistics
* Based on the work of Ricardo N. Rocha Sardo in SCode project
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include "PlaYUVerFrameStats.h"
#include "PlaYUVerFrame.h"
#include "LibMemory.h"
namespace plaYUVer
{
PlaYUVerFrameStats::PlaYUVerFrameStats() :
m_puiHistogram( NULL ),
m_bHasHistogram( false )
{
}
PlaYUVerFrameStats::~PlaYUVerFrameStats()
{
if( m_puiHistogram )
{
//delete[] m_puiHistogram;
freeMem1D( m_puiHistogram );
}
m_puiHistogram = NULL;
m_bHasHistogram = false;
}
// statistics
Void PlaYUVerFrameStats::xSetupStatistics( const PlaYUVerFrame *pcFrame )
{
m_pppImageData = pcFrame->getPelBufferYUV();
m_uiImageWidth = pcFrame->getWidth();
m_uiImageHeight = pcFrame->getHeight();
m_uiChannels = pcFrame->getNumberChannels();
m_uiHistoSegments = 1 << pcFrame->getBitsPel();
imageColorSpace = pcFrame->getColorSpace();
imageChromaSize = pcFrame->getChromaLength();
if( imageColorSpace == PlaYUVerFrame::COLOR_RGB || imageColorSpace == PlaYUVerFrame::COLOR_ARGB )
histoChannels = m_uiChannels + 1;
else
histoChannels = m_uiChannels;
}
Void PlaYUVerFrameStats::calcHistogram()
{
if( m_bHasHistogram )
return;
if( !m_puiHistogram )
{
//m_puiHistogram = new UInt[m_uiHistoSegments * histoChannels];
getMem1D<UInt>( &( m_puiHistogram ), m_uiHistoSegments * histoChannels );
if( !m_puiHistogram )
{
return;
}
}
m_bRunningFlag = true;
UInt i, j;
if( imageColorSpace == PlaYUVerFrame::COLOR_YUV )
{
const Pel *data[3];
data[LUMA] = m_pppImageData[LUMA][0];
data[CHROMA_U] = m_pppImageData[CHROMA_U][0];
data[CHROMA_V] = m_pppImageData[CHROMA_V][0];
for( i = 0; i < m_uiImageHeight * m_uiImageWidth && m_bRunningFlag; i++ )
{
m_puiHistogram[*( data[LUMA] ) + LUMA * m_uiHistoSegments]++;
data[LUMA] += 1;
}
for( i = 0; ( i < imageChromaSize ) && m_bRunningFlag; i++ )
{
for( j = 1; j < m_uiChannels; j++ )
{
m_puiHistogram[*( data[j] ) + j * m_uiHistoSegments]++;
data[j] += 1;
}
}
}
else
{
const Pel* data[3];
Pel luma;
data[COLOR_R] = m_pppImageData[COLOR_R][0];
data[COLOR_G] = m_pppImageData[COLOR_G][0];
data[COLOR_B] = m_pppImageData[COLOR_B][0];
for( i = 0; ( i < m_uiImageHeight * m_uiImageWidth ) && m_bRunningFlag; i++ )
{
for( j = 0; j < m_uiChannels; j++ )
{
m_puiHistogram[*( data[j] ) + j * m_uiHistoSegments]++;
}
if( ( imageColorSpace == PlaYUVerFrame::COLOR_RGB || imageColorSpace == PlaYUVerFrame::COLOR_ARGB ) )
{
PlaYUVerFrame::Pixel currPixel( imageColorSpace, *( data[COLOR_R] ), *( data[COLOR_G] ), *( data[COLOR_B] ) );
luma = PlaYUVerFrame::ConvertPixel( currPixel, PlaYUVerFrame::COLOR_YUV ).Y();
m_puiHistogram[luma + j * m_uiHistoSegments]++;
}
for( j = 0; j < m_uiChannels; j++ )
data[j] += 1;
}
}
m_bHasHistogram = true;
m_bRunningFlag = false;
}
Int PlaYUVerFrameStats::getHistogramSegment()
{
return m_uiHistoSegments;
}
Int PlaYUVerFrameStats::getRealHistoChannel( Int channel )
{
Int histoChannel;
switch( imageColorSpace )
{
case PlaYUVerFrame::COLOR_GRAY:
if( channel != LUMA )
{
return -1;
}
histoChannel = 0;
break;
case PlaYUVerFrame::COLOR_RGB:
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != LUMA )
{
return -1;
}
else
{
if( channel == LUMA )
{
histoChannel = 3;
}
else
{
histoChannel = channel;
}
}
break;
case PlaYUVerFrame::COLOR_ARGB:
if( channel != COLOR_R && channel != COLOR_G && channel != COLOR_B && channel != COLOR_A && channel != LUMA )
{
return -1;
}
else
{
if( channel == LUMA )
{
histoChannel = 4;
}
else
{
histoChannel = channel;
}
}
break;
case PlaYUVerFrame::COLOR_YUV:
if( channel != LUMA && channel != CHROMA_U && channel != CHROMA_V )
{
return -1;
}
else
{
histoChannel = channel;
}
break;
default:
histoChannel = -1;
}
return histoChannel;
}
Double PlaYUVerFrameStats::getCount( Int channel, UInt start, UInt end )
{
UInt i;
Int histoChannel;
Int indexStart;
Double count = 0.0;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( i = start; i <= end; i++ )
{
count += m_puiHistogram[indexStart + i];
}
return count;
}
Double PlaYUVerFrameStats::getPixels()
{
if( !m_bHasHistogram )
{
return 0.0;
}
return ( m_uiImageWidth * m_uiImageHeight );
}
Double PlaYUVerFrameStats::getMean( Int channel, UInt start, UInt end )
{
Int indexStart;
Int histoChannel;
Double mean = 0.0;
Double count;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( UInt i = start; i <= end; i++ )
{
mean += i * m_puiHistogram[indexStart + i];
}
count = getCount( channel, start, end );
if( count > 0.0 )
{
return mean / count;
}
return mean;
}
Int PlaYUVerFrameStats::getMedian( Int channel, UInt start, UInt end )
{
Int histoChannel;
Int indexStart;
Double sum = 0.0;
Double count;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0;
}
indexStart = histoChannel * m_uiHistoSegments;
count = getCount( channel, start, end );
for( UInt i = start; i <= end; i++ )
{
sum += m_puiHistogram[indexStart + i];
if( sum * 2 > count )
return i;
}
return 0;
}
Double PlaYUVerFrameStats::getStdDev( Int channel, UInt start, UInt end )
{
Int histoChannel;
Int indexStart;
Double dev = 0.0;
Double count;
Double mean;
if( !m_bHasHistogram || start < 0 || end > m_uiHistoSegments - 1 || start > end )
{
return 0.0;
}
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
mean = getMean( channel, start, end );
count = getCount( channel, start, end );
if( count == 0.0 )
count = 1.0;
/*------------ original
for ( i = start ; i <= end ; i++ )
{
dev += ( i - mean ) * ( i - mean ) * m_puiHistogram[indexStart +i];
}
return sqrt( dev / count );
-----------------------*/
for( UInt i = start; i <= end; i++ )
{
dev += ( i * i ) * m_puiHistogram[indexStart + i];
}
return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) );
}
Double PlaYUVerFrameStats::getHistogramValue( Int channel, UInt bin )
{
Double value;
Int histoChannel;
Int indexStart;
if( !m_bHasHistogram || bin < 0 || bin > m_uiHistoSegments - 1 )
return 0.0;
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
value = m_puiHistogram[indexStart + bin];
return value;
}
Double PlaYUVerFrameStats::getMaximum( Int channel )
{
Double max = 0.0;
Int histoChannel;
Int indexStart;
if( !m_bHasHistogram )
return 0.0;
histoChannel = getRealHistoChannel( channel );
if( histoChannel == -1 )
{
return 0.0;
}
indexStart = histoChannel * m_uiHistoSegments;
for( UInt x = 0; x < m_uiHistoSegments; x++ )
{
if( m_puiHistogram[indexStart + x] > max )
{
max = m_puiHistogram[indexStart + x];
}
}
return max;
}
} // NAMESPACE
-111
View File
@@ -1,111 +0,0 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file PlaYUVerFrameStats.h
* \ingroup PlaYUVerLib
* \brief Measure PlaYUVerFrame statistics
* Based on the work of Ricardo N. Rocha Sardo in SCode project
*/
#ifndef __PLAYUVERFRAMESTATS_H__
#define __PLAYUVERFRAMESTATS_H__
#include "PlaYUVerDefs.h"
namespace plaYUVer
{
class PlaYUVerFrame;
class PlaYUVerFrameStats
{
public:
PlaYUVerFrameStats();
~PlaYUVerFrameStats();
Void calcHistogram();
// Methods for to manipulate the histogram data.
Double getCount( Int channel, UInt start, UInt end );
Double getMean( Int channel, UInt start, UInt end );
Int getMedian( Int channel, UInt start, UInt end );
/**
* @return Number of image pixels
*/
Double getPixels();
Double getStdDev( Int channel, UInt start, UInt end );
Double getHistogramValue( Int channel, UInt bin );
Double getMaximum( Int channel );
/**
* @return Number of histogram segments: 256 or 65536 for 8 or 16 bits per
* sample.
*/
Int getHistogramSegment();
/**
* Control calculation
*/
Void setRunningFlag( Bool bFlag )
{
m_bRunningFlag = bFlag;
}
Bool getHasHistogram()
{
return m_bHasHistogram;
}
private:
/** The histogram data.*/
UInt* m_puiHistogram;
/** If the image is RGB and calcLuma is true, we have 1 more channel */
Int histoChannels;
/** Image information.*/
Pel*** m_pppImageData;
UInt m_uiImageWidth;
UInt m_uiImageHeight;
UInt m_uiChannels;
Int imageColorSpace;
UInt imageChromaSize;
/** Numbers of histogram segments dependaing of image bytes depth*/
UInt m_uiHistoSegments;
/** Used to stop thread during calculations.*/
Bool m_bRunningFlag;
Int getRealHistoChannel( Int channel );
protected:
Bool m_bHasHistogram;
Void xSetupStatistics( const PlaYUVerFrame *pcFrame );
};
} // NAMESPACE
#endif // __PLAYUVERFRAMESTATS_H__