[166] | 1 | #include "CommonDef.h" |
---|
| 2 | #include "TComYuv.h" |
---|
| 3 | #include "TComPic.h" |
---|
| 4 | #include "../TLibDecoder/TDecCu.h" |
---|
| 5 | #include "DebugLog.h" |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | char* pcPartSizeName[] = |
---|
| 9 | { |
---|
| 10 | "SIZE_2Nx2N", ///< symmetric motion partition, 2Nx2N |
---|
| 11 | "SIZE_2NxN", ///< symmetric motion partition, 2Nx N |
---|
| 12 | "SIZE_Nx2N", ///< symmetric motion partition, Nx2N |
---|
| 13 | "SIZE_NxN", ///< symmetric motion partition, Nx N |
---|
| 14 | |
---|
| 15 | "SIZE_2NxnU", ///< asymmetric motion partition, 2Nx( N/2) + 2Nx(3N/2) |
---|
| 16 | "SIZE_2NxnD", ///< asymmetric motion partition, 2Nx(3N/2) + 2Nx( N/2) |
---|
| 17 | "SIZE_nLx2N", ///< asymmetric motion partition, ( N/2)x2N + (3N/2)x2N |
---|
| 18 | "SIZE_nRx2N" ///< asymmetric motion partition, (3N/2)x2N + ( N/2)x2N |
---|
| 19 | }; |
---|
| 20 | |
---|
| 21 | char* pcPredModeName[] = |
---|
| 22 | { |
---|
| 23 | "MODE_SKIP", ///< SKIP mode |
---|
| 24 | "MODE_INTER", ///< inter-prediction mode |
---|
| 25 | "MODE_INTRA" ///< intra-prediction mode |
---|
| 26 | #if FORCE_REF_VSP==1 |
---|
| 27 | ,"MODE_SYNTH" ///< vsp skip mode |
---|
| 28 | #endif |
---|
| 29 | }; |
---|
| 30 | |
---|
| 31 | void printMotionInfo( TComDataCU* pcCU, UInt uiIdx, FILE* pfFile ) |
---|
| 32 | { |
---|
| 33 | UInt iInterDir = pcCU->getInterDir( uiIdx ); |
---|
| 34 | fprintf(pfFile, "interDir,%d, ", iInterDir ); |
---|
| 35 | if (iInterDir != 2) { |
---|
| 36 | fprintf(pfFile, "L0Idx,%d, ", pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx( uiIdx )); |
---|
| 37 | fprintf(pfFile, "L0Mv(,%d,%d,), ", pcCU->getCUMvField(REF_PIC_LIST_0)->getMv( uiIdx ).getHor(), pcCU->getCUMvField(REF_PIC_LIST_0)->getMv( uiIdx ).getVer() ); |
---|
| 38 | } else { |
---|
| 39 | fprintf(pfFile, "L0Idx,-, L0Mv(,-,-,), "); |
---|
| 40 | } |
---|
| 41 | if (iInterDir != 1) { |
---|
| 42 | fprintf(pfFile, "L1Idx,%d, ", pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx( uiIdx )); |
---|
| 43 | fprintf(pfFile, "L1Mv(,%d,%d,), ", pcCU->getCUMvField(REF_PIC_LIST_1)->getMv( uiIdx ).getHor(), pcCU->getCUMvField(REF_PIC_LIST_1)->getMv( uiIdx ).getVer() ); |
---|
| 44 | } else { |
---|
| 45 | fprintf(pfFile, "L1Idx,-, L1Mv(,-,-,), "); |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | bool DebugLog::DebugLogOut( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 50 | { |
---|
| 51 | if ( !m_pfDebugLogFile ) return false; |
---|
| 52 | |
---|
| 53 | int iIdxWidth = (pcCU->getWidth( uiAbsPartIdx ) << uiDepth) >> 2; |
---|
| 54 | int iXoffset = (g_auiZscanToRaster[uiAbsPartIdx] % iIdxWidth) << 2; |
---|
| 55 | int iYoffset = (g_auiZscanToRaster[uiAbsPartIdx] / iIdxWidth) << 2; |
---|
| 56 | fprintf(m_pfDebugLogFile, "Pos(,%d,%d,) , PartIdx,%d, ", pcCU->getCUPelX()+iXoffset, pcCU->getCUPelY()+iYoffset, uiAbsPartIdx); |
---|
| 57 | #if (VSP_N) |
---|
| 58 | { |
---|
| 59 | char cRefVsp = 0; Int aiRefIdx[2] = {-1, -1}; |
---|
| 60 | Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx( uiAbsPartIdx ); aiRefIdx[0] = iRefIdx; |
---|
| 61 | if( iRefIdx >= 0 ) cRefVsp |= (pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP ? 0x01 : 0); |
---|
| 62 | iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx( uiAbsPartIdx ); aiRefIdx[1] = iRefIdx; |
---|
| 63 | if( iRefIdx >= 0 ) cRefVsp |= (pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP ? 0x02 : 0); |
---|
| 64 | fprintf(m_pfDebugLogFile, "VSP,%d, RefIdx(,%d,%d,), ", cRefVsp, aiRefIdx[0], aiRefIdx[1] ); // 0:not VSP, 1:VSP L0, 2:VSP L1, 3:VSP Bi |
---|
| 65 | fprintf(m_pfDebugLogFile, "MV("); |
---|
| 66 | if(aiRefIdx[0]>=0)fprintf(m_pfDebugLogFile, "(,%d,%d,)",pcCU->getCUMvField( RefPicList(0) )->getMv(uiAbsPartIdx).getHor(),pcCU->getCUMvField( RefPicList(0) )->getMv(uiAbsPartIdx).getVer()); |
---|
| 67 | else fprintf(m_pfDebugLogFile, "(,-,-,)"); |
---|
| 68 | if(aiRefIdx[1]>=0)fprintf(m_pfDebugLogFile, "(,%d,%d,)",pcCU->getCUMvField( RefPicList(1) )->getMv(uiAbsPartIdx).getHor(),pcCU->getCUMvField( RefPicList(1) )->getMv(uiAbsPartIdx).getVer()); |
---|
| 69 | else fprintf(m_pfDebugLogFile, "(,-,-,)"); |
---|
| 70 | fprintf(m_pfDebugLogFile, ")"); |
---|
| 71 | } |
---|
| 72 | #endif |
---|
| 73 | fprintf(m_pfDebugLogFile, "depth,%d,(,%d x %d,), ", uiDepth, pcCU->getWidth( uiAbsPartIdx ), pcCU->getHeight( uiAbsPartIdx )); |
---|
| 74 | fprintf(m_pfDebugLogFile, "Predmode,%s, ", |
---|
| 75 | #if FORCE_REF_VSP==1 |
---|
| 76 | pcCU->getPredictionMode( uiAbsPartIdx ) < 4 ? |
---|
| 77 | #else |
---|
| 78 | pcCU->getPredictionMode( uiAbsPartIdx ) < 3 ? |
---|
| 79 | #endif |
---|
| 80 | pcPredModeName[(int)pcCU->getPredictionMode( uiAbsPartIdx )] : "SIZE_NONE"); |
---|
| 81 | #if FORCE_REF_VSP==1 |
---|
| 82 | fprintf(m_pfDebugLogFile, "VspSkipFlg,%d,", pcCU->getPredictionMode( uiAbsPartIdx )==MODE_SYNTH?1:0); |
---|
| 83 | #endif |
---|
| 84 | #if HHI_MPI |
---|
| 85 | fprintf(m_pfDebugLogFile, "TextModeDepFlg,%d,", pcCU->getSlice()->getIsDepth() ? (pcCU->getTextureModeDepth( uiAbsPartIdx )==uiDepth) : 0 ); |
---|
| 86 | #endif |
---|
| 87 | fprintf(m_pfDebugLogFile, "Mergeflag,%d,MergeIdx,%d,", pcCU->getMergeFlag( uiAbsPartIdx ), pcCU->getMergeIndex( uiAbsPartIdx ) ); |
---|
| 88 | fprintf(m_pfDebugLogFile, "Partsize,%s, ", pcCU->getPartitionSize( uiAbsPartIdx ) < 8 ? pcPartSizeName[(int)pcCU->getPartitionSize( uiAbsPartIdx )] : "SIZE_NONE"); |
---|
| 89 | fprintf(m_pfDebugLogFile, "Cbf(,%d,%d,%d,), ", pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA), pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U), pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) ); |
---|
| 90 | |
---|
| 91 | #if OUT_PRED_INFO |
---|
| 92 | UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2; |
---|
| 93 | if (pcCU->getPredictionMode( uiAbsPartIdx ) != MODE_INTRA) { |
---|
| 94 | //InterDirectionNum,L0Idx,L0Mv,L1Idx,L1Mv |
---|
| 95 | printMotionInfo( pcCU, uiAbsPartIdx, m_pfDebugLogFile ); |
---|
| 96 | switch ( pcCU->getPartitionSize( uiAbsPartIdx ) ) |
---|
| 97 | { |
---|
| 98 | case SIZE_2Nx2N:{ break; } |
---|
| 99 | case SIZE_2NxN: { printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset << 1), m_pfDebugLogFile ); break; } |
---|
| 100 | case SIZE_Nx2N: { printMotionInfo( pcCU, uiAbsPartIdx + uiPartOffset , m_pfDebugLogFile ); break; } |
---|
| 101 | case SIZE_NxN: |
---|
| 102 | { |
---|
| 103 | for ( Int iPartIdx = 0; iPartIdx < 4; iPartIdx++ ) { |
---|
| 104 | printMotionInfo( pcCU, uiAbsPartIdx + uiPartOffset * iPartIdx, m_pfDebugLogFile ); |
---|
| 105 | } |
---|
| 106 | break; |
---|
| 107 | } |
---|
| 108 | #if ASYMMETRIC_USE |
---|
| 109 | case SIZE_2NxnU:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset >> 1) , m_pfDebugLogFile ); break; } |
---|
| 110 | case SIZE_2NxnD:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset << 1) + (uiPartOffset >> 1), m_pfDebugLogFile ); break; } |
---|
| 111 | case SIZE_nLx2N:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset >> 2) , m_pfDebugLogFile ); break; } |
---|
| 112 | case SIZE_nRx2N:{ printMotionInfo( pcCU, uiAbsPartIdx + (uiPartOffset ) + (uiPartOffset >> 2), m_pfDebugLogFile ); break; } |
---|
| 113 | #endif |
---|
| 114 | default: { break; } |
---|
| 115 | } |
---|
| 116 | } else { |
---|
| 117 | //IntraPredDirection |
---|
| 118 | fprintf( m_pfDebugLogFile, "IntraDir(L,%d,C,%d,), ", pcCU->getLumaIntraDir( uiAbsPartIdx ), pcCU->getChromaIntraDir( uiAbsPartIdx ) ); |
---|
| 119 | if (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN) |
---|
| 120 | { |
---|
| 121 | for (int i=1; i < 4; i++) { |
---|
| 122 | fprintf( m_pfDebugLogFile, "IntraDir(L,%d,C,%d,), ", pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset * i ), pcCU->getChromaIntraDir( uiAbsPartIdx + uiPartOffset * i ) ); |
---|
| 123 | } |
---|
| 124 | } |
---|
| 125 | } |
---|
| 126 | #endif |
---|
| 127 | fprintf(m_pfDebugLogFile, "\n"); |
---|
| 128 | return true; |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | //Color set function of TComYuv |
---|
| 133 | #if DEBUGIMGOUT |
---|
| 134 | Void TComYuv::colsetToPicYuv ( const UChar ucColor[3], Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine ) |
---|
| 135 | { |
---|
| 136 | colsetToPicLuma ( ucColor[0], iOffset, pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx, bDrawLine ); |
---|
| 137 | for (int i=0; i < 2; i++) |
---|
| 138 | for (int j=0; j < 2; j++) |
---|
| 139 | iOffset[i][j] >>= 1; |
---|
| 140 | colsetToPicChroma( ucColor[1], ucColor[2], iOffset, pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx, bDrawLine ); |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | Void TComYuv::colsetToPicLuma ( const UChar ucLumaOffCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine ) |
---|
| 144 | { |
---|
| 145 | Int offset = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0; |
---|
| 146 | Int iStartX = bDrawLine ? 1:0; |
---|
| 147 | Int y, x, iWidth, iHeight; |
---|
| 148 | iWidth = m_iWidth >>uiPartDepth; |
---|
| 149 | iHeight = m_iHeight>>uiPartDepth; |
---|
| 150 | |
---|
| 151 | Pel* pSrc = getLumaAddr(uiPartIdx, iWidth); |
---|
| 152 | Pel* pDst = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx ); |
---|
| 153 | |
---|
| 154 | UInt iSrcStride = getStride(); |
---|
| 155 | UInt iDstStride = pcPicYuvDst->getStride(); |
---|
| 156 | |
---|
| 157 | pSrc += iOffset[0][1] * iSrcStride + iOffset[0][0]; //TopLeft |
---|
| 158 | pDst += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft |
---|
| 159 | iWidth = iOffset[1][0]; //ButtomRight |
---|
| 160 | iHeight = iOffset[1][1]; //ButtomRight |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | if( bDrawLine ) |
---|
| 164 | { |
---|
| 165 | for( x = 0; x < iWidth; x++ ) |
---|
| 166 | pDst[x] = (((pSrc[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2; //Top line |
---|
| 167 | pDst += iDstStride; |
---|
| 168 | pSrc += iSrcStride; |
---|
| 169 | iHeight--; |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | if( ucLumaOffCol == 0 ) |
---|
| 173 | { |
---|
| 174 | for ( y = iHeight; y != 0; y-- ) |
---|
| 175 | { |
---|
| 176 | if( bDrawLine ) |
---|
| 177 | pDst[0] = (((pSrc[0] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2; //Left line |
---|
| 178 | for( x = iStartX; x < iWidth; x++ ) |
---|
| 179 | pDst[x] = (pSrc[x] + offset) >> g_uiBitIncrement; //glay scale |
---|
| 180 | pDst += iDstStride; |
---|
| 181 | pSrc += iSrcStride; |
---|
| 182 | } |
---|
| 183 | } else { |
---|
| 184 | for ( y = iHeight; y != 0; y-- ) |
---|
| 185 | { |
---|
| 186 | if( bDrawLine ) |
---|
| 187 | pDst[0] = (((pSrc[0] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2; //Left line |
---|
| 188 | for( x = iStartX; x < iWidth; x++ ) |
---|
| 189 | pDst[x] = (((pSrc[x] + offset) >> g_uiBitIncrement) >> 2) + ucLumaOffCol; |
---|
| 190 | pDst += iDstStride; |
---|
| 191 | pSrc += iSrcStride; |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | Void TComYuv::colsetToPicChroma( const UChar ucUCol, const UChar ucVCol, Int iOffset[2][2], TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx, Bool bDrawLine ) |
---|
| 197 | { |
---|
| 198 | Int y, x, iWidth, iHeight; |
---|
| 199 | iWidth = m_iCWidth >>uiPartDepth; |
---|
| 200 | iHeight = m_iCHeight>>uiPartDepth; |
---|
| 201 | Int iStartX = bDrawLine ? 1:0; |
---|
| 202 | |
---|
| 203 | Pel* pDstU = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 204 | Pel* pDstV = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 205 | |
---|
| 206 | UInt iDstStride = pcPicYuvDst->getCStride(); |
---|
| 207 | |
---|
| 208 | pDstU += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft |
---|
| 209 | pDstV += iOffset[0][1] * iDstStride + iOffset[0][0]; //TopLeft |
---|
| 210 | iWidth = iOffset[1][0]; //ButtomRight |
---|
| 211 | iHeight = iOffset[1][1]; //ButtomRight |
---|
| 212 | |
---|
| 213 | if( bDrawLine ) |
---|
| 214 | { |
---|
| 215 | for( x = 0; x < iWidth; x++ ) |
---|
| 216 | { |
---|
| 217 | pDstU[x] = LINE_CB_COL2; //Top line color |
---|
| 218 | pDstV[x] = LINE_CR_COL2; //Top line color |
---|
| 219 | } |
---|
| 220 | pDstV += iDstStride; |
---|
| 221 | pDstU += iDstStride; |
---|
| 222 | iHeight--; |
---|
| 223 | } |
---|
| 224 | for ( y = iHeight; y != 0; y-- ) |
---|
| 225 | { |
---|
| 226 | if( bDrawLine ) { |
---|
| 227 | pDstU[0] = LINE_CB_COL2; //Left line color |
---|
| 228 | pDstV[0] = LINE_CR_COL2; //Left line color |
---|
| 229 | } |
---|
| 230 | for( x = iStartX; x < iWidth; x++ ) |
---|
| 231 | { |
---|
| 232 | pDstU[x] = ucUCol; |
---|
| 233 | pDstV[x] = ucVCol; |
---|
| 234 | } |
---|
| 235 | pDstU += iDstStride; |
---|
| 236 | pDstV += iDstStride; |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | Void TComYuv::drawLineToPicYuv ( bool bHor, bool bVer, UInt uiSize, TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx ) |
---|
| 241 | { |
---|
| 242 | Int offset = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0; |
---|
| 243 | Int y, x, iWidth, iHeight, iWidthC, iHeightC; |
---|
| 244 | |
---|
| 245 | iWidth = m_iWidth >>uiPartDepth; |
---|
| 246 | iHeight = m_iHeight>>uiPartDepth; |
---|
| 247 | iWidthC = m_iCWidth >>uiPartDepth; |
---|
| 248 | iHeightC = m_iCHeight>>uiPartDepth; |
---|
| 249 | |
---|
| 250 | |
---|
| 251 | Pel* pSrc = getLumaAddr(uiPartIdx, iWidth); |
---|
| 252 | Pel* pDst = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx ); |
---|
| 253 | Pel* pDstU = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 254 | Pel* pDstV = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 255 | |
---|
| 256 | UInt iSrcStride = getStride(); |
---|
| 257 | UInt iDstStride = pcPicYuvDst->getStride(); |
---|
| 258 | UInt iDstStrideC = pcPicYuvDst->getCStride(); |
---|
| 259 | |
---|
| 260 | if ( bHor ) |
---|
| 261 | { |
---|
| 262 | //Luma |
---|
| 263 | Pel* pDstHor = pDst + iDstStride * ((iHeight * uiSize) >> 2); |
---|
| 264 | Pel* pSrcHor = pSrc + iSrcStride * ((iHeight * uiSize) >> 2); |
---|
| 265 | for( x = 1; x < iWidth; x++ ) |
---|
| 266 | pDstHor[x] = (((pSrcHor[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL; |
---|
| 267 | //CbCr |
---|
| 268 | Pel* pDstUHor = pDstU + iDstStrideC * ((iHeightC * uiSize) >> 2); |
---|
| 269 | Pel* pDstVHor = pDstV + iDstStrideC * ((iHeightC * uiSize) >> 2); |
---|
| 270 | for( x = 1; x < iWidthC; x++ ) |
---|
| 271 | { |
---|
| 272 | pDstUHor[x] = LINE_CB_COL; |
---|
| 273 | pDstVHor[x] = LINE_CR_COL; |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | if ( bVer ) |
---|
| 277 | { |
---|
| 278 | //Luma |
---|
| 279 | Pel* pDstVer = pDst + iDstStride; |
---|
| 280 | Pel* pSrcVer = pSrc + iSrcStride; |
---|
| 281 | x = (iWidth * uiSize) >> 2; |
---|
| 282 | for ( y = iHeight; y != 1; y-- ) |
---|
| 283 | { |
---|
| 284 | pDstVer[x] = (((pSrcVer[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL; |
---|
| 285 | pDstVer += iDstStride; |
---|
| 286 | pSrcVer += iSrcStride; |
---|
| 287 | } |
---|
| 288 | //CbCr |
---|
| 289 | Pel* pDstVerU = pDstU + iDstStrideC; |
---|
| 290 | Pel* pDstVerV = pDstV + iDstStrideC; |
---|
| 291 | x = (iHeightC * uiSize) >> 2; |
---|
| 292 | for ( y = iHeightC; y != 1; y-- ) |
---|
| 293 | { |
---|
| 294 | pDstVerU[x] = LINE_CB_COL; |
---|
| 295 | pDstVerV[x] = LINE_CR_COL; |
---|
| 296 | pDstVerU += iDstStrideC; |
---|
| 297 | pDstVerV += iDstStrideC; |
---|
| 298 | } |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | Void TComYuv::drawRectToPicYuv ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx ) |
---|
| 304 | { |
---|
| 305 | Int offset = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0; |
---|
| 306 | Int y, x, iWidth, iHeight, iWidthC, iHeightC; |
---|
| 307 | |
---|
| 308 | iWidth = m_iWidth >>uiPartDepth; |
---|
| 309 | iHeight = m_iHeight>>uiPartDepth; |
---|
| 310 | iWidthC = m_iCWidth >>uiPartDepth; |
---|
| 311 | iHeightC = m_iCHeight>>uiPartDepth; |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | Pel* pSrc = getLumaAddr(uiPartIdx, iWidth); |
---|
| 315 | Pel* pDst = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx ); |
---|
| 316 | Pel* pDstU = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 317 | Pel* pDstV = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx ); |
---|
| 318 | |
---|
| 319 | UInt iSrcStride = getStride(); |
---|
| 320 | UInt iDstStride = pcPicYuvDst->getStride(); |
---|
| 321 | UInt iDstStrideC = pcPicYuvDst->getCStride(); |
---|
| 322 | |
---|
| 323 | //X |
---|
| 324 | { |
---|
| 325 | //Luma |
---|
| 326 | Pel* pDstHor = pDst; |
---|
| 327 | Pel* pSrcHor = pSrc; |
---|
| 328 | for( x = 0; x < iWidth; x++ ) |
---|
| 329 | pDstHor[x] = (((pSrcHor[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2; |
---|
| 330 | //CbCr |
---|
| 331 | Pel* pDstUHor = pDstU; |
---|
| 332 | Pel* pDstVHor = pDstV; |
---|
| 333 | for( x = 0; x < iWidthC; x++ ) |
---|
| 334 | { |
---|
| 335 | pDstUHor[x] = LINE_CB_COL2; |
---|
| 336 | pDstVHor[x] = LINE_CR_COL2; |
---|
| 337 | } |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | //Y |
---|
| 341 | { |
---|
| 342 | //Luma |
---|
| 343 | Pel* pDstVer = pDst; |
---|
| 344 | Pel* pSrcVer = pSrc; |
---|
| 345 | x = 0; |
---|
| 346 | for ( y = iHeight; y >= 0; y-- ) |
---|
| 347 | { |
---|
| 348 | pDstVer[x] = (((pSrcVer[x] + offset) >> g_uiBitIncrement) >> 2) + LINE_LUMA_OFF_COL2; |
---|
| 349 | pDstVer += iDstStride; |
---|
| 350 | pSrcVer += iSrcStride; |
---|
| 351 | } |
---|
| 352 | //CbCr |
---|
| 353 | Pel* pDstVerU = pDstU; |
---|
| 354 | Pel* pDstVerV = pDstV; |
---|
| 355 | x = 0; |
---|
| 356 | for ( y = iHeightC; y >= 0; y-- ) |
---|
| 357 | { |
---|
| 358 | pDstVerU[x] = LINE_CB_COL2; |
---|
| 359 | pDstVerV[x] = LINE_CR_COL2; |
---|
| 360 | pDstVerU += iDstStrideC; |
---|
| 361 | pDstVerV += iDstStrideC; |
---|
| 362 | } |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | } |
---|
| 366 | |
---|
| 367 | Void TDecCu::xColsetToPic( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 368 | { |
---|
| 369 | int iIdxWidth = (pcCU->getWidth( 0 ) << uiDepth) >> 2; |
---|
| 370 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 371 | PredMode ePredMode = pcCU->getPredictionMode( 0 ); |
---|
| 372 | Int iRect[2][2] = {{0,0}, {0,0}}; |
---|
| 373 | Int iColorIdx = 0; |
---|
| 374 | UInt uiPartAddr; |
---|
| 375 | |
---|
| 376 | if ( ePredMode == MODE_INTER ) |
---|
| 377 | { |
---|
| 378 | for (int iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ ) |
---|
| 379 | { |
---|
| 380 | pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRect[1][0], iRect[1][1] ); |
---|
| 381 | iRect[0][0] = (g_auiZscanToRaster[uiPartAddr] % iIdxWidth) << 2; |
---|
| 382 | iRect[0][1] = (g_auiZscanToRaster[uiPartAddr] / iIdxWidth) << 2; |
---|
| 383 | |
---|
| 384 | #if (VSP_N) |
---|
| 385 | { |
---|
| 386 | Char cRefVsp = 0x00; |
---|
| 387 | Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx(iPartIdx); |
---|
| 388 | if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP ) |
---|
| 389 | cRefVsp |= 0x01; |
---|
| 390 | iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx(iPartIdx); |
---|
| 391 | if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP ) |
---|
| 392 | cRefVsp |= 0x02; |
---|
| 393 | #if FORCE_REF_VSP |
---|
| 394 | if( pcCU->isVspMode(iPartIdx) ) |
---|
| 395 | cRefVsp |= 0x04; |
---|
| 396 | #endif |
---|
| 397 | |
---|
| 398 | switch( cRefVsp ) |
---|
| 399 | { |
---|
| 400 | case 0: // INTER |
---|
| 401 | iColorIdx = 2; |
---|
| 402 | break; |
---|
| 403 | case 1: // VSP L0 |
---|
| 404 | iColorIdx = 4; |
---|
| 405 | break; |
---|
| 406 | case 2: // VSP L1 |
---|
| 407 | iColorIdx = 6; |
---|
| 408 | break; |
---|
| 409 | case 3: // VSP Bi |
---|
| 410 | iColorIdx = 7; |
---|
| 411 | break; |
---|
| 412 | #if FORCE_REF_VSP |
---|
| 413 | case 4: // VSP Skip |
---|
| 414 | iColorIdx = 5; |
---|
| 415 | break; |
---|
| 416 | #endif |
---|
| 417 | default: |
---|
| 418 | assert(0); |
---|
| 419 | break; |
---|
| 420 | } |
---|
| 421 | } |
---|
| 422 | #else |
---|
| 423 | iColorIdx = 2; |
---|
| 424 | #endif |
---|
| 425 | |
---|
| 426 | m_ppcYuvReco[uiDepth]->colsetToPicYuv ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 427 | } |
---|
| 428 | } else { |
---|
| 429 | iRect[0][0]=iRect[0][1]=0; |
---|
| 430 | iRect[1][0]=pcCU->getWidth(0); |
---|
| 431 | iRect[1][1]=pcCU->getHeight(0); |
---|
| 432 | |
---|
| 433 | iColorIdx = ePredMode==MODE_SKIP ? 0 : 1; |
---|
| 434 | |
---|
| 435 | m_ppcYuvReco[uiDepth]->colsetToPicYuv ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 436 | } |
---|
| 437 | |
---|
| 438 | switch ( pcCU->getPartitionSize( 0 ) ) |
---|
| 439 | { |
---|
| 440 | case SIZE_2Nx2N: |
---|
| 441 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, false, 4, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 442 | break; |
---|
| 443 | case SIZE_2NxN: |
---|
| 444 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 445 | break; |
---|
| 446 | case SIZE_Nx2N: |
---|
| 447 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 448 | break; |
---|
| 449 | case SIZE_NxN: |
---|
| 450 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , true , 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 451 | break; |
---|
| 452 | case SIZE_2NxnU: |
---|
| 453 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 1, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 454 | break; |
---|
| 455 | case SIZE_2NxnD: |
---|
| 456 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 3, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 457 | break; |
---|
| 458 | case SIZE_nLx2N: |
---|
| 459 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 1, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 460 | break; |
---|
| 461 | case SIZE_nRx2N: |
---|
| 462 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 3, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 463 | break; |
---|
| 464 | default: |
---|
| 465 | break; |
---|
| 466 | } |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | Void TDecCu::xColsetToPicMerge( TComDataCU* pcCU, TComPicYuv* pcPicYuv, UInt uiZorderIdx, UInt uiDepth ) |
---|
| 470 | { |
---|
| 471 | int iIdxWidth = (pcCU->getWidth( 0 ) << uiDepth) >> 2; |
---|
| 472 | UInt uiCUAddr = pcCU->getAddr(); |
---|
| 473 | PredMode ePredMode = pcCU->getPredictionMode( 0 ); |
---|
| 474 | Int iRect[2][2] = {{0,0}, {0,0}}; |
---|
| 475 | Int iColorIdx = 0; |
---|
| 476 | UInt uiPartAddr; |
---|
| 477 | UInt uiMergeIdx; |
---|
| 478 | Bool bSkip = ePredMode == MODE_SKIP ? true : false; |
---|
| 479 | |
---|
| 480 | if ( ePredMode == MODE_INTER || bSkip ) |
---|
| 481 | { |
---|
| 482 | for (int iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ ) |
---|
| 483 | { |
---|
| 484 | pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRect[1][0], iRect[1][1] ); |
---|
| 485 | iRect[0][0] = (g_auiZscanToRaster[uiPartAddr] % iIdxWidth) << 2; |
---|
| 486 | iRect[0][1] = (g_auiZscanToRaster[uiPartAddr] / iIdxWidth) << 2; |
---|
| 487 | Bool bMerge = pcCU->getMergeFlag( iPartIdx ); |
---|
| 488 | |
---|
| 489 | if( bSkip || bMerge ) { |
---|
| 490 | uiMergeIdx = pcCU->getMergeIndex( iPartIdx ); |
---|
| 491 | #if (FORCE_REF_VSP) |
---|
| 492 | { |
---|
| 493 | iColorIdx = bSkip ? 1 : (bMerge ? 5 : 0); |
---|
| 494 | Int iRefIdx = pcCU->getCUMvField( RefPicList(0) )->getRefIdx(iPartIdx); |
---|
| 495 | char cRefVsp = 0x00; |
---|
| 496 | if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(0), iRefIdx ) == NUM_VIEW_VSP ) |
---|
| 497 | cRefVsp |= 0x01; |
---|
| 498 | iRefIdx = pcCU->getCUMvField( RefPicList(1) )->getRefIdx(iPartIdx); |
---|
| 499 | if( iRefIdx >= 0 && pcCU->getSlice()->getRefViewId( RefPicList(1), iRefIdx ) == NUM_VIEW_VSP ) |
---|
| 500 | cRefVsp |= 0x02; |
---|
| 501 | |
---|
| 502 | if( cRefVsp ) { |
---|
| 503 | iColorIdx += 1; |
---|
| 504 | } else if ( uiMergeIdx ) { |
---|
| 505 | iColorIdx += 3; |
---|
| 506 | } |
---|
| 507 | } |
---|
| 508 | #else |
---|
| 509 | iColorIdx = 2; |
---|
| 510 | #endif |
---|
| 511 | assert( iColorIdx > 0 && iColorIdx < 10 ); |
---|
| 512 | |
---|
| 513 | m_ppcYuvReco[uiDepth]->colsetToPicYuv ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 514 | |
---|
| 515 | } else { |
---|
| 516 | |
---|
| 517 | //Inter Not Merge |
---|
| 518 | m_ppcYuvReco[uiDepth]->colsetToPicYuv ( g_ucCol[0], iRect, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 519 | |
---|
| 520 | } |
---|
| 521 | } // end iPartIdx loop |
---|
| 522 | |
---|
| 523 | } else |
---|
| 524 | { |
---|
| 525 | //Intra , Not Merge Inter |
---|
| 526 | iRect[0][0]=iRect[0][1]=0; |
---|
| 527 | iRect[1][0]=pcCU->getWidth(0); |
---|
| 528 | iRect[1][1]=pcCU->getHeight(0); |
---|
| 529 | |
---|
| 530 | iColorIdx = 0; |
---|
| 531 | |
---|
| 532 | m_ppcYuvReco[uiDepth]->colsetToPicYuv ( g_ucCol[iColorIdx], iRect, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 533 | } |
---|
| 534 | |
---|
| 535 | switch ( pcCU->getPartitionSize( 0 ) ) |
---|
| 536 | { |
---|
| 537 | case SIZE_2Nx2N: |
---|
| 538 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, false, 4, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 539 | break; |
---|
| 540 | case SIZE_2NxN: |
---|
| 541 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 542 | break; |
---|
| 543 | case SIZE_Nx2N: |
---|
| 544 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 545 | break; |
---|
| 546 | case SIZE_NxN: |
---|
| 547 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , true , 2, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 548 | break; |
---|
| 549 | case SIZE_2NxnU: |
---|
| 550 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 1, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 551 | break; |
---|
| 552 | case SIZE_2NxnD: |
---|
| 553 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( true , false, 3, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 554 | break; |
---|
| 555 | case SIZE_nLx2N: |
---|
| 556 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 1, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 557 | break; |
---|
| 558 | case SIZE_nRx2N: |
---|
| 559 | m_ppcYuvReco[uiDepth]->drawLineToPicYuv ( false, true , 3, pcPicYuv, uiCUAddr, uiZorderIdx ); |
---|
| 560 | break; |
---|
| 561 | default: |
---|
| 562 | break; |
---|
| 563 | } |
---|
| 564 | } |
---|
| 565 | #endif //DEBUGIMGOUT |
---|