mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03:00
LibGfx/JBIG2: Make compute_context() a function pointer
...instead of a lambda that checks the template on every call. Doesn't make a performance difference locally, but seems maybe nicer? No behavior change.
This commit is contained in:
parent
828c640087
commit
c4a45bb521
Notes:
sideshowbarker
2024-07-17 10:08:28 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/c4a45bb521 Pull-request: https://github.com/SerenityOS/serenity/pull/23695
@ -964,16 +964,17 @@ static ErrorOr<NonnullOwnPtr<BitBuffer>> generic_region_decoding_procedure(Gener
|
||||
return result;
|
||||
};
|
||||
|
||||
auto compute_context = [&inputs, &compute_context_0, &compute_context_1, &compute_context_2, &compute_context_3](NonnullOwnPtr<BitBuffer> const& buffer, int x, int y) -> u16 {
|
||||
u16 (*compute_context)(NonnullOwnPtr<BitBuffer> const&, int, int);
|
||||
if (inputs.gb_template == 0)
|
||||
return compute_context_0(buffer, x, y);
|
||||
if (inputs.gb_template == 1)
|
||||
return compute_context_1(buffer, x, y);
|
||||
if (inputs.gb_template == 2)
|
||||
return compute_context_2(buffer, x, y);
|
||||
compute_context = compute_context_0;
|
||||
else if (inputs.gb_template == 1)
|
||||
compute_context = compute_context_1;
|
||||
else if (inputs.gb_template == 2)
|
||||
compute_context = compute_context_2;
|
||||
else {
|
||||
VERIFY(inputs.gb_template == 3);
|
||||
return compute_context_3(buffer, x, y);
|
||||
};
|
||||
compute_context = compute_context_3;
|
||||
}
|
||||
|
||||
// "The values of the pixels in this neighbourhood define a context. Each context has its own adaptive probability estimate
|
||||
// used by the arithmetic coder (see Annex E)."
|
||||
|
Loading…
Reference in New Issue
Block a user