Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/shared/decode_input_bitstream.h

raw
1 /*
2 * Copyright (c) 2019, 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_input_bitstream.h
24 //! \brief Defines the common interface for decode input bitstream
25 //! \details Defines the interface to handle the decode input bitstream in
26 //! both single execution call mode and multiple excution call mode.
27 //!
28
29 #ifndef __DECODE_INPUT_BITSTREAM_H__
30 #define __DECODE_INPUT_BITSTREAM_H__
31
32 #include "decode_packet_id.h"
33 #include "decode_resource_array.h"
34 #include "decode_sub_pipeline.h"
35 #include "codec_def_decode.h"
36 #include "media_feature_manager.h"
37 #include "decode_basic_feature.h"
38 #include "decode_huc_copy_packet_itf.h"
39 #include "decode_status_report.h"
40
41 namespace decode {
42
43 class DecodeInputBitstream : public DecodeSubPipeline
44 {
45 public:
46 struct Segment
47 {
48 MOS_RESOURCE resource;
49 uint32_t offset = 0;
50 uint32_t size = 0;
51 };
52
53 //!
54 //! \brief Decode input bitstream constructor
55 //!
56 DecodeInputBitstream(DecodePipeline* pipeline, MediaTask* task, uint8_t numVdbox);
57
58 //!
59 //! \brief Decode input bitstream destructor
60 //!
61 virtual ~DecodeInputBitstream();
62
63 //!
64 //! \brief Initialize the bitstream context
65 //!
66 //! \param [in] settings
67 //! Reference to the Codechal settings
68 //! \return MOS_STATUS
69 //! MOS_STATUS_SUCCESS if success, else fail reason
70 //!
71 virtual MOS_STATUS Init(CodechalSetting& settings) override;
72
73 //!
74 //! \brief Prepare interal parameters
75 //! \param [in] params
76 //! Reference to decode pipeline parameters
77 //! \return MOS_STATUS
78 //! MOS_STATUS_SUCCESS if success, else fail reason
79 //!
80 virtual MOS_STATUS Prepare(DecodePipelineParams& params) override;
81
82 //!
83 //! \brief
84 //! \param [in] Check it the input bitstream is complete
85 //! bitstream size
86 //! \return bool
87 //! Ture if input bitstream is complete, else return false
88 //!
89 virtual bool IsComplete();
90
91 //!
92 //! \brief Get media function for context switch
93 //! \return MediaFunction
94 //! Return the media function
95 //!
96 MediaFunction GetMediaFunction() override;
97
98 protected:
99 //!
100 //! \brief Reset the bitstream context for each frame
101 //! \return MOS_STATUS
102 //! MOS_STATUS_SUCCESS if success, else fail reason
103 //!
104 MOS_STATUS Begin();
105
106 //!
107 //! \brief Append the new bits
108 //! \param [in] decodeParams
109 //! Decode parameters
110 //! \return MOS_STATUS
111 //! MOS_STATUS_SUCCESS if success, else fail reason
112 //!
113 virtual MOS_STATUS Append(const CodechalDecodeParams &decodeParams);
114
115 //!
116 //! \brief Add new segment to segment list
117 //! \param [in] resource
118 //! Resource of current segment
119 //! \param [in] offset
120 //! Offset of current segment
121 //! \param [in] size
122 //! Size of current segment
123 //! \return MOS_STATUS
124 //! MOS_STATUS_SUCCESS if success, else fail reason
125 //!
126 void AddNewSegment(MOS_RESOURCE& resource, uint32_t offset, uint32_t size);
127
128 //!
129 //! \brief Initialize scalability parameters
130 //!
131 virtual void InitScalabilityPars(PMOS_INTERFACE osInterface) override;
132
133 //!
134 //! \brief Allocate catenated bitstream buffer
135 //! \return MOS_STATUS
136 //! MOS_STATUS_SUCCESS if success, else fail reason
137 //!
138 MOS_STATUS AllocateCatenatedBuffer();
139
140 protected:
141 DecodeBasicFeature* m_basicFeature = nullptr; //!< Decode basic feature
142 DecodeAllocator * m_allocator = nullptr; //!< Resource allocator
143
144 HucCopyPktItf * m_concatPkt = nullptr; //!< Bitstream concat packet
145 PMOS_BUFFER m_catenatedBuffer = nullptr; //!< Catenated bitstream for decode
146 uint32_t m_requiredSize = 0; //!< Size of bitstream in bytes of current frame
147 uint32_t m_segmentsTotalSize = 0; //!< Total size of segments in m_segments
148
149 MEDIA_CLASS_DEFINE_END(decode__DecodeInputBitstream)
150 };
151
152 }
153
154 #endif