[28] | 1 | |
---|
| 2 | |
---|
| 3 | #ifndef __TCOMMP__ |
---|
| 4 | #define __TCOMMP__ |
---|
| 5 | |
---|
| 6 | class TComMP; |
---|
| 7 | |
---|
| 8 | #include "../TLibCommon/TypeDef.h" |
---|
| 9 | #include "../TLibCommon/CommonDef.h" |
---|
| 10 | |
---|
| 11 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
| 12 | class TComDepthMapGenerator; |
---|
| 13 | //#include "../TLibCommon/TComDepthMapGenerator.h" |
---|
| 14 | #else |
---|
| 15 | class TAppComCamPara; |
---|
| 16 | //#include "../../App/TAppCommon/TAppComCamPara.h" |
---|
| 17 | #endif |
---|
| 18 | |
---|
| 19 | #include "../TLibCommon/TComList.h" |
---|
| 20 | #include "../TLibCommon/TComSlice.h" |
---|
| 21 | #include "../TLibCommon/TComPic.h" |
---|
| 22 | #include "../TLibCommon/TComDataCU.h" |
---|
| 23 | #include "../TLibCommon/TComMotionInfo.h" |
---|
| 24 | |
---|
| 25 | #include <map> |
---|
| 26 | //#include <cstdlib> |
---|
| 27 | //using namespace std; |
---|
| 28 | |
---|
| 29 | #if POZNAN_MP |
---|
| 30 | |
---|
| 31 | // ==================================================================================================================== |
---|
| 32 | // Class definition |
---|
| 33 | // ==================================================================================================================== |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | /// MP class |
---|
| 37 | class TComMP |
---|
| 38 | { |
---|
| 39 | //typedef Int PUT_MP_ARRAY_TYPE; |
---|
| 40 | typedef Short PUT_MP_ARRAY_TYPE; |
---|
| 41 | typedef std::map<UInt,PUT_MP_ARRAY_TYPE**> TComMapppi; |
---|
| 42 | |
---|
| 43 | static const int OCCLUSION = -1; |
---|
| 44 | |
---|
| 45 | private: |
---|
| 46 | |
---|
| 47 | Bool m_bInit; |
---|
| 48 | Bool m_bEnabled; |
---|
| 49 | Bool m_bDBMPEnabled; |
---|
| 50 | |
---|
| 51 | UInt m_uiHeight; |
---|
| 52 | UInt m_uiWidth; |
---|
| 53 | |
---|
| 54 | UInt m_uiPOC; |
---|
| 55 | UInt m_uiView; |
---|
| 56 | Bool m_bIsDepth; |
---|
| 57 | |
---|
| 58 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
| 59 | TComDepthMapGenerator* m_pcDepthMapGenerator; |
---|
| 60 | #else |
---|
| 61 | //TAppComCamPara* m_pcCameraData; |
---|
| 62 | Int**** m_aiBaseViewShiftLUT; |
---|
| 63 | #endif |
---|
| 64 | std::vector<TComPic*>* m_pcRefPicsList; |
---|
| 65 | std::vector<TComPic*>* m_pcDepthRefPicsList; |
---|
| 66 | |
---|
| 67 | Short** m_ppiMvPtCorrX; |
---|
| 68 | Short** m_ppiMvPtCorrY; |
---|
| 69 | Short** m_ppiMvPtCorrZ; |
---|
| 70 | Short** m_ppiMvPtCorrRefViewIdx; |
---|
| 71 | |
---|
[41] | 72 | #if !POZNAN_MP_USE_DEPTH_MAP_GENERATION && POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE |
---|
| 73 | Short** m_ppiTempMvPtCorrX; |
---|
| 74 | Short** m_ppiTempMvPtCorrY; |
---|
| 75 | Short** m_ppiTempMvPtCorrZ; |
---|
| 76 | #endif |
---|
| 77 | |
---|
[28] | 78 | TComDataCU*** m_pppcRefCU; //XY array of pointers to reference CU for each point of picture |
---|
| 79 | UShort** m_ppuicRefPartAddr; //XY array of part addresses for each reference CU for each point of picture |
---|
| 80 | |
---|
| 81 | #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA |
---|
| 82 | TComMapppi m_ppiL0RefPOC; |
---|
| 83 | TComMapppi m_ppiL0MvX; |
---|
| 84 | TComMapppi m_ppiL0MvY; |
---|
| 85 | TComMapppi m_ppiL1RefPOC; |
---|
| 86 | TComMapppi m_ppiL1MvX; |
---|
| 87 | TComMapppi m_ppiL1MvY; |
---|
| 88 | #endif |
---|
| 89 | |
---|
| 90 | #if POZNAN_DBMP_CALC_PRED_DATA |
---|
| 91 | Int* m_piTempL0RefIdx; |
---|
| 92 | Int* m_piTempL0MvX; |
---|
| 93 | Int* m_piTempL0MvY; |
---|
| 94 | Int* m_piTempL1RefIdx; |
---|
| 95 | Int* m_piTempL1MvX; |
---|
| 96 | Int* m_piTempL1MvY; |
---|
| 97 | |
---|
| 98 | Int* m_piTempBuff; |
---|
| 99 | Int* m_piResBuff; |
---|
| 100 | #endif |
---|
| 101 | |
---|
| 102 | #if POZNAN_DBMP_CALC_PRED_DATA |
---|
| 103 | TComCUMvField* apcDBMPPredMVField[2]; |
---|
| 104 | #endif |
---|
| 105 | |
---|
| 106 | #if POZNAN_DBMP & !POZNAN_DBMP_COMPRESS_ME_DATA |
---|
| 107 | Void initArrayMap(UInt uiViewId, Bool bIsDepth); |
---|
| 108 | #endif |
---|
| 109 | |
---|
| 110 | public: |
---|
| 111 | |
---|
| 112 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
| 113 | TComMP(UInt uiHeight=0, UInt uiWidth=0); |
---|
| 114 | #else |
---|
| 115 | //TComMP(UInt uiHeight=0, UInt uiWidth=0, TAppComCamPara* pcCameraData=NULL); |
---|
| 116 | TComMP(UInt uiHeight=0, UInt uiWidth=0, Int**** aiBaseViewShiftLUT=NULL); |
---|
| 117 | #endif |
---|
| 118 | ~TComMP(); |
---|
| 119 | |
---|
| 120 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
| 121 | Void init(UInt uiHeight, UInt uiWidth); |
---|
| 122 | #else |
---|
| 123 | //Void init(UInt uiHeight, UInt uiWidth, TAppComCamPara* pcCameraData); |
---|
| 124 | Void init(UInt uiHeight, UInt uiWidth, Int**** aiBaseViewShiftLUT); |
---|
[41] | 125 | #if POZNAN_MP_USE_CURRENT_VIEW_DEPTH_MAP_IF_AVAILABLE |
---|
| 126 | Void clearTemp(); |
---|
[28] | 127 | #endif |
---|
[41] | 128 | #endif |
---|
[28] | 129 | Void uninit(); |
---|
| 130 | Void clear(); |
---|
| 131 | Void disable(); |
---|
| 132 | |
---|
| 133 | Bool isInit(); |
---|
| 134 | Bool isEnabled(); |
---|
| 135 | Bool isDBMPEnabled(); |
---|
| 136 | |
---|
| 137 | #if POZNAN_MP_USE_DEPTH_MAP_GENERATION |
---|
| 138 | Void setDepthMapGenerator(TComDepthMapGenerator* pcDepthMapGenerator){m_pcDepthMapGenerator = pcDepthMapGenerator;} |
---|
| 139 | #endif |
---|
| 140 | Void setRefPicsList(std::vector<TComPic*>* pcListPic){m_pcRefPicsList = pcListPic;} |
---|
| 141 | Void setDepthRefPicsList(std::vector<TComPic*>* pcListPic){m_pcDepthRefPicsList = pcListPic;} |
---|
| 142 | Bool pairMultiview(TComPic* pcPic); |
---|
| 143 | |
---|
| 144 | Short** getMPCx() {return m_ppiMvPtCorrX;} |
---|
| 145 | Short** getMPCy() {return m_ppiMvPtCorrY;} |
---|
| 146 | Short** getMPCz() {return m_ppiMvPtCorrZ;} |
---|
| 147 | Short** getMPCRefViewIdx() {return m_ppiMvPtCorrRefViewIdx;} |
---|
| 148 | TComDataCU*** getMPCRefCU() {return m_pppcRefCU;} |
---|
| 149 | UShort** getMPCRefPartAddr() {return m_ppuicRefPartAddr;} |
---|
| 150 | |
---|
| 151 | #if POZNAN_MP_FILL |
---|
| 152 | Void fillMultiview(UInt uiViewId); |
---|
| 153 | #endif |
---|
| 154 | |
---|
| 155 | #if POZNAN_DBMP |
---|
| 156 | #if !POZNAN_DBMP_COMPRESS_ME_DATA |
---|
| 157 | PUT_MP_ARRAY_TYPE** getL0RefPOC(UInt uiViewID, Bool bIsDepth) {return m_ppiL0RefPOC[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 158 | PUT_MP_ARRAY_TYPE** getL0MvX(UInt uiViewID, Bool bIsDepth) {return m_ppiL0MvX[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 159 | PUT_MP_ARRAY_TYPE** getL0MvY(UInt uiViewID, Bool bIsDepth) {return m_ppiL0MvY[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 160 | PUT_MP_ARRAY_TYPE** getL1RefPOC(UInt uiViewID, Bool bIsDepth) {return m_ppiL1RefPOC[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 161 | PUT_MP_ARRAY_TYPE** getL1MvX(UInt uiViewID, Bool bIsDepth) {return m_ppiL1MvX[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 162 | PUT_MP_ARRAY_TYPE** getL1MvY(UInt uiViewID, Bool bIsDepth) {return m_ppiL1MvY[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID];} |
---|
| 163 | |
---|
| 164 | Void setL0RefPOC(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL0RefPOC[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 165 | Void setL0MvX(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL0MvX[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 166 | Void setL0MvY(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL0MvY[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 167 | Void setL1RefPOC(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL1RefPOC[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 168 | Void setL1MvX(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL1MvX[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 169 | Void setL1MvY(UInt uiViewID, Bool bIsDepth, UInt uiX, UInt uiY, PUT_MP_ARRAY_TYPE iVal) {m_ppiL1MvY[(bIsDepth)? (uiViewID+MAX_NUMBER_VIEWS) : uiViewID][uiY][uiX]=iVal;} |
---|
| 170 | |
---|
| 171 | Void saveDBMPData(TComDataCU* pcCU); |
---|
| 172 | #endif |
---|
| 173 | |
---|
[45] | 174 | Void getDBMPPredData(TComDataCU* pcCU, Int x, Int y, |
---|
[28] | 175 | Int &ref_frame0, Int &ref_frame0_idx, TComMv &mv0, Int ref_frame0_idx_2nd, TComMv mv0_2nd, |
---|
| 176 | Int &ref_frame1, Int &ref_frame1_idx, TComMv &mv1, Int ref_frame1_idx_2nd, TComMv mv1_2nd); |
---|
| 177 | #endif |
---|
| 178 | |
---|
| 179 | #if POZNAN_DBMP_CALC_PRED_DATA |
---|
| 180 | Int* getTempL0RefIdx() {return m_piTempL0RefIdx;} |
---|
| 181 | Int* getTempL0MvX() {return m_piTempL0MvX;} |
---|
| 182 | Int* getTempL0MvY() {return m_piTempL0MvY;} |
---|
| 183 | Int* getTempL1RefIdx() {return m_piTempL1RefIdx;} |
---|
| 184 | Int* getTempL1MvX() {return m_piTempL1MvX;} |
---|
| 185 | Int* getTempL1MvY() {return m_piTempL1MvY;} |
---|
| 186 | |
---|
[45] | 187 | Void xCalcDBMPPredData(UInt uiCnt, Int &ref_frame0_idx, TComMv &mv0, Int &ref_frame1_idx, TComMv &mv1); |
---|
[28] | 188 | #endif |
---|
| 189 | |
---|
| 190 | #if POZNAN_DBMP_CALC_PRED_DATA |
---|
| 191 | Void calcDBMPPredData(TComDataCU* pcCU, UInt uiAbsPartIdx, Int &ref_frame0_idx, TComMv &mv0, Int &ref_frame1_idx, TComMv &mv1); |
---|
| 192 | TComCUMvField* getDBMPPredMVField(RefPicList eRefListIdx){return apcDBMPPredMVField[eRefListIdx];} |
---|
| 193 | Void setDBMPPredMVField(RefPicList eRefListIdx, TComDataCU* pcCU); |
---|
| 194 | Void setDBMPPredMVField(RefPicList eRefListIdx, TComDataCU* pcCU, Int iNumPartSrc, Int iPartAddrDst); |
---|
| 195 | #endif |
---|
| 196 | |
---|
| 197 | TComPic* GetPicFromList(std::vector<TComPic*>* rcListPic, UInt uiPOC, UInt uiView); |
---|
| 198 | Int GetRepresentativeVal(UInt &uiCntMax, Int* puiIn, UInt uiLen, Int* puiTemp, Bool bUseRestrictedVal=false, Int uiRestrictedVal=0); |
---|
| 199 | |
---|
| 200 | }; |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | //#endif |
---|
| 206 | |
---|
| 207 | #endif // __TCOMMP__ |
---|
| 208 | |
---|
| 209 | |
---|
| 210 | #endif // POZNAN_MP |
---|