[x265] [PATCH 3 of 3] compress: clean up

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Tue Dec 17 14:00:17 CET 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1387285108 -19800
# Node ID c14f3ef98f22c77c7ce1c52f9084f64946c3282a
# Parent  0350191d340e87ca1330debfc3a5e28297ee3134
compress: clean up

diff -r 0350191d340e -r c14f3ef98f22 source/encoder/compress.cpp
--- 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 @@
                         }
                     }
                 }
+                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 @@
                 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);


More information about the x265-devel mailing list