mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibGfx/JBIG2: Pass Context to get_next_bit() instead of to initialize()
The context can vary for every bit we read. This does not affect the one use in the test which reuses the same context for all bits, but it is necessary for future changes.
This commit is contained in:
@@ -368,13 +368,13 @@ TEST_CASE(test_jbig2_arithmetic_decoder)
|
||||
|
||||
// "For this entire test, a single value of CX is used. I(CX) is initially 0 and MPS(CX) is initially 0."
|
||||
Gfx::JBIG2::ArithmeticDecoder::Context context { 0, 0 };
|
||||
auto decoder = MUST(Gfx::JBIG2::ArithmeticDecoder::initialize(input, context));
|
||||
auto decoder = MUST(Gfx::JBIG2::ArithmeticDecoder::initialize(input));
|
||||
|
||||
for (auto expected : output) {
|
||||
u8 actual = 0;
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
actual <<= 1;
|
||||
actual |= static_cast<u8>(decoder.get_next_bit());
|
||||
actual |= static_cast<u8>(decoder.get_next_bit(context));
|
||||
}
|
||||
EXPECT_EQ(actual, expected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user