/src/vvdec/source/Lib/CommonLib/PicListManager.h
Line | Count | Source |
1 | | /* ----------------------------------------------------------------------------- |
2 | | The copyright in this software is being made available under the Clear BSD |
3 | | License, included below. No patent rights, trademark rights and/or |
4 | | other Intellectual Property Rights other than the copyrights concerning |
5 | | the Software are granted under this license. |
6 | | |
7 | | The Clear BSD License |
8 | | |
9 | | Copyright (c) 2018-2026, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. & The VVdeC Authors. |
10 | | All rights reserved. |
11 | | |
12 | | Redistribution and use in source and binary forms, with or without modification, |
13 | | are permitted (subject to the limitations in the disclaimer below) provided that |
14 | | the following conditions are met: |
15 | | |
16 | | * Redistributions of source code must retain the above copyright notice, |
17 | | this list of conditions and the following disclaimer. |
18 | | |
19 | | * Redistributions in binary form must reproduce the above copyright |
20 | | notice, this list of conditions and the following disclaimer in the |
21 | | documentation and/or other materials provided with the distribution. |
22 | | |
23 | | * Neither the name of the copyright holder nor the names of its |
24 | | contributors may be used to endorse or promote products derived from this |
25 | | software without specific prior written permission. |
26 | | |
27 | | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY |
28 | | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
29 | | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
31 | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
32 | | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
33 | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
34 | | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
35 | | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
36 | | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
37 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | | POSSIBILITY OF SUCH DAMAGE. |
39 | | |
40 | | |
41 | | ------------------------------------------------------------------------------------------- */ |
42 | | |
43 | | #pragma once |
44 | | |
45 | | #include "Unit.h" |
46 | | #include "Picture.h" |
47 | | |
48 | | #include <unordered_set> |
49 | | |
50 | | namespace vvdec |
51 | | { |
52 | | |
53 | | struct Picture; |
54 | | class Slice; |
55 | | class SPS; |
56 | | class PPS; |
57 | | class VPS; |
58 | | class ReferencePictureList; |
59 | | |
60 | | class PicListManager |
61 | | { |
62 | | private: |
63 | | PicList m_cPicList; // Dynamic buffer |
64 | | int m_parseFrameDelay = -1; |
65 | | int m_parallelDecInst = 1; |
66 | | UserAllocator m_userAllocator; |
67 | | int m_tuneInDelay = 0; |
68 | | bool m_firstOutputPic = true; |
69 | | std::unordered_set<const Picture*> m_allRefPics; |
70 | | |
71 | | public: |
72 | 0 | PicListManager() = default; |
73 | 0 | ~PicListManager() { deleteBuffers(); } |
74 | | |
75 | | void create( int frameDelay, int decInstances, const UserAllocator& userAllocator ); |
76 | | void restart() |
77 | 0 | { |
78 | 0 | m_firstOutputPic = true; |
79 | 0 | m_tuneInDelay = 0; |
80 | 0 | } |
81 | | |
82 | 0 | const Picture* getFrontPic() const { return m_cPicList.empty() ? nullptr : m_cPicList.front(); } |
83 | 0 | const Picture* getBackPic() const { return m_cPicList.empty() ? nullptr : m_cPicList.back(); } |
84 | | Picture* getNewPicBuffer( const SPS& sps, const PPS& pps, const uint32_t temporalLayer, const int layerId, const VPS* vps ); |
85 | | void deleteBuffers(); |
86 | | void markUnusedPicturesReusable(); |
87 | | Picture* findClosestPic( int iLostPoc ); |
88 | | Picture* getNextOutputPic( uint32_t numReorderPicsHighestTid, uint32_t maxDecPicBufferingHighestTid, bool bFlush ); |
89 | | void releasePicture( Picture* pic ); |
90 | | }; |
91 | | } |