From 7dcd5ed206f2f4a5c954ba2d852149e637878ba2 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Sun, 25 Sep 2022 03:23:25 -0500 Subject: [PATCH] LibVideo: Make probability tables save to the specified index Previously, saved probability tables were being inserted, causing the Vector to increase in size when it should say fixed at a size of 4. This changes the Vector to an Array which will default-initalize and allow assigning to any index without previously setting size. --- Userland/Libraries/LibVideo/VP9/ProbabilityTables.cpp | 3 ++- Userland/Libraries/LibVideo/VP9/ProbabilityTables.h | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibVideo/VP9/ProbabilityTables.cpp b/Userland/Libraries/LibVideo/VP9/ProbabilityTables.cpp index 365f285ab9..bc8c49a562 100644 --- a/Userland/Libraries/LibVideo/VP9/ProbabilityTables.cpp +++ b/Userland/Libraries/LibVideo/VP9/ProbabilityTables.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Hunter Salyer + * Copyright (c) 2022, Gregory Bertilson * * SPDX-License-Identifier: BSD-2-Clause */ @@ -1172,7 +1173,7 @@ KfUVModeProbs const& ProbabilityTables::kf_uv_mode_prob() const void ProbabilityTables::save_probs(size_t index) { - m_saved_probability_tables.insert(index, m_current_probability_table); + m_saved_probability_tables[index] = m_current_probability_table; } void ProbabilityTables::reset_probs() diff --git a/Userland/Libraries/LibVideo/VP9/ProbabilityTables.h b/Userland/Libraries/LibVideo/VP9/ProbabilityTables.h index ea75018f93..ab91fc4d92 100644 --- a/Userland/Libraries/LibVideo/VP9/ProbabilityTables.h +++ b/Userland/Libraries/LibVideo/VP9/ProbabilityTables.h @@ -1,14 +1,16 @@ /* * Copyright (c) 2021, Hunter Salyer + * Copyright (c) 2022, Gregory Bertilson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once -#include "Symbols.h" +#include #include -#include + +#include "Symbols.h" namespace Video::VP9 { @@ -97,7 +99,7 @@ private: CoefProbs coef_probs; }; - Vector m_saved_probability_tables; + Array m_saved_probability_tables; ProbabilityTable m_current_probability_table; };