mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:37:35 +00:00
LibVideo: Put motion vector or reference frame pairs in a struct
Since these two types are often passed around as a pair, it's easier to handle them with a simple pair struct, at least for now. Once things are fully being passed around as parameters wherever possible, it may be good to change this type for something more generalized.
This commit is contained in:
parent
6192a33e79
commit
fce7639c90
2 changed files with 49 additions and 15 deletions
33
Userland/Libraries/LibVideo/VP9/Context.h
Normal file
33
Userland/Libraries/LibVideo/VP9/Context.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 "Enums.h"
|
||||
#include "MotionVector.h"
|
||||
|
||||
namespace Video::VP9 {
|
||||
|
||||
template<typename T>
|
||||
struct Pair {
|
||||
T a;
|
||||
T b;
|
||||
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
if (index == 0)
|
||||
return a;
|
||||
if (index == 1)
|
||||
return b;
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
};
|
||||
|
||||
typedef Pair<ReferenceFrameType> ReferenceFramePair;
|
||||
typedef Pair<MotionVector> MotionVectorPair;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue