1 /* 2 * Copyright (c) 2017, 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 codechal_decode_histogram.h 24 //! \brief defines the decode histogram. 25 //! \details decode histogram. 26 //! 27 #ifndef __CODECHAL_DECODE_HISTOGRAM_H__ 28 #define __CODECHAL_DECODE_HISTOGRAM_H__ 29 #include "mos_os.h" 30 #include "codechal.h" 31 #include "codechal_hw.h" 32 #include "codechal_decoder.h" 33 34 #define HISTOGRAM_BINCOUNT 256 35 36 //! 37 //! \class CodechalDecodeHistogram 38 //! \brief Decode histogram base class 39 //! \details This class defines the base class for decode histogram, it includes 40 //! common member fields, functions, interfaces etc. Specific definitions, 41 //! features should be put into their corresponding classes. To create a 42 //! decode histogram instance, client needs to new the instance in media interfaces 43 //! 44 class CodechalDecodeHistogram 45 { 46 public: 47 //! 48 //! \brief Decode histogram constructor 49 //! \param [in] hwInterface 50 //! Hardware interface 51 //! \param [in] osInterface 52 //! OS interface 53 //! \return No return 54 //! 55 CodechalDecodeHistogram( 56 CodechalHwInterface *hwInterface, 57 MOS_INTERFACE *osInterface); 58 //! 59 //! \brief Decode histogram destructor 60 //! 61 virtual ~CodechalDecodeHistogram(); 62 //! 63 //! \brief Set histogram component 64 //! \param [in] component 65 //! Specify the histogram component 66 //! \return No return 67 //! 68 virtual void setHistogramComponent(uint8_t component); 69 70 //! 71 //! \brief Get surface to hold input histogram buffer 72 //! \return PMOS_SURFACE 73 //! 74 virtual PMOS_SURFACE GetHistogramSurface(); 75 76 //! 77 //! \brief Set source surface to hold internal histogram buffer 78 //! \return No Return 79 //! SetSrcHistogramSurface(PMOS_SURFACE refSurface)80 virtual void SetSrcHistogramSurface(PMOS_SURFACE refSurface) {}; 81 82 //! 83 //! \brief Render and output the histogram 84 //! \param [in] codechalDecoder 85 //! Pointer of codechal decoder 86 //! \param [in] inputSurface 87 //! Input surface to generate histogram 88 //! \return MOS_STATUS 89 //! MOS_STATUS_SUCCESS if success, else fail reason 90 //! 91 virtual MOS_STATUS RenderHistogram( 92 CodechalDecode *codechalDecoder, 93 MOS_SURFACE *inputSurface); 94 95 protected: 96 CodechalDecode *m_decoder = nullptr; //!< Pointer of codechal deocder 97 MOS_INTERFACE *m_osInterface = nullptr; //!< Pointer of OS interface 98 CodechalHwInterface *m_hwInterface = nullptr; //!< Pointer of hardware interface 99 PMOS_SURFACE m_inputSurface = nullptr; //!< Pointer of input surface 100 uint8_t m_histogramComponent = 0; //!< Histogram component 101 MOS_RESOURCE m_resHistogram; //!< Internal histogram resource 102 MOS_SURFACE m_inputHistogramSurfaces[4]; //!< Histogram surfaces to hold input buffers 103 }; 104 105 #endif 106