[x265] [PATCH] WeightPrediction: check difPoc <= bframes+1 to allow weight analysis for valid references
kavitha at multicorewareinc.com
kavitha at multicorewareinc.com
Fri Jan 24 06:40:25 CET 2014
# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1390540541 -19800
# Fri Jan 24 10:45:41 2014 +0530
# Branch stable
# Node ID 2a6a1ffd137843960262949ba0eaf93cc4eb5749
# Parent 9497c55d7be248569b3eb606b985bfba6013882f
WeightPrediction: check difPoc <= bframes+1 to allow weight analysis for valid references
diff -r 9497c55d7be2 -r 2a6a1ffd1378 source/encoder/weightPrediction.cpp
--- a/source/encoder/weightPrediction.cpp Wed Jan 22 14:33:03 2014 +0530
+++ b/source/encoder/weightPrediction.cpp Fri Jan 24 10:45:41 2014 +0530
@@ -195,9 +195,11 @@
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)
+ continue;
+ else
{
+ m_mvs = fenc->lowresMvs[list][difPoc - 1];
if (m_mvs[0].x == 0x7FFF)
continue;
else
@@ -245,44 +247,42 @@
switch (yuv)
{
case 0:
-
+ {
m_mcbuf = ref->fpelPlane;
m_inbuf = fenc->lowresPlane[0];
- if (m_mvs)
+ 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)
{
- 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)
+ for (int x = 0; x < m_frmWidth; x += 8, pixoff += 8, cu++)
{
- for (int x = 0; x < m_frmWidth; x += 8, pixoff += 8, cu++)
+ if (m_mvCost[cu] > fenc->intraCost[cu])
{
- if (fenc->lowresMvCosts[0][difPoc - 1][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);
+ 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);
}
+ }
- 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;
- if (m_mvs) mcChroma();
+ mcChroma();
break;
case 2:
@@ -290,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();
+ mcChroma();
break;
}
diff -r 9497c55d7be2 -r 2a6a1ffd1378 source/encoder/weightPrediction.h
--- a/source/encoder/weightPrediction.h Wed Jan 22 14:33:03 2014 +0530
+++ b/source/encoder/weightPrediction.h Fri Jan 24 10:45:41 2014 +0530
@@ -42,10 +42,11 @@
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,6 +57,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;
More information about the x265-devel
mailing list