1 /*
2 * Copyright (c) 2020-2021, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file     decode_vp8_reference_frames.h
24 //! \brief    Defines reference list related logic for vp8 decode
25 //!
26 #ifndef __DECODE_VP8_REFERENCE_FRAMES_H__
27 #define __DECODE_VP8_REFERENCE_FRAMES_H__
28 
29 #include "codec_def_decode_vp8.h"
30 #include "mhw_vdbox.h"
31 #include "decode_allocator.h"
32 #include "decode_vp8_basic_feature.h"
33 
34 namespace decode
35 {
36 class Vp8BasicFeature;
37 
38 class Vp8ReferenceFrames
39 {
40 public:
41     //!
42     //! \brief  Vp8ReferenceFrames constructor
43     //!
44     Vp8ReferenceFrames();
45 
46     //!
47     //! \brief  Vp8ReferenceFrames deconstructor
48     //!
49     ~Vp8ReferenceFrames();
50 
51     //!
52     //! \brief  Init Vp8 reference frames
53     //! \param  [in] basicFeature
54     //!         Pointer to Vp8 basic feature
55     //! \return  MOS_STATUS
56     //!         MOS_STATUS_SUCCESS if success, else fail reason
57     //!
58     MOS_STATUS Init(Vp8BasicFeature *basicFeature, DecodeAllocator& allocator);
59 
60     //!
61     //! \brief  Update reference frames for picture
62     //! \param  [in] picParams
63     //!         Picture parameters
64     //! \return  MOS_STATUS
65     //!         MOS_STATUS_SUCCESS if success, else fail reason
66     //!
67     MOS_STATUS UpdatePicture(CODEC_VP8_PIC_PARAMS &picParams);
68 
69 
70     PCODEC_REF_LIST m_vp8RefList[CODECHAL_NUM_UNCOMPRESSED_SURFACE_VP8];  //!< Pointer to reference list
71     PCODEC_REF_LIST m_currRefList = nullptr;                              //!< Current frame reference list
72 
73   protected:
74     //!
75     //! \brief  Update the current frame entry on m_refList
76     //! \param  [in] picParams
77     //!         Picture parameters
78     //! \return  MOS_STATUS
79     //!         MOS_STATUS_SUCCESS if success, else fail reason
80     //!
81     MOS_STATUS UpdateCurFrame(const CODEC_VP8_PIC_PARAMS &picParams);
82 
83     Vp8BasicFeature *m_basicFeature = nullptr;  //!< vp8 basic feature
84     DecodeAllocator *m_allocator    = nullptr;  //!< Decode allocator
85     std::vector<uint8_t> m_activeReferenceList; //!< Active reference list of current picture
86 
87   MEDIA_CLASS_DEFINE_END(decode__Vp8ReferenceFrames)
88 };
89 
90 }  // namespace decode
91 
92 #endif  // !__DECODE_VP8_REFERENCE_FRAMES_H__
93