mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
Merge "Speedup to HuffmanCostCombinedCount"
This commit is contained in:
commit
2df5bd30a6
@ -1143,24 +1143,18 @@ static VP8LStreaks HuffmanCostCombinedCount(const uint32_t* X,
|
|||||||
const uint32_t* Y, int length) {
|
const uint32_t* Y, int length) {
|
||||||
int i;
|
int i;
|
||||||
int streak = 0;
|
int streak = 0;
|
||||||
|
uint32_t xy_prev = 0xffffffff;
|
||||||
VP8LStreaks stats;
|
VP8LStreaks stats;
|
||||||
memset(&stats, 0, sizeof(stats));
|
memset(&stats, 0, sizeof(stats));
|
||||||
for (i = 0; i < length - 1; ++i) {
|
for (i = 0; i < length; ++i) {
|
||||||
const int xy = X[i] + Y[i];
|
const uint32_t xy = X[i] + Y[i];
|
||||||
const int xy_next = X[i + 1] + Y[i + 1];
|
|
||||||
++streak;
|
++streak;
|
||||||
if (xy == xy_next) {
|
if (xy != xy_prev) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
stats.counts[xy != 0] += (streak > 3);
|
stats.counts[xy != 0] += (streak > 3);
|
||||||
stats.streaks[xy != 0][(streak > 3)] += streak;
|
stats.streaks[xy != 0][(streak > 3)] += streak;
|
||||||
streak = 0;
|
streak = 0;
|
||||||
|
xy_prev = xy;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
const int xy = X[i] + Y[i];
|
|
||||||
++streak;
|
|
||||||
stats.counts[xy != 0] += (streak > 3);
|
|
||||||
stats.streaks[xy != 0][(streak > 3)] += streak;
|
|
||||||
}
|
}
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
@ -245,29 +245,22 @@ static VP8LStreaks HuffmanCostCombinedCount(const uint32_t* X,
|
|||||||
const uint32_t* Y, int length) {
|
const uint32_t* Y, int length) {
|
||||||
int i;
|
int i;
|
||||||
int streak = 0;
|
int streak = 0;
|
||||||
|
uint32_t xy_prev = 0xffffffff;
|
||||||
VP8LStreaks stats;
|
VP8LStreaks stats;
|
||||||
int* const pstreaks = &stats.streaks[0][0];
|
int* const pstreaks = &stats.streaks[0][0];
|
||||||
int* const pcnts = &stats.counts[0];
|
int* const pcnts = &stats.counts[0];
|
||||||
int temp0, temp1, temp2, temp3;
|
int temp0, temp1, temp2, temp3;
|
||||||
memset(&stats, 0, sizeof(stats));
|
memset(&stats, 0, sizeof(stats));
|
||||||
for (i = 0; i < length - 1; ++i) {
|
for (i = 0; i < length; ++i) {
|
||||||
const uint32_t xy = X[i] + Y[i];
|
|
||||||
const uint32_t xy_next = X[i + 1] + Y[i + 1];
|
|
||||||
++streak;
|
|
||||||
if (xy == xy_next) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
temp0 = (xy != 0);
|
|
||||||
HUFFMAN_COST_PASS
|
|
||||||
streak = 0;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const uint32_t xy = X[i] + Y[i];
|
const uint32_t xy = X[i] + Y[i];
|
||||||
++streak;
|
++streak;
|
||||||
temp0 = (xy != 0);
|
if (xy != xy_prev) {
|
||||||
HUFFMAN_COST_PASS
|
temp0 = (xy != 0);
|
||||||
|
HUFFMAN_COST_PASS
|
||||||
|
streak = 0;
|
||||||
|
xy_prev = xy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user