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:
parent
7d27273dc7
commit
7dcd5ed206
Notes:
sideshowbarker
2024-07-17 06:07:19 +09:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/SerenityOS/serenity/commit/7dcd5ed206 Pull-request: https://github.com/SerenityOS/serenity/pull/15363 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/FireFox317 Reviewed-by: https://github.com/MacDue Reviewed-by: https://github.com/davidot
2 changed files with 7 additions and 4 deletions
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue