[x265] [PATCH] WeightPrediction: Avoid motion compensation when difPoc is large
Kavitha Sampath
kavitha at multicorewareinc.com
Tue Jan 28 07:48:12 CET 2014
# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1390891330 -19800
# Tue Jan 28 12:12:10 2014 +0530
# Node ID 7abfa3ed39001e591c2def68eb05e4282f7e9414
# Parent 3c2441447f2a26fbe087ed9b420fc3fd087163c3
WeightPrediction: Avoid motion compensation when difPoc is large
diff -r 3c2441447f2a -r 7abfa3ed3900 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Mon Jan 27 14:17:25 2014 -0600
+++ b/source/encoder/frameencoder.cpp Tue Jan 28 12:12:10 2014 +0530
@@ -465,7 +465,7 @@
//------------------------------------------------------------------------------
// Weighted Prediction implemented at Slice level. SliceMode=2 is
not supported yet.
//------------------------------------------------------------------------------
- WeightPrediction wp(slice);
+ WeightPrediction wp(slice, m_cfg->param);
wp.weightAnalyseEnc();
}
diff -r 3c2441447f2a -r 7abfa3ed3900 source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp Mon Jan 27 14:17:25 2014 -0600
+++ b/source/encoder/weightPrediction.cpp Tue Jan 28 12:12:10 2014 +0530
@@ -188,20 +188,20 @@
{
for (int refIdxTemp = 0; (refIdxTemp <
m_slice->getNumRefIdx(list)) && (numWeighted < 8); refIdxTemp++)
{
+ bool mcFlag = false;
check = 0;
fw = m_wp[list][refIdxTemp];
ref = &m_slice->getRefPic(list, refIdxTemp)->m_lowres;
refPoc = m_slice->getRefPic(list, refIdxTemp)->getPOC();
difPoc = abs(curPoc - refPoc);
- if (difPoc > m_bframes + 1)
- continue;
- else
+ if (difPoc <= m_bframes + 1)
{
m_mvs = fenc->lowresMvs[list][difPoc - 1];
- if (m_mvs[0].x == 0x7FFF)
- continue;
- else
+ if (m_mvs[0].x != 0x7FFF)
+ {
m_mvCost = fenc->lowresMvCosts[0][difPoc - 1];
+ mcFlag = true;
+ }
}
const float epsilon = 1.f / 128.f;
float guessScale[3], fencMean[3], refMean[3];
@@ -245,42 +245,44 @@
switch (yuv)
{
case 0:
- {
+
m_mcbuf = ref->fpelPlane;
m_inbuf = fenc->lowresPlane[0];
- pixel *tempm_buf;
- pixel m_buf8[8 * 8];
- int pixoff = 0, cu = 0;
- intptr_t strd;
- for (int y = 0; y < m_frmHeight; y += 8, pixoff = y *
m_refStride)
+ if (mcFlag)
{
- for (int x = 0; x < m_frmWidth; x += 8, pixoff +=
8, cu++)
+ pixel *tempm_buf;
+ pixel m_buf8[8 * 8];
+ int pixoff = 0, cu = 0;
+ intptr_t strd;
+ for (int y = 0; y < m_frmHeight; y += 8, pixoff =
y * m_refStride)
{
- if (m_mvCost[cu] > fenc->intraCost[cu])
+ for (int x = 0; x < m_frmWidth; x += 8, pixoff
+= 8, cu++)
{
- strd = m_refStride;
- tempm_buf = m_inbuf + pixoff;
+ if (m_mvCost[cu] > fenc->intraCost[cu])
+ {
+ strd = m_refStride;
+ tempm_buf = m_inbuf + pixoff;
+ }
+ else
+ {
+ strd = 8;
+ tempm_buf = ref->lowresMC(pixoff,
m_mvs[cu], m_buf8, strd);
+ ic++;
+ }
+ primitives.blockcpy_pp(8, 8, m_buf + (y *
m_refStride) + x, m_refStride, tempm_buf, strd);
}
- else
- {
- strd = 8;
- tempm_buf = ref->lowresMC(pixoff,
m_mvs[cu], m_buf8, strd);
- ic++;
- }
- primitives.blockcpy_pp(8, 8, m_buf + (y *
m_refStride) + x, m_refStride, tempm_buf, strd);
}
+
+ m_mcbuf = m_buf;
}
-
- m_mcbuf = m_buf;
break;
- }
case 1:
m_mcbuf = m_slice->getRefPic(list,
refIdxTemp)->getPicYuvOrg()->getCbAddr();
m_inbuf =
m_slice->getPic()->getPicYuvOrg()->getCbAddr();
m_blockSize = 8;
- mcChroma();
+ if (mcFlag) mcChroma();
break;
case 2:
@@ -288,7 +290,7 @@
m_mcbuf = m_slice->getRefPic(list,
refIdxTemp)->getPicYuvOrg()->getCrAddr();
m_inbuf =
m_slice->getPic()->getPicYuvOrg()->getCrAddr();
m_blockSize = 8;
- mcChroma();
+ if (mcFlag) mcChroma();
break;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/6eb40ae3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: weightPrediction.patch
Type: application/octet-stream
Size: 5434 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/6eb40ae3/attachment-0001.obj>
More information about the x265-devel
mailing list