mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
WebP/Lossy: Reduce size of MacroblockMetadata from 80 to 20 bytes
For a 1024x1024 image, saves about a quarter MB of memory use while decoding (compared to the decompressed image data itself needing 4 MiB). Not a huge win, but also very easy to do, so might as well. No behavior change, no measurable performance impact.
This commit is contained in:
parent
4df3b5e1d2
commit
24aa302e88
2 changed files with 3 additions and 3 deletions
|
@ -405,7 +405,7 @@ ErrorOr<u8> tree_decode(BooleanDecoder& decoder, ReadonlySpan<TreeIndex> tree, R
|
|||
struct MacroblockMetadata {
|
||||
// https://datatracker.ietf.org/doc/html/rfc6386#section-10 "Segment-Based Feature Adjustments"
|
||||
// Read only if `update_mb_segmentation_map` is set.
|
||||
int segment_id { 0 }; // 0, 1, 2, or 3. Fits in two bits.
|
||||
u8 segment_id { 0 }; // 0, 1, 2, or 3. Fits in two bits.
|
||||
|
||||
// https://datatracker.ietf.org/doc/html/rfc6386#section-11.1 "mb_skip_coeff"
|
||||
bool skip_coefficients { false };
|
||||
|
|
|
@ -22,7 +22,7 @@ const TreeIndex MACROBLOCK_SEGMENT_TREE[2 * (4 - 1)] = {
|
|||
|
||||
// https://datatracker.ietf.org/doc/html/rfc6386#section-8.2 "Tree Coding Example"
|
||||
// Repeated in https://datatracker.ietf.org/doc/html/rfc6386#section-11.2 "Luma Modes"
|
||||
enum IntraMacroblockMode {
|
||||
enum IntraMacroblockMode : u8 {
|
||||
DC_PRED, /* predict DC using row above and column to the left */
|
||||
V_PRED, /* predict rows using row above */
|
||||
H_PRED, /* predict columns using column to the left */
|
||||
|
@ -45,7 +45,7 @@ static TreeIndex constexpr KEYFRAME_YMODE_TREE[2 * (num_ymodes - 1)] = {
|
|||
static Prob constexpr KEYFRAME_YMODE_PROBABILITIES[num_ymodes - 1] = { 145, 156, 163, 128 };
|
||||
|
||||
// https://datatracker.ietf.org/doc/html/rfc6386#section-11.2 "Luma Modes"
|
||||
enum IntraBlockMode {
|
||||
enum IntraBlockMode : u8 {
|
||||
B_DC_PRED, /* predict DC using row above and column
|
||||
to the left */
|
||||
B_TM_PRED, /* propagate second differences a la
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue