Add PlaYUVerFrameStats in order to calculate frame stats. This is meant to replace the existing class
This commit is contained in:
1 parent
34b4fe7439
commit
bec150f705
5 files changed
+555
-3
No files matched your search
@@ -0,0 +1,120 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014 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
|
||||
* \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:
|
||||
|
||||
enum StatisticsChannel
|
||||
{
|
||||
LumaChannel = 0,
|
||||
RedChannel = 1,
|
||||
GreenChannel = 2,
|
||||
BlueChannel = 3,
|
||||
AlphaChannel = 4,
|
||||
YChannel = 1,
|
||||
CbChannel = 2,
|
||||
CrChannel = 3
|
||||
};
|
||||
|
||||
enum StatisticsOptions
|
||||
{
|
||||
CalcLumaWhenRGB = 1
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
|
||||
/** The histogram data.*/
|
||||
Double* m_pdHistogram;
|
||||
|
||||
/** If true, calc the luminosity channel histogram when the image is RGB */
|
||||
Bool calcLuma;
|
||||
|
||||
/** 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 runningFlag;
|
||||
|
||||
Int getRealHistoChannel( Int channel );
|
||||
|
||||
protected:
|
||||
|
||||
Bool m_bHasHistogram;
|
||||
|
||||
Void xSetupStatistics( const PlaYUVerFrame *pcFrame, UInt options = CalcLumaWhenRGB );
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __PLAYUVERFRAMESTATS_H__
|
||||
Reference in new issue
Block a user