[Opalvoip-svn] SF.net SVN: opalvoip:[34123] ptlib/branches/v2_16
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2015-10-02 16:13:55
|
Revision: 34123 http://sourceforge.net/p/opalvoip/code/34123 Author: rjongbloed Date: 2015-10-02 16:13:53 +0000 (Fri, 02 Oct 2015) Log Message: ----------- Merged revision(s) 34121 from ptlib/trunk: Fixed scan line alignment issue when converting YUV420P to RGB24 ........ Modified Paths: -------------- ptlib/branches/v2_16/src/ptlib/common/vconvert.cxx Property Changed: ---------------- ptlib/branches/v2_16/ Index: ptlib/branches/v2_16 =================================================================== --- ptlib/branches/v2_16 2015-10-02 16:09:53 UTC (rev 34122) +++ ptlib/branches/v2_16 2015-10-02 16:13:53 UTC (rev 34123) Property changes on: ptlib/branches/v2_16 ___________________________________________________________________ Modified: svn:mergeinfo ## -10,4 +10,4 ## /ptlib/branches/v2_4:21086,21094,21147,21160,21185,21281,21296,21305,21322,21337,21363,21467,21471-21472,21506,21508,21623,21695,21744,21746,21763,22241,22958,23045-23046,23061,23066,23712 /ptlib/branches/v2_6:22195,22243,22295,22304,22311,22317,22320,22356,22458,22509,22587,22601-22602,22611,22629,22633,22673,22681,22729,22731-22732,22736,22742,22848,22960,22992,23161,23163,23167,23169,23177,23239,23291,23298,23336,23429,23595,23823,23827,23873,24816 /ptlib/branches/v2_8:24034,24044,24046,24054,24060,24065,24084,24090,24113,24136,24142,24165-24166,24168,24172,24367,24372,24410,24540,24992 -/ptlib/trunk:34109-34115 +/ptlib/trunk:34109-34115,34121 \ No newline at end of property Modified: ptlib/branches/v2_16/src/ptlib/common/vconvert.cxx =================================================================== --- ptlib/branches/v2_16/src/ptlib/common/vconvert.cxx 2015-10-02 16:09:53 UTC (rev 34122) +++ ptlib/branches/v2_16/src/ptlib/common/vconvert.cxx 2015-10-02 16:13:53 UTC (rev 34123) @@ -1884,12 +1884,12 @@ } #endif + BYTE * scanLinePtrRGB = dstFrameBuffer; + int scanLineSizeRGB = (rgbIncrement*m_dstFrameWidth+3)&~3; + unsigned srcPixpos[4] = { 0, 1, m_srcFrameWidth, m_srcFrameWidth + 1 }; - unsigned dstPixpos[4] = { 0, rgbIncrement, m_dstFrameWidth*rgbIncrement, (m_dstFrameWidth+1)*rgbIncrement }; + unsigned dstPixpos[4] = { 0, rgbIncrement, scanLineSizeRGB, scanLineSizeRGB+rgbIncrement }; - BYTE * scanLinePtrRGB = dstFrameBuffer; - int scanLineSizeRGB = rgbIncrement*m_dstFrameWidth; - if (m_verticalFlip) { scanLinePtrRGB += (m_dstFrameHeight - 2) * scanLineSizeRGB; scanLineSizeRGB = -scanLineSizeRGB; @@ -1899,6 +1899,8 @@ dstPixpos[3] = rgbIncrement; } + scanLineSizeRGB *= 2; + static const unsigned greenOffset = 1; #define YUV420PtoRGB_PIXEL_UV(pixelU, pixelV) \ @@ -1917,19 +1919,17 @@ rgbPtr[blueOffset] = CLAMP(bvalue); if (m_srcFrameWidth == m_dstFrameWidth && m_srcFrameHeight == m_dstFrameHeight) { - if (m_verticalFlip) - scanLineSizeRGB *= 3; - for (unsigned y = 0; y < m_srcFrameHeight; y += 2) { + BYTE * pixelRGB = scanLinePtrRGB; for (unsigned x = 0; x < m_srcFrameWidth; x += 2) { YUV420PtoRGB_PIXEL_UV(scanLinePtrU, scanLinePtrV); for (unsigned p = 0; p < 4; p++) { - BYTE * rgbPtr = scanLinePtrRGB + dstPixpos[p]; + BYTE * rgbPtr = pixelRGB + dstPixpos[p]; YUV420PtoRGB_PIXEL_RGB(scanLinePtrY); if (rgbIncrement == 4) rgbPtr[3] = 0; } - scanLinePtrRGB += rgbIncrement*2; + pixelRGB += rgbIncrement*2; scanLinePtrY += 2; scanLinePtrU++; scanLinePtrV++; @@ -1941,7 +1941,6 @@ else { unsigned scanLineSizeY = m_srcFrameWidth*2; // Actually two scan lines unsigned scanLineSizeUV = m_srcFrameWidth/2; - scanLineSizeRGB *= 2; PRasterDutyCycle raster(m_resizeMode, m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, 2, 2); do { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |