# HG changeset patch
# User Shazeb Nawaz Khan <[email protected]>
# Date 1381496334 -19800
# Fri Oct 11 18:28:54 2013 +0530
# Node ID 695be3cbd99cc9136c379049e874dd79c5fdad58
# Parent c6d89dc62e191f56f63dbcb1781a6494da50a70d
Some fixes in applyWeight() function
These wont fix the PSNR drop but are necessary
diff -r c6d89dc62e19 -r 695be3cbd99c source/common/reference.cpp
--- a/source/common/reference.cpp Fri Oct 11 01:47:53 2013 -0500
+++ b/source/common/reference.cpp Fri Oct 11 18:28:54 2013 +0530
@@ -92,7 +92,7 @@
void MotionReference::applyWeight(int rows, int numRows)
{
- rows = X265_MIN(rows, numRows-1);
+ rows = X265_MIN(rows, numRows);
if (m_numWeightedRows >= rows)
return;
int marginX = m_reconPic->m_lumaMarginX;
@@ -101,15 +101,15 @@
pixel* dst = fpelPlane + ((m_numWeightedRows * (int)g_maxCUHeight) *
lumaStride);
int width = m_reconPic->getWidth();
int height = ((rows - m_numWeightedRows) * g_maxCUHeight);
- if (rows == numRows - 1)
+ if (rows == numRows)
height = ((m_reconPic->getHeight() % g_maxCUHeight) ?
(m_reconPic->getHeight() % g_maxCUHeight) : g_maxCUHeight);
size_t dstStride = lumaStride;
// Computing weighted CU rows
int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
- shift = shift + shiftNum;
- round = shift ? (1 << (shift - 1)) : 0;
- primitives.weightpUniPixel(src, dst, lumaStride, dstStride, width, height,
weight, round, shift, offset);
+ int local_shift = shift + shiftNum;
+ int local_round = local_shift ? (1 << (local_shift - 1)) : 0;
+ primitives.weightpUniPixel(src, dst, lumaStride, dstStride, width, height,
weight, local_round, local_shift, offset);
// Extending Left & Right
primitives.extendRowBorder(dst, dstStride, width, height, marginX);
@@ -125,7 +125,7 @@
}
// Extending Bottom
- if (rows == (numRows - 1))
+ if (rows == numRows)
{
pixel *pixY = fpelPlane - marginX + (m_reconPic->getHeight() - 1) *
dstStride;
for (int y = 0; y < marginY; y++)
diff -r c6d89dc62e19 -r 695be3cbd99c source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Fri Oct 11 01:47:53 2013 -0500
+++ b/source/encoder/motion.cpp Fri Oct 11 18:28:54 2013 +0530
@@ -1159,18 +1159,20 @@
int realHeight = blockheight + (dir == 1);
intptr_t realStride = FENC_STRIDE + (dir == 2);
pixel *fref = ref->unweightedFPelPlane + blockOffset + (qmv.x >> 2) +
(qmv.y >> 2) * ref->lumaStride;
-
+ int shiftNum = IF_INTERNAL_PREC - X265_DEPTH;
+ int local_shift = ref->shift + shiftNum;
+ int local_round = local_shift ? (1 << (local_shift - 1)) : 0;
if (ref->isWeighted)
{
if (yFrac == 0)
{
primitives.ipfilter_ps[FILTER_H_P_S_8](fref, ref->lumaStride,
immedVal, realStride, realWidth, realHeight, g_lumaFilter[xFrac]);
- primitives.weightpUni(immedVal, subpelbuf, realStride, realStride,
realWidth, realHeight, ref->weight, ref->round, ref->shift, ref->offset);
+ primitives.weightpUni(immedVal, subpelbuf, realStride, realStride,
realWidth, realHeight, ref->weight, local_round, local_shift, ref->offset);
}
else if (xFrac == 0)
{
primitives.ipfilter_ps[FILTER_V_P_S_8](fref, ref->lumaStride,
immedVal, realStride, realWidth, realHeight, g_lumaFilter[yFrac]);
- primitives.weightpUni(immedVal, subpelbuf, realStride, realStride,
realWidth, realHeight, ref->weight, ref->round, ref->shift, ref->offset);
+ primitives.weightpUni(immedVal, subpelbuf, realStride, realStride,
realWidth, realHeight, ref->weight, local_round, local_shift, ref->offset);
}
else
{
@@ -1178,7 +1180,7 @@
int halfFilterSize = (filterSize >> 1);
primitives.ipfilter_ps[FILTER_H_P_S_8](fref - (halfFilterSize - 1)
* ref->lumaStride, ref->lumaStride, immedVal, realWidth, realWidth, realHeight
+ filterSize - 1, g_lumaFilter[xFrac]);
primitives.ipfilter_ss[FILTER_V_S_S_8](immedVal + (halfFilterSize
- 1) * realWidth, realWidth, immedVal2, realStride, realWidth, realHeight,
g_lumaFilter[yFrac]);
- primitives.weightpUni(immedVal2, subpelbuf, realStride,
realStride, realWidth, realHeight, ref->weight, ref->round, ref->shift,
ref->offset);
+ primitives.weightpUni(immedVal2, subpelbuf, realStride,
realStride, realWidth, realHeight, ref->weight, local_round, local_shift,
ref->offset);
}
}
else
_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel