summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo/VP9/LookupTables.h
diff options
context:
space:
mode:
authorZaggy1024 <zaggy1024@gmail.com>2023-02-02 23:32:12 -0600
committerJelle Raaijmakers <jelle@gmta.nl>2023-02-03 09:10:14 +0100
commit0f45153bbb5b0f0c8a4b9d891a0dce0537ee76c6 (patch)
tree04ac5a0120ea0c0eb7154ab1bd071d521f89430f /Userland/Libraries/LibVideo/VP9/LookupTables.h
parent7b92eff4a6b85398407ebc1c3ecac94cdaf975a6 (diff)
downloadserenity-0f45153bbb5b0f0c8a4b9d891a0dce0537ee76c6.zip
LibVideo/VP9: Use proper indices for updating inter_mode probabilities
I previously changed it to use the absolute inter-prediction mode values instead of the ones relative to NearestMv. That caused the probability adaption to take invalid indices from the counts and broke certain videos. Now it will just convert to the PredictionMode enum when returning from parse_inter_mode, which allows us to still use it the same as before.
Diffstat (limited to 'Userland/Libraries/LibVideo/VP9/LookupTables.h')
-rw-r--r--Userland/Libraries/LibVideo/VP9/LookupTables.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/Userland/Libraries/LibVideo/VP9/LookupTables.h b/Userland/Libraries/LibVideo/VP9/LookupTables.h
index 67c58e334b..0756719465 100644
--- a/Userland/Libraries/LibVideo/VP9/LookupTables.h
+++ b/Userland/Libraries/LibVideo/VP9/LookupTables.h
@@ -132,10 +132,14 @@ static constexpr int tx_size_16_tree[4] = {
-Transform_8x8, -Transform_16x16
};
static constexpr int tx_size_8_tree[2] = { -Transform_4x4, -Transform_8x8 };
+inline constexpr int inter_mode(PredictionMode mode)
+{
+ return to_underlying(mode) - to_underlying(PredictionMode::NearestMv);
+}
static constexpr int inter_mode_tree[6] = {
- -to_underlying(PredictionMode::ZeroMv), 2,
- -to_underlying(PredictionMode::NearestMv), 4,
- -to_underlying(PredictionMode::NearMv), -to_underlying(PredictionMode::NewMv)
+ -inter_mode(PredictionMode::ZeroMv), 2,
+ -inter_mode(PredictionMode::NearestMv), 4,
+ -inter_mode(PredictionMode::NearMv), -inter_mode(PredictionMode::NewMv)
};
static constexpr int interp_filter_tree[4] = {
-EightTap, 2,