【VC开源代码栏目提醒】:以下是网学会员为您推荐的VC开源代码-yuvai.cpp,希望本篇文章对您学习有所帮助。
/*************************************************************************
This software module was originally developed by
Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation
Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation
Bruce Lin (blin@microsoft.com), Microsoft Corporation
Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation
(date: March, 1996)
in the course of development of the MPEG-4 Video (ISO/IEC 14496-2).
This software module is an implementation of a part of one or more MPEG-4 Video tools
as specified by the MPEG-4 Video.
ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications
thereof for use in hardware or software products claiming conformance to the MPEG-4 Video.
Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents.
The original developer of this software module and his/her company,
the subsequent editors and their companies,
and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation.
Copyright is not released for non MPEG-4 Video conforming products.
Microsoft retains full right to use the code for his/her own purpose,
assign or donate the code to a third party and to inhibit third parties from using the code for non <MPEG standard> conforming products.
This copyright notice must be included in all copies or derivative works.
Copyright (c) 1996, 1997.
Module Name:
yuva.hpp
Abstract:
YUVA (4:2:0) VOP
Revision History:
*************************************************************************/
#include "typeapi.h"
#ifdef __MFC_
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW
#endif // __MFC_
CVOPIntYUVBA::~CVOPIntYUVBA ()
{
delete m_piiY;
delete m_piiU;
delete m_piiV;
delete m_piiBY;
delete m_piiBUV;
delete m_piiA;
}
Void CVOPIntYUVBA::constructFromVOPF (const CVOPIntYUVBA& vopi, const CRct& rc)
{
if (rc.valid ()) {
CRct rY = (rc.valid ()) ? rc : vopi.whereY ();
CRct rUV = rY / 2;
m_piiY = new CIntImage (*vopi.getPlane (Y_PLANE), rY);
m_piiU = new CIntImage (*vopi.getPlane (U_PLANE), rUV);
m_piiV = new CIntImage (*vopi.getPlane (V_PLANE), rUV);
m_piiBY = new CIntImage (*vopi.getPlane (BY_PLANE), rY);
m_piiBUV = new CIntImage (*vopi.getPlane (BUV_PLANE), rUV);
if (m_fAUsage == EIGHT_BIT) {
m_piiA = new CIntImage (*vopi.getPlane (A_PLANE), rY);
assert (m_piiA != NULL);
}
}
else {
m_piiY = new CIntImage (*vopi.getPlane (Y_PLANE));
m_piiU = new CIntImage (*vopi.getPlane (U_PLANE));
m_piiV = new CIntImage (*vopi.getPlane (V_PLANE));
m_piiBY = new CIntImage (*vopi.getPlane (BY_PLANE));
m_piiBUV = new CIntImage (*vopi.getPlane (BUV_PLANE));
if (m_fAUsage == EIGHT_BIT) {
m_piiA = new CIntImage (*vopi.getPlane (A_PLANE));
assert (m_piiA != NULL);
}
}
assert (m_piiY != NULL);
assert (m_piiU != NULL);
assert (m_piiV != NULL);
assert (m_piiBY != NULL);
assert (m_piiBUV != NULL);
}
CVOPIntYUVBA::CVOPIntYUVBA (const CVOPIntYUVBA& vopi, AlphaUsage fAUsage, const CRct& rc) :
m_fAUsage (fAUsage), m_piiY (NULL), m_piiU (NULL), m_piiV (NULL), m_piiBY (NULL), m_piiBUV (NULL), m_piiA (NULL)
{
constructFromVOPF (vopi, rc);
}
CVOPIntYUVBA::CVOPIntYUVBA (const CVOPIntYUVBA& vopi, const CRct& rc) :
m_piiY (NULL), m_piiU (NULL), m_piiV (NULL), m_piiBY (NULL), m_piiBUV (NULL), m_piiA (NULL)
{
m_fAUsage = vopi.fAUsage ();
constructFromVOPF (vopi, rc);
}
CVOPIntYU
VBA::CVOPIntYUVBA (const CVideoObjectPlane& vop, AlphaUsage fAUsage, const CRct& rc) :
m_fAUsage (fAUsage), m_piiY (NULL), m_piiU (NULL), m_piiV (NULL), m_piiBY (NULL), m_piiBUV (NULL), m_piiA (NULL)
{
CRct r = (rc.valid ()) ? rc : vop.where ();
m_piiY = new CIntImage (r);
CIntImage* piiU = new CIntImage (r);
CIntImage* piiV = new CIntImage (r);
m_piiBY = new CIntImage (r);
if (m_fAUsage == EIGHT_BIT)
m_piiA = new CIntImage (r);
if (r == vop.where ()) { // faster operation if these two has the same rects
PixelI* ppxlfY = (PixelI*) m_piiY -> pixels ();
PixelI* ppxlfU = (PixelI*) piiU -> pixels ();
PixelI* ppxlfV = (PixelI*) piiV -> pixels ();
PixelI* ppxlfB = (PixelI*) m_piiBY -> pixels ();
const CPixel* ppxl = vop.pixels ();
UInt area = vop.where ().area ();
UInt ip;
for (ip = 0; ip < area; ip++, p