Revision: 34871
http://sourceforge.net/p/opalvoip/code/34871
Author: rjongbloed
Date: 2016-07-14 14:33:09 +0000 (Thu, 14 Jul 2016)
Log Message:
-----------
Allow for any src/dst dimension when cropping.
Modified Paths:
--------------
ptlib/trunk/src/ptlib/common/vconvert.cxx
Modified: ptlib/trunk/src/ptlib/common/vconvert.cxx
===================================================================
--- ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 12:56:09 UTC (rev 34870)
+++ ptlib/trunk/src/ptlib/common/vconvert.cxx 2016-07-14 14:33:09 UTC (rev 34871)
@@ -666,6 +666,7 @@
static bool ValidateDimensions(unsigned srcFrameWidth, unsigned srcFrameHeight,
unsigned dstFrameWidth, unsigned dstFrameHeight,
+ PVideoFrameInfo::ResizeMode resizeMode,
std::ostream * error)
{
if (srcFrameWidth == 0 || dstFrameWidth == 0 || srcFrameHeight == 0 || dstFrameHeight == 0) {
@@ -675,6 +676,9 @@
return false;
}
+ if (resizeMode != PVideoFrameInfo::eScale)
+ return true;
+
if (srcFrameWidth <= dstFrameWidth && srcFrameHeight <= dstFrameHeight)
return true;
@@ -725,7 +729,7 @@
}
}
- if (!ValidateDimensions(srcWidth, srcHeight, dstWidth, dstHeight, error))
+ if (!ValidateDimensions(srcWidth, srcHeight, dstWidth, dstHeight, resizeMode, error))
return false;
if (srcFrameWidth == 0)
@@ -1512,7 +1516,7 @@
PSTANDARD_COLOUR_CONVERTER(YUY2,YUV420P)
{
- if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, NULL))
+ if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, m_resizeMode, NULL))
return false;
if (m_dstFrameWidth == m_srcFrameWidth)
@@ -1653,7 +1657,7 @@
*/
PSTANDARD_COLOUR_CONVERTER(YUV422,YUV420P)
{
- if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, NULL))
+ if (!ValidateDimensions(m_srcFrameWidth, m_srcFrameHeight, m_dstFrameWidth, m_dstFrameHeight, m_resizeMode, NULL))
return false;
if (m_dstFrameWidth == m_srcFrameWidth)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|