mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
fix the -g/O3 discrepancy for 32bit compile
in debug mode, some float operations see their intermediate values stored in memory rather than staying in the FPU (which is 80bit precision). Several fixes are possible (breaking long calculations into atomic steps for instance), but simpler of all is just about turning the cost[] array into float* instead of double*. The code is a tad faster, and i didn't see any major output size difference. Change-Id: Icf1f833e15f8ee4ecc7f9a521d07fdc96ef711aa
This commit is contained in:
parent
73ba4357fe
commit
a792b913bd
@ -459,8 +459,8 @@ static int BackwardReferencesHashChainDistanceOnly(
|
||||
const int quality = 100;
|
||||
const int pix_count = xsize * ysize;
|
||||
const int use_color_cache = (cache_bits > 0);
|
||||
double* const cost =
|
||||
(double*)WebPSafeMalloc((uint64_t)pix_count, sizeof(*cost));
|
||||
float* const cost =
|
||||
(float*)WebPSafeMalloc((uint64_t)pix_count, sizeof(*cost));
|
||||
CostModel* cost_model = (CostModel*)malloc(sizeof(*cost_model));
|
||||
HashChain* hash_chain = (HashChain*)malloc(sizeof(*hash_chain));
|
||||
VP8LColorCache hashers;
|
||||
@ -481,7 +481,7 @@ static int BackwardReferencesHashChainDistanceOnly(
|
||||
goto Error;
|
||||
}
|
||||
|
||||
for (i = 0; i < pix_count; ++i) cost[i] = 1e100;
|
||||
for (i = 0; i < pix_count; ++i) cost[i] = 1e38f;
|
||||
|
||||
// We loop one pixel at a time, but store all currently best points to
|
||||
// non-processed locations from this point.
|
||||
@ -509,10 +509,9 @@ static int BackwardReferencesHashChainDistanceOnly(
|
||||
prev_cost + GetDistanceCost(cost_model, code);
|
||||
int k;
|
||||
for (k = 1; k < len; ++k) {
|
||||
const double cost_val =
|
||||
distance_cost + GetLengthCost(cost_model, k);
|
||||
const double cost_val = distance_cost + GetLengthCost(cost_model, k);
|
||||
if (cost[i + k] > cost_val) {
|
||||
cost[i + k] = cost_val;
|
||||
cost[i + k] = (float)cost_val;
|
||||
dist_array[i + k] = k + 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user