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     encode_vdenc_lpla_analysis.h
24 //! \brief    Defines for encode lowpower lookahead(Lookahead Analysis Pass) feature
25 //!
26 
27 #ifndef __ENCODE_VDENC_LPLA_ANALYSIS_H__
28 #define __ENCODE_VDENC_LPLA_ANALYSIS_H__
29 
30 #include "media_feature.h"
31 #include "encode_allocator.h"
32 #include "encode_basic_feature.h"
33 #include "encode_pipeline.h"
34 #include "encode_huc_brc_update_packet.h"
35 #include "encode_lpla.h"
36 
37 namespace encode
38 {
39 #define VDBOX_HUC_LA_ANALYSIS_KERNEL_DESCRIPTOR 16
40 
41     struct VdencStreamInState
42     {
43         // DWORD 0
44         union
45         {
46             struct
47             {
48                 uint32_t RoiCtrl : MOS_BITFIELD_RANGE(0, 7);
49                 uint32_t MaxTuSize : MOS_BITFIELD_RANGE(8, 9);
50                 uint32_t MaxCuSize : MOS_BITFIELD_RANGE(10, 11);
51                 uint32_t NumImePredictors : MOS_BITFIELD_RANGE(12, 15);
52                 uint32_t Reserved_0 : MOS_BITFIELD_RANGE(16, 20);
53                 uint32_t ForceQPDelta : MOS_BITFIELD_BIT(21);
54                 uint32_t PaletteDisable : MOS_BITFIELD_BIT(22);
55                 uint32_t Reserved_1 : MOS_BITFIELD_BIT(23);
56                 uint32_t PuTypeCtrl : MOS_BITFIELD_RANGE(24, 31);
57             };
58             uint32_t Value;
59         } DW0;
60 
61         // DWORD 1-4
62         union
63         {
64             struct
65             {
66                 uint32_t ForceMvX : MOS_BITFIELD_RANGE(0, 15);
67                 uint32_t ForceMvY : MOS_BITFIELD_RANGE(16, 31);
68             };
69             uint32_t Value;
70         } DW1[4];
71 
72         // DWORD 5
73         union
74         {
75             struct
76             {
77                 uint32_t Reserved : MOS_BITFIELD_RANGE(0, 31);
78             };
79             uint32_t Value;
80         } DW5;
81 
82         // DWORD 6
83         union
84         {
85             struct
86             {
87                 uint32_t ForceRefIdx : MOS_BITFIELD_RANGE(0, 15);  //4-bits per 16x16 block
88                 uint32_t NumMergeCandidateCu8x8 : MOS_BITFIELD_RANGE(16, 19);
89                 uint32_t NumMergeCandidateCu16x16 : MOS_BITFIELD_RANGE(20, 23);
90                 uint32_t NumMergeCandidateCu32x32 : MOS_BITFIELD_RANGE(24, 27);
91                 uint32_t NumMergeCandidateCu64x64 : MOS_BITFIELD_RANGE(28, 31);
92             };
93             uint32_t Value;
94         } DW6;
95 
96         // DWORD 7
97         union
98         {
99             struct
100             {
101                 uint32_t SegID : MOS_BITFIELD_RANGE(0, 15);  //4-bits per 16x16 block
102                 uint32_t QpEnable : MOS_BITFIELD_RANGE(16, 19);
103                 uint32_t SegIDEnable : MOS_BITFIELD_RANGE(20, 20);
104                 uint32_t Reserved : MOS_BITFIELD_RANGE(21, 22);
105                 uint32_t ForceRefIdEnable : MOS_BITFIELD_RANGE(23, 23);
106                 uint32_t ImePredictorSelect : MOS_BITFIELD_RANGE(24, 31);
107             };
108             uint32_t Value;
109         } DW7;
110 
111         // DWORD 8-11
112         union
113         {
114             struct
115             {
116                 uint32_t ImePredictorMvX : MOS_BITFIELD_RANGE(0, 15);
117                 uint32_t ImePredictorMvY : MOS_BITFIELD_RANGE(16, 31);
118             };
119             uint32_t Value;
120         } DW8[4];
121 
122         // DWORD 12
123         union
124         {
125             struct
126             {
127                 uint32_t ImePredictorRefIdx : MOS_BITFIELD_RANGE(0, 15);  //4-bits per 16x16 block
128                 uint32_t Reserved : MOS_BITFIELD_RANGE(16, 31);
129             };
130             uint32_t Value;
131         } DW12;
132 
133         // DWORD 13
134         union
135         {
136             struct
137             {
138                 uint32_t PanicModeLCUThreshold : MOS_BITFIELD_RANGE(0, 15);
139                 uint32_t Reserved : MOS_BITFIELD_RANGE(16, 31);
140             };
141             uint32_t Value;
142         } DW13;
143 
144         // DWORD 14
145         union
146         {
147             struct
148             {
149                 uint32_t ForceQp_0 : MOS_BITFIELD_RANGE(0, 7);
150                 uint32_t ForceQp_1 : MOS_BITFIELD_RANGE(8, 15);
151                 uint32_t ForceQp_2 : MOS_BITFIELD_RANGE(16, 23);
152                 uint32_t ForceQp_3 : MOS_BITFIELD_RANGE(24, 31);
153             };
154             uint32_t Value;
155         } DW14;
156 
157         // DWORD 15
158         union
159         {
160             struct
161             {
162                 uint32_t Reserved : MOS_BITFIELD_RANGE(0, 31);
163             };
164             uint32_t Value;
165         } DW15;
166 
167         inline bool operator==(const VdencStreamInState &ps) const
168         {
169             if ((this->DW0.Value == ps.DW0.Value) &&
170                 (this->DW1[0].Value == ps.DW1[0].Value) &&
171                 this->DW1[1].Value == ps.DW1[1].Value &&
172                 this->DW1[2].Value == ps.DW1[2].Value &&
173                 this->DW1[3].Value == ps.DW1[3].Value &&
174                 this->DW5.Value == ps.DW5.Value &&
175                 this->DW6.Value == ps.DW6.Value &&
176                 this->DW7.Value == ps.DW7.Value &&
177                 this->DW8[0].Value == ps.DW8[0].Value &&
178                 this->DW8[1].Value == ps.DW8[1].Value &&
179                 this->DW8[2].Value == ps.DW8[2].Value &&
180                 this->DW8[3].Value == ps.DW8[3].Value &&
181                 this->DW12.Value == ps.DW12.Value &&
182                 this->DW13.Value == ps.DW13.Value &&
183                 this->DW14.Value == ps.DW14.Value &&
184                 this->DW15.Value == ps.DW15.Value)
185                 return true;
186             return false;
187         }
188     };
189 
190     // cqm type
191     enum
192     {
193         CQM_HINT_USE_FLAT_MATRIX          = 0,    //use flat matrix
194         CQM_HINT_USE_WEAK_CUST_MATRIX     = 1,    //use weak customized matrix
195         CQM_HINT_USE_MEDIUM_CUST_MATRIX   = 2,    //use medium customized matrix
196         CQM_HINT_USE_STRONG_CUST_MATRIX   = 3,    //use strong customized matrix
197         CQM_HINT_USE_EXTREME_CUST_MATRIX  = 4,    //use extreme customized matrix
198         CQM_HINT_NUM_CUST_MATRIX          = 4,    //the number of customized matrix
199         CQM_HINT_INVALID                  = 0xFF  //invalid hint
200     };
201     //!
202     //! \struct    VdencHevcLaStats
203     //! \brief     Vdenc HEVC lookahead info for BRC
204     //!
205     struct VdencHevcLaStats
206     {
207         uint32_t sad = 0;
208         uint32_t frameByteCount = 0;
209         uint32_t headerBitCount = 0;
210         uint32_t intraCuCount = 0;
211         uint32_t reserved[4];
212     };
213 
214     //!
215     //! \struct    VdencHevcLaData
216     //! \brief     Encode lookahead analysis output data structure
217     //!
218     struct VdencHevcLaData
219     {
220         uint32_t reserved0[1];
221         uint32_t targetFrameSize = 0;
222         uint32_t targetBufferFulness = 0;
223         uint32_t reserved1[2];
224         union
225         {
226             struct
227             {
228                 uint32_t cqmHint : 8;  //!< Custom quantization matrix hint. 0x00 - flat matrix; 0x01 - CQM; 0xFF - invalid hint; other values are reserved.
229                 uint32_t reserved2 : 24;
230             };
231             uint32_t encodeHints = 0;
232         };
233         uint32_t pyramidDeltaQP = 0;
234         uint32_t reserved3[9];
235     };
236 
237     //!
238     //! \struct    VdencHevcHucLaDmem
239     //! \brief     This struct is defined for Lookahead HUC kernel DMEM
240     //!
241     struct VdencHevcHucLaDmem
242     {
243         uint32_t lookAheadFunc = 0;  //0: init, 1 update
244         // Init
245         uint32_t lengthAhead = 0;         // in the units of frames
246         uint32_t vbvBufferSize = 0;       // in the units of frames
247         uint32_t vbvInitialFullness = 0;  // in the units of frames
248         uint32_t cuCount = 0;             // normalized 8x8 CU count
249         uint32_t statsRecords = 0;        // # of statistic records
250         uint32_t averageFrameSize = 0;    // in the units of bytes, should be target_bit_rate/frame_rate
251         uint16_t minGop = 0;
252         uint16_t maxGop = 0;
253         uint16_t BGop = 0;
254         uint16_t AGop = 0;
255         uint16_t AGop_Threshold = 0;
256         uint16_t PGop = 0;
257         uint8_t  downscaleRatio = 0;  // 0-no scale, 1-2x, 2-4x
258         uint8_t  isIframeInsideBGOP = 0;
259         uint8_t  adaptiveIDR = 0;
260         uint8_t  GopOpt = 0;  //0 open GOP, 1 close GOP, 2 strict GOP
261         uint32_t mbr_ratio = 0;
262         uint8_t  la_dump_type = 0;
263         uint8_t  codec_type = 0;
264         uint8_t  RSVD[2];
265         uint32_t enc_frame_width = 0;
266         uint32_t enc_frame_height = 0;
267         uint8_t  RSVD1[4];
268         // for Update, valid only when lookAheadFunc = 1
269         uint32_t validStatsRecords = 0;  // # of valid stats records
270         uint32_t offset = 0;             // offset in unit of entries
271         uint8_t  cqmQpThreshold = 0;     // QP threshold for CQM enable/disable. If estimated QP > CQM_QP_threshold, kernel set HUC_HEVC_LA_DATA.enableCQM to 1.
272         uint8_t  currentPass = 0;
273         uint8_t  RSVD2[54];
274     };
275 
276     //!
277     //! \struct    CodechalVdencHevcLaData
278     //! \brief     Codechal encode lookahead analysis output data structure
279     //!
280     struct CodechalVdencHevcLaData
281     {
282         uint32_t reserved0[1];
283         uint32_t targetFrameSize;
284         uint32_t targetBufferFulness;
285         uint32_t reserved1[2];
286         union
287         {
288             struct
289             {
290                 uint32_t cqmHint    : 8;  //!< Custom quantization matrix hint. 0x00 - flat matrix; 0x01 - CQM; 0xFF - invalid hint; other values are reserved.
291                 uint32_t reserved2  : 24;
292             };
293             uint32_t encodeHints;
294         };
295         uint32_t pyramidDeltaQP;
296         uint8_t  adaptive_rounding;
297         uint8_t  miniGopSize;
298         uint32_t reserved3[8];
299     };
300 
301     class VdencLplaAnalysis : public MediaFeature, public mhw::vdbox::vdenc::Itf::ParSetting, public mhw::vdbox::huc::Itf::ParSetting
302     {
303     public:
304         VdencLplaAnalysis(
305             MediaFeatureManager *featureManager,
306             EncodeAllocator *allocator,
307             CodechalHwInterfaceNext *hwInterface,
308             void *constSettings);
309 
310         virtual ~VdencLplaAnalysis();
311 
312         //!
313         //! \brief  Init lpla analysis features related parameter
314         //! \param  [in] settings
315         //!         Pointer to settings
316         //! \return MOS_STATUS
317         //!         MOS_STATUS_SUCCESS if success, else fail reason
318         //!
319         MOS_STATUS Init(void *settings) override;
320 
321         //!
322         //! \brief  Update cqp basic features related parameter
323         //! \param  [in] params
324         //!         Pointer to parameters
325         //! \return MOS_STATUS
326         //!         MOS_STATUS_SUCCESS if success, else fail reason
327         //!
328         MOS_STATUS Update(void *params) override;
329 
330         //!
331         //! \brief    Setup/configure encoder based on sequence parameter set
332         //! \details  It is invoked when the encoder receives a new sequence parameter set and it would
333         //!           set up and configure the encoder state that used for the sequence
334         //!
335         //! \return   MOS_STATUS
336         //!           MOS_STATUS_SUCCESS if success, else fail reason
337         //!
338         MOS_STATUS SetSequenceStructs();
339 
340         MOS_STATUS UpdateLaDataIdx();
341 
342         //!
343         //! \brief    Read stats from VDEnc and PAK for lookahead
344         //!
345         //! \param    [in] cmdBuffer
346         //!            Pointer to command buffer
347         //!
348         //! \return   MOS_STATUS
349         //!           MOS_STATUS_SUCCESS if success, else fail reason
350         //!
351         MOS_STATUS StoreLookaheadStatistics(MOS_COMMAND_BUFFER &cmdBuffer, MHW_VDBOX_NODE_IND vdboxIndex);
352 
353         //!
354         //! \brief    Read stats from VDEnc for lookahead
355         //!
356         //! \param    [in] cmdBuffer
357         //!            Pointer to command buffer
358         //!
359         //! \return   MOS_STATUS
360         //!           MOS_STATUS_SUCCESS if success, else fail reason
361         //!
362         MOS_STATUS StoreVdencStatistics(MOS_COMMAND_BUFFER &cmdBuffer, uint8_t index);
363 
364         MOS_STATUS SetLaUpdateDmemParameters(HUC_DMEM_STATE_PAR_ALIAS &dmemParams,
365             uint8_t currRecycledBufIdx, uint16_t curPass, uint16_t numPasses);
366 
367         //!
368         //! \brief  Set look ahead init dmem buffer
369         //! \return MOS_STATUS
370         //!         MOS_STATUS_SUCCESS if success, else fail reason
371         //!
372         MOS_STATUS SetLaInitDmemBuffer() const;
373 
374         //!
375         //! \brief  Set look ahead update dmem buffer
376         //! \param  [in] currRecycledBufIdx
377         //!         Current recycled buffer index
378         //! \param  [in] currLaDataIdx
379         //!         Current lookahead data index
380         //! \param  [in] numValidLaRecords
381         //!         Valid Lookahead records number
382         //! \return MOS_STATUS
383         //!         MOS_STATUS_SUCCESS if success, else fail reason
384         //!
385         MOS_STATUS SetLaUpdateDmemBuffer(uint8_t currRecycledBufIdx, uint8_t currLaDataIdx,
386             uint32_t numValidLaRecords, uint16_t curPass, uint16_t numPasses);
387 
388         //!
389         //! \brief  Get look ahead status report
390         //! \param  [in] encodeStatusMfx
391         //!         encode status
392         //! \param  [in] statusReportData
393         //!         status report data
394         //! \return MOS_STATUS
395         //!         MOS_STATUS_SUCCESS if success, else fail reason
396         //!
397         MOS_STATUS GetLplaStatusReport(EncodeStatusMfx *encodeStatusMfx, EncodeStatusReportData *statusReportData);
398 
399         //!
400         //! \brief  Calculate Look ahead records
401         //! \return MOS_STATUS
402         //!         MOS_STATUS_SUCCESS if success, else fail reason
403         //!
404         MOS_STATUS CalculateLaRecords(bool blastPass);
405 
406         //!
407         //! \brief  Check if look ahead pass is required
408         //! \return MOS_STATUS
409         //!         MOS_STATUS_SUCCESS if success, else fail reason
410         //!
411         bool IsLaAnalysisRequired();
412 
413         //!
414         //! \brief  Check if look ahead record is empty
415         //! \return bool
416         //!         true if record is empty
417         //!
418         bool IsLaRecordsEmpty();
419 
420         //!
421         //! \brief  Check if look ahead record is empty
422         //! \return bool
423         //!         true if record is empty
424         //!
IsLastPicInStream()425         bool IsLastPicInStream() { return m_lastPicInStream; }
426 
427         //!
428         //! \brief  Check if look ahead init is required
429         //! \return bool
430         //!         true if look ahead init is required
431         //!
IsLaInitRequired()432         bool IsLaInitRequired() { return m_lookaheadInit; }
433 
IsLplaAIdrEnabled()434         inline bool IsLplaAIdrEnabled(){ return m_lookaheadAdaptiveI; }
435 
436         MOS_STATUS SetConditionalPass(bool blastPass, bool &condPass);
437         MOS_STATUS EnableStreamIn(bool is1stPass, bool isLastPass, bool &streaminEnabled);
438         MOS_STATUS SetVdencPipeBufAddrParams(bool enableStreamIn, MHW_VDBOX_PIPE_BUF_ADDR_PARAMS &pipeBufAddrParams);
439 
440         MOS_STATUS ReadLPLAData(PMOS_COMMAND_BUFFER cmdBuffer, PMOS_RESOURCE resource, uint32_t baseOffset);
441 
442         MHW_SETPAR_DECL_HDR(VDENC_PIPE_MODE_SELECT);
443 
444         MHW_SETPAR_DECL_HDR(VDENC_PIPE_BUF_ADDR_STATE);
445 
446         MHW_SETPAR_DECL_HDR(VDENC_CMD2);
447 
448         MHW_SETPAR_DECL_HDR(HUC_DMEM_STATE);
449 
450         MHW_SETPAR_DECL_HDR(HUC_VIRTUAL_ADDR_STATE);
451 
452 #if USE_CODECHAL_DEBUG_TOOL
453         //!
454         //! \brief  Dump look ahead resource
455         //! \param  [in] pipeline
456         //!         encode pipeline
457         //! \return MOS_STATUS
458         //!         MOS_STATUS_SUCCESS if success, else fail reason
459         //!
460         MOS_STATUS DumpLaResource(EncodePipeline *pipeline, bool isInput);
461 #endif
462 
463     protected:
464         //! \brief  Allocate feature related resources
465         //! \return MOS_STATUS
466         //!         MOS_STATUS_SUCCESS if success, else fail reason
467         //!
468         virtual MOS_STATUS AllocateResources() override;
469 
470         MOS_STATUS GetLaStatsStoreIdx(uint8_t &index);
471 
472         MOS_STATUS SetupForceIntraStreamIn();
473 
474         MOS_STATUS SetStreaminDataPerRegion(
475             uint32_t streamInWidth, uint32_t top, uint32_t bottom, uint32_t left, uint32_t right,
476             mhw::vdbox::vdenc::VDENC_STREAMIN_STATE_PAR *streaminParams, void *streaminData);
477 
478         MOS_STATUS SetStreaminDataPerLcu(mhw::vdbox::vdenc::VDENC_STREAMIN_STATE_PAR *streaminParams, void *streaminData);
479 
480         MOS_STATUS StreaminZigZagToLinearMap( uint32_t  streamInWidth,  uint32_t  x, uint32_t  y, uint32_t *offset, uint32_t *xyOffset);
481 
482         CODEC_HEVC_ENCODE_SEQUENCE_PARAMS *m_hevcSeqParams = nullptr;  //!< Pointer to sequence parameter
483         CODEC_HEVC_ENCODE_PICTURE_PARAMS  *m_hevcPicParams = nullptr;  //!< Pointer to picture parameter
484         CODEC_HEVC_ENCODE_SLICE_PARAMS *m_hevcSliceParams = nullptr; //!< Pointer to slice parameter
485         HevcBasicFeature                  *m_hevcBasicFeature = nullptr;  //!< Hevc Basic Feature used in each frame
486 
487         EncodeBasicFeature       *m_basicFeature    = nullptr;  //!< EncodeBasicFeature
488         CodechalHwInterfaceNext      *m_hwInterface     = nullptr;  //!< Codechal HW Interface
489         EncodeAllocator          *m_allocator       = nullptr;  //!< Encode Allocator
490         PMOS_INTERFACE            m_osInterface     = nullptr;
491 
492         std::shared_ptr<mhw::vdbox::hcp::Itf> m_hcpItf = nullptr;
493         std::shared_ptr<mhw::mi::Itf>         m_miItf  = nullptr;
494 
495         bool                       m_streamInEnabled             = false;    //!< Stream in enable
496         bool                       m_lookaheadAdaptiveI          = false;    //!< Adaptive I flag for lookaheads
497         static constexpr uint32_t  m_numLaDataEntry              = 128;      //!< number of entries in lookahead data buffer and lookahead stats buffer
498         PMOS_RESOURCE              m_vdencLaStatsBuffer          = nullptr;  //!< VDEnc statistics buffer for lookahead
499         PMOS_RESOURCE              m_vdencLaDataBuffer           = nullptr;  //!< lookahead data buffer, output of lookahead analysis
500         uint32_t                   m_brcLooaheadStatsBufferSize  = 0;        //!< Lookahead statistics buffer size
501         uint32_t                   m_numSlices                   = 0;        //!< Number of slices
502         PCODEC_ENCODER_SLCDATA     m_slcData                     = nullptr;  //!< record slice header size & position
503         PCODECHAL_NAL_UNIT_PARAMS *m_nalUnitParams               = nullptr;  //!< Pointer to NAL unit parameters
504         uint8_t                    m_lookaheadDepth              = 0;        //!< Number of frames to lookahead
505         uint32_t                   m_vdencLaInitDmemBufferSize   = 0;        //!< Offset of Lookahead init DMEM buffer
506         PMOS_RESOURCE              m_vdencLaInitDmemBuffer       = nullptr;  //!< lookahead init dmem buffer
507         uint32_t                   m_averageFrameSize            = 0;        //!< Average frame size based on targed bitrate and frame rate, in unit of bits
508         PMOS_RESOURCE              m_vdencLaHistoryBuffer        = nullptr;  //!< VDEnc lookahead history buffer
509         static constexpr uint32_t  m_LaHistoryBufSize            = 8192;     //!< Lookahead history buffer size
510         uint32_t                   m_brcLooaheadDataBufferSize   = 0;        //!< Lookahead statistics buffer size
511         uint32_t                   m_vdencLaUpdateDmemBufferSize = 0;        //!< Offset of Lookahead update DMEM buffer
512         uint8_t                    m_cqmQpThreshold              = 40;       //!< QP threshold for CQM enable/disable. Used by lookahead analysis kernel.
513         bool                       m_lastPicInStream             = false;    //!< Flag to indicate if it is last picture in stream
514         uint32_t                   m_targetBufferFulness         = 0;        //!< Target encode buffer fulness in bits, used by BRC and calculated from initial buffer fulness, target frame size (from DDI) and average frame size
515         int32_t                    m_bufferFulnessError          = 0;        //!< VBV buffer fulness error between unit of bits (used by driver) and unit of frame (used by LA analsis kernel)
516         bool                       m_initDeltaQP                 = true;     //!< Initial delta QP
517         uint32_t                   m_prevQpModulationStrength    = 0;        //!< Previous QP Modulation strength
518         uint32_t                   m_prevTargetFrameSize         = 0;        //!< Target frame size of previous frame.
519         bool                       m_lookaheadReport             = false;    //!< Lookahead report valid flag
520         uint32_t                   m_numValidLaRecords           = 0;        //!< Number of valid lookahead records
521         uint8_t                    m_currLaDataIdx               = 0;        //!< Current lookahead data index
522         mutable bool               m_lookaheadInit               = true;     //!< Lookahead init flag
523         EncodeLPLA                *m_lplaHelper                  = nullptr;  //!< Lookahead helper
524         uint32_t                   m_offset = 0;
525 
526         uint32_t                   m_intraInterval               = 0;  //!< Frame count since last I frame
527         bool                       m_forceIntraSteamInSetupDone  = false;
528         PMOS_RESOURCE              m_forceIntraStreamInBuf       = nullptr;
529         PMOS_RESOURCE              m_vdencLaUpdateDmemBuffer[CODECHAL_ENCODE_RECYCLED_BUFFER_NUM][CODECHAL_LPLA_NUM_OF_PASSES] = {};  //!< VDEnc Lookahead Update DMEM buffer
530         uint32_t                   m_statsBuffer[600][4]                                                                       = {};
531         bool                       m_useDSData = false;
532         bool                       m_bLastPicFlagFirstIn                                                                       = true;
533 
534     MEDIA_CLASS_DEFINE_END(encode__VdencLplaAnalysis)
535     };
536 } // namespace encode
537 
538 #endif
539