| 1 | /* |
| 2 | * Copyright (c) 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_jpeg_pipeline.h |
| 24 | //! \brief Defines the interface for jpeg decode pipeline |
| 25 | //! |
| 26 | #ifndef __DECODE_JPEG_PIPELINE_H__ |
| 27 | #define __DECODE_JPEG_PIPELINE_H__ |
| 28 | |
| 29 | #include "decode_pipeline.h" |
| 30 | #include "decode_jpeg_basic_feature.h" |
| 31 | |
| 32 | namespace decode { |
| 33 | |
| 34 | class JpegPipeline : public DecodePipeline |
| 35 | { |
| 36 | public: |
| 37 | |
| 38 | //! |
| 39 | //! \brief JpegPipeline constructor |
| 40 | //! \param [in] hwInterface |
| 41 | //! Pointer to CodechalHwInterface |
| 42 | //! \param [in] debugInterface |
| 43 | //! Pointer to CodechalDebugInterface |
| 44 | //! |
| 45 | JpegPipeline( |
| 46 | CodechalHwInterfaceNext *hwInterface, |
| 47 | CodechalDebugInterface* debugInterface); |
| 48 | |
| 49 | virtual ~JpegPipeline() {}; |
| 50 | |
| 51 | //! |
| 52 | //! \brief Declare Regkeys in the scope of jpeg decode |
| 53 | //! \return MOS_STATUS |
| 54 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 55 | virtual MOS_STATUS InitUserSetting(MediaUserSettingSharedPtr userSettingPtr) override; |
| 56 | |
| 57 | DeclareDecodePacketId(jpegDecodePacketId); |
| 58 | DeclareDecodePacketId(jpegPictureSubPacketId); |
| 59 | |
| 60 | protected: |
| 61 | //! |
| 62 | //! \brief Initialize the decode pipeline |
| 63 | //! \param [in] settings |
| 64 | //! Pointer to the initialize settings |
| 65 | //! \return MOS_STATUS |
| 66 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 67 | //! |
| 68 | virtual MOS_STATUS Initialize(void *settings) override; |
| 69 | |
| 70 | //! |
| 71 | //! \brief Prepare interal parameters, should be invoked for each frame |
| 72 | //! \param [in] params |
| 73 | //! Pointer to the input parameters |
| 74 | //! \return MOS_STATUS |
| 75 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 76 | //! |
| 77 | virtual MOS_STATUS Prepare(void *params) override; |
| 78 | |
| 79 | //! |
| 80 | //! \brief Uninitialize the decode pipeline |
| 81 | //! \return MOS_STATUS |
| 82 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 83 | //! |
| 84 | virtual MOS_STATUS Uninitialize() override; |
| 85 | |
| 86 | //! |
| 87 | //! \brief User Feature Key Report |
| 88 | //! \return MOS_STATUS |
| 89 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 90 | //! |
| 91 | virtual MOS_STATUS UserFeatureReport() override; |
| 92 | |
| 93 | //! |
| 94 | //! \brief Active decode packets |
| 95 | //! \return MOS_STATUS |
| 96 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 97 | //! |
| 98 | virtual MOS_STATUS ActivateDecodePackets(); |
| 99 | |
| 100 | //! |
| 101 | //! \brief create media feature manager |
| 102 | //! \return MOS_STATUS |
| 103 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 104 | //! |
| 105 | virtual MOS_STATUS CreateFeatureManager() override; |
| 106 | |
| 107 | //! |
| 108 | //! \brief Create sub packets |
| 109 | //! \param [in] codecSettings |
| 110 | //! Point to codechal settings |
| 111 | //! \return MOS_STATUS |
| 112 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 113 | //! |
| 114 | virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override; |
| 115 | |
| 116 | virtual MOS_STATUS CreatePreSubPipeLines(DecodeSubPipelineManager &subPipelineManager) override; |
| 117 | |
| 118 | #if USE_CODECHAL_DEBUG_TOOL |
| 119 | MOS_STATUS DumpPicParams( |
| 120 | CodecDecodeJpegPicParams *picParams); |
| 121 | |
| 122 | MOS_STATUS DumpIQParams( |
| 123 | CodecJpegQuantMatrix *matrixData); |
| 124 | |
| 125 | MOS_STATUS DumpScanParams( |
| 126 | CodecDecodeJpegScanParameter *scanParams); |
| 127 | |
| 128 | MOS_STATUS DumpHuffmanTable( |
| 129 | PCODECHAL_DECODE_JPEG_HUFFMAN_TABLE huffmanTable); |
| 130 | #endif |
| 131 | |
| 132 | protected: |
| 133 | |
| 134 | JpegBasicFeature *m_basicFeature = nullptr; //!< Jpeg Basic Feature |
| 135 | |
| 136 | MEDIA_CLASS_DEFINE_END(decode__JpegPipeline) |
| 137 | }; |
| 138 | |
| 139 | } |
| 140 | #endif // !__DECODE_JPEG_PIPELINE_H__ |