Fix bug with PlaYUVerPixel
This commit is contained in:
3 files changed
+199
-133
No files matched your search
@@ -999,15 +999,19 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
|
|||||||
if( ColorSpace == PlaYUVerPixel::COLOR_YUV )
|
if( ColorSpace == PlaYUVerPixel::COLOR_YUV )
|
||||||
{
|
{
|
||||||
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
||||||
strStatus.append(
|
strStatus.append( QString( "Y: %1 U: %2 V: %3" )
|
||||||
QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() ) );
|
.arg( sPixelValue.Y() )
|
||||||
|
.arg( sPixelValue.Cb() )
|
||||||
|
.arg( sPixelValue.Cr() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( ColorSpace == PlaYUVerPixel::COLOR_RGB ) )
|
if( ( ColorSpace == PlaYUVerPixel::COLOR_RGB ) )
|
||||||
{
|
{
|
||||||
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
||||||
strStatus.append(
|
strStatus.append( QString( "R: %1 G: %2 B: %3" )
|
||||||
QString( "R: %1 G: %2 B: %3" ).arg( sPixelValue.R() ).arg( sPixelValue.G() ).arg( sPixelValue.B() ) );
|
.arg( sPixelValue.R() )
|
||||||
|
.arg( sPixelValue.G() )
|
||||||
|
.arg( sPixelValue.B() ) );
|
||||||
}
|
}
|
||||||
emit updateStatusBar( strStatus );
|
emit updateStatusBar( strStatus );
|
||||||
}
|
}
|
||||||
|
|||||||
+101
-43
@@ -35,10 +35,6 @@
|
|||||||
|
|
||||||
#define MAX_NUMBER_COMPONENTS 4
|
#define MAX_NUMBER_COMPONENTS 4
|
||||||
|
|
||||||
/*! \brief Supported formats
|
|
||||||
*
|
|
||||||
* List of supported pixels formats
|
|
||||||
*/
|
|
||||||
std::vector<String> PlaYUVerFrame::supportedColorSpacesListNames()
|
std::vector<String> PlaYUVerFrame::supportedColorSpacesListNames()
|
||||||
{
|
{
|
||||||
return std::vector<String>{
|
return std::vector<String>{
|
||||||
@@ -79,7 +75,24 @@ Int PlaYUVerFrame::findPixelFormat( const String& name )
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Void YuvToRgb( const Int& iY, const Int& iU, const Int& iV, Int& iR, Int& iG, Int& iB )
|
struct PlaYUVerPixelPrivate
|
||||||
|
{
|
||||||
|
PlaYUVerPixelPrivate( const Int& ColorSpace )
|
||||||
|
{
|
||||||
|
iColorSpace = ColorSpace == PlaYUVerPixel::COLOR_GRAY ?
|
||||||
|
PlaYUVerPixel::COLOR_YUV :
|
||||||
|
ColorSpace;
|
||||||
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
PixelComponents[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Int iColorSpace;
|
||||||
|
Pel PixelComponents[MAX_NUMBER_COMPONENTS];
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline Void yuvToRgb( const Int& iY, const Int& iU, const Int& iV, Int& iR, Int& iG, Int& iB )
|
||||||
{
|
{
|
||||||
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 );
|
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 );
|
||||||
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 );
|
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 );
|
||||||
@@ -96,64 +109,56 @@ static inline Void rgbToYuv( const Int& iR, const Int& iG, const Int& iB, Int& i
|
|||||||
iV = ( 1000 * ( iR - iY ) + 179456 ) / 1402;
|
iV = ( 1000 * ( iR - iY ) + 179456 ) / 1402;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlaYUVerPixelPrivate
|
|
||||||
{
|
|
||||||
Int iColorSpace;
|
|
||||||
Pel PixelComponents[MAX_NUMBER_COMPONENTS];
|
|
||||||
};
|
|
||||||
|
|
||||||
Int PlaYUVerPixel::getMaxNumberOfComponents()
|
Int PlaYUVerPixel::getMaxNumberOfComponents()
|
||||||
{
|
{
|
||||||
return MAX_NUMBER_COMPONENTS;
|
return MAX_NUMBER_COMPONENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel::PlaYUVerPixel()
|
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace )
|
||||||
: d( new PlaYUVerPixelPrivate )
|
: d( new PlaYUVerPixelPrivate( ColorSpace ) )
|
||||||
{
|
{
|
||||||
d->iColorSpace = COLOR_INVALID;
|
|
||||||
d->PixelComponents[0] = 0;
|
|
||||||
d->PixelComponents[1] = 0;
|
|
||||||
d->PixelComponents[2] = 0;
|
|
||||||
d->PixelComponents[3] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace )
|
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0 )
|
||||||
|
: d( new PlaYUVerPixelPrivate( ColorSpace ) )
|
||||||
{
|
{
|
||||||
d->iColorSpace = ColorSpace == COLOR_GRAY ? COLOR_YUV : ColorSpace;
|
d->PixelComponents[0] = c0;
|
||||||
d->PixelComponents[0] = 0;
|
|
||||||
d->PixelComponents[1] = 0;
|
|
||||||
d->PixelComponents[2] = 0;
|
|
||||||
d->PixelComponents[3] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2 )
|
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2 )
|
||||||
|
: d( new PlaYUVerPixelPrivate( ColorSpace ) )
|
||||||
{
|
{
|
||||||
d->iColorSpace = ColorSpace == COLOR_GRAY ? COLOR_YUV : ColorSpace;
|
|
||||||
d->PixelComponents[0] = c0;
|
d->PixelComponents[0] = c0;
|
||||||
d->PixelComponents[1] = c1;
|
d->PixelComponents[1] = c1;
|
||||||
d->PixelComponents[2] = c2;
|
d->PixelComponents[2] = c2;
|
||||||
d->PixelComponents[3] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2, const Pel& c3 )
|
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2, const Pel& c3 )
|
||||||
|
: d( new PlaYUVerPixelPrivate( ColorSpace ) )
|
||||||
{
|
{
|
||||||
d->iColorSpace = ColorSpace == COLOR_GRAY ? COLOR_YUV : ColorSpace;
|
|
||||||
d->PixelComponents[0] = c0;
|
d->PixelComponents[0] = c0;
|
||||||
d->PixelComponents[1] = c1;
|
d->PixelComponents[1] = c1;
|
||||||
d->PixelComponents[2] = c2;
|
d->PixelComponents[2] = c2;
|
||||||
d->PixelComponents[3] = c3;
|
d->PixelComponents[3] = c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel::~PlaYUVerPixel() {}
|
PlaYUVerPixel::PlaYUVerPixel( const PlaYUVerPixel& other )
|
||||||
|
: d( new PlaYUVerPixelPrivate( other.colorSpace() ) )
|
||||||
Int PlaYUVerPixel::ColorSpaceType()
|
|
||||||
{
|
{
|
||||||
return d->iColorSpace;
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
d->PixelComponents[i] = other[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pel* PlaYUVerPixel::Components()
|
PlaYUVerPixel::~PlaYUVerPixel()
|
||||||
{
|
{
|
||||||
return d->PixelComponents;
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
Int PlaYUVerPixel::colorSpace() const
|
||||||
|
{
|
||||||
|
return d->iColorSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pel PlaYUVerPixel::Y() const
|
Pel PlaYUVerPixel::Y() const
|
||||||
@@ -168,6 +173,22 @@ Pel PlaYUVerPixel::Cr() const
|
|||||||
{
|
{
|
||||||
return d->PixelComponents[2];
|
return d->PixelComponents[2];
|
||||||
}
|
}
|
||||||
|
Pel PlaYUVerPixel::R() const
|
||||||
|
{
|
||||||
|
return d->PixelComponents[0];
|
||||||
|
}
|
||||||
|
Pel PlaYUVerPixel::G() const
|
||||||
|
{
|
||||||
|
return d->PixelComponents[1];
|
||||||
|
}
|
||||||
|
Pel PlaYUVerPixel::B() const
|
||||||
|
{
|
||||||
|
return d->PixelComponents[2];
|
||||||
|
}
|
||||||
|
Pel PlaYUVerPixel::A() const
|
||||||
|
{
|
||||||
|
return d->PixelComponents[3];
|
||||||
|
}
|
||||||
|
|
||||||
Pel& PlaYUVerPixel::Y()
|
Pel& PlaYUVerPixel::Y()
|
||||||
{
|
{
|
||||||
@@ -193,6 +214,10 @@ Pel& PlaYUVerPixel::B()
|
|||||||
{
|
{
|
||||||
return d->PixelComponents[2];
|
return d->PixelComponents[2];
|
||||||
}
|
}
|
||||||
|
Pel& PlaYUVerPixel::A()
|
||||||
|
{
|
||||||
|
return d->PixelComponents[3];
|
||||||
|
}
|
||||||
|
|
||||||
Pel PlaYUVerPixel::operator[]( const Int& channel ) const
|
Pel PlaYUVerPixel::operator[]( const Int& channel ) const
|
||||||
{
|
{
|
||||||
@@ -203,6 +228,15 @@ Pel& PlaYUVerPixel::operator[]( const Int& channel )
|
|||||||
return d->PixelComponents[channel];
|
return d->PixelComponents[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaYUVerPixel PlaYUVerPixel::operator=( const PlaYUVerPixel& other )
|
||||||
|
{
|
||||||
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
d->PixelComponents[i] = other[i];
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
PlaYUVerPixel PlaYUVerPixel::operator+( const PlaYUVerPixel& in )
|
PlaYUVerPixel PlaYUVerPixel::operator+( const PlaYUVerPixel& in )
|
||||||
{
|
{
|
||||||
PlaYUVerPixel result;
|
PlaYUVerPixel result;
|
||||||
@@ -210,20 +244,45 @@ PlaYUVerPixel PlaYUVerPixel::operator+( const PlaYUVerPixel& in )
|
|||||||
{
|
{
|
||||||
result[i] = d->PixelComponents[i] + in[i];
|
result[i] = d->PixelComponents[i] + in[i];
|
||||||
}
|
}
|
||||||
PlaYUVerPixel out( d->iColorSpace, Y() + in.Y(), Cb() + in.Cb(), Cr() + in.Cr() );
|
return result;
|
||||||
return out;
|
}
|
||||||
|
|
||||||
|
PlaYUVerPixel PlaYUVerPixel::operator+=( const PlaYUVerPixel& in )
|
||||||
|
{
|
||||||
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
d->PixelComponents[i] += in[i];
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel PlaYUVerPixel::operator-( const PlaYUVerPixel& in )
|
PlaYUVerPixel PlaYUVerPixel::operator-( const PlaYUVerPixel& in )
|
||||||
{
|
{
|
||||||
PlaYUVerPixel out( d->iColorSpace, Y() - in.Y(), Cb() - in.Cb(), Cr() - in.Cr() );
|
PlaYUVerPixel result;
|
||||||
return out;
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
result[i] = d->PixelComponents[i] - in[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaYUVerPixel PlaYUVerPixel::operator-=( const PlaYUVerPixel& in )
|
||||||
|
{
|
||||||
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
d->PixelComponents[i] -= in[i];
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel PlaYUVerPixel::operator*( const Double& op )
|
PlaYUVerPixel PlaYUVerPixel::operator*( const Double& op )
|
||||||
{
|
{
|
||||||
PlaYUVerPixel out( d->iColorSpace, Y() * op, Cb() * op, Cr() * op );
|
PlaYUVerPixel result;
|
||||||
return out;
|
for( Int i = 0; i < MAX_NUMBER_COMPONENTS; i++ )
|
||||||
|
{
|
||||||
|
result[i] = d->PixelComponents[i] * op;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaYUVerPixel PlaYUVerPixel::ConvertPixel( ColorSpace eOutputSpace )
|
PlaYUVerPixel PlaYUVerPixel::ConvertPixel( ColorSpace eOutputSpace )
|
||||||
@@ -236,7 +295,7 @@ PlaYUVerPixel PlaYUVerPixel::ConvertPixel( ColorSpace eOutputSpace )
|
|||||||
|
|
||||||
if( eOutputSpace == COLOR_RGB )
|
if( eOutputSpace == COLOR_RGB )
|
||||||
{
|
{
|
||||||
YuvToRgb( Y(), Cb(), Cr(), outA, outB, outC );
|
yuvToRgb( Y(), Cb(), Cr(), outA, outB, outC );
|
||||||
outPixel.R() = outA;
|
outPixel.R() = outA;
|
||||||
outPixel.G() = outB;
|
outPixel.G() = outB;
|
||||||
outPixel.B() = outC;
|
outPixel.B() = outC;
|
||||||
@@ -649,8 +708,7 @@ UChar* PlaYUVerFrame::getRGBBuffer()
|
|||||||
|
|
||||||
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos )
|
PlaYUVerPixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos )
|
||||||
{
|
{
|
||||||
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace, d->m_uiHalfPelValue, d->m_uiHalfPelValue,
|
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace );
|
||||||
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 ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||||
@@ -679,7 +737,7 @@ Void PlaYUVerFrame::setPixelValue( Int xPos, Int yPos, PlaYUVerPixel pixel )
|
|||||||
{
|
{
|
||||||
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
Int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||||
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
Int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||||
d->m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )] = pixel.Components()[ch];
|
d->m_pppcInputPel[ch][( yPos >> ratioH )][( xPos >> ratioW )] = pixel[ch];
|
||||||
}
|
}
|
||||||
d->m_bHasHistogram = false;
|
d->m_bHasHistogram = false;
|
||||||
d->m_bHasRGBPel = false;
|
d->m_bHasRGBPel = false;
|
||||||
|
|||||||
+90
-86
@@ -61,15 +61,14 @@ public:
|
|||||||
|
|
||||||
static Int getMaxNumberOfComponents();
|
static Int getMaxNumberOfComponents();
|
||||||
|
|
||||||
PlaYUVerPixel();
|
PlaYUVerPixel( const Int& ColorSpace = COLOR_INVALID );
|
||||||
PlaYUVerPixel( const Int& ColorSpace );
|
PlaYUVerPixel( const Int& ColorSpace, const Pel& c0 );
|
||||||
PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2 );
|
PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2 );
|
||||||
PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2, const Pel& c3 );
|
PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2, const Pel& c3 );
|
||||||
|
PlaYUVerPixel( const PlaYUVerPixel& other );
|
||||||
~PlaYUVerPixel();
|
~PlaYUVerPixel();
|
||||||
|
|
||||||
Int ColorSpaceType();
|
Int colorSpace() const;
|
||||||
|
|
||||||
Pel* Components();
|
|
||||||
|
|
||||||
Pel Y() const;
|
Pel Y() const;
|
||||||
Pel Cb() const;
|
Pel Cb() const;
|
||||||
@@ -77,6 +76,7 @@ public:
|
|||||||
Pel R() const;
|
Pel R() const;
|
||||||
Pel G() const;
|
Pel G() const;
|
||||||
Pel B() const;
|
Pel B() const;
|
||||||
|
Pel A() const;
|
||||||
|
|
||||||
Pel& Y();
|
Pel& Y();
|
||||||
Pel& Cb();
|
Pel& Cb();
|
||||||
@@ -84,12 +84,16 @@ public:
|
|||||||
Pel& R();
|
Pel& R();
|
||||||
Pel& G();
|
Pel& G();
|
||||||
Pel& B();
|
Pel& B();
|
||||||
|
Pel& A();
|
||||||
|
|
||||||
Pel operator[]( const Int& channel ) const;
|
Pel operator[]( const Int& channel ) const;
|
||||||
Pel& operator[]( const Int& channel );
|
Pel& operator[]( const Int& channel );
|
||||||
|
|
||||||
|
PlaYUVerPixel operator=( const PlaYUVerPixel& );
|
||||||
PlaYUVerPixel operator+( const PlaYUVerPixel& );
|
PlaYUVerPixel operator+( const PlaYUVerPixel& );
|
||||||
|
PlaYUVerPixel operator+=( const PlaYUVerPixel& );
|
||||||
PlaYUVerPixel operator-( const PlaYUVerPixel& );
|
PlaYUVerPixel operator-( const PlaYUVerPixel& );
|
||||||
|
PlaYUVerPixel operator-=( const PlaYUVerPixel& );
|
||||||
PlaYUVerPixel operator*( const Double& );
|
PlaYUVerPixel operator*( const Double& );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,8 +117,8 @@ class PlaYUVerFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** ColorSpace Enum
|
/** ColorSpace Enum
|
||||||
* List of supported pixel formats - do not change order
|
* List of supported pixel formats - do not change order
|
||||||
*/
|
*/
|
||||||
enum PixelFormats
|
enum PixelFormats
|
||||||
{
|
{
|
||||||
NO_FMT = -1,
|
NO_FMT = -1,
|
||||||
@@ -130,58 +134,58 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that handles the supported color space
|
* Function that handles the supported color space
|
||||||
* of PlaYUVerFrame
|
* of PlaYUVerFrame
|
||||||
* @return vector of strings with pixel formats names
|
* @return vector of strings with pixel formats names
|
||||||
*/
|
*/
|
||||||
static std::vector<String> supportedColorSpacesListNames();
|
static std::vector<String> supportedColorSpacesListNames();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that handles the supported pixel formats
|
* Function that handles the supported pixel formats
|
||||||
* of PlaYUVerFrame
|
* of PlaYUVerFrame
|
||||||
* @return vector of strings with pixel formats names
|
* @return vector of strings with pixel formats names
|
||||||
*/
|
*/
|
||||||
static std::vector<String> supportedPixelFormatListNames();
|
static std::vector<String> supportedPixelFormatListNames();
|
||||||
static std::vector<String> supportedPixelFormatListNames( Int colorSpace );
|
static std::vector<String> supportedPixelFormatListNames( Int colorSpace );
|
||||||
static Int findPixelFormat( const String& name );
|
static Int findPixelFormat( const String& name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new frame using the following configuration
|
* Creates a new frame using the following configuration
|
||||||
*
|
*
|
||||||
* @param width width of the frame
|
* @param width width of the frame
|
||||||
* @param height height of the frame
|
* @param height height of the frame
|
||||||
* @param pel_format pixel format index (always use PixelFormats enum)
|
* @param pel_format pixel format index (always use PixelFormats enum)
|
||||||
*
|
*
|
||||||
* @note this function might misbehave if the pixel format enum is not correct
|
* @note this function might misbehave if the pixel format enum is not correct
|
||||||
*/
|
*/
|
||||||
PlaYUVerFrame( UInt width, UInt height, Int pelFormat, Int bitsPixel = 8 );
|
PlaYUVerFrame( UInt width, UInt height, Int pelFormat, Int bitsPixel = 8 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy contructor
|
* Copy contructor
|
||||||
*
|
*
|
||||||
* @param other existing frame to copy from
|
* @param other existing frame to copy from
|
||||||
*/
|
*/
|
||||||
PlaYUVerFrame( const PlaYUVerFrame& other );
|
PlaYUVerFrame( const PlaYUVerFrame& other );
|
||||||
PlaYUVerFrame( const PlaYUVerFrame* other );
|
PlaYUVerFrame( const PlaYUVerFrame* other );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and new frame with the configuration of an existing one and copy
|
* Creates and new frame with the configuration of an existing one and copy
|
||||||
* its contents. This function only copies a specific region from the existing
|
* its contents. This function only copies a specific region from the existing
|
||||||
* frame
|
* frame
|
||||||
*
|
*
|
||||||
* @param other existing frame to copy from
|
* @param other existing frame to copy from
|
||||||
* @param posX position X to crop from
|
* @param posX position X to crop from
|
||||||
* @param posY position Y to crop from
|
* @param posY position Y to crop from
|
||||||
* @param areaWidth crop width
|
* @param areaWidth crop width
|
||||||
* @param areaHeight crop height
|
* @param areaHeight crop height
|
||||||
*/
|
*/
|
||||||
PlaYUVerFrame( const PlaYUVerFrame& other, UInt x, UInt y, UInt width, UInt height );
|
PlaYUVerFrame( const PlaYUVerFrame& other, UInt x, UInt y, UInt width, UInt height );
|
||||||
PlaYUVerFrame( const PlaYUVerFrame* other, UInt x, UInt y, UInt width, UInt height );
|
PlaYUVerFrame( const PlaYUVerFrame* other, UInt x, UInt y, UInt width, UInt height );
|
||||||
|
|
||||||
~PlaYUVerFrame();
|
~PlaYUVerFrame();
|
||||||
|
|
||||||
/** Format match opts
|
/** Format match opts
|
||||||
*/
|
*/
|
||||||
enum FormatMatching
|
enum FormatMatching
|
||||||
{
|
{
|
||||||
MATCH_COLOR_SPACE = 1,
|
MATCH_COLOR_SPACE = 1,
|
||||||
@@ -193,57 +197,57 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if two PlaYUVerFrames have the same fmt
|
* Check if two PlaYUVerFrames have the same fmt
|
||||||
* @param other frame to compare with
|
* @param other frame to compare with
|
||||||
* @param match matching conditions (use enum FormatMatching)
|
* @param match matching conditions (use enum FormatMatching)
|
||||||
* @return true if format matches
|
* @return true if format matches
|
||||||
*/
|
*/
|
||||||
Bool haveSameFmt( const PlaYUVerFrame& other, UInt match = MATCH_ALL ) const;
|
Bool haveSameFmt( const PlaYUVerFrame& other, UInt match = MATCH_ALL ) const;
|
||||||
Bool haveSameFmt( const PlaYUVerFrame* other, UInt match = MATCH_ALL ) const;
|
Bool haveSameFmt( const PlaYUVerFrame* other, UInt match = MATCH_ALL ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pixel format information
|
* Get pixel format information
|
||||||
* @return pixel format index
|
* @return pixel format index
|
||||||
*/
|
*/
|
||||||
Int getPelFormat() const;
|
Int getPelFormat() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pixel format information
|
* Get pixel format information
|
||||||
* @return pixel format name
|
* @return pixel format name
|
||||||
*/
|
*/
|
||||||
String getPelFmtName();
|
String getPelFmtName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get color space information
|
* Get color space information
|
||||||
* @return get color space index
|
* @return get color space index
|
||||||
*/
|
*/
|
||||||
Int getColorSpace() const;
|
Int getColorSpace() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of channels
|
* Get the number of channels
|
||||||
* @return number of channels
|
* @return number of channels
|
||||||
*/
|
*/
|
||||||
UInt getNumberChannels() const;
|
UInt getNumberChannels() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get width of the frame
|
* Get width of the frame
|
||||||
* @param channel/component
|
* @param channel/component
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
UInt getWidth( Int channel = 0 ) const;
|
UInt getWidth( Int channel = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get height of the frame
|
* Get height of the frame
|
||||||
* @param channel/component
|
* @param channel/component
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
UInt getHeight( Int channel = 0 ) const;
|
UInt getHeight( Int channel = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of pixels of the frame
|
* Get number of pixels of the frame
|
||||||
* @param channel/component
|
* @param channel/component
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
UInt getPixels( Int channel = 0 ) const;
|
UInt getPixels( Int channel = 0 ) const;
|
||||||
|
|
||||||
UInt8 getChromaWidthRatio() const;
|
UInt8 getChromaWidthRatio() const;
|
||||||
@@ -254,26 +258,26 @@ public:
|
|||||||
UInt getChromaSize() const;
|
UInt getChromaSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of bits per pixel
|
* Get number of bits per pixel
|
||||||
* @return number of bits
|
* @return number of bits
|
||||||
*/
|
*/
|
||||||
UInt getBitsPel() const;
|
UInt getBitsPel() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of bytes per frame of an existing frame
|
* Get number of bytes per frame of an existing frame
|
||||||
* @return number of bytes per frame
|
* @return number of bytes per frame
|
||||||
*/
|
*/
|
||||||
UInt64 getBytesPerFrame();
|
UInt64 getBytesPerFrame();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of bytes per frame of a specific pixel format
|
* Get number of bytes per frame of a specific pixel format
|
||||||
* @return number of bytes per frame
|
* @return number of bytes per frame
|
||||||
*/
|
*/
|
||||||
static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel );
|
static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset frame pixels to zero
|
* Reset frame pixels to zero
|
||||||
*/
|
*/
|
||||||
Void clear();
|
Void clear();
|
||||||
|
|
||||||
Pel*** getPelBufferYUV() const;
|
Pel*** getPelBufferYUV() const;
|
||||||
@@ -297,8 +301,8 @@ public:
|
|||||||
Void fillRGBBuffer();
|
Void fillRGBBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Histogram
|
* Histogram
|
||||||
*/
|
*/
|
||||||
Void calcHistogram();
|
Void calcHistogram();
|
||||||
|
|
||||||
UInt getMin( Int channel );
|
UInt getMin( Int channel );
|
||||||
@@ -313,18 +317,18 @@ public:
|
|||||||
Int getHistogramSegment();
|
Int getHistogramSegment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface with OpenCV lib
|
* Interface with OpenCV lib
|
||||||
*/
|
*/
|
||||||
Bool toMat( cv::Mat& cvMat, Bool convertToGray = false );
|
Bool toMat( cv::Mat& cvMat, Bool convertToGray = false );
|
||||||
Bool fromMat( cv::Mat& cvMat );
|
Bool fromMat( cv::Mat& cvMat );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup PlaYUVerLibFrame
|
* \ingroup PlaYUVerLibFrame
|
||||||
* @defgroup PlaYUVerLibFrameQualityMetrics Quality Metrics Interface
|
* @defgroup PlaYUVerLibFrameQualityMetrics Quality Metrics Interface
|
||||||
* @{
|
* @{
|
||||||
* Quality metrics interface
|
* Quality metrics interface
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum QualityMetrics
|
enum QualityMetrics
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user