1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

LibVideo/VP9: Pre-calculate inter-frames' reference frame scale factors

Changing the calculation of reference frame scale factors to be done on
a per-frame basis reduces the amount of work done in
`predict_inter_block()`, which is a big hotspot in most videos.

This reduces decode times in a test video from YouTube by about 5%
(~37.2s -> ~35.4s).
This commit is contained in:
Zaggy1024 2023-04-13 13:31:48 -05:00 committed by Tim Flynn
parent 5cd5edc3bd
commit bc49af08b4
4 changed files with 88 additions and 43 deletions

View file

@ -265,7 +265,13 @@ struct ReferenceFrame {
u8 bit_depth { 0 };
Array<Vector<u16>, 3> frame_planes {};
bool is_valid() { return bit_depth > 0; }
bool is_valid() const { return bit_depth > 0; }
// These values are set at the start of each inter frame to be used during prediction.
i32 x_scale { 0 };
i32 y_scale { 0 };
i32 scaled_step_x { 0 };
i32 scaled_step_y { 0 };
};
}