[x265] [PATCH] WeightPrediction: Avoid motion compensation when difPoc is large
Kavitha Sampath
kavitha at multicorewareinc.com
Tue Jan 28 04:56:27 CET 2014
# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1390879943 -19800
# Tue Jan 28 09:02:23 2014 +0530
# Node ID 32a73eb61f9a33103e07173a35c7f723c23a2bd0
# Parent b59b1e579f78b4c29c0c1491e6198a63ba1d597f
WeightPrediction: Avoid motion compensation when difPoc is large
diff -r b59b1e579f78 -r 32a73eb61f9a source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Mon Jan 27 00:10:56 2014 -0600
+++ b/source/encoder/frameencoder.cpp Tue Jan 28 09:02:23 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 b59b1e579f78 -r 32a73eb61f9a source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp Mon Jan 27 00:10:56 2014 -0600
+++ b/source/encoder/weightPrediction.cpp Tue Jan 28 09:02:23 2014 +0530
@@ -188,18 +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);
- m_mvs = fenc->lowresMvs[list][difPoc - 1];
- if (m_mvs)
+ if (difPoc <= m_bframes + 1)
{
- if (m_mvs[0].x == 0x7FFF)
- continue;
- else
+ m_mvs = fenc->lowresMvs[list][difPoc - 1];
+ 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];
@@ -246,7 +248,7 @@
m_mcbuf = ref->fpelPlane;
m_inbuf = fenc->lowresPlane[0];
- if (m_mvs)
+ if (mcFlag)
{
pixel *tempm_buf;
pixel m_buf8[8 * 8];
@@ -256,7 +258,7 @@
{
for (int x = 0; x < m_frmWidth; x += 8, pixoff
+= 8, cu++)
{
- if (fenc->lowresMvCosts[0][difPoc - 1][cu]
> fenc->intraCost[cu])
+ if (m_mvCost[cu] > fenc->intraCost[cu])
{
strd = m_refStride;
tempm_buf = m_inbuf + pixoff;
@@ -280,7 +282,7 @@
m_mcbuf = m_slice->getRefPic(list,
refIdxTemp)->getPicYuvOrg()->getCbAddr();
m_inbuf =
m_slice->getPic()->getPicYuvOrg()->getCbAddr();
m_blockSize = 8;
- if (m_mvs) 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;
- if (m_mvs) mcChroma();
+ if (mcFlag) mcChroma();
break;
}
diff -r b59b1e579f78 -r 32a73eb61f9a source/encoder/weightPrediction.h
--- a/source/encoder/weightPrediction.h Mon Jan 27 00:10:56 2014 -0600
+++ b/source/encoder/weightPrediction.h Tue Jan 28 09:02:23 2014 +0530
@@ -42,10 +42,9 @@
pixel *m_mcbuf, *m_inbuf, *m_buf;
int32_t *m_intraCost;
MV *m_mvs;
-
+ int m_bframes;
public:
-
- WeightPrediction(TComSlice *slice)
+ WeightPrediction(TComSlice *slice, x265_param param)
{
this->m_slice = slice;
m_csp = m_slice->getPic()->getPicYuvOrg()->m_picCsp;
@@ -56,7 +55,7 @@
m_dstStride = m_frmWidth;
m_refStride = m_slice->getPic()->m_lowres.lumaStride;
m_intraCost = m_slice->getPic()->m_lowres.intraCost;
-
+ m_bframes = param.bframes;
m_mcbuf = NULL;
m_inbuf = NULL;
m_buf = (pixel*)X265_MALLOC(pixel, m_frmHeight * m_refStride);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/e1219349/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5912.patch
Type: application/octet-stream
Size: 4624 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140128/e1219349/attachment.obj>
More information about the x265-devel
mailing list