Improve portability of PlaYUVerFrame and PlaYUVerPixel
This commit is contained in:
1 parent
5b2d7d69b1
commit
a654d89904
6 files changed
+498
-421
No files matched your search
+69
-7
@@ -28,8 +28,8 @@
|
||||
#include "PlaYUVerFrame.h"
|
||||
#include "PlaYUVerPixel.h"
|
||||
|
||||
|
||||
PlaYUVerPixel::PlaYUVerPixel()
|
||||
PlaYUVerPixel::PlaYUVerPixel() :
|
||||
m_iColorSpace( COLOR_INVALID )
|
||||
{
|
||||
m_iColorSpace = COLOR_INVALID;
|
||||
PixelComponents[0] = 0;
|
||||
@@ -38,7 +38,7 @@ PlaYUVerPixel::PlaYUVerPixel()
|
||||
PixelComponents[3] = 0;
|
||||
}
|
||||
|
||||
PlaYUVerPixel::PlaYUVerPixel( Int ColorSpace )
|
||||
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace )
|
||||
{
|
||||
m_iColorSpace = ColorSpace == COLOR_GRAY ? COLOR_YUV : ColorSpace;
|
||||
PixelComponents[0] = 0;
|
||||
@@ -47,7 +47,7 @@ PlaYUVerPixel::PlaYUVerPixel( Int ColorSpace )
|
||||
PixelComponents[3] = 0;
|
||||
}
|
||||
|
||||
PlaYUVerPixel::PlaYUVerPixel( Int ColorSpace, Pel c0, Pel c1, Pel c2 )
|
||||
PlaYUVerPixel::PlaYUVerPixel( const Int& ColorSpace, const Pel& c0, const Pel& c1, const Pel& c2 )
|
||||
{
|
||||
m_iColorSpace = ColorSpace == COLOR_GRAY ? COLOR_YUV : ColorSpace;
|
||||
PixelComponents[0] = c0;
|
||||
@@ -56,6 +56,68 @@ PlaYUVerPixel::PlaYUVerPixel( Int ColorSpace, Pel c0, Pel c1, Pel c2 )
|
||||
PixelComponents[3] = 0;
|
||||
}
|
||||
|
||||
PlaYUVerPixel::~PlaYUVerPixel()
|
||||
{
|
||||
}
|
||||
|
||||
Int PlaYUVerPixel::ColorSpaceType()
|
||||
{
|
||||
return m_iColorSpace;
|
||||
}
|
||||
|
||||
Pel* PlaYUVerPixel::Components()
|
||||
{
|
||||
return PixelComponents;
|
||||
}
|
||||
|
||||
Pel PlaYUVerPixel::Y() const
|
||||
{
|
||||
return PixelComponents[0];
|
||||
}
|
||||
Pel PlaYUVerPixel::Cb() const
|
||||
{
|
||||
return PixelComponents[1];
|
||||
}
|
||||
Pel PlaYUVerPixel::Cr() const
|
||||
{
|
||||
return PixelComponents[2];
|
||||
}
|
||||
|
||||
|
||||
Pel& PlaYUVerPixel::Y()
|
||||
{
|
||||
return PixelComponents[0];
|
||||
}
|
||||
Pel& PlaYUVerPixel::Cb()
|
||||
{
|
||||
return PixelComponents[1];
|
||||
}
|
||||
Pel& PlaYUVerPixel::Cr()
|
||||
{
|
||||
return PixelComponents[2];
|
||||
}
|
||||
Pel& PlaYUVerPixel::R()
|
||||
{
|
||||
return PixelComponents[0];
|
||||
}
|
||||
Pel& PlaYUVerPixel::G()
|
||||
{
|
||||
return PixelComponents[1];
|
||||
}
|
||||
Pel& PlaYUVerPixel::B()
|
||||
{
|
||||
return PixelComponents[2];
|
||||
}
|
||||
|
||||
Pel PlaYUVerPixel::operator[]( const Int& channel ) const
|
||||
{
|
||||
return PixelComponents[channel];
|
||||
}
|
||||
Pel& PlaYUVerPixel::operator[]( const Int& channel )
|
||||
{
|
||||
return PixelComponents[channel];
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerPixel::operator+ ( const PlaYUVerPixel& in )
|
||||
{
|
||||
PlaYUVerPixel out( m_iColorSpace, Y() + in.Y(), Cb() + in.Cb(), Cr() + in.Cr() );
|
||||
@@ -68,9 +130,9 @@ PlaYUVerPixel PlaYUVerPixel::operator- ( const PlaYUVerPixel& in )
|
||||
return out;
|
||||
}
|
||||
|
||||
PlaYUVerPixel PlaYUVerPixel::operator* ( const Double& d )
|
||||
PlaYUVerPixel PlaYUVerPixel::operator* ( const Double& op )
|
||||
{
|
||||
PlaYUVerPixel out( m_iColorSpace, Y() * d, Cb() * d, Cr() * d );
|
||||
PlaYUVerPixel out( m_iColorSpace, Y() * op, Cb() * op, Cr() * op );
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -84,7 +146,7 @@ PlaYUVerPixel PlaYUVerPixel::ConvertPixel( ColorSpace eOutputSpace )
|
||||
|
||||
if( eOutputSpace == COLOR_RGB )
|
||||
{
|
||||
YUV2RGB( Y(), Cb(), Cr(), outA, outB, outC );
|
||||
YuvToRgb( Y(), Cb(), Cr(), outA, outB, outC );
|
||||
outPixel.R() = outA;
|
||||
outPixel.G() = outB;
|
||||
outPixel.B() = outC;
|
||||
|
||||
Reference in new issue
Block a user