[x265] [PATCH] Bug fix
nvijay.anand at trispacetech.com
nvijay.anand at trispacetech.com
Sat Jul 30 06:20:27 CEST 2016
# HG changeset patch
# User N Vijay Anand <nvijay.anand at trispacetech.com>
# Date 1469852339 -19800
# Sat Jul 30 09:48:59 2016 +0530
# Node ID 72f16a34946f5f03da875c67a75124dfec1b4ecb
# Parent a19731cbbd224ca642de1a9b8e5159a12fdf5fbf
Bug fix.
Coding convention.
diff -r a19731cbbd22 -r 72f16a34946f source/encoder/motion.cpp
--- a/source/encoder/motion.cpp Thu Jul 28 15:34:41 2016 +0530
+++ b/source/encoder/motion.cpp Sat Jul 30 09:48:59 2016 +0530
@@ -3,6 +3,7 @@
*
* Authors: Steve Borho <steve at borho.org>
* Min Chen <chenm003 at 163.com>
+ * N Vijay Anand <nvijay.anand at trispacetech.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -99,15 +100,17 @@
}
+#define MAX_NUM_BESTVECTORS (4)
+
inline void PushToBMVStack(MV *bStack, MV & bv, int *bCostStack, int bcost)
{
- for (int i=0; i<4; i++)
+ for (int i=0; i<MAX_NUM_BESTVECTORS; i++)
{
if((bCostStack[i] == bcost) && (bv == bStack[i]))
break;
if((bCostStack[i] > bcost) && (bv != bStack[i]))
{
- for (int j=3; j>i; j--)
+ for (int j=MAX_NUM_BESTVECTORS-1; j>i; j--)
{
bStack[j] = bStack[j-1];
bCostStack[j] = bCostStack[j-1];
@@ -655,10 +658,13 @@
/* re-measure full pel rounded MVP with SAD as search start point */
MV bmv = pmv.roundToFPel();
MV bmvStack[4] = {bmv, bmv, bmv, bmv};
- int bmvCostStack[4] = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff};
+ int bmvCostStack[4] = {bprecost, 0x7fffffff, 0x7fffffff, 0x7fffffff};
int bcost = bprecost;
if (pmv.isSubpel())
+ {
bcost = sad(fenc, FENC_STRIDE, fref + bmv.x + bmv.y * stride, stride) + mvcost(bmv << 2);
+ bmvCostStack[0] = bcost;
+ }
// measure SAD cost at MV(0) if MVP is not zero
if (pmv.notZero())
@@ -668,6 +674,8 @@
{
bcost = cost;
bmv = 0;
+ bmvStack[0] = bmv;
+ bmvCostStack[0] = bcost;
}
}
@@ -1147,6 +1155,7 @@
{
bmv = bestpre;
bcost = bprecost;
+ PushToBMVStack(bmvStack, bmv, bmvCostStack, bcost);
}
else
{
@@ -1168,7 +1177,7 @@
else if (ref->isLowres)
{
int bdir = 0;
- for (int nBmv=0; nBmv<4; nBmv++)
+ for (int nBmv=0; nBmv<MAX_NUM_BESTVECTORS; nBmv++)
{
bdir = 0;
bmv = bmvStack[nBmv];
@@ -1199,7 +1208,7 @@
bmv = bmvStack[0];
bcost = bmvCostStack[0];
- for (int i=1; i<4; i++)
+ for (int i=1; i<MAX_NUM_BESTVECTORS; i++)
{
if (bmvCostStack[i]<bcost)
{
@@ -1212,7 +1221,7 @@
{
pixelcmp_t hpelcomp;
- for (int nBmv=0; nBmv<4; nBmv++)
+ for (int nBmv=0; nBmv<MAX_NUM_BESTVECTORS; nBmv++)
{
bmv = bmvStack[nBmv];
@@ -1266,7 +1275,7 @@
bmv = bmvStack[0];
bcost = bmvCostStack[0];
- for (int i=1; i<4; i++)
+ for (int i=1; i<MAX_NUM_BESTVECTORS; i++)
{
if (bmvCostStack[i]<bcost)
{
More information about the x265-devel
mailing list