Fix bug with PlaYUVerPixel

This commit is contained in:
jfmcarreira committed 2018-02-04 19:32:00 +00:00
1 parent e9e8db92b5
commit d735df75fd
3 files changed
+199 -133

No files matched your search

+90 -86
View File
@@ -61,15 +61,14 @@ public:
static Int getMaxNumberOfComponents();
PlaYUVerPixel();
PlaYUVerPixel( const Int& ColorSpace );
PlaYUVerPixel( const Int& ColorSpace = COLOR_INVALID );
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, const Pel& c3 );
PlaYUVerPixel( const PlaYUVerPixel& other );
~PlaYUVerPixel();
Int ColorSpaceType();
Pel* Components();
Int colorSpace() const;
Pel Y() const;
Pel Cb() const;
@@ -77,6 +76,7 @@ public:
Pel R() const;
Pel G() const;
Pel B() const;
Pel A() const;
Pel& Y();
Pel& Cb();
@@ -84,12 +84,16 @@ public:
Pel& R();
Pel& G();
Pel& B();
Pel& A();
Pel operator[]( const Int& channel ) const;
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 Double& );
/**
@@ -113,8 +117,8 @@ class PlaYUVerFrame
{
public:
/** ColorSpace Enum
* List of supported pixel formats - do not change order
*/
* List of supported pixel formats - do not change order
*/
enum PixelFormats
{
NO_FMT = -1,
@@ -130,58 +134,58 @@ public:
};
/**
* Function that handles the supported color space
* of PlaYUVerFrame
* @return vector of strings with pixel formats names
*/
* Function that handles the supported color space
* of PlaYUVerFrame
* @return vector of strings with pixel formats names
*/
static std::vector<String> supportedColorSpacesListNames();
/**
* Function that handles the supported pixel formats
* of PlaYUVerFrame
* @return vector of strings with pixel formats names
*/
* Function that handles the supported pixel formats
* of PlaYUVerFrame
* @return vector of strings with pixel formats names
*/
static std::vector<String> supportedPixelFormatListNames();
static std::vector<String> supportedPixelFormatListNames( Int colorSpace );
static Int findPixelFormat( const String& name );
/**
* Creates a new frame using the following configuration
*
* @param width width of the frame
* @param height height of the frame
* @param pel_format pixel format index (always use PixelFormats enum)
*
* @note this function might misbehave if the pixel format enum is not correct
*/
* Creates a new frame using the following configuration
*
* @param width width of the frame
* @param height height of the frame
* @param pel_format pixel format index (always use PixelFormats enum)
*
* @note this function might misbehave if the pixel format enum is not correct
*/
PlaYUVerFrame( UInt width, UInt height, Int pelFormat, Int bitsPixel = 8 );
/**
* Copy contructor
*
* @param other existing frame to copy from
*/
* Copy contructor
*
* @param other existing frame to copy from
*/
PlaYUVerFrame( const PlaYUVerFrame& other );
PlaYUVerFrame( const PlaYUVerFrame* other );
/**
* 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
* frame
*
* @param other existing frame to copy from
* @param posX position X to crop from
* @param posY position Y to crop from
* @param areaWidth crop width
* @param areaHeight crop height
*/
* 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
* frame
*
* @param other existing frame to copy from
* @param posX position X to crop from
* @param posY position Y to crop from
* @param areaWidth crop width
* @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();
/** Format match opts
*/
*/
enum FormatMatching
{
MATCH_COLOR_SPACE = 1,
@@ -193,57 +197,57 @@ public:
};
/**
* Check if two PlaYUVerFrames have the same fmt
* @param other frame to compare with
* @param match matching conditions (use enum FormatMatching)
* @return true if format matches
*/
* Check if two PlaYUVerFrames have the same fmt
* @param other frame to compare with
* @param match matching conditions (use enum FormatMatching)
* @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;
/**
* Get pixel format information
* @return pixel format index
*/
* Get pixel format information
* @return pixel format index
*/
Int getPelFormat() const;
/**
* Get pixel format information
* @return pixel format name
*/
* Get pixel format information
* @return pixel format name
*/
String getPelFmtName();
/**
* Get color space information
* @return get color space index
*/
* Get color space information
* @return get color space index
*/
Int getColorSpace() const;
/**
* Get the number of channels
* @return number of channels
*/
* Get the number of channels
* @return number of channels
*/
UInt getNumberChannels() const;
/**
* Get width of the frame
* @param channel/component
* @return number of pixels
*/
* Get width of the frame
* @param channel/component
* @return number of pixels
*/
UInt getWidth( Int channel = 0 ) const;
/**
* Get height of the frame
* @param channel/component
* @return number of pixels
*/
* Get height of the frame
* @param channel/component
* @return number of pixels
*/
UInt getHeight( Int channel = 0 ) const;
/**
* Get number of pixels of the frame
* @param channel/component
* @return number of pixels
*/
* Get number of pixels of the frame
* @param channel/component
* @return number of pixels
*/
UInt getPixels( Int channel = 0 ) const;
UInt8 getChromaWidthRatio() const;
@@ -254,26 +258,26 @@ public:
UInt getChromaSize() const;
/**
* Get number of bits per pixel
* @return number of bits
*/
* Get number of bits per pixel
* @return number of bits
*/
UInt getBitsPel() const;
/**
* Get number of bytes per frame of an existing frame
* @return number of bytes per frame
*/
* Get number of bytes per frame of an existing frame
* @return number of bytes per frame
*/
UInt64 getBytesPerFrame();
/**
* Get number of bytes per frame of a specific pixel format
* @return number of bytes per frame
*/
* Get number of bytes per frame of a specific pixel format
* @return number of bytes per frame
*/
static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel );
/**
* Reset frame pixels to zero
*/
* Reset frame pixels to zero
*/
Void clear();
Pel*** getPelBufferYUV() const;
@@ -297,8 +301,8 @@ public:
Void fillRGBBuffer();
/**
* Histogram
*/
* Histogram
*/
Void calcHistogram();
UInt getMin( Int channel );
@@ -313,18 +317,18 @@ public:
Int getHistogramSegment();
/**
* Interface with OpenCV lib
*/
* Interface with OpenCV lib
*/
Bool toMat( cv::Mat& cvMat, Bool convertToGray = false );
Bool fromMat( cv::Mat& cvMat );
/**
* \ingroup PlaYUVerLibFrame
* @defgroup PlaYUVerLibFrameQualityMetrics Quality Metrics Interface
* @{
* Quality metrics interface
*
*/
* @{
* Quality metrics interface
*
*/
enum QualityMetrics
{