1 /*
2 * Copyright (c) 2022, 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_m12.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_M12_H__
30 #define __DECODE_INPUT_BITSTREAM_M12_H__
31 
32 #include "decode_input_bitstream.h"
33 #include "decode_jpeg_basic_feature.h"
34 #include "codechal_hw.h"
35 
36 namespace decode
37 {
38 
39 class DecodeInputBitstreamM12 : public DecodeInputBitstream
40 {
41 public:
42     //!
43     //! \brief  Decode input bitstream constructor
44     //!
45     DecodeInputBitstreamM12(DecodePipeline *pipeline, MediaTask *task, uint8_t numVdbox, CodechalHwInterface *hwInterface);
46 
47     //!
48     //! \brief  Decode input bitstream destructor
49     //!
~DecodeInputBitstreamM12()50     virtual ~DecodeInputBitstreamM12(){};
51 
52     //!
53     //! \brief  Initialize the bitstream context
54     //!
55     //! \param  [in] settings
56     //!         Reference to the Codechal settings
57     //! \return MOS_STATUS
58     //!         MOS_STATUS_SUCCESS if success, else fail reason
59     //!
60     virtual MOS_STATUS Init(CodechalSetting &settings) override;
61 
62 protected:
63     CodechalHwInterface *m_hwInterface = nullptr;
64 
65     MEDIA_CLASS_DEFINE_END(decode__DecodeInputBitstreamM12)
66 };
67 
68 class DecodeJpegInputBitstreamM12 : public DecodeInputBitstreamM12
69 {
70 public:
71     //!
72     //! \brief  JPEG Decode input bitstream constructor
73     //!
74     DecodeJpegInputBitstreamM12(DecodePipeline *pipeline, MediaTask *task, uint8_t numVdbox, CodechalHwInterface *hwInterface);
75 
76     //!
77     //! \brief  Decode input bitstream destructor
78     //!
~DecodeJpegInputBitstreamM12()79     virtual ~DecodeJpegInputBitstreamM12() {}
80 
81     MOS_STATUS Init(CodechalSetting &settings) override;
82 
83     MOS_STATUS Append(const CodechalDecodeParams &decodeParams) override;
84     bool       IsComplete() override;
85 
86 private:
87     JpegBasicFeature *m_jpegBasicFeature  = nullptr;  //!< Decode basic feature
88     bool              m_completeJpegScan  = false;    //to indicate the scan was complete
89     bool              m_completeBitStream = false;
90 
91     MEDIA_CLASS_DEFINE_END(decode__DecodeJpegInputBitstreamM12)
92 };
93 
94 }  // namespace decode
95 #endif
96