simplify the Histogram struct, to only store max_value and last_nz

we don't need to store the whole distribution in order to compute the alpha

Later, we can incorporate the max_value / last_non_zero bookkeeping
in SSE2 directly.

Change-Id: I748ccea4ac17965d7afcab91845ef01be3aa3e15
This commit is contained in:
Pascal Massimino
2014-12-10 10:44:57 +01:00
parent 37e395fd1c
commit bad775715a
6 changed files with 59 additions and 33 deletions

View File

@ -59,6 +59,7 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred,
VP8Histogram* const histo) {
const __m128i max_coeff_thresh = _mm_set1_epi16(MAX_COEFF_THRESH);
int j;
int distribution[MAX_COEFF_THRESH + 1] = { 0 };
for (j = start_block; j < end_block; ++j) {
int16_t out[16];
int k;
@ -91,9 +92,10 @@ static void CollectHistogram(const uint8_t* ref, const uint8_t* pred,
// Convert coefficients to bin.
for (k = 0; k < 16; ++k) {
histo->distribution[out[k]]++;
++distribution[out[k]];
}
}
VP8LSetHistogramData(distribution, histo);
}
//------------------------------------------------------------------------------