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     media_ddi_encode_fei_hevc.h
24 //! \brief    Defines class for DDI media hevc fei encode
25 //!
26 
27 #ifndef __MEDIA_DDI_ENCODE_FEI_HEVC_H__
28 #define __MEDIA_DDI_ENCODE_FEI_HEVC_H__
29 
30 #include "media_ddi_encode_hevc.h"
31 
32 //!
33 //! \class  DdiEncodeHevcFei
34 //! \brief  Ddi encode HEVC FEI
35 //!
36 class DdiEncodeHevcFei : public DdiEncodeHevc
37 {
38 public:
39     //!
40     //! \brief   Constructor
41     //!
DdiEncodeHevcFei()42     DdiEncodeHevcFei() {}
43 
44     //!
45     //! \brief   Destructor
46     //!
47     virtual ~DdiEncodeHevcFei();
48 
49     virtual VAStatus ContextInitialize(CodechalSetting * codecHalSettings);
50 
51     virtual VAStatus EncodeInCodecHal(uint32_t numSlices);
52 
53     virtual VAStatus ResetAtFrameLevel();
54 
55     virtual VAStatus RenderPicture(
56         VADriverContextP ctx,
57         VAContextID      context,
58         VABufferID       *buffers,
59         int32_t          numBuffers);
60 
61     //!
62     //! \brief    Add ENC output buffer information
63     //! \details  Add ENC output buffer information to
64     //!           status report queue. This function will
65     //!           be invoked at RenderPicture
66     //!
67     //! \param    [in] encBuf
68     //!           Pointer to ENC mv output buffer
69     //! \param    [in] typeIdx
70     //!           DDI_ENCODE_FEI_ENC_BUFFER_TYPE
71     //!
72     //! \return   VAStatus
73     //!           VA_STATUS_SUCCESS if successful, else fail reason
74     //!
75     VAStatus AddToEncStatusReportQueue(
76         void                           *encBuf,
77         DDI_ENCODE_FEI_ENC_BUFFER_TYPE typeIdx);
78 
79     //!
80     //! \brief    Update position
81     //! \details  Update position after add ENC output buffer
82     //!           to status report queue. This function will be
83     //!           invoked at RenderPicture
84     //!
85     //! \return   VAStatus
86     //!           VA_STATUS_SUCCESS if successful, else fail reason
87     //!
88     VAStatus AddToEncStatusReportQueueUpdatePos();
89 
90     //!
91     //! \brief    Parse FEI picture parameters
92     //! \details  Parse FEI picture parameters
93     //!
94     //! \param    [in] data
95     //!           Pointer to buffer VAEncMiscParameterFEIFrameControlH264Intel
96     //!
97     //! \return   VAStatus
98     //!           VA_STATUS_SUCCESS if successful, else fail reason
99     //!
100     VAStatus ParseMiscParamFeiPic(void *data);
101 
102     virtual VAStatus ParseMiscParams(void *ptr);
103 
104 private:
105     //! \brief    Max passes number for HEVC FEI
106     static const uint8_t feiHevcMaxPassesNum = 8;
107 };
108 #endif /* __MEDIA_DDI_ENCODE_FEI_HEVC_H__ */
109