1 /*
2 * Copyright (c) 2017-2020, 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_sfc_vp9_g12.h
24 //! \brief    Defines the SFC interface extension for VP9 decode in G12+ platform.
25 //! \details  Defines all types, macros, and functions required by CodecHal SFC for VP9 decoding.
26 //!           Definitions are not externally facing.
27 //!
28 
29 #ifndef __CODECHAL_DECODE_SFC_VP9_G12_H__
30 #define __CODECHAL_DECODE_SFC_VP9_G12_H__
31 
32 #include "mhw_sfc_g12_X.h"
33 #include "codechal_decode_sfc.h"
34 #include "codechal_decode_scalability_g12.h"
35 
36 class CodechalVp9SfcStateG12 : public CodechalSfcState
37 {
38 public:
39     //!
40     //! \brief    Constructor
41     //!
42     CodechalVp9SfcStateG12();
43     //!
44     //! \brief    Destructor
45     //!
46     ~CodechalVp9SfcStateG12();
47 
48     //!
49     //! \brief    Check if SFC output is supported and Initialize SFC
50     //! \param    [in] decodeProcParams
51     //!           Pointer to decode processing params
52     //! \param    [in] vp9PicParams
53     //!           Pointer to VP9 picture paramters
54     //! \param    [in] scalabilityState
55     //!           Pointer to CODECHAL_DECODE_SCALABILITY_STATE structure
56     //! \return   MOS_STATUS
57     //!           MOS_STATUS_SUCCESS if success, else fail reason
58     //!
59     MOS_STATUS CheckAndInitialize(
60         DecodeProcessingParams             *decProcessingParams,
61         PCODEC_VP9_PIC_PARAMS               vp9PicParams,
62         PCODECHAL_DECODE_SCALABILITY_STATE  scalabilityState);
63 
64     virtual bool IsSfcFormatSupported(
65         MOS_FORMAT                          inputFormat,
66         MOS_FORMAT                          outputFormat);
67 
68     virtual MOS_STATUS UpdateInputInfo(
69         PMHW_SFC_STATE_PARAMS               sfcStateParams);
70 
71     virtual MOS_STATUS AddSfcCommands(
72         PMOS_COMMAND_BUFFER                 cmdBuffer);
73 
74     virtual MOS_STATUS SetSfcStateParams(
75         PMHW_SFC_STATE_PARAMS               sfcStateParams,
76         PMHW_SFC_OUT_SURFACE_PARAMS         outSurfaceParams);
77 
78     virtual MOS_STATUS SetSfcAvsStateParams();
79 
80 protected:
81     MOS_STATUS AllocateResources();
82 
83 protected:
84     int                                     m_numPipe = 1;          //!< Number of pipes for scalability
85     int                                     m_curPipe = 0;          //!< Current pipe index
86     int                                     m_numBuffersAllocated = 0; //!< Number line buffer allocated
87     PCODEC_VP9_PIC_PARAMS                   m_vp9PicParams;         //!< VP9 picture parameters
88     PCODECHAL_DECODE_SCALABILITY_STATE_G12  m_scalabilityState;     //!< Decode scalability state
89     PMOS_SURFACE                            m_histogramSurface = nullptr;   //!< Histogram stream out buffer
90     MOS_RESOURCE                           *m_resAvsLineBuffers = nullptr;   //!< AVS Line Buffer, one for each pipe
91     MOS_RESOURCE                           *m_resSfdLineBuffers = nullptr;   //!< SFD Line Buffer, one for each pipe
92     MOS_RESOURCE                            m_resAvsLineTileBuffer = { 0 };  //!< Avs Line Tile Buffer MOS Resource
93     MOS_RESOURCE                            m_resSfdLineTileBuffer = { 0 };  //!< SFD Line Tile Buffer MOS Resource
94 };
95 
96 #endif
97