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<T, 4> which will default-initalize and
allow assigning to any index without previously setting size.
This commit is contained in:
Zaggy1024 2022-09-25 03:23:25 -05:00 committed by Andrew Kaster
parent 7d27273dc7
commit 7dcd5ed206
Notes: sideshowbarker 2024-07-17 06:07:19 +09:00
2 changed files with 7 additions and 4 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* 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()

View file

@ -1,14 +1,16 @@
/*
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Symbols.h"
#include <AK/Array.h>
#include <AK/Types.h>
#include <AK/Vector.h>
#include "Symbols.h"
namespace Video::VP9 {
@ -97,7 +99,7 @@ private:
CoefProbs coef_probs;
};
Vector<ProbabilityTable, 4> m_saved_probability_tables;
Array<ProbabilityTable, 4> m_saved_probability_tables;
ProbabilityTable m_current_probability_table;
};