changeset 5771:c1802fef73b4

compress: clean up
author Deepthi Devaki <deepthidevaki@multicorewareinc.com>
date Tue, 17 Dec 2013 18:28:28 +0530
parents 06ea3901bf35
children f766e7c3b165
files source/encoder/compress.cpp
diffstat 1 files changed, 65 insertions(+-), 65 deletions(-) [+]
line wrap: on
line diff
--- a/source/encoder/compress.cpp	Tue Dec 17 18:19:22 2013 +0530
+++ b/source/encoder/compress.cpp	Tue Dec 17 18:28:28 2013 +0530
@@ -541,6 +541,71 @@ void TEncCu::xCompressInterCU(TComDataCU
                         }
                     }
                 }
+                if (m_cfg->param.rdLevel <= 2)
+                {
+                    if (outBestCU->getPredictionMode(0) == MODE_INTER)
+                    {
+                        int numPart = outBestCU->getNumPartInter();
+                        for (int partIdx = 0; partIdx < numPart; partIdx++)
+                        {
+                            m_search->motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
+                        }
+
+                        if (m_cfg->param.rdLevel == 2)
+                        {
+                            m_search->encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
+                                                                m_bestResiYuv[depth], m_bestRecoYuv[depth], false);
+                        }
+                        else if (m_cfg->param.rdLevel == 1)
+                        {
+                            m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getWidth(0));
+                            m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
+                        }
+                        else if (m_cfg->param.rdLevel == 0)
+                        {
+                            m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
+                        }
+                    }
+                    else
+                    {
+                        if (m_cfg->param.rdLevel == 2)
+                            xEncodeIntraInInter(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],  m_bestRecoYuv[depth]);
+                        else if (m_cfg->param.rdLevel == 1)
+                        {
+                            m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
+                        }
+                        else if (m_cfg->param.rdLevel == 0)
+                        {
+                            m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
+                        }
+                    }
+                    //Check Merge-skip
+                    if (m_cfg->param.rdLevel <= 2)
+                    {
+                        if (!(outBestCU->getPredictionMode(0) == MODE_INTER && outBestCU->getPartitionSize(0) == SIZE_2Nx2N && outBestCU->getMergeFlag(0)))
+                        {
+                            int numPart = m_mergeCU[depth]->getNumPartInter();
+                            for (int partIdx = 0; partIdx < numPart; partIdx++)
+                            {
+                                m_search->motionCompensation(m_mergeCU[depth], bestMergePred, REF_PIC_LIST_X, partIdx, false, true);
+                            }
+                        }
+                        m_search->encodeResAndCalcRdInterCU(m_mergeCU[depth], m_origYuv[depth], bestMergePred, m_tmpResiYuv[depth],
+                                                            m_bestResiYuv[depth], m_tmpRecoYuv[depth], true);
+
+                        if (m_mergeCU[depth]->m_totalCost < outBestCU->m_totalCost)
+                        {
+                            outBestCU = m_mergeCU[depth];
+                            tempYuv = m_bestRecoYuv[depth];
+                            m_bestRecoYuv[depth] = m_tmpRecoYuv[depth];
+                            m_tmpRecoYuv[depth] = tempYuv;
+                            if (bestMergePred != m_bestPredYuv[depth])
+                            {
+                                bestMergePred->copyPartToPartYuv(m_bestPredYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0));
+                            }
+                        }
+                    }
+                }
             }
             else
             {
@@ -553,71 +618,6 @@ void TEncCu::xCompressInterCU(TComDataCU
                 m_bestRecoYuv[depth] = m_bestMergeRecoYuv[depth];
                 m_bestMergeRecoYuv[depth] = tempYuv;
             }
-            if (m_cfg->param.rdLevel <= 2 && !earlyskip)
-            {
-                if (outBestCU->getPredictionMode(0) == MODE_INTER)
-                {
-                    int numPart = outBestCU->getNumPartInter();
-                    for (int partIdx = 0; partIdx < numPart; partIdx++)
-                    {
-                        m_search->motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
-                    }
-
-                    if (m_cfg->param.rdLevel == 2)
-                    {
-                        m_search->encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
-                                                            m_bestResiYuv[depth], m_bestRecoYuv[depth], false);
-                    }
-                    else if (m_cfg->param.rdLevel == 1)
-                    {
-                        m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getWidth(0));
-                        m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
-                    }
-                    else if (m_cfg->param.rdLevel == 0)
-                    {
-                        m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
-                    }
-                }
-                else
-                {
-                    if (m_cfg->param.rdLevel == 2)
-                        xEncodeIntraInInter(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],  m_bestRecoYuv[depth]);
-                    else if (m_cfg->param.rdLevel == 1)
-                    {
-                        m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
-                    }
-                    else if (m_cfg->param.rdLevel == 0)
-                    {
-                        m_origYuv[depth]->copyPartToPartYuv(m_bestRecoYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0), true, true);
-                    }
-                }
-                //Check Merge-skip
-                if (m_cfg->param.rdLevel <= 2)
-                {
-                    if (!(outBestCU->getPredictionMode(0) == MODE_INTER && outBestCU->getPartitionSize(0) == SIZE_2Nx2N && outBestCU->getMergeFlag(0)))
-                    {
-                        int numPart = m_mergeCU[depth]->getNumPartInter();
-                        for (int partIdx = 0; partIdx < numPart; partIdx++)
-                        {
-                            m_search->motionCompensation(m_mergeCU[depth], bestMergePred, REF_PIC_LIST_X, partIdx, false, true);
-                        }
-                    }
-                    m_search->encodeResAndCalcRdInterCU(m_mergeCU[depth], m_origYuv[depth], bestMergePred, m_tmpResiYuv[depth],
-                                                        m_bestResiYuv[depth], m_tmpRecoYuv[depth], true);
-
-                    if (m_mergeCU[depth]->m_totalCost < outBestCU->m_totalCost)
-                    {
-                        outBestCU = m_mergeCU[depth];
-                        tempYuv = m_bestRecoYuv[depth];
-                        m_bestRecoYuv[depth] = m_tmpRecoYuv[depth];
-                        m_tmpRecoYuv[depth] = tempYuv;
-                        if (bestMergePred != m_bestPredYuv[depth])
-                        {
-                            bestMergePred->copyPartToPartYuv(m_bestPredYuv[depth], 0, outBestCU->getWidth(0), outBestCU->getHeight(0));
-                        }
-                    }
-                }
-            }
 
             if (m_cfg->param.rdLevel > 0) //checkDQP can be done only after residual encoding is done
                 xCheckDQP(outBestCU);