<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"MS ゴシック";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"MS ゴシック";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"MS Pゴシック";
panose-1:2 11 6 0 7 2 5 8 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@MS ゴシック";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"\@MS Pゴシック";
panose-1:2 11 6 0 7 2 5 8 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0mm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"MS Pゴシック";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.hoenzb
{mso-style-name:hoenzb;}
span.18
{mso-style-type:personal-reply;
font-family:"Arial","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Arial","sans-serif";}
@page WordSection1
{size:612.0pt 792.0pt;
margin:99.25pt 30.0mm 30.0mm 30.0mm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026">
<v:textbox inset="5.85pt,.7pt,5.85pt,.7pt" />
</o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=JA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Deepthi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>I can’t reproduce that.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>residualQTIntrachroma() is not called.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>Satoshi</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0mm 0mm 0mm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0mm 0mm 0mm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> x265-devel [mailto:x265-devel-bounces@videolan.org] <b>On Behalf Of </b>Deepthi Nandakumar<br><b>Sent:</b> Friday, May 09, 2014 5:01 PM<br><b>To:</b> Development for x265<br><b>Subject:</b> Re: [x265] fix: residualQTIntrachroma() for 4:2:2<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>Satoshi,<br><br>We received a regression test report on this patch. There was an output mismatch between --asm=true and --asm=false. This could be due to either of the 2 reasons below.<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>1. A real code issue, due to C-asm differences<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>2. An inconsistent output, multiple runs cause the output to change. <o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>vc11-x86_64-16bpp-Release<br> input clip:CrowdRun_1920x1080_50_10bit_422.yuv<o:p></o:p></span></p><div id=":16o"><p class=MsoNormal><span lang=EN-US> CLI: --preset superfast --input-csp i422 --weightp --input-depth 10 --input-res 1920x1080 --fps 50 --input --hash 1<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>Can you please take a look at this?<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US>Thanks,<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US>Deepthi<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><o:p> </o:p></span></p><div><p class=MsoNormal><span lang=EN-US>On Tue, May 6, 2014 at 12:41 AM, Steve Borho <<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>> wrote:<o:p></o:p></span></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>On Mon, May 5, 2014 at 9:56 AM, Satoshi Nakagawa <<a href="mailto:nakagawa424@oki.com">nakagawa424@oki.com</a>> wrote:<br>> # HG changeset patch<br>> # User Satoshi Nakagawa <<a href="mailto:nakagawa424@oki.com">nakagawa424@oki.com</a>><br>> # Date 1399301165 -32400<br>> # Mon May 05 23:46:05 2014 +0900<br>> # Node ID d46ae184365e85997b0ab1a64a608a0cb7997b6d<br>> # Parent dcf74ea39e3157ff1e66331db56f03edd5f9b810<br>> fix: residualQTIntrachroma() for 4:2:2<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US>Thanks Satoshi.<br><br>We're in the middle of refactoring our test setup so we can actually<br>figure out whether a patch has unintended consequences prior to it<br>getting pushed to default. This patch and your other recent patch are<br>queued to be the first to be tested this way, together. So there will<br>probably be a lag of a day or two before they get pushed.<o:p></o:p></span></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><br>> diff -r dcf74ea39e31 -r d46ae184365e source/Lib/TLibEncoder/TEncEntropy.cpp<br>> --- a/source/Lib/TLibEncoder/TEncEntropy.cpp Sat May 03 15:08:24 2014 -0500<br>> +++ b/source/Lib/TLibEncoder/TEncEntropy.cpp Mon May 05 23:46:05 2014 +0900<br>> @@ -367,13 +367,14 @@<br>> m_entropyCoderIf->codeCoeffNxN(cu, (cu->getCoeffY() + offsetLuma), absPartIdx, width, depth, TEXT_LUMA);<br>> }<br>><br>> - if ((log2TrafoSize == 2) && !(cu->getChromaFormat() == CHROMA_444))<br>> + int chFmt = cu->getChromaFormat();<br>> + if ((log2TrafoSize == 2) && !(chFmt == CHROMA_444))<br>> {<br>> uint32_t partNum = cu->getPic()->getNumPartInCU() >> ((depth - 1) << 1);<br>> if ((absPartIdx % partNum) == (partNum - 1))<br>> {<br>> uint32_t trWidthC = log2TrafoSize << 1;<br>> - const bool splitIntoSubTUs = (cu->getChromaFormat() == CHROMA_422) ? true : false;<br>> + const bool splitIntoSubTUs = (chFmt == CHROMA_422);<br>><br>> uint32_t curPartNum = cu->getPic()->getNumPartInCU() >> ((depth - 1) << 1);<br>><br>> @@ -399,7 +400,7 @@<br>> {<br>> uint32_t trWidthC = width >> hChromaShift;<br>> uint32_t trHeightC = height >> vChromaShift;<br>> - const bool splitIntoSubTUs = trWidthC != trHeightC;<br>> + const bool splitIntoSubTUs = (chFmt == CHROMA_422);<br>> trHeightC = splitIntoSubTUs ? trHeightC >> 1 : trHeightC;<br>> uint32_t curPartNum = cu->getPic()->getNumPartInCU() >> (depth << 1);<br>> for (uint32_t chromaId = TEXT_CHROMA; chromaId < MAX_NUM_COMPONENT; chromaId++)<br>> @@ -439,11 +440,12 @@<br>> if (cu->isIntra(absPartIdx)) // If it is Intra mode, encode intra prediction mode.<br>> {<br>> encodeIntraDirModeLuma(cu, absPartIdx, true);<br>> - if (cu->getChromaFormat() != CHROMA_400)<br>> + int chFmt = cu->getChromaFormat();<br>> + if (chFmt != CHROMA_400)<br>> {<br>> encodeIntraDirModeChroma(cu, absPartIdx);<br>><br>> - if ((cu->getChromaFormat() == CHROMA_444) && (cu->getPartitionSize(absPartIdx) == SIZE_NxN))<br>> + if ((chFmt == CHROMA_444) && (cu->getPartitionSize(absPartIdx) == SIZE_NxN))<br>> {<br>> uint32_t partOffset = (cu->getPic()->getNumPartInCU() >> (cu->getDepth(absPartIdx) << 1)) >> 2;<br>> encodeIntraDirModeChroma(cu, absPartIdx + partOffset);<br>> diff -r dcf74ea39e31 -r d46ae184365e source/Lib/TLibEncoder/TEncSearch.cpp<br>> --- a/source/Lib/TLibEncoder/TEncSearch.cpp Sat May 03 15:08:24 2014 -0500<br>> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp Mon May 05 23:46:05 2014 +0900<br>> @@ -168,7 +168,6 @@<br>> uint32_t trMode = cu->getTransformIdx(absPartIdx);<br>> uint32_t subdiv = (trMode > trDepth ? 1 : 0);<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - fullDepth;<br>> - int chFmt = cu->getChromaFormat();<br>><br>> if (cu->getPredictionMode(0) == MODE_INTRA && cu->getPartitionSize(0) == SIZE_NxN && trDepth == 0)<br>> {<br>> @@ -197,6 +196,7 @@<br>><br>> if (bChroma)<br>> {<br>> + int chFmt = cu->getChromaFormat();<br>> if ((trSizeLog2 > 2) && !(chFmt == CHROMA_444))<br>> {<br>> if (trDepth == 0 || cu->getCbf(absPartIdx, TEXT_CHROMA_U, trDepth - 1))<br>> @@ -235,9 +235,6 @@<br>> uint32_t fullDepth = cu->getDepth(0) + trDepth;<br>> uint32_t trMode = cu->getTransformIdx(absPartIdx);<br>> uint32_t subdiv = (trMode > trDepth ? 1 : 0);<br>> - uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - fullDepth;<br>> - uint32_t chroma = (ttype != TEXT_LUMA ? 1 : 0);<br>> - int chFmt = cu->getChromaFormat();<br>><br>> if (subdiv)<br>> {<br>> @@ -250,6 +247,8 @@<br>> return;<br>> }<br>><br>> + uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize()] + 2 - fullDepth;<br>> + int chFmt = cu->getChromaFormat();<br>> if ((ttype != TEXT_LUMA) && (trSizeLog2 == 2) && !(chFmt == CHROMA_444))<br>> {<br>> assert(trDepth > 0);<br>> @@ -263,6 +262,7 @@<br>> }<br>><br>> //===== coefficients =====<br>> + uint32_t chroma = (ttype != TEXT_LUMA ? 1 : 0);<br>> int cspx = chroma ? m_hChromaShift : 0;<br>> int cspy = chroma ? m_vChromaShift : 0;<br>> uint32_t width = cu->getCUSize(0) >> (trDepth + cspx);<br>> @@ -409,7 +409,6 @@<br>> pixel* fenc = fencYuv->getLumaAddr(absPartIdx);<br>> pixel* pred = predYuv->getLumaAddr(absPartIdx);<br>> int16_t* residual = resiYuv->getLumaAddr(absPartIdx);<br>> - int chFmt = cu->getChromaFormat();<br>> int part = partitionFromSizes(width, height);<br>><br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> @@ -453,6 +452,7 @@<br>> int lastPos = -1;<br>> cu->setTrIdxSubParts(trDepth, absPartIdx, fullDepth);<br>><br>> + int chFmt = cu->getChromaFormat();<br>> m_trQuant->setQPforQuant(cu->getQP(0), TEXT_LUMA, QP_BD_OFFSET, 0, chFmt);<br>> m_trQuant->selectLambda(TEXT_LUMA);<br>><br>> @@ -515,7 +515,7 @@<br>><br>> TextType ttype = (chromaId == 1) ? TEXT_CHROMA_U : TEXT_CHROMA_V;<br>> uint32_t width = cu->getCUSize(absPartIdx) >> (trDepth + m_hChromaShift);<br>> - uint32_t height = cu->getCUSize(absPartIdx) >> (trDepth + m_vChromaShift);<br>> + uint32_t height = width;<br>> uint32_t stride = fencYuv->getCStride();<br>> pixel* fenc = (chromaId == 1) ? fencYuv->getCbAddr(absPartIdx) : fencYuv->getCrAddr(absPartIdx);<br>> pixel* pred = (chromaId == 1) ? predYuv->getCbAddr(absPartIdx) : predYuv->getCrAddr(absPartIdx);<br>> @@ -530,7 +530,6 @@<br>> pixel* reconIPred = (chromaId == 1) ? cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder) : cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder);<br>> uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();<br>> bool useTransformSkipChroma = cu->getTransformSkip(absPartIdx, ttype);<br>> - height = (width != height) ? height >> 1 : height;<br>> int part = partitionFromSizes(width, height);<br>><br>> if (!bReusePred)<br>> @@ -546,7 +545,6 @@<br>> uint32_t lumaLCUIdx = (chFmt == CHROMA_444) ? absPartIdx : absPartIdx & (~((1 << (2 * g_addCUDepth)) - 1));<br>> chromaPredMode = cu->getLumaIntraDir(lumaLCUIdx);<br>> }<br>> -<br>> chromaPredMode = (chFmt == CHROMA_422) ? g_chroma422IntraAngleMappingTable[chromaPredMode] : chromaPredMode;<br>> //===== get prediction signal =====<br>> predIntraChromaAng(chromaPred, chromaPredMode, pred, stride, width, height, chFmt);<br>> @@ -1033,15 +1031,16 @@<br>> {<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;<br>> + int chFmt = cu->getChromaFormat();<br>><br>> bool bChromaSame = false;<br>> - if (trSizeLog2 == 2 && !(cu->getChromaFormat() == CHROMA_444))<br>> + if (trSizeLog2 == 2 && !(chFmt == CHROMA_444))<br>> {<br>> assert(trDepth > 0);<br>> trDepth--;<br>> uint32_t qpdiv = cu->getPic()->getNumPartInCU() >> ((cu->getDepth(0) + trDepth) << 1);<br>> bool bFirstQ = ((absPartIdx % qpdiv) == 0);<br>> - bool bSecondQ = (cu->getChromaFormat() == CHROMA_422) ? ((absPartIdx % qpdiv) == 2) : false;<br>> + bool bSecondQ = (chFmt == CHROMA_422) ? ((absPartIdx % qpdiv) == 2) : false;<br>> if ((!bFirstQ) && (!bSecondQ))<br>> {<br>> return;<br>> @@ -1082,15 +1081,16 @@<br>> {<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;<br>> + int chFmt = cu->getChromaFormat();<br>><br>> bool bChromaSame = false;<br>> - if (trSizeLog2 == 2 && !(cu->getChromaFormat() == CHROMA_444))<br>> + if (trSizeLog2 == 2 && !(chFmt == CHROMA_444))<br>> {<br>> assert(trDepth > 0);<br>> trDepth--;<br>> uint32_t qpdiv = cu->getPic()->getNumPartInCU() >> ((cu->getDepth(0) + trDepth) << 1);<br>> bool bFirstQ = ((absPartIdx % qpdiv) == 0);<br>> - bool bSecondQ = (cu->getChromaFormat() == CHROMA_422) ? ((absPartIdx % qpdiv) == 2) : false;<br>> + bool bSecondQ = (chFmt == CHROMA_422) ? ((absPartIdx % qpdiv) == 2) : false;<br>> if ((!bFirstQ) && (!bSecondQ))<br>> {<br>> return;<br>> @@ -1192,11 +1192,11 @@<br>><br>> if (trMode == trDepth)<br>> {<br>> + int chFmt = cu->getChromaFormat();<br>> bool checkTransformSkip = cu->getSlice()->getPPS()->getUseTransformSkip();<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> -<br>> uint32_t actualTrDepth = trDepth;<br>> - if ((trSizeLog2 == 2) && !(cu->getChromaFormat() == CHROMA_444))<br>> + if ((trSizeLog2 == 2) && !(chFmt == CHROMA_444))<br>> {<br>> assert(trDepth > 0);<br>> actualTrDepth--;<br>> @@ -1208,11 +1208,10 @@<br>> }<br>> }<br>><br>> - uint32_t width = cu->getCUSize(0) >> (actualTrDepth + m_hChromaShift);<br>> - uint32_t height = cu->getCUSize(0) >> (actualTrDepth + m_vChromaShift);<br>> - const bool splitIntoSubTUs = width != height;<br>> -<br>> - checkTransformSkip &= (width <= 4);<br>> + uint32_t tuSize = cu->getCUSize(0) >> (actualTrDepth + m_hChromaShift);<br>> + const bool splitIntoSubTUs = (chFmt == CHROMA_422);<br>> +<br>> + checkTransformSkip &= (tuSize <= 4);<br>><br>> if (m_cfg->param->bEnableTSkipFast)<br>> {<br>> @@ -1349,10 +1348,10 @@<br>> {<br>> uint32_t fullDepth = cu->getDepth(0) + trDepth;<br>> uint32_t trMode = cu->getTransformIdx(absPartIdx);<br>> - int chFmt = cu->getChromaFormat();<br>><br>> if (trMode == trDepth)<br>> {<br>> + int chFmt = cu->getChromaFormat();<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;<br>><br>> @@ -1406,13 +1405,14 @@<br>> {<br>> uint32_t fullDepth = cu->getDepth(0) + trDepth;<br>> uint32_t trMode = cu->getTransformIdx(absPartIdx);<br>> - int chFmt = cu->getChromaFormat();<br>><br>> if (trMode == trDepth)<br>> {<br>> + int chFmt = cu->getChromaFormat();<br>> uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> fullDepth] + 2;<br>> + uint32_t origTrDepth = trDepth;<br>> uint32_t actualTrDepth = trDepth;<br>> - if (trSizeLog2 == 2)<br>> + if ((trSizeLog2 == 2) && !(chFmt == CHROMA_444))<br>> {<br>> assert(trDepth > 0);<br>> actualTrDepth--;<br>> @@ -1424,88 +1424,108 @@<br>> }<br>> }<br>><br>> - cu->setTransformSkipSubParts(0, TEXT_CHROMA_U, absPartIdx, cu->getDepth(0) + actualTrDepth);<br>> - cu->setTransformSkipSubParts(0, TEXT_CHROMA_V, absPartIdx, cu->getDepth(0) + actualTrDepth);<br>> - uint32_t width = cu->getCUSize(0) >> (trDepth + m_hChromaShift);<br>> - uint32_t height = cu->getCUSize(0) >> (trDepth + m_vChromaShift);<br>> - uint32_t stride = fencYuv->getCStride();<br>> -<br>> - for (uint32_t chromaId = 0; chromaId < 2; chromaId++)<br>> + uint32_t width = cu->getCUSize(0) >> (actualTrDepth + m_hChromaShift);<br>> + uint32_t height = width;<br>> + uint32_t stride = fencYuv->getCStride();<br>> + const bool splitIntoSubTUs = (chFmt == CHROMA_422);<br>> +<br>> + for (int chromaId = TEXT_CHROMA; chromaId < MAX_NUM_COMPONENT; chromaId++)<br>> {<br>> - TextType ttype = (chromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U);<br>> - uint32_t chromaPredMode = cu->getChromaIntraDir(absPartIdx);<br>> - pixel* fenc = (chromaId > 0 ? fencYuv->getCrAddr(absPartIdx) : fencYuv->getCbAddr(absPartIdx));<br>> - pixel* pred = (chromaId > 0 ? predYuv->getCrAddr(absPartIdx) : predYuv->getCbAddr(absPartIdx));<br>> - int16_t* residual = (chromaId > 0 ? resiYuv->getCrAddr(absPartIdx) : resiYuv->getCbAddr(absPartIdx));<br>> - pixel* recon = (chromaId > 0 ? reconYuv->getCrAddr(absPartIdx) : reconYuv->getCbAddr(absPartIdx));<br>> - uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> 2;<br>> - coeff_t* coeff = (chromaId > 0 ? cu->getCoeffCr() : cu->getCoeffCb()) + numCoeffPerInc * absPartIdx;<br>> -<br>> - uint32_t zorder = cu->getZorderIdxInCU() + absPartIdx;<br>> - pixel* reconIPred = (chromaId > 0 ? cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder) : cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder));<br>> - uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();<br>> - bool useTransformSkipChroma = cu->getTransformSkip(absPartIdx, ttype);<br>> - //===== update chroma mode =====<br>> - if (chromaPredMode == DM_CHROMA_IDX)<br>> + TComTURecurse tuIterator;<br>> + uint32_t curPartNum = cu->getPic()->getNumPartInCU() >> ((cu->getDepth(0) + actualTrDepth) << 1);<br>> + initSection(&tuIterator, splitIntoSubTUs ? VERTICAL_SPLIT : DONT_SPLIT, curPartNum, absPartIdx);<br>> +<br>> + do<br>> {<br>> - chromaPredMode = cu->getLumaIntraDir(0);<br>> + uint32_t absTUPartIdxC = tuIterator.m_absPartIdxTURelCU;<br>> + cu->setTransformSkipPartRange(0, (TextType)chromaId, absTUPartIdxC, tuIterator.m_absPartIdxStep);<br>> +<br>> + TextType ttype = (chromaId == 1) ? TEXT_CHROMA_U : TEXT_CHROMA_V;<br>> + pixel* fenc = (chromaId == 1) ? fencYuv->getCbAddr(absTUPartIdxC) : fencYuv->getCrAddr(absTUPartIdxC);<br>> + pixel* pred = (chromaId == 1) ? predYuv->getCbAddr(absTUPartIdxC) : predYuv->getCrAddr(absTUPartIdxC);<br>> + int16_t* residual = (chromaId == 1) ? resiYuv->getCbAddr(absTUPartIdxC) : resiYuv->getCrAddr(absTUPartIdxC);<br>> + pixel* recon = (chromaId == 1) ? reconYuv->getCbAddr(absTUPartIdxC) : reconYuv->getCrAddr(absTUPartIdxC);<br>> + uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> (m_hChromaShift + m_vChromaShift);<br>> + coeff_t* coeff = (chromaId == 1 ? cu->getCoeffCb() : cu->getCoeffCr()) + numCoeffPerInc * absTUPartIdxC;<br>> + uint32_t zorder = cu->getZorderIdxInCU() + absTUPartIdxC;<br>> + pixel* reconIPred = (chromaId == 1) ? cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder) : cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder);<br>> + uint32_t reconIPredStride = cu->getPic()->getPicYuvRec()->getCStride();<br>> + //bool useTransformSkipChroma = cu->getTransformSkip(absTUPartIdxC, ttype);<br>> + const bool useTransformSkipChroma = false;<br>> +<br>> + uint32_t chromaPredMode = cu->getChromaIntraDir(absTUPartIdxC);<br>> + //===== update chroma mode =====<br>> + if (chromaPredMode == DM_CHROMA_IDX)<br>> + {<br>> + uint32_t lumaLCUIdx = (chFmt == CHROMA_444) ? absTUPartIdxC : absTUPartIdxC & (~((1 << (2 * g_addCUDepth)) - 1));<br>> + chromaPredMode = cu->getLumaIntraDir(lumaLCUIdx);<br>> + }<br>> + chromaPredMode = (chFmt == CHROMA_422) ? g_chroma422IntraAngleMappingTable[chromaPredMode] : chromaPredMode;<br>> + //===== init availability pattern =====<br>> + TComPattern::initAdiPatternChroma(cu, absTUPartIdxC, actualTrDepth, m_predBuf, m_predBufStride, m_predBufHeight, chromaId);<br>> + pixel* chromaPred = TComPattern::getAdiChromaBuf(chromaId, height, m_predBuf);<br>> +<br>> + //===== get prediction signal =====<br>> + predIntraChromaAng(chromaPred, chromaPredMode, pred, stride, width, height, chFmt);<br>> +<br>> + //===== get residual signal =====<br>> + assert(!((uint32_t)(size_t)fenc & (width - 1)));<br>> + assert(!((uint32_t)(size_t)pred & (width - 1)));<br>> + assert(!((uint32_t)(size_t)residual & (width - 1)));<br>> + int size = g_convertToBit[width];<br>> + primitives.calcresidual[size](fenc, pred, residual, stride);<br>> +<br>> + //--- transform and quantization ---<br>> + uint32_t absSum = 0;<br>> + int lastPos = -1;<br>> +<br>> + int curChromaQpOffset;<br>> + if (ttype == TEXT_CHROMA_U)<br>> + {<br>> + curChromaQpOffset = cu->getSlice()->getPPS()->getChromaCbQpOffset() + cu->getSlice()->getSliceQpDeltaCb();<br>> + }<br>> + else<br>> + {<br>> + curChromaQpOffset = cu->getSlice()->getPPS()->getChromaCrQpOffset() + cu->getSlice()->getSliceQpDeltaCr();<br>> + }<br>> + m_trQuant->setQPforQuant(cu->getQP(0), TEXT_CHROMA, cu->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset, chFmt);<br>> +<br>> + m_trQuant->selectLambda(TEXT_CHROMA);<br>> +<br>> + absSum = m_trQuant->transformNxN(cu, residual, stride, coeff, width, ttype, absTUPartIdxC, &lastPos, useTransformSkipChroma);<br>> +<br>> + //--- set coded block flag ---<br>> + cu->setCbfPartRange((((absSum > 0) ? 1 : 0) << origTrDepth), ttype, absTUPartIdxC, tuIterator.m_absPartIdxStep);<br>> +<br>> + //--- inverse transform ---<br>> + if (absSum)<br>> + {<br>> + int scalingListType = 0 + ttype;<br>> + assert(scalingListType < 6);<br>> + m_trQuant->invtransformNxN(cu->getCUTransquantBypass(absTUPartIdxC), REG_DCT, residual, stride, coeff, width, scalingListType, useTransformSkipChroma, lastPos);<br>> + }<br>> + else<br>> + {<br>> + int16_t* resiTmp = residual;<br>> + memset(coeff, 0, sizeof(coeff_t) * width * height);<br>> + primitives.blockfill_s[size](resiTmp, stride, 0);<br>> + }<br>> +<br>> + //===== reconstruction =====<br>> + assert(((intptr_t)residual & (width - 1)) == 0);<br>> + assert(width <= 32);<br>> +<br>> + // use square primitive<br>> + int part = partitionFromSizes(width, width);<br>> + primitives.chroma[CHROMA_444].add_ps[part](recon, stride, pred, residual, stride, stride);<br>> + primitives.chroma[CHROMA_444].copy_pp[part](reconIPred, reconIPredStride, recon, stride);<br>> }<br>> - //===== init availability pattern =====<br>> - TComPattern::initAdiPatternChroma(cu, absPartIdx, trDepth, m_predBuf, m_predBufStride, m_predBufHeight, chromaId + 1);<br>> - pixel* chromaPred = TComPattern::getAdiChromaBuf(chromaId + 1, height, m_predBuf);<br>> -<br>> - //===== get prediction signal =====<br>> - predIntraChromaAng(chromaPred, chromaPredMode, pred, stride, width, height, chFmt);<br>> -<br>> - //===== get residual signal =====<br>> - assert(!((uint32_t)(size_t)fenc & (width - 1)));<br>> - assert(!((uint32_t)(size_t)pred & (width - 1)));<br>> - assert(!((uint32_t)(size_t)residual & (width - 1)));<br>> - int size = g_convertToBit[width];<br>> - primitives.calcresidual[size](fenc, pred, residual, stride);<br>> -<br>> - //--- transform and quantization ---<br>> - uint32_t absSum = 0;<br>> - int lastPos = -1;<br>> -<br>> - int curChromaQpOffset;<br>> - if (ttype == TEXT_CHROMA_U)<br>> + while (isNextSection(&tuIterator));<br>> +<br>> + if (splitIntoSubTUs)<br>> {<br>> - curChromaQpOffset = cu->getSlice()->getPPS()->getChromaCbQpOffset() + cu->getSlice()->getSliceQpDeltaCb();<br>> + offsetSubTUCBFs(cu, (TextType)chromaId, trDepth, absPartIdx);<br>> }<br>> - else<br>> - {<br>> - curChromaQpOffset = cu->getSlice()->getPPS()->getChromaCrQpOffset() + cu->getSlice()->getSliceQpDeltaCr();<br>> - }<br>> - m_trQuant->setQPforQuant(cu->getQP(0), TEXT_CHROMA, cu->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset, chFmt);<br>> -<br>> - m_trQuant->selectLambda(TEXT_CHROMA);<br>> -<br>> - absSum = m_trQuant->transformNxN(cu, residual, stride, coeff, width, ttype, absPartIdx, &lastPos, useTransformSkipChroma);<br>> -<br>> - //--- set coded block flag ---<br>> - cu->setCbfSubParts((absSum ? 1 : 0) << trDepth, ttype, absPartIdx, cu->getDepth(0) + trDepth);<br>> -<br>> - //--- inverse transform ---<br>> - if (absSum)<br>> - {<br>> - int scalingListType = 0 + ttype;<br>> - assert(scalingListType < 6);<br>> - m_trQuant->invtransformNxN(cu->getCUTransquantBypass(absPartIdx), REG_DCT, residual, stride, coeff, width, scalingListType, useTransformSkipChroma, lastPos);<br>> - }<br>> - else<br>> - {<br>> - int16_t* resiTmp = residual;<br>> - memset(coeff, 0, sizeof(coeff_t) * width * height);<br>> - primitives.blockfill_s[size](resiTmp, stride, 0);<br>> - }<br>> -<br>> - //===== reconstruction =====<br>> - assert(((uint32_t)(size_t)residual & (width - 1)) == 0);<br>> - assert(width <= 32);<br>> - int part = partitionFromSizes(cu->getCUSize(0) >> (trDepth), cu->getCUSize(0) >> (trDepth));<br>> - primitives.chroma[m_cfg->param->internalCsp].add_ps[part](recon, stride, pred, residual, stride, stride);<br>> - primitives.chroma[m_cfg->param->internalCsp].copy_pp[part](reconIPred, reconIPredStride, recon, stride);<br>> }<br>> }<br>> else<br>> @@ -3060,7 +3080,7 @@<br>> trWidth = trHeight = 1 << trSizeLog2;<br>> trWidthC = 1 << trSizeCLog2;<br>> trHeightC = (chFmt == CHROMA_422) ? (trWidthC << 1) : trWidthC;<br>> - const bool splitIntoSubTUs = trWidthC != trHeightC;<br>> + const bool splitIntoSubTUs = (chFmt == CHROMA_422);<br>> uint32_t absPartIdxStep = cu->getPic()->getNumPartInCU() >> ((cu->getDepth(0) + trModeC) << 1);<br>><br>> // code full block<br>> @@ -3898,12 +3918,12 @@<br>> void TEncSearch::xSetResidualQTData(TComDataCU* cu, uint32_t absPartIdx, uint32_t absTUPartIdx, ShortYuv* resiYuv, uint32_t depth, bool bSpatial)<br>> {<br>> assert(cu->getDepth(0) == cu->getDepth(absPartIdx));<br>> - int chFmt = cu->getChromaFormat();<br>> const uint32_t curTrMode = depth - cu->getDepth(0);<br>> const uint32_t trMode = cu->getTransformIdx(absPartIdx);<br>><br>> if (curTrMode == trMode)<br>> {<br>> + int chFmt = cu->getChromaFormat();<br>> const uint32_t trSizeLog2 = g_convertToBit[cu->getSlice()->getSPS()->getMaxCUSize() >> depth] + 2;<br>> uint32_t trSizeCLog2 = trSizeLog2 - m_hChromaShift;<br>> const uint32_t qtlayer = cu->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - trSizeLog2;<br>> diff -r dcf74ea39e31 -r d46ae184365e source/encoder/compress.cpp<br>> --- a/source/encoder/compress.cpp Sat May 03 15:08:24 2014 -0500<br>> +++ b/source/encoder/compress.cpp Mon May 05 23:46:05 2014 +0900<br>> @@ -498,10 +498,7 @@<br>> if (outBestCU->getSlice()->getSliceType() == P_SLICE)<br>> {<br>> /*compute intra cost */<br>> -<br>> - // TODO: residualQTIntrachroma is broken for 4:2:2<br>> - bool bdoIntra = (m_param->internalCsp != X265_CSP_I422);<br>> - // bool bdoIntra = true;<br>> + bool bdoIntra = true;<br>><br>> if (m_param->rdLevel > 2)<br>> {<br>> _______________________________________________<br>> x265-devel mailing list<br>> <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>> <a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br><br><br><o:p></o:p></span></p></div></div><p class=MsoNormal><span class=hoenzb><span lang=EN-US style='color:#888888'>--</span></span><span lang=EN-US style='color:#888888'><br><span class=hoenzb>Steve Borho</span></span><span lang=EN-US><o:p></o:p></span></p><div><div><p class=MsoNormal><span lang=EN-US>_______________________________________________<br>x265-devel mailing list<br><a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br><a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><o:p></o:p></span></p></div></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></div></div></body></html>