1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © Microsoft Corporation
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#ifndef D3D12_VIDEO_ENC_H
25bf215546Sopenharmony_ci#define D3D12_VIDEO_ENC_H
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci#include "d3d12_video_types.h"
28bf215546Sopenharmony_ci#include "d3d12_video_encoder_references_manager.h"
29bf215546Sopenharmony_ci#include "d3d12_video_dpb_storage_manager.h"
30bf215546Sopenharmony_ci#include "d3d12_video_encoder_bitstream_builder_h264.h"
31bf215546Sopenharmony_ci
32bf215546Sopenharmony_ci///
33bf215546Sopenharmony_ci/// Pipe video interface starts
34bf215546Sopenharmony_ci///
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci/**
37bf215546Sopenharmony_ci * creates a video encoder
38bf215546Sopenharmony_ci */
39bf215546Sopenharmony_cistruct pipe_video_codec *
40bf215546Sopenharmony_cid3d12_video_encoder_create_encoder(struct pipe_context *context, const struct pipe_video_codec *templ);
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci/**
43bf215546Sopenharmony_ci * destroy this video encoder
44bf215546Sopenharmony_ci */
45bf215546Sopenharmony_civoid
46bf215546Sopenharmony_cid3d12_video_encoder_destroy(struct pipe_video_codec *codec);
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci/**
49bf215546Sopenharmony_ci * start encoding of a new frame
50bf215546Sopenharmony_ci */
51bf215546Sopenharmony_civoid
52bf215546Sopenharmony_cid3d12_video_encoder_begin_frame(struct pipe_video_codec * codec,
53bf215546Sopenharmony_ci                                struct pipe_video_buffer *target,
54bf215546Sopenharmony_ci                                struct pipe_picture_desc *picture);
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_ci/**
57bf215546Sopenharmony_ci * encode to a bitstream
58bf215546Sopenharmony_ci */
59bf215546Sopenharmony_civoid
60bf215546Sopenharmony_cid3d12_video_encoder_encode_bitstream(struct pipe_video_codec * codec,
61bf215546Sopenharmony_ci                                     struct pipe_video_buffer *source,
62bf215546Sopenharmony_ci                                     struct pipe_resource *    destination,
63bf215546Sopenharmony_ci                                     void **                   feedback);
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci/**
66bf215546Sopenharmony_ci * get encoder feedback
67bf215546Sopenharmony_ci */
68bf215546Sopenharmony_civoid
69bf215546Sopenharmony_cid3d12_video_encoder_get_feedback(struct pipe_video_codec *codec, void *feedback, unsigned *size);
70bf215546Sopenharmony_ci
71bf215546Sopenharmony_ci/**
72bf215546Sopenharmony_ci * end encoding of the current frame
73bf215546Sopenharmony_ci */
74bf215546Sopenharmony_civoid
75bf215546Sopenharmony_cid3d12_video_encoder_end_frame(struct pipe_video_codec * codec,
76bf215546Sopenharmony_ci                              struct pipe_video_buffer *target,
77bf215546Sopenharmony_ci                              struct pipe_picture_desc *picture);
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci/**
80bf215546Sopenharmony_ci * flush any outstanding command buffers to the hardware
81bf215546Sopenharmony_ci * should be called before a video_buffer is acessed by the gallium frontend again
82bf215546Sopenharmony_ci */
83bf215546Sopenharmony_civoid
84bf215546Sopenharmony_cid3d12_video_encoder_flush(struct pipe_video_codec *codec);
85bf215546Sopenharmony_ci
86bf215546Sopenharmony_ci///
87bf215546Sopenharmony_ci/// Pipe video interface ends
88bf215546Sopenharmony_ci///
89bf215546Sopenharmony_ci
90bf215546Sopenharmony_cienum d3d12_video_encoder_config_dirty_flags
91bf215546Sopenharmony_ci{
92bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_none                   = 0x0,
93bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_codec                  = 0x1,
94bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_profile                = 0x2,
95bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_level                  = 0x4,
96bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_codec_config           = 0x8,
97bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_input_format           = 0x10,
98bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_resolution             = 0x20,
99bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_rate_control           = 0x40,
100bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_slices                 = 0x80,
101bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_gop                    = 0x100,
102bf215546Sopenharmony_ci   d3d12_video_encoder_config_dirty_flag_motion_precision_limit = 0x200,
103bf215546Sopenharmony_ci};
104bf215546Sopenharmony_ciDEFINE_ENUM_FLAG_OPERATORS(d3d12_video_encoder_config_dirty_flags);
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_ci///
107bf215546Sopenharmony_ci/// d3d12_video_encoder functions starts
108bf215546Sopenharmony_ci///
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_cistruct d3d12_video_encoder
111bf215546Sopenharmony_ci{
112bf215546Sopenharmony_ci   struct pipe_video_codec base;
113bf215546Sopenharmony_ci   struct pipe_screen *    m_screen;
114bf215546Sopenharmony_ci   struct d3d12_screen *   m_pD3D12Screen;
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_ci   ///
117bf215546Sopenharmony_ci   /// D3D12 objects and context info
118bf215546Sopenharmony_ci   ///
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ci   const uint m_NodeMask  = 0u;
121bf215546Sopenharmony_ci   const uint m_NodeIndex = 0u;
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_ci   ComPtr<ID3D12Fence> m_spFence;
124bf215546Sopenharmony_ci   uint                m_fenceValue = 1u;
125bf215546Sopenharmony_ci
126bf215546Sopenharmony_ci   ComPtr<ID3D12VideoDevice3>            m_spD3D12VideoDevice;
127bf215546Sopenharmony_ci   ComPtr<ID3D12VideoEncoder>            m_spVideoEncoder;
128bf215546Sopenharmony_ci   ComPtr<ID3D12VideoEncoderHeap>        m_spVideoEncoderHeap;
129bf215546Sopenharmony_ci   ComPtr<ID3D12CommandQueue>            m_spEncodeCommandQueue;
130bf215546Sopenharmony_ci   ComPtr<ID3D12CommandAllocator>        m_spCommandAllocator;
131bf215546Sopenharmony_ci   ComPtr<ID3D12VideoEncodeCommandList2> m_spEncodeCommandList;
132bf215546Sopenharmony_ci   std::vector<D3D12_RESOURCE_BARRIER>   m_transitionsBeforeCloseCmdList;
133bf215546Sopenharmony_ci
134bf215546Sopenharmony_ci   std::unique_ptr<d3d12_video_encoder_references_manager_interface> m_upDPBManager;
135bf215546Sopenharmony_ci   std::unique_ptr<d3d12_video_dpb_storage_manager_interface>        m_upDPBStorageManager;
136bf215546Sopenharmony_ci   std::unique_ptr<d3d12_video_bitstream_builder_interface>          m_upBitstreamBuilder;
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_ci   bool m_needsGPUFlush = false;
139bf215546Sopenharmony_ci
140bf215546Sopenharmony_ci   ComPtr<ID3D12Resource> m_spResolvedMetadataBuffer;
141bf215546Sopenharmony_ci   ComPtr<ID3D12Resource> m_spMetadataOutputBuffer;
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_ci   std::vector<uint8_t> m_BitstreamHeadersBuffer;
144bf215546Sopenharmony_ci
145bf215546Sopenharmony_ci   struct
146bf215546Sopenharmony_ci   {
147bf215546Sopenharmony_ci      bool m_fArrayOfTexturesDpb;
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_SUPPORT_FLAGS                          m_SupportFlags;
150bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_VALIDATION_FLAGS                       m_ValidationFlags;
151bf215546Sopenharmony_ci      D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS m_currentResolutionSupportCaps;
152bf215546Sopenharmony_ci      union
153bf215546Sopenharmony_ci      {
154bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PROFILE_H264 m_H264Profile;
155bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PROFILE_HEVC m_HEVCProfile;
156bf215546Sopenharmony_ci      } m_encoderSuggestedProfileDesc = {};
157bf215546Sopenharmony_ci
158bf215546Sopenharmony_ci      union
159bf215546Sopenharmony_ci      {
160bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_LEVELS_H264                 m_H264LevelSetting;
161bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC m_HEVCLevelSetting;
162bf215546Sopenharmony_ci      } m_encoderLevelSuggestedDesc = {};
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci      // Required size for the layout-resolved metadata buffer of current frame to be encoded
165bf215546Sopenharmony_ci      size_t m_resolvedLayoutMetadataBufferRequiredSize;
166bf215546Sopenharmony_ci
167bf215546Sopenharmony_ci      // The maximum number of slices that the output of the current frame to be encoded will contain
168bf215546Sopenharmony_ci      uint32_t m_MaxSlicesInOutput;
169bf215546Sopenharmony_ci
170bf215546Sopenharmony_ci      D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS m_ResourceRequirementsCaps;
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_ci   } m_currentEncodeCapabilities;
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_ci   struct
175bf215546Sopenharmony_ci   {
176bf215546Sopenharmony_ci      d3d12_video_encoder_config_dirty_flags m_ConfigDirtyFlags = d3d12_video_encoder_config_dirty_flag_none;
177bf215546Sopenharmony_ci
178bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC m_currentResolution = {};
179bf215546Sopenharmony_ci      D3D12_BOX m_FrameCroppingCodecConfig = {};
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci      D3D12_FEATURE_DATA_FORMAT_INFO m_encodeFormatInfo = {};
182bf215546Sopenharmony_ci
183bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_CODEC m_encoderCodecDesc = {};
184bf215546Sopenharmony_ci
185bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS m_seqFlags = D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_NONE;
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci      /// As the following D3D12 Encode types have pointers in their structures, we need to keep a deep copy of them
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ci      union
190bf215546Sopenharmony_ci      {
191bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PROFILE_H264 m_H264Profile;
192bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PROFILE_HEVC m_HEVCProfile;
193bf215546Sopenharmony_ci      } m_encoderProfileDesc = {};
194bf215546Sopenharmony_ci
195bf215546Sopenharmony_ci      union
196bf215546Sopenharmony_ci      {
197bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_LEVELS_H264                 m_H264LevelSetting;
198bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC m_HEVCLevelSetting;
199bf215546Sopenharmony_ci      } m_encoderLevelDesc = {};
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_ci      struct
202bf215546Sopenharmony_ci      {
203bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE  m_Mode;
204bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS m_Flags;
205bf215546Sopenharmony_ci         DXGI_RATIONAL                          m_FrameRate;
206bf215546Sopenharmony_ci         union
207bf215546Sopenharmony_ci         {
208bf215546Sopenharmony_ci            D3D12_VIDEO_ENCODER_RATE_CONTROL_CQP  m_Configuration_CQP;
209bf215546Sopenharmony_ci            D3D12_VIDEO_ENCODER_RATE_CONTROL_CBR  m_Configuration_CBR;
210bf215546Sopenharmony_ci            D3D12_VIDEO_ENCODER_RATE_CONTROL_VBR  m_Configuration_VBR;
211bf215546Sopenharmony_ci            D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR m_Configuration_QVBR;
212bf215546Sopenharmony_ci         } m_Config;
213bf215546Sopenharmony_ci      } m_encoderRateControlDesc = {};
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci      union
216bf215546Sopenharmony_ci      {
217bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264 m_H264Config;
218bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC m_HEVCConfig;
219bf215546Sopenharmony_ci      } m_encoderCodecSpecificConfigDesc = {};
220bf215546Sopenharmony_ci
221bf215546Sopenharmony_ci
222bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE m_encoderSliceConfigMode;
223bf215546Sopenharmony_ci      union
224bf215546Sopenharmony_ci      {
225bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES m_SlicesPartition_H264;
226bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES m_SlicesPartition_HEVC;
227bf215546Sopenharmony_ci      } m_encoderSliceConfigDesc = {};
228bf215546Sopenharmony_ci
229bf215546Sopenharmony_ci      union
230bf215546Sopenharmony_ci      {
231bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 m_H264GroupOfPictures;
232bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC m_HEVCGroupOfPictures;
233bf215546Sopenharmony_ci      } m_encoderGOPConfigDesc = {};
234bf215546Sopenharmony_ci
235bf215546Sopenharmony_ci      union
236bf215546Sopenharmony_ci      {
237bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264 m_H264PicData;
238bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC m_HEVCPicData;
239bf215546Sopenharmony_ci      } m_encoderPicParamsDesc = {};
240bf215546Sopenharmony_ci
241bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE m_encoderMotionPrecisionLimit =
242bf215546Sopenharmony_ci         D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE_MAXIMUM;
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci      D3D12_VIDEO_ENCODER_INTRA_REFRESH m_IntraRefresh = { D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE_NONE, 0 };
245bf215546Sopenharmony_ci      uint32_t                          m_IntraRefreshCurrentFrameIndex = 0;
246bf215546Sopenharmony_ci
247bf215546Sopenharmony_ci   } m_currentEncodeConfig;
248bf215546Sopenharmony_ci};
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_cibool
251bf215546Sopenharmony_cid3d12_video_encoder_create_command_objects(struct d3d12_video_encoder *pD3D12Enc);
252bf215546Sopenharmony_cibool
253bf215546Sopenharmony_cid3d12_video_encoder_reconfigure_session(struct d3d12_video_encoder *pD3D12Enc,
254bf215546Sopenharmony_ci                                        struct pipe_video_buffer *  srcTexture,
255bf215546Sopenharmony_ci                                        struct pipe_picture_desc *  picture);
256bf215546Sopenharmony_cibool
257bf215546Sopenharmony_cid3d12_video_encoder_update_current_encoder_config_state(struct d3d12_video_encoder *pD3D12Enc,
258bf215546Sopenharmony_ci                                                        struct pipe_video_buffer *  srcTexture,
259bf215546Sopenharmony_ci                                                        struct pipe_picture_desc *  picture);
260bf215546Sopenharmony_cibool
261bf215546Sopenharmony_cid3d12_video_encoder_reconfigure_encoder_objects(struct d3d12_video_encoder *pD3D12Enc,
262bf215546Sopenharmony_ci                                                struct pipe_video_buffer *  srcTexture,
263bf215546Sopenharmony_ci                                                struct pipe_picture_desc *  picture);
264bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA
265bf215546Sopenharmony_cid3d12_video_encoder_get_current_picture_param_settings(struct d3d12_video_encoder *pD3D12Enc);
266bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_LEVEL_SETTING
267bf215546Sopenharmony_cid3d12_video_encoder_get_current_level_desc(struct d3d12_video_encoder *pD3D12Enc);
268bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION
269bf215546Sopenharmony_cid3d12_video_encoder_get_current_codec_config_desc(struct d3d12_video_encoder *pD3D12Enc);
270bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_PROFILE_DESC
271bf215546Sopenharmony_cid3d12_video_encoder_get_current_profile_desc(struct d3d12_video_encoder *pD3D12Enc);
272bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_RATE_CONTROL
273bf215546Sopenharmony_cid3d12_video_encoder_get_current_rate_control_settings(struct d3d12_video_encoder *pD3D12Enc);
274bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
275bf215546Sopenharmony_cid3d12_video_encoder_get_current_slice_param_settings(struct d3d12_video_encoder *pD3D12Enc);
276bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
277bf215546Sopenharmony_cid3d12_video_encoder_get_current_gop_desc(struct d3d12_video_encoder *pD3D12Enc);
278bf215546Sopenharmony_ciuint32_t
279bf215546Sopenharmony_cid3d12_video_encoder_get_current_max_dpb_capacity(struct d3d12_video_encoder *pD3D12Enc);
280bf215546Sopenharmony_civoid
281bf215546Sopenharmony_cid3d12_video_encoder_create_reference_picture_manager(struct d3d12_video_encoder *pD3D12Enc);
282bf215546Sopenharmony_civoid
283bf215546Sopenharmony_cid3d12_video_encoder_update_picparams_tracking(struct d3d12_video_encoder *pD3D12Enc,
284bf215546Sopenharmony_ci                                              struct pipe_video_buffer *  srcTexture,
285bf215546Sopenharmony_ci                                              struct pipe_picture_desc *  picture);
286bf215546Sopenharmony_civoid
287bf215546Sopenharmony_cid3d12_video_encoder_calculate_metadata_resolved_buffer_size(uint32_t maxSliceNumber, size_t &bufferSize);
288bf215546Sopenharmony_ciuint32_t
289bf215546Sopenharmony_cid3d12_video_encoder_calculate_max_slices_count_in_output(
290bf215546Sopenharmony_ci   D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE                          slicesMode,
291bf215546Sopenharmony_ci   const D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES *slicesConfig,
292bf215546Sopenharmony_ci   uint32_t                                                                 MaxSubregionsNumberFromCaps,
293bf215546Sopenharmony_ci   D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC                              sequenceTargetResolution,
294bf215546Sopenharmony_ci   uint32_t                                                                 SubregionBlockPixelsSize);
295bf215546Sopenharmony_cibool
296bf215546Sopenharmony_cid3d12_video_encoder_prepare_output_buffers(struct d3d12_video_encoder *pD3D12Enc,
297bf215546Sopenharmony_ci                                           struct pipe_video_buffer *  srcTexture,
298bf215546Sopenharmony_ci                                           struct pipe_picture_desc *  picture);
299bf215546Sopenharmony_ciuint32_t
300bf215546Sopenharmony_cid3d12_video_encoder_build_codec_headers(struct d3d12_video_encoder *pD3D12Enc);
301bf215546Sopenharmony_civoid
302bf215546Sopenharmony_cid3d12_video_encoder_extract_encode_metadata(
303bf215546Sopenharmony_ci   struct d3d12_video_encoder *                               pD3D12Dec,
304bf215546Sopenharmony_ci   ID3D12Resource *                                           pResolvedMetadataBuffer,
305bf215546Sopenharmony_ci   size_t                                                     resourceMetadataSize,
306bf215546Sopenharmony_ci   D3D12_VIDEO_ENCODER_OUTPUT_METADATA &                      encoderMetadata,
307bf215546Sopenharmony_ci   std::vector<D3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA> &pSubregionsMetadata);
308bf215546Sopenharmony_ci
309bf215546Sopenharmony_ciD3D12_VIDEO_ENCODER_CODEC
310bf215546Sopenharmony_cid3d12_video_encoder_get_current_codec(struct d3d12_video_encoder *pD3D12Enc);
311bf215546Sopenharmony_ci
312bf215546Sopenharmony_cibool d3d12_video_encoder_negotiate_requested_features_and_d3d12_driver_caps(struct d3d12_video_encoder *pD3D12Enc, D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT &capEncoderSupportData);
313bf215546Sopenharmony_cibool d3d12_video_encoder_query_d3d12_driver_caps(struct d3d12_video_encoder *pD3D12Enc, D3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT &capEncoderSupportData);
314bf215546Sopenharmony_cibool d3d12_video_encoder_check_subregion_mode_support(struct d3d12_video_encoder *pD3D12Enc, D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE requestedSlicesMode);
315bf215546Sopenharmony_ci
316bf215546Sopenharmony_ci///
317bf215546Sopenharmony_ci/// d3d12_video_encoder functions ends
318bf215546Sopenharmony_ci///
319bf215546Sopenharmony_ci
320bf215546Sopenharmony_ci#endif
321