mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
GetBackwardReferences: fail on alloc error
previously failures in the call to VP8LBackwardReferencesTraceBackwards() would be ignored which, though it wouldn't result in a crash, would produce non-deterministic output Change-Id: Id9890a60883c3270ec75e968506d46eea32b76d4 (cherry picked from commite3cfafaf71
) (cherry picked from commit20ef03ee35
)
This commit is contained in:
parent
d21fa8d4c2
commit
258f74e883
@ -976,15 +976,16 @@ static int GetBackwardReferences(int width, int height,
|
|||||||
const VP8LHashChain* const hash_chain_tmp =
|
const VP8LHashChain* const hash_chain_tmp =
|
||||||
(lz77_types_best[i] == kLZ77Standard) ? hash_chain : &hash_chain_box;
|
(lz77_types_best[i] == kLZ77Standard) ? hash_chain : &hash_chain_box;
|
||||||
const int cache_bits = (i == 1) ? 0 : *cache_bits_best;
|
const int cache_bits = (i == 1) ? 0 : *cache_bits_best;
|
||||||
if (VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits,
|
double bit_cost_trace;
|
||||||
hash_chain_tmp, &refs[i],
|
if (!VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits,
|
||||||
refs_tmp)) {
|
hash_chain_tmp, &refs[i],
|
||||||
double bit_cost_trace;
|
refs_tmp)) {
|
||||||
VP8LHistogramCreate(histo, refs_tmp, cache_bits);
|
goto Error;
|
||||||
bit_cost_trace = VP8LHistogramEstimateBits(histo);
|
}
|
||||||
if (bit_cost_trace < bit_costs_best[i]) {
|
VP8LHistogramCreate(histo, refs_tmp, cache_bits);
|
||||||
BackwardRefsSwap(refs_tmp, &refs[i]);
|
bit_cost_trace = VP8LHistogramEstimateBits(histo);
|
||||||
}
|
if (bit_cost_trace < bit_costs_best[i]) {
|
||||||
|
BackwardRefsSwap(refs_tmp, &refs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user