diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 3a1c13e..a180b12 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -157,9 +157,6 @@ struct PlaYUVerFramePrivate /** Numbers of histogram segments depending of image bytes depth*/ UInt m_uiHistoSegments; - /** Used to stop thread during calculations.*/ - Bool m_bRunningFlag; - Bool m_bHasHistogram; /** @@ -797,7 +794,6 @@ Void PlaYUVerFrame::calcHistogram() return; } } - d->m_bRunningFlag = true; xMemSet( UInt, d->m_uiHistoSegments * d->m_uiHistoChannels, d->m_puiHistogram ); @@ -810,12 +806,12 @@ Void PlaYUVerFrame::calcHistogram() data[LUMA] = d->m_pppcInputPel[LUMA][0]; data[CHROMA_U] = d->m_pppcInputPel[CHROMA_U][0]; data[CHROMA_V] = d->m_pppcInputPel[CHROMA_V][0]; - for( i = 0; i < d->m_uiHeight * d->m_uiWidth && d->m_bRunningFlag; i++ ) + for( i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) { d->m_puiHistogram[*( data[LUMA] ) + LUMA * d->m_uiHistoSegments]++; data[LUMA] += 1; } - for( i = 0; ( i < getChromaLength() ) && d->m_bRunningFlag; i++ ) + for( i = 0; ( i < getChromaLength() ); i++ ) { for( j = 1; j < numberChannels; j++ ) { @@ -832,7 +828,7 @@ Void PlaYUVerFrame::calcHistogram() data[COLOR_G] = d->m_pppcInputPel[COLOR_G][0]; data[COLOR_B] = d->m_pppcInputPel[COLOR_B][0]; - for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ) && d->m_bRunningFlag; i++ ) + for( i = 0; ( i < d->m_uiHeight * d->m_uiWidth ); i++ ) { for( j = 0; j < numberChannels; j++ ) { @@ -850,7 +846,6 @@ Void PlaYUVerFrame::calcHistogram() } } d->m_bHasHistogram = true; - d->m_bRunningFlag = false; } Int PlaYUVerFrame::getHistogramSegment() diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 9f460ce..dac5b69 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -63,18 +63,6 @@ class PlaYUVerFrame NUMBER_PEL_FORMATS }; - /** Format match opts - */ - enum FormatMatching - { - MATCH_COLOR_SPACE = 1, - MATCH_RESOLUTION = 2, - MATCH_PEL_FMT = 4, - MATCH_BITS = 8, - MATCH_COLOR_SPACE_IGNORE_GRAY = 16, - MATCH_ALL = 0xFFFF, - }; - /** * Function that handles the supported color space * of PlaYUVerFrame @@ -111,8 +99,7 @@ class PlaYUVerFrame PlaYUVerFrame( const PlaYUVerFrame* other ); /** - * Creates and new frame with the configuration of an - * existing one and copy its contents. + * 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 @@ -126,6 +113,24 @@ class PlaYUVerFrame ~PlaYUVerFrame(); + /** Format match opts + */ + enum FormatMatching + { + MATCH_COLOR_SPACE = 1, + MATCH_RESOLUTION = 2, + MATCH_PEL_FMT = 4, + MATCH_BITS = 8, + MATCH_COLOR_SPACE_IGNORE_GRAY = 16, + MATCH_ALL = 0xFFFF, + }; + + /** + * 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; @@ -144,10 +149,13 @@ class PlaYUVerFrame /** * Get color space information * @return get color space index - * @ */ Int getColorSpace() const; + /** + * Get the number of channels + * @return number of channels + */ UInt getNumberChannels() const; /** @@ -156,12 +164,14 @@ class PlaYUVerFrame * @return number of pixels */ UInt getWidth( Int channel = 0 ) const; + /** * 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 @@ -176,6 +186,10 @@ class PlaYUVerFrame UInt getChromaLength() const; UInt getChromaSize() const; + /** + * Get number of bits per pixel + * @return number of bits + */ UInt getBitsPel() const; /** @@ -185,8 +199,7 @@ class PlaYUVerFrame 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 */ static UInt64 getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelFormat, UInt bitsPixel );