[x265] [PATCH] improve fillReferenceSamples by reduce condition operators in loop
Min Chen
chenm003 at 163.com
Thu Jun 18 00:14:55 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1434578419 25200
# Node ID cc2dfd5afed2d730cffe4b243b779eb9ef6945b1
# Parent 70e715cf702f8723a14b2b9d541cbcc364ebebab
improve fillReferenceSamples by reduce condition operators in loop
---
source/common/predict.cpp | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
diff -r 70e715cf702f -r cc2dfd5afed2 source/common/predict.cpp
--- a/source/common/predict.cpp Wed Jun 17 15:00:15 2015 -0700
+++ b/source/common/predict.cpp Wed Jun 17 15:00:19 2015 -0700
@@ -776,30 +776,17 @@
// Fill left & below-left samples
adiTemp += picStride;
adi--;
- pNeighborFlags--;
- for (int j = 0; j < leftUnits; j++)
+ // NOTE: over copy here, but reduce condition operators
+ for (int j = 0; j < leftUnits * unitHeight; j++)
{
- if (*pNeighborFlags)
- for (int i = 0; i < unitHeight; i++)
- adi[-i] = adiTemp[i * picStride];
-
- adiTemp += unitHeight * picStride;
- adi -= unitHeight;
- pNeighborFlags--;
+ adi[-j] = adiTemp[j * picStride];
}
// Fill above & above-right samples
adiTemp = adiOrigin - picStride;
adi = adiLineBuffer + (leftUnits * unitHeight) + unitWidth;
- pNeighborFlags = bNeighborFlags + leftUnits + 1;
- for (int j = 0; j < aboveUnits; j++)
- {
- if (*pNeighborFlags)
- memcpy(adi, adiTemp, unitWidth * sizeof(*adiTemp));
- adiTemp += unitWidth;
- adi += unitWidth;
- pNeighborFlags++;
- }
+ // NOTE: over copy here, but reduce condition operators
+ memcpy(adi, adiTemp, aboveUnits * unitWidth * sizeof(*adiTemp));
// Pad reference samples when necessary
int curr = 0;
More information about the x265-devel
mailing list