Improve PlaYUVerFrame and add comments
This commit is contained in:
4 files changed
+106
-68
No files matched your search
+33
-26
@@ -455,6 +455,13 @@ struct PlaYUVerFramePrivate
|
||||
{
|
||||
realChannel = channel;
|
||||
}
|
||||
else if( m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_GRAY )
|
||||
{
|
||||
if( channel >= 10 && channel < 11 )
|
||||
{
|
||||
realChannel = channel - 10;
|
||||
}
|
||||
}
|
||||
else if( m_pcPelFormat->colorSpace == PlaYUVerPixel::COLOR_YUV )
|
||||
{
|
||||
if( channel >= 10 && channel < 13 )
|
||||
@@ -473,6 +480,8 @@ struct PlaYUVerFramePrivate
|
||||
realChannel = channel - 20;
|
||||
}
|
||||
}
|
||||
if( realChannel > (Int)m_uiHistoChannels )
|
||||
realChannel = -1;
|
||||
return realChannel;
|
||||
}
|
||||
|
||||
@@ -647,23 +656,9 @@ UInt8 PlaYUVerFrame::getChromaHeightRatio() const
|
||||
return d->m_pcPelFormat->log2ChromaHeight;
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getChromaWidth() const
|
||||
{
|
||||
if( d->m_pcPelFormat->colorSpace == GRAY )
|
||||
return 0;
|
||||
return CHROMASHIFT( d->m_uiWidth, d->m_pcPelFormat->log2ChromaWidth );
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getChromaHeight() const
|
||||
{
|
||||
if( d->m_pcPelFormat->colorSpace == GRAY )
|
||||
return 0;
|
||||
return CHROMASHIFT( d->m_uiHeight, d->m_pcPelFormat->log2ChromaHeight );
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getChromaLength() const
|
||||
{
|
||||
return getChromaWidth() * getChromaHeight();
|
||||
return getWidth( 1 ) * getHeight( 1 );
|
||||
}
|
||||
|
||||
UInt PlaYUVerFrame::getBitsPel() const
|
||||
@@ -727,16 +722,28 @@ UChar* PlaYUVerFrame::getRGBBuffer() const
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
UChar* PlaYUVerFrame::getRGBBuffer()
|
||||
//UChar* PlaYUVerFrame::getRGBBuffer()
|
||||
//{
|
||||
// if( !d->m_bHasRGBPel )
|
||||
// {
|
||||
// fillRGBBuffer();
|
||||
// }
|
||||
// return d->m_pcARGB32;
|
||||
//}
|
||||
|
||||
Pel PlaYUVerFrame::operator()( UInt ch, UInt xPos, UInt yPos )
|
||||
{
|
||||
if( !d->m_bHasRGBPel )
|
||||
{
|
||||
fillRGBBuffer();
|
||||
}
|
||||
return d->m_pcARGB32;
|
||||
if( ch < d->m_pcPelFormat->numberChannels )
|
||||
return d->m_pppcInputPel[ch][yPos][xPos];
|
||||
return 0;
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixel( Int xPos, Int yPos )
|
||||
PlaYUVerPixel PlaYUVerFrame::operator()( UInt xPos, UInt yPos )
|
||||
{
|
||||
return getPixel( xPos, yPos );
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixel( UInt xPos, UInt yPos )
|
||||
{
|
||||
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace );
|
||||
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
@@ -748,7 +755,7 @@ PlaYUVerPixel PlaYUVerFrame::getPixel( Int xPos, Int yPos )
|
||||
return PixelValue;
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixel( Int xPos, Int yPos, PlaYUVerPixel::ColorSpace eColorSpace )
|
||||
PlaYUVerPixel PlaYUVerFrame::getPixel( UInt xPos, UInt yPos, PlaYUVerPixel::ColorSpace eColorSpace )
|
||||
{
|
||||
PlaYUVerPixel PixelValue( d->m_pcPelFormat->colorSpace );
|
||||
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
@@ -761,7 +768,7 @@ PlaYUVerPixel PlaYUVerFrame::getPixel( Int xPos, Int yPos, PlaYUVerPixel::ColorS
|
||||
return PixelValue;
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::setPixel( Int xPos, Int yPos, PlaYUVerPixel pixel )
|
||||
Void PlaYUVerFrame::setPixel( UInt xPos, UInt yPos, PlaYUVerPixel pixel )
|
||||
{
|
||||
for( UInt ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||
{
|
||||
@@ -1552,8 +1559,8 @@ Double PlaYUVerFrame::getSSIM( PlaYUVerFrame* Org, Int component )
|
||||
}
|
||||
else
|
||||
{
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component], getChromaWidth(),
|
||||
getChromaHeight(), 4, 4, 255, 4 );
|
||||
dSSIM = compute_ssim( d->m_pppcInputPel[component], Org->getPelBufferYUV()[component], getWidth( component ),
|
||||
getHeight( component ), 4, 4, 255, 4 );
|
||||
}
|
||||
return dSSIM;
|
||||
}
|
||||
+57
-8
@@ -253,12 +253,23 @@ public:
|
||||
*/
|
||||
UInt getPixels( Int channel = 0 ) const;
|
||||
|
||||
/**
|
||||
* Get chroma width ratio
|
||||
* @return ratio multiple of 2
|
||||
*/
|
||||
UInt8 getChromaWidthRatio() const;
|
||||
|
||||
/**
|
||||
* Get chroma height ratio
|
||||
* @return ratio multiple of 2
|
||||
*/
|
||||
UInt8 getChromaHeightRatio() const;
|
||||
UInt getChromaWidth() const;
|
||||
UInt getChromaHeight() const;
|
||||
|
||||
/**
|
||||
* Get number of pixels in each chroma channel
|
||||
* @return number of pixels
|
||||
*/
|
||||
UInt getChromaLength() const;
|
||||
UInt getChromaSize() const;
|
||||
|
||||
/**
|
||||
* Get number of bits per pixel
|
||||
@@ -285,12 +296,50 @@ public:
|
||||
|
||||
Pel*** getPelBufferYUV() const;
|
||||
Pel*** getPelBufferYUV();
|
||||
UChar* getRGBBuffer() const;
|
||||
UChar* getRGBBuffer();
|
||||
|
||||
PlaYUVerPixel getPixel( Int xPos, Int yPos );
|
||||
PlaYUVerPixel getPixel( Int xPos, Int yPos, PlaYUVerPixel::ColorSpace eColorSpace );
|
||||
Void setPixel( Int xPos, Int yPos, PlaYUVerPixel pixel );
|
||||
UChar* getRGBBuffer() const;
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param ch frame channel
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
Pel operator()( UInt ch, UInt xPos, UInt yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
PlaYUVerPixel operator()( UInt xPos, UInt yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @return pixel value
|
||||
*/
|
||||
PlaYUVerPixel getPixel( UInt xPos, UInt yPos );
|
||||
|
||||
/**
|
||||
* Get pixel value at coordinates
|
||||
* in the desired color space
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
* @param eColorSpace desired color space
|
||||
* @return pixel value
|
||||
*/
|
||||
PlaYUVerPixel getPixel( UInt xPos, UInt yPos, PlaYUVerPixel::ColorSpace eColorSpace );
|
||||
|
||||
/**
|
||||
* Set pixel value at coordinates to a given value
|
||||
* @param xPos position in X axis
|
||||
* @param yPos position in Y axis
|
||||
*/
|
||||
Void setPixel( UInt xPos, UInt yPos, PlaYUVerPixel pixel );
|
||||
|
||||
Void copyFrom( const PlaYUVerFrame& );
|
||||
Void copyFrom( const PlaYUVerFrame* );
|
||||
|
||||
Reference in new issue
Block a user