📄 vopses.hpp
字号:
/*************************************************************************
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)
and edited by
Wei Wu (weiwu@stallion.risc.rockwell.com) Rockwell Science Center
and also edited by
Yoshihiro Kikuchi (TOSHIBA CORPORATION)
Takeshi Nagai (TOSHIBA CORPORATION)
Toshiaki Watanabe (TOSHIBA CORPORATION)
Noboru Yamaguchi (TOSHIBA CORPORATION)
and edited by Xuemin Chen (General Instrument Corp.)
Mathias Wien (wien@ient.rwth-aachen.de), RWTH Aachen / Robert BOSCH GmbH
and also edited by
Yoshinori Suzuki (Hitachi, Ltd.)
and also edited by
Fujitsu Laboratories Ltd. (contact: Eishi Morimatsu)
Sehoon Son (shson@unitel.co.kr) Samsung AIT
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:
vopSes.hpp
Abstract:
Base class for the encoder for one Video Object.
Revision History:
December 20, 1997 Interlaced tools added by General Instrument Corp.(GI)
X. Chen (xchen@gi.com), B. Eifrig (beifrig@gi.com)
May. 9 1998: add boundary by Hyundai Electronics
Cheol-Soo Park (cspark@super5.hyundai.co.kr)
May. 9 1998: add field based MC padding by Hyundai Electronics
Cheol-Soo Park (cspark@super5.hyundai.co.kr)
Feb 16 1999: add Quarter Sample
Mathias Wien (wien@ient.rwth-aachen.de)
Feb 23 1999: GMC add by Yoshinori Suzuki (Hitachi, Ltd.)
Sep.06 1999 : RRV added by Eishi Morimatsu (Fujitsu Laboratories Ltd.)
*************************************************************************/
#ifndef __VOPSES_HPP_
#define __VOPSES_HPP_
typedef enum {NOT_DONE, PIECE_DONE, UPDATE_DONE} SptMBstatus;
#define BlockMemory Int*
typedef struct MacroBlockMemory {
BlockMemory* rgblkm;
} MacroBlockMemory;
// GMC
struct trajpoint
{
Int x;
Int y;
};
typedef struct trajpoint TrajPoint;
struct gme_para
{
Double dp1;
Double dp2;
Double dp3;
Double dp4;
Double dp5;
Double dp6;
Double dp7;
Double dp8;
};
typedef struct gme_para GME_para;
// ~GMC
class ArCodec;
class CInvBlockDCT;
class CVideoObject
{
public:
// Constructors
virtual ~CVideoObject ();
CVideoObject ();
// Attributes
const CVOPU8YUVBA* pvopcQuantCurr () const {return m_pvopcCurrQ;}
const CVOPU8YUVBA* pvopcRefQPrev () const {return m_pvopcRefQ0;}
const CVOPU8YUVBA* pvopcRefQLater () const {return m_pvopcRefQ1;}
//This modification is for reconstructed BVOP image in SS coding should be used as refrence layer
const CVOPU8YUVBA* pvopcReconCurr () const;
// {return ((m_vopmd.vopPredType == BVOP && m_volmd.volType == BASE_LAYER)
// ||(m_vopmd.vopPredType == BVOP && m_vopmd.iRefSelectCode != 0)
// ||(m_vopmd.vopPredType == SPRITE && m_volmd.fAUsage != RECTANGLE))
// ? m_pvopcCurrQ : m_pvopcRefQ1;} //reconstructed current frame
const VOLMode& volmd () const {return m_volmd;}
const VOPMode& vopmd () const {return m_vopmd;}
//OBSS_SAIT_991015
VOLMode& getvolmd () {return m_volmd;} //OBSSFIX_1:1
Int getvolWidth () {return m_ivolWidth;} //OBSSFIX_1:1
Int getvolHeight () {return m_ivolHeight;} //OBSSFIX_1:1
ShapeMode* shapemd () {return m_rgBaseshpmd;}
Void setShapeMode (ShapeMode* shapemode) {m_rgBaseshpmd = shapemode;}
CMotionVector* getmvBaseBY() {return m_rgmvBaseBY; }
Void setmvBaseBY (CMotionVector* pmvBaseBY) {m_rgmvBaseBY = pmvBaseBY;}
Int getMBYRef() {return m_iNumMBYRef; }
Int getMBXRef() {return m_iNumMBXRef; }
Int getMBBaseYRef() {return m_iNumMBBaseYRef; }
Int getMBBaseXRef() {return m_iNumMBBaseXRef; }
Void setMBXYRef(Int X, int Y) { m_iNumMBBaseXRef = X; m_iNumMBBaseYRef = Y; }
CRct getBaseRct() {return m_rctBase; };
Void setBaseRct(CRct prctBase) {
m_rctBase.top = prctBase.top; m_rctBase.left = prctBase.left;
m_rctBase.right = prctBase.right; m_rctBase.bottom = prctBase.bottom;
m_rctBase.width = prctBase.width;}
CRct GetDisplayWindow(){return m_rctDisplayWindow;}
//~OBSS_SAIT_991015
UInt fSptUsage () const {return m_uiSprite;}
// Operations
virtual Void encode () {}
virtual Int decode () {return 0;}
Void swapRefQ1toSpt ();
Void changeSizeofCurrQ (CRct rctOrg);
Void setRctDisp (CRct rctDisp) {m_rctSptDisp = rctDisp;}
Void setEnhnType ( Int iEnhnType ) {m_volmd.iEnhnType = iEnhnType;}
Int iNumOfPnts () const {return m_iNumOfPnts;}
const CVOPU8YUVBA* pvopcSptQ () const {return m_pvopcSptQ;}
//low latency sprite stuff
Void Overlay (CU8Image& uci1, CU8Image& uci2, float fscale); //1 on 2
Void VOPOverlay (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, Int iscale = 0); //1 on 2
// dshu: begin of modification
Void U8iGet (CU8Image& uci1, CU8Image& uci2, CRct rctPieceY);
Void PieceGet (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, CRct rctPieceY);
Void U8iPut (CU8Image& uci1, CU8Image& uci2, CRct rctPieceY);
Void PiecePut (CVOPU8YUVBA& pvopc1, CVOPU8YUVBA& pvopc2, CRct rctPieceY);
// dshu: end of modification
// dshu: [v071] Begin of modification
Void padSprite();
Void copySptQShapeYToMb (PixelC* ppxlcDstMB, const PixelC* ppxlcSrc) ;
// dshu: [v071] end of modification
Bool SptPieceMB_NOT_HOLE(Int iMBXoffset, Int iMBYoffset, CMBMode* pmbmd);
Bool SptUpdateMB_NOT_HOLE(Int iMBXoffset, Int iMBYoffset, CMBMode* pmbmd);
Void SaveMBmCurrRow (Int iMBYoffset, MacroBlockMemory** rgpmbmCurr);
Void RestoreMBmCurrRow (Int iMBYoffset, MacroBlockMemory** rgpmbmCurr);
Void CopyCurrQToPred (PixelC* ppxlcQMBY, PixelC* ppxlcQMBU, PixelC* ppxlcQMBV);
///// 97/12/22 start
Void copyVOPU8YUVBA (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1);
Void copyVOPU8YUVBA (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1, CVOPU8YUVBA*& pvopc2);
Void compute_bfShapeMembers ();
///// 97/12/22 end
///////////////// implementation /////////////////
//OBSS_SAIT_991015 //_SONY_SS_ for SS BASE layer BVOP coding
Int show_current_time() {return m_t;}
static Int getAuxCompCount(Int vol_shape_extension);
protected:
// general routines
Void swapVOPU8Pointers (CVOPU8YUVBA*& pvopc0, CVOPU8YUVBA*& pvopc1);
Void swapVOPIntPointers (CVOPIntYUVBA*& pvopi0, CVOPIntYUVBA*& pvopi1);
// VOL routines
Void allocateVOLMembers (Int iSessionWidth, Int iSessionHeight);
Void computeVOLConstMembers ();
// VOP routines
Void computeVOPMembers ();
Void setRefStartingPointers ();
Void updateAllRefVOPs ();
Void updateAllRefVOPs (const CVOPU8YUVBA *pvopcRefBaselayer); // for spatial scalability
Void repeatPadYOrA (PixelC* ppxlcOldLeft, CVOPU8YUVBA* pvopcRef);
Void repeatPadUV (CVOPU8YUVBA* pvopcRef);
Void resetBYPlane ();
// MB routines
Void decideTransparencyStatus (CMBMode* pmbmd, const PixelC* ppxlcMBBY);
Void decideMBTransparencyStatus (CMBMode* pmbmd);
Void downSampleBY (const PixelC* ppxlcMBBY, PixelC* ppxlcMBBUV); // downsample original BY now for LPE padding (using original shape)
// Added for field based MC padding by Hyundai(1998-5-9)
Void decideFieldTransparencyStatus (
CMBMode* pmbmd,
const PixelC* ppxlcMBBY,
const PixelC* ppxlcMBBUV
);
Void fieldBasedDownSampleBY (
const PixelC* ppxlcMBBY,
PixelC* ppxlcMBBUV
);
// End of Hyundai(1998-5-9)
// error signal processing
Void addErrorAndPredToCurrQ (PixelC* ppxlcRefMBY, PixelC* ppxlcRefMBU, PixelC* ppxlcRefMBV);
Void addAlphaErrorAndPredToCurrQ (PixelC* ppxlcRefMBA, Int iAuxComp);
// shape coding functions
Void saveShapeMode();
own Int* computeShapeSubBlkIndex (Int iSubBlkSize, Int iSrcSize);
Int getContextUS (PixelC a, PixelC b, PixelC c, PixelC d, PixelC e, PixelC f, PixelC g, PixelC h);
PixelC getRefValue (const PixelC* ppxlcRow, Int x_adr, Int y_adr, Int h_size, Int v_size);
Void adaptiveUpSampleShape (const PixelC* rgpxlcSrc, PixelC* rgpxlcDst, Int h_size, Int v_size);
Void downSampleShapeMCPred(const PixelC* ppxlcSrc,PixelC* ppxlcDst,Int iRate);
Void upSampleShape (PixelC* ppxlcBYFrm,const PixelC* rgpxlcSrc, PixelC* rgpxlcDst);
Void copyLeftTopBorderFromVOP (PixelC* ppxlcSrc, PixelC* ppxlcDst);
Void subsampleLeftTopBorderFromVOP (PixelC* ppxlcSrc, PixelC* ppxlcDst);
Void makeRightBottomBorder (PixelC* ppxlcSrc, Int iWidth);
Int contextIntra (const PixelC* ppxlcSrc);
Int contextIntraTranspose (const PixelC* ppxlcSrc);
Int contextInter (const PixelC* ppxlcSrc, const PixelC* ppxlcPred);
Int contextInterTranspose (const PixelC* ppxlcSrc, const PixelC* ppxlcPred);
//OBSS_SAIT_991015
Void saveBaseShapeMode();
Void makeRightBottomBorder (PixelC* ppxlcDst, Int iDstWidth, PixelC* ppxlcSrc, Int iSrcWidth);
Int contextSIHorizontal (const PixelC* ppxlcSrc, Int iUpperSkip, Int iBottomSkip);
Int contextSIVertical (const PixelC* ppxlcSrc, Int iRightSkip, Int iLeftSkip, Int iUpperSkip, Int iBottomSkip);
Int decideScanOrder(const PixelC* ppxlPred); //for st_order
Void VerticalScanning(Int *no_mismatch, Int *no_match, Int *no_xor, Int type_id_mis[256][4], Int num_loop_hor, Int num_loop_ver, Bool residual_scanning_hor, Bool residual_scanning_ver, Bool* HorSamplingChk, Bool* VerSamplingChk);
Void HorizontalScanning(Int *no_mismatch, Int *no_match, Int *no_xor, Int type_id_mis[256][4], Int num_loop_hor, Int num_loop_ver, Bool residual_scanning_hor, Bool residual_scanning_ver, Bool* HorSamplingChk, Bool* VerSamplingChk);
Void motionCompLowerBY (
PixelC* ppxlcPred,
const PixelC* ppxlcRefLeftTop,
CoordI iXRef, CoordI iYRef
);
//~OBSS_SAIT_991015
Void copyReconShapeToMbAndRef (PixelC* ppxlcDstMB, PixelC* ppxlcRefFrm, PixelC pxlcSrc);
Void copyReconShapeToMbAndRef (PixelC* ppxlcDstMB, PixelC* ppxlcRefFrm, const PixelC* ppxlcSrc, Int iSrcWidth, Int iBorder);
Void copyRefShapeToMb (PixelC* ppxlcDstMB, const PixelC* ppxlcSrc); // Added for data partitioning mode By Toshiba(1998-1-16:DP+RVLC)
Void copyReconShapeUVToRef (PixelC* ppxlcRefFrm, const PixelC* ppxlcSrc);
CMotionVector findShapeMVP (const CMotionVector* pmv, const CMotionVector* pmvBY,
const CMBMode* pmbmd, Int iMBX, Int iMBY) const;
Int m_iInverseCR;
// B-VOP stuff
Void findColocatedMB (Int iMBX, Int iMBY, const CMBMode*& pmbmdRef, const CMotionVector*& pmvRef);
// motion compensation
Void limitMVRangeToExtendedBBHalfPel (CoordI &x,CoordI &y,CRct *prct,Int iBlkSize);
Void limitMVRangeToExtendedBBFullPel (CoordI &x,CoordI &y,CRct *prct,Int iBlkSize);
Void limitMVRangeToExtendedBBQuarterPel (CoordI &x,CoordI &y,CRct *prct,Int iBlkSize); // QuarterSample, mwi
Void motionCompMB (
PixelC* ppxlcPredMB,
const PixelC* ppxlcRefLeftTop,
const CMotionVector* pmv, const CMBMode* pmbmd,
Int imbX, Int imbY,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -