Re: [x265] [PATCH] analysis: add CU specific details to encodeCU()
Ok, thanks. please send a follow-on patch cleaning up both encodeCU and compressCu functions. On Tue, Sep 16, 2014 at 11:32 AM, Santhoshini Sekar santhosh...@multicorewareinc.com wrote: On Tue, Sep 16, 2014 at 10:56 AM, Deepthi Nandakumar deep...@multicorewareinc.com wrote: On Tue, Sep 16, 2014 at 9:45 AM, santhosh...@multicorewareinc.com wrote: # HG changeset patch # User Santhoshini Sekar santhosh...@multicorewareinc.com # Date 1410840429 -19800 # Tue Sep 16 09:37:09 2014 +0530 # Node ID 50505472d3e33b775c70f2f373e1c15d17e47e66 # Parent 7e29b10982d2eb7fd79f581d6f04184522ba analysis: add CU specific details to encodeCU() diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/analysis.cpp Tue Sep 16 09:37:09 2014 +0530 @@ -301,7 +301,6 @@ { if (cu-m_slice-m_pps-bUseDQP) m_bEncodeDQP = true; -loadCTUData(cu); // initialize CU data m_bestCU[0]-initCU(cu-m_pic, cu-getAddr()); diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.cpp --- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.cppTue Sep 16 09:37:09 2014 +0530 @@ -481,14 +481,14 @@ } } -void Entropy::encodeCTU(TComDataCU* cu) +void Entropy::encodeCTU(TComDataCU* cu, CU* cuData) { bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP; -encodeCU(cu, 0, 0, false, bEncodeDQP); +encodeCU(cu, 0, 0, bEncodeDQP, cuData); } /* encode a CU block recursively */ -void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP) +void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU* cuData) { Frame* pic = cu-m_pic; Slice* slice = cu-m_slice; @@ -496,30 +496,24 @@ if (depth = slice-m_pps-maxCuDQPDepth slice-m_pps-bUseDQP) bEncodeDQP = true; -if (!bInsidePicture) +int cuSplitFlag = !(cuData-flags CU::LEAF); +int cuUnsplitFlag = !(cuData-flags CU::SPLIT_MANDATORY); + +if (!cuUnsplitFlag) { -uint32_t xmax = slice-m_sps-picWidthInLumaSamples - cu-getCUPelX(); -uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY(); -uint32_t cuSize = g_maxCUSize depth; - -bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax - g_zscanToPelY[absPartIdx] + cuSize = ymax); - -if (!bInsidePicture) +uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; +for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) { -uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; -for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -{ -if (g_zscanToPelX[absPartIdx] xmax g_zscanToPelY[absPartIdx] ymax) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); -} - -return; +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +int cuPresentFlagChild = !(childCU-flags CU::PRESENT); +if (!cuPresentFlagChild) +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); } +return; } // We need to split, so don't try these modes. -if (bInsidePicture depth g_maxCUDepth) +if (cuSplitFlag) codeSplitFlag(cu, absPartIdx, depth); if (depth cu-getDepth(absPartIdx) depth g_maxCUDepth) @@ -527,7 +521,10 @@ uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); +{ +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); +} return; } diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.h --- a/source/encoder/entropy.h Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.h Tue Sep 16 09:37:09 2014 +0530 @@ -148,7 +148,7 @@ void codeShortTermRefPicSet(RPS* rps); void finishSlice() { encodeBinTrm(1); finish(); dynamic_castBitstream*(m_bitIf)-writeByteAlignment(); } -void encodeCTU(TComDataCU* cu); +void encodeCTU(TComDataCU* cu, CU *cuData); void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx); void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int allowMergeLeft, int allowMergeUp); void codeSaoMerge(uint32_t code) { encodeBin(code,
[x265] [PATCH] analysis: add CU specific details to encodeCU()
# HG changeset patch # User Santhoshini Sekar santhosh...@multicorewareinc.com # Date 1410848612 -19800 # Tue Sep 16 11:53:32 2014 +0530 # Node ID 74b5192133a548c492b8b2cb34dde8242107900e # Parent 7e29b10982d2eb7fd79f581d6f04184522ba analysis: add CU specific details to encodeCU() diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/analysis.cpp Tue Sep 16 11:53:32 2014 +0530 @@ -301,7 +301,6 @@ { if (cu-m_slice-m_pps-bUseDQP) m_bEncodeDQP = true; -loadCTUData(cu); // initialize CU data m_bestCU[0]-initCU(cu-m_pic, cu-getAddr()); diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.cpp --- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.cppTue Sep 16 11:53:32 2014 +0530 @@ -484,11 +484,11 @@ void Entropy::encodeCTU(TComDataCU* cu) { bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP; -encodeCU(cu, 0, 0, false, bEncodeDQP); +encodeCU(cu, 0, 0, bEncodeDQP, cu-m_CULocalData ); } /* encode a CU block recursively */ -void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP) +void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU* cuData) { Frame* pic = cu-m_pic; Slice* slice = cu-m_slice; @@ -496,30 +496,24 @@ if (depth = slice-m_pps-maxCuDQPDepth slice-m_pps-bUseDQP) bEncodeDQP = true; -if (!bInsidePicture) +int cuSplitFlag = !(cuData-flags CU::LEAF); +int cuUnsplitFlag = !(cuData-flags CU::SPLIT_MANDATORY); + +if (!cuUnsplitFlag) { -uint32_t xmax = slice-m_sps-picWidthInLumaSamples - cu-getCUPelX(); -uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY(); -uint32_t cuSize = g_maxCUSize depth; - -bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax - g_zscanToPelY[absPartIdx] + cuSize = ymax); - -if (!bInsidePicture) +uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; +for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) { -uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; -for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -{ -if (g_zscanToPelX[absPartIdx] xmax g_zscanToPelY[absPartIdx] ymax) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); -} - -return; +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +int cuPresentFlagChild = !(childCU-flags CU::PRESENT); +if (!cuPresentFlagChild) +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); } +return; } // We need to split, so don't try these modes. -if (bInsidePicture depth g_maxCUDepth) +if (cuSplitFlag) codeSplitFlag(cu, absPartIdx, depth); if (depth cu-getDepth(absPartIdx) depth g_maxCUDepth) @@ -527,7 +521,10 @@ uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); +{ +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); +} return; } diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.h --- a/source/encoder/entropy.h Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.h Tue Sep 16 11:53:32 2014 +0530 @@ -193,7 +193,7 @@ void encodeBinsEP(uint32_t binValues, int numBins); void encodeBinTrm(uint32_t binValue); -void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP); +void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU *cuData); void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth); void writeOut(); diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/frameencoder.cpp --- a/source/encoder/frameencoder.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/frameencoder.cpp Tue Sep 16 11:53:32 2014 +0530 @@ -470,6 +470,7 @@ } } +m_tld.cuCoder.loadCTUData(cu); // final coding (bitstream generation) for this CU m_entropyCoder.encodeCTU(cu); @@ -689,6 +690,7 @@ // load current best state from go-on entropy coder curRow.rdEntropyCoders[0][CI_CURR_BEST].load(rowCoder); +tld.cuCoder.loadCTUData(cu); tld.cuCoder.m_quant.setQPforQuant(cu); tld.cuCoder.compressCU(cu); // Does all the CU
Re: [x265] [PATCH] analysis: add CU specific details to encodeCU()
On 09/16, santhosh...@multicorewareinc.com wrote: # HG changeset patch # User Santhoshini Sekar santhosh...@multicorewareinc.com # Date 1410848612 -19800 # Tue Sep 16 11:53:32 2014 +0530 # Node ID 74b5192133a548c492b8b2cb34dde8242107900e # Parent 7e29b10982d2eb7fd79f581d6f04184522ba analysis: add CU specific details to encodeCU() diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/analysis.cpp Tue Sep 16 11:53:32 2014 +0530 @@ -301,7 +301,6 @@ { if (cu-m_slice-m_pps-bUseDQP) m_bEncodeDQP = true; -loadCTUData(cu); // initialize CU data m_bestCU[0]-initCU(cu-m_pic, cu-getAddr()); diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.cpp --- a/source/encoder/entropy.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.cpp Tue Sep 16 11:53:32 2014 +0530 @@ -484,11 +484,11 @@ void Entropy::encodeCTU(TComDataCU* cu) { bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP; -encodeCU(cu, 0, 0, false, bEncodeDQP); +encodeCU(cu, 0, 0, bEncodeDQP, cu-m_CULocalData ); queued with this white-space nit fixed } /* encode a CU block recursively */ -void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP) +void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU* cuData) { Frame* pic = cu-m_pic; Slice* slice = cu-m_slice; @@ -496,30 +496,24 @@ if (depth = slice-m_pps-maxCuDQPDepth slice-m_pps-bUseDQP) bEncodeDQP = true; -if (!bInsidePicture) +int cuSplitFlag = !(cuData-flags CU::LEAF); +int cuUnsplitFlag = !(cuData-flags CU::SPLIT_MANDATORY); + +if (!cuUnsplitFlag) { -uint32_t xmax = slice-m_sps-picWidthInLumaSamples - cu-getCUPelX(); -uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY(); -uint32_t cuSize = g_maxCUSize depth; - -bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax - g_zscanToPelY[absPartIdx] + cuSize = ymax); - -if (!bInsidePicture) +uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; +for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) { -uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; -for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -{ -if (g_zscanToPelX[absPartIdx] xmax g_zscanToPelY[absPartIdx] ymax) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); -} - -return; +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +int cuPresentFlagChild = !(childCU-flags CU::PRESENT); +if (!cuPresentFlagChild) +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); } +return; } // We need to split, so don't try these modes. -if (bInsidePicture depth g_maxCUDepth) +if (cuSplitFlag) codeSplitFlag(cu, absPartIdx, depth); if (depth cu-getDepth(absPartIdx) depth g_maxCUDepth) @@ -527,7 +521,10 @@ uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); +{ +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); +} return; } diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/entropy.h --- a/source/encoder/entropy.hThu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.hTue Sep 16 11:53:32 2014 +0530 @@ -193,7 +193,7 @@ void encodeBinsEP(uint32_t binValues, int numBins); void encodeBinTrm(uint32_t binValue); -void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP); +void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU *cuData); void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth); void writeOut(); diff -r 7e29b10982d2 -r 74b5192133a5 source/encoder/frameencoder.cpp --- a/source/encoder/frameencoder.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/frameencoder.cpp Tue Sep 16 11:53:32 2014 +0530 @@ -470,6 +470,7 @@ } } +m_tld.cuCoder.loadCTUData(cu); // final coding (bitstream generation) for this CU m_entropyCoder.encodeCTU(cu); @@ -689,6 +690,7 @@ // load current best state from go-on entropy
[x265] [PATCH] analysis: add CU specific details to encodeCU()
# HG changeset patch # User Santhoshini Sekar santhosh...@multicorewareinc.com # Date 1410840429 -19800 # Tue Sep 16 09:37:09 2014 +0530 # Node ID 50505472d3e33b775c70f2f373e1c15d17e47e66 # Parent 7e29b10982d2eb7fd79f581d6f04184522ba analysis: add CU specific details to encodeCU() diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/analysis.cpp Tue Sep 16 09:37:09 2014 +0530 @@ -301,7 +301,6 @@ { if (cu-m_slice-m_pps-bUseDQP) m_bEncodeDQP = true; -loadCTUData(cu); // initialize CU data m_bestCU[0]-initCU(cu-m_pic, cu-getAddr()); diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.cpp --- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.cppTue Sep 16 09:37:09 2014 +0530 @@ -481,14 +481,14 @@ } } -void Entropy::encodeCTU(TComDataCU* cu) +void Entropy::encodeCTU(TComDataCU* cu, CU* cuData) { bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP; -encodeCU(cu, 0, 0, false, bEncodeDQP); +encodeCU(cu, 0, 0, bEncodeDQP, cuData); } /* encode a CU block recursively */ -void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP) +void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU* cuData) { Frame* pic = cu-m_pic; Slice* slice = cu-m_slice; @@ -496,30 +496,24 @@ if (depth = slice-m_pps-maxCuDQPDepth slice-m_pps-bUseDQP) bEncodeDQP = true; -if (!bInsidePicture) +int cuSplitFlag = !(cuData-flags CU::LEAF); +int cuUnsplitFlag = !(cuData-flags CU::SPLIT_MANDATORY); + +if (!cuUnsplitFlag) { -uint32_t xmax = slice-m_sps-picWidthInLumaSamples - cu-getCUPelX(); -uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY(); -uint32_t cuSize = g_maxCUSize depth; - -bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax - g_zscanToPelY[absPartIdx] + cuSize = ymax); - -if (!bInsidePicture) +uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; +for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) { -uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; -for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -{ -if (g_zscanToPelX[absPartIdx] xmax g_zscanToPelY[absPartIdx] ymax) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); -} - -return; +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +int cuPresentFlagChild = !(childCU-flags CU::PRESENT); +if (!cuPresentFlagChild) +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); } +return; } // We need to split, so don't try these modes. -if (bInsidePicture depth g_maxCUDepth) +if (cuSplitFlag) codeSplitFlag(cu, absPartIdx, depth); if (depth cu-getDepth(absPartIdx) depth g_maxCUDepth) @@ -527,7 +521,10 @@ uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); +{ +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); +} return; } diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.h --- a/source/encoder/entropy.h Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.h Tue Sep 16 09:37:09 2014 +0530 @@ -148,7 +148,7 @@ void codeShortTermRefPicSet(RPS* rps); void finishSlice() { encodeBinTrm(1); finish(); dynamic_castBitstream*(m_bitIf)-writeByteAlignment(); } -void encodeCTU(TComDataCU* cu); +void encodeCTU(TComDataCU* cu, CU *cuData); void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx); void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int allowMergeLeft, int allowMergeUp); void codeSaoMerge(uint32_t code) { encodeBin(code, m_contextState[OFF_SAO_MERGE_FLAG_CTX]); } @@ -193,7 +193,7 @@ void encodeBinsEP(uint32_t binValues, int numBins); void encodeBinTrm(uint32_t binValue); -void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP); +void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU *cuData); void finishCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth); void writeOut(); diff -r
Re: [x265] [PATCH] analysis: add CU specific details to encodeCU()
Thanks, looks good. On Tue, Sep 16, 2014 at 9:45 AM, santhosh...@multicorewareinc.com wrote: # HG changeset patch # User Santhoshini Sekar santhosh...@multicorewareinc.com # Date 1410840429 -19800 # Tue Sep 16 09:37:09 2014 +0530 # Node ID 50505472d3e33b775c70f2f373e1c15d17e47e66 # Parent 7e29b10982d2eb7fd79f581d6f04184522ba analysis: add CU specific details to encodeCU() diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/analysis.cpp --- a/source/encoder/analysis.cpp Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/analysis.cpp Tue Sep 16 09:37:09 2014 +0530 @@ -301,7 +301,6 @@ { if (cu-m_slice-m_pps-bUseDQP) m_bEncodeDQP = true; -loadCTUData(cu); // initialize CU data m_bestCU[0]-initCU(cu-m_pic, cu-getAddr()); diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.cpp --- a/source/encoder/entropy.cppThu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.cppTue Sep 16 09:37:09 2014 +0530 @@ -481,14 +481,14 @@ } } -void Entropy::encodeCTU(TComDataCU* cu) +void Entropy::encodeCTU(TComDataCU* cu, CU* cuData) { bool bEncodeDQP = cu-m_slice-m_pps-bUseDQP; -encodeCU(cu, 0, 0, false, bEncodeDQP); +encodeCU(cu, 0, 0, bEncodeDQP, cuData); } /* encode a CU block recursively */ -void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP) +void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bEncodeDQP, CU* cuData) { Frame* pic = cu-m_pic; Slice* slice = cu-m_slice; @@ -496,30 +496,24 @@ if (depth = slice-m_pps-maxCuDQPDepth slice-m_pps-bUseDQP) bEncodeDQP = true; -if (!bInsidePicture) +int cuSplitFlag = !(cuData-flags CU::LEAF); +int cuUnsplitFlag = !(cuData-flags CU::SPLIT_MANDATORY); + +if (!cuUnsplitFlag) { -uint32_t xmax = slice-m_sps-picWidthInLumaSamples - cu-getCUPelX(); -uint32_t ymax = slice-m_sps-picHeightInLumaSamples - cu-getCUPelY(); -uint32_t cuSize = g_maxCUSize depth; - -bInsidePicture = (g_zscanToPelX[absPartIdx] + cuSize = xmax - g_zscanToPelY[absPartIdx] + cuSize = ymax); - -if (!bInsidePicture) +uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; +for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) { -uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; -for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -{ -if (g_zscanToPelX[absPartIdx] xmax g_zscanToPelY[absPartIdx] ymax) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); -} - -return; +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +int cuPresentFlagChild = !(childCU-flags CU::PRESENT); +if (!cuPresentFlagChild) +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); } +return; } // We need to split, so don't try these modes. -if (bInsidePicture depth g_maxCUDepth) +if (cuSplitFlag) codeSplitFlag(cu, absPartIdx, depth); if (depth cu-getDepth(absPartIdx) depth g_maxCUDepth) @@ -527,7 +521,10 @@ uint32_t qNumParts = (pic-getNumPartInCU() (depth 1)) 2; for (uint32_t partUnitIdx = 0; partUnitIdx 4; partUnitIdx++, absPartIdx += qNumParts) -encodeCU(cu, absPartIdx, depth + 1, bInsidePicture, bEncodeDQP); +{ +CU *childCU = cu-m_CULocalData + cuData-childIdx + partUnitIdx; +encodeCU(cu, absPartIdx, depth + 1, bEncodeDQP, childCU); +} return; } diff -r 7e29b10982d2 -r 50505472d3e3 source/encoder/entropy.h --- a/source/encoder/entropy.h Thu Sep 11 19:24:28 2014 +0530 +++ b/source/encoder/entropy.h Tue Sep 16 09:37:09 2014 +0530 @@ -148,7 +148,7 @@ void codeShortTermRefPicSet(RPS* rps); void finishSlice() { encodeBinTrm(1); finish(); dynamic_castBitstream*(m_bitIf)-writeByteAlignment(); } -void encodeCTU(TComDataCU* cu); +void encodeCTU(TComDataCU* cu, CU *cuData); void codeSaoOffset(SaoLcuParam* saoLcuParam, uint32_t compIdx); void codeSaoUnitInterleaving(int compIdx, bool saoFlag, int rx, int ry, SaoLcuParam* saoLcuParam, int cuAddrInSlice, int cuAddrUpInSlice, int allowMergeLeft, int allowMergeUp); void codeSaoMerge(uint32_t code) { encodeBin(code, m_contextState[OFF_SAO_MERGE_FLAG_CTX]); } @@ -193,7 +193,7 @@ void encodeBinsEP(uint32_t binValues, int numBins); void encodeBinTrm(uint32_t binValue); -void encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool bInsidePicture, bool bEncodeDQP); +void