{ **************************************************************************
  FreePascal/Delphi DirectX 12 Header Files
  
  Copyright 2013-2021 Norbert Sonnleitner

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   SOFTWARE.
  ************************************************************************** }

{ **************************************************************************
  Additional Copyright (C) for this modul:

  Copyright (c) Microsoft Corporation.  All rights reserved.

  This unit consists of the following header files
  File name: D3D12Video.h

  Header version: 10.0.22621.0

  ************************************************************************** }
unit DX12.D3D12Video;

{$IFDEF FPC}
{$mode delphi}
{$ENDIF}

interface

uses
    Windows, Classes, SysUtils, DX12.DXGI, DX12.D3D12;

const
    IID_ID3D12VideoDecoderHeap: TGUID = '{0946B7C9-EBF6-4047-BB73-8683E27DBB1F}';
    IID_ID3D12VideoDevice: TGUID = '{1F052807-0B46-4ACC-8A89-364F793718A4}';
    IID_ID3D12VideoDecoder: TGUID = '{C59B6BDC-7720-4074-A136-17A156037470}';
    IID_ID3D12VideoProcessor: TGUID = '{304FDB32-BEDE-410A-8545-943AC6A46138}';
    IID_ID3D12VideoDecodeCommandList: TGUID = '{3B60536E-AD29-4E64-A269-F853837E5E53}';
    IID_ID3D12VideoProcessCommandList: TGUID = '{AEB2543A-167F-4682-ACC8-D159ED4A6209}';
    IID_ID3D12VideoDecodeCommandList1: TGUID = '{D52F011B-B56E-453C-A05A-A7F311C8F472}';
    IID_ID3D12VideoProcessCommandList1: TGUID = '{542C5C4D-7596-434F-8C93-4EFA6766F267}';
    IID_ID3D12VideoMotionEstimator: TGUID = '{33FDAE0E-098B-428F-87BB-34B695DE08F8}';
    IID_ID3D12VideoMotionVectorHeap: TGUID = '{5BE17987-743A-4061-834B-23D22DAEA505}';
    IID_ID3D12VideoDevice1: TGUID = '{981611AD-A144-4C83-9890-F30E26D658AB}';
    IID_ID3D12VideoEncodeCommandList: TGUID = '{8455293A-0CBD-4831-9B39-FBDBAB724723}';
    IID_ID3D12VideoDecoder1: TGUID = '{79A2E5FB-CCD2-469A-9FDE-195D10951F7E}';
    IID_ID3D12VideoDecoderHeap1: TGUID = '{DA1D98C5-539F-41B2-BF6B-1198A03B6D26}';
    IID_ID3D12VideoProcessor1: TGUID = '{F3CFE615-553F-425C-86D8-EE8C1B1FB01C}';
    IID_ID3D12VideoExtensionCommand: TGUID = '{554E41E8-AE8E-4A8C-B7D2-5B4F274A30E4}';
    IID_ID3D12VideoDevice2: TGUID = '{F019AC49-F838-4A95-9B17-579437C8F513}';
    IID_ID3D12VideoDecodeCommandList2: TGUID = '{6e120880-c114-4153-8036-d247051e1729}';
    IID_ID3D12VideoProcessCommandList2: TGUID = '{db525ae4-6ad6-473c-baa7-59b2e37082e4}';
    IID_ID3D12VideoEncodeCommandList1: TGUID = '{94971eca-2bdb-4769-88cf-3675ea757ebc}';
    IID_ID3D12VideoDecodeCommandList3: TGUID = '{2aee8c37-9562-42da-8abf-61efeb2e4513}';
    IID_ID3D12VideoProcessCommandList3: TGUID = '{1a0a4ca4-9f08-40ce-9558-b411fd2666ff}';

    IID_ID3D12VideoEncoder: TGUID = '{2E0D212D-8DF9-44A6-A770-BB289B182737}';
    IID_ID3D12VideoEncoderHeap: TGUID = '{22B35D96-876A-44C0-B25E-FB8C9C7F1C4A}';
    IID_ID3D12VideoDevice3: TGUID = '{4243ADB4-3A32-4666-973C-0CCC5625DC44}';
    IID_ID3D12VideoEncodeCommandList2: TGUID = '{895491e2-e701-46a9-9a1f-8d3480ed867a}';
    IID_ID3D12VideoEncodeCommandList3: TGUID = '{7f027b22-1515-4e85-aa0d-026486580576}';


    D3D12_VIDEO_DECODE_PROFILE_MPEG2: TGUID = '{ee27417f-5e28-4e65-beea-1d26b508adc9}';
    D3D12_VIDEO_DECODE_PROFILE_MPEG1_AND_MPEG2: TGUID = '{86695f12-340e-4f04-9fd3-9253dd327460}';
    D3D12_VIDEO_DECODE_PROFILE_H264: TGUID = '{1b81be68-a0c7-11d3-b984-00c04f2e73c5}';
    D3D12_VIDEO_DECODE_PROFILE_H264_STEREO_PROGRESSIVE: TGUID = '{d79be8da-0cf1-4c81-b82a-69a4e236f43d}';
    D3D12_VIDEO_DECODE_PROFILE_H264_STEREO: TGUID = '{f9aaccbb-c2b6-4cfc-8779-5707b1760552}';
    D3D12_VIDEO_DECODE_PROFILE_H264_MULTIVIEW: TGUID = '{705b9d82-76cf-49d6-b7e6-ac8872db013c}';
    D3D12_VIDEO_DECODE_PROFILE_VC1: TGUID = '{1b81beA3-a0c7-11d3-b984-00c04f2e73c5}';
    D3D12_VIDEO_DECODE_PROFILE_VC1_D2010: TGUID = '{1b81beA4-a0c7-11d3-b984-00c04f2e73c5}';
    D3D12_VIDEO_DECODE_PROFILE_MPEG4PT2_SIMPLE: TGUID = '{efd64d74-c9e8-41d7-a5e9-e9b0e39fa319}';
    D3D12_VIDEO_DECODE_PROFILE_MPEG4PT2_ADVSIMPLE_NOGMC: TGUID = '{ed418a9f-010d-4eda-9ae3-9a65358d8d2e}';
    D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN: TGUID = '{5b11d51b-2f4c-4452-bcc3-09f2a1160cc0}';
    D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10: TGUID = '{107af0e0-ef1a-4d19-aba8-67a163073d13}';
    D3D12_VIDEO_DECODE_PROFILE_VP9: TGUID = '{463707f8-a1d0-4585-876d-83aa6d60b89e}';
    D3D12_VIDEO_DECODE_PROFILE_VP9_10BIT_PROFILE2: TGUID = '{a4c749ef-6ecf-48aa-8448-50a7a1165ff7}';
    D3D12_VIDEO_DECODE_PROFILE_VP8: TGUID = '{90b899ea-3a62-4705-88b3-8df04b2744e7}';

    D3D12_VIDEO_DECODE_PROFILE_AV1_PROFILE0: TGUID = '{b8be4ccb-cf53-46ba-8d59-d6b8a6da5d2a}';
    D3D12_VIDEO_DECODE_PROFILE_AV1_PROFILE1: TGUID = '{6936ff0f-45b1-4163-9cc1-646ef6946108}';
    D3D12_VIDEO_DECODE_PROFILE_AV1_PROFILE2: TGUID = '{0c5f2aa1-e541-4089-bb7b-98110a19d7c8}';
    D3D12_VIDEO_DECODE_PROFILE_AV1_12BIT_PROFILE2: TGUID = '{17127009-a00f-4ce1-994e-bf4081f6f3f0}';
    D3D12_VIDEO_DECODE_PROFILE_AV1_12BIT_PROFILE2_420: TGUID = '{2d80bed6-9cac-4835-9e91-327bbc4f9ee8}';


type

    TD3D12_VIDEO_FIELD_TYPE = (
        D3D12_VIDEO_FIELD_TYPE_NONE = 0,
        D3D12_VIDEO_FIELD_TYPE_INTERLACED_TOP_FIELD_FIRST = 1,
        D3D12_VIDEO_FIELD_TYPE_INTERLACED_BOTTOM_FIELD_FIRST = 2
        );

    TD3D12_VIDEO_FRAME_STEREO_FORMAT = (
        D3D12_VIDEO_FRAME_STEREO_FORMAT_NONE = 0,
        D3D12_VIDEO_FRAME_STEREO_FORMAT_MONO = 1,
        D3D12_VIDEO_FRAME_STEREO_FORMAT_HORIZONTAL = 2,
        D3D12_VIDEO_FRAME_STEREO_FORMAT_VERTICAL = 3,
        D3D12_VIDEO_FRAME_STEREO_FORMAT_SEPARATE = 4
        );

    TD3D12_VIDEO_FORMAT = record
        Format: TDXGI_FORMAT;
        ColorSpace: TDXGI_COLOR_SPACE_TYPE;
    end;
    PD3D12_VIDEO_FORMAT = ^TD3D12_VIDEO_FORMAT;

    TD3D12_VIDEO_SAMPLE = record
        Width: UINT;
        Height: UINT;
        Format: TD3D12_VIDEO_FORMAT;
    end;
    PD3D12_VIDEO_SAMPLE = ^TD3D12_VIDEO_SAMPLE;

    TD3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE = (
        D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE_NONE = 0,
        D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE_FIELD_BASED = 1
        );

    TD3D12_FEATURE_VIDEO = (
        D3D12_FEATURE_VIDEO_DECODE_SUPPORT = 0,
        D3D12_FEATURE_VIDEO_DECODE_PROFILES = 1,
        D3D12_FEATURE_VIDEO_DECODE_FORMATS = 2,
        D3D12_FEATURE_VIDEO_DECODE_CONVERSION_SUPPORT = 3,
        D3D12_FEATURE_VIDEO_PROCESS_SUPPORT = 5,
        D3D12_FEATURE_VIDEO_PROCESS_MAX_INPUT_STREAMS = 6,
        D3D12_FEATURE_VIDEO_PROCESS_REFERENCE_INFO = 7,
        D3D12_FEATURE_VIDEO_DECODER_HEAP_SIZE = 8,
        D3D12_FEATURE_VIDEO_PROCESSOR_SIZE = 9,
        D3D12_FEATURE_VIDEO_DECODE_PROFILE_COUNT = 10,
        D3D12_FEATURE_VIDEO_DECODE_FORMAT_COUNT = 11,
        D3D12_FEATURE_VIDEO_ARCHITECTURE = 17,
        D3D12_FEATURE_VIDEO_DECODE_HISTOGRAM = 18,
        D3D12_FEATURE_VIDEO_FEATURE_AREA_SUPPORT = 19,
        D3D12_FEATURE_VIDEO_MOTION_ESTIMATOR = 20,
        D3D12_FEATURE_VIDEO_MOTION_ESTIMATOR_SIZE = 21,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMAND_COUNT = 22,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMANDS = 23,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMAND_PARAMETER_COUNT = 24,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMAND_PARAMETERS = 25,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMAND_SUPPORT = 26,
        D3D12_FEATURE_VIDEO_EXTENSION_COMMAND_SIZE = 27,
        D3D12_FEATURE_VIDEO_DECODE_PROTECTED_RESOURCES = 28,
        D3D12_FEATURE_VIDEO_PROCESS_PROTECTED_RESOURCES = 29,
        D3D12_FEATURE_VIDEO_MOTION_ESTIMATOR_PROTECTED_RESOURCES = 30,
        D3D12_FEATURE_VIDEO_DECODER_HEAP_SIZE1 = 31,
        D3D12_FEATURE_VIDEO_PROCESSOR_SIZE1 = 32,
        D3D12_FEATURE_VIDEO_ENCODER_CODEC = 33,
        D3D12_FEATURE_VIDEO_ENCODER_PROFILE_LEVEL = 34,
        D3D12_FEATURE_VIDEO_ENCODER_OUTPUT_RESOLUTION_RATIOS_COUNT = 35,
        D3D12_FEATURE_VIDEO_ENCODER_OUTPUT_RESOLUTION = 36,
        D3D12_FEATURE_VIDEO_ENCODER_INPUT_FORMAT = 37,
        D3D12_FEATURE_VIDEO_ENCODER_RATE_CONTROL_MODE = 38,
        D3D12_FEATURE_VIDEO_ENCODER_INTRA_REFRESH_MODE = 39,
        D3D12_FEATURE_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE = 40,
        D3D12_FEATURE_VIDEO_ENCODER_HEAP_SIZE = 41,
        D3D12_FEATURE_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT = 42,
        D3D12_FEATURE_VIDEO_ENCODER_SUPPORT = 43,
        D3D12_FEATURE_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT = 44,
        D3D12_FEATURE_VIDEO_ENCODER_RESOURCE_REQUIREMENTS = 45
        );

    TD3D12_BITSTREAM_ENCRYPTION_TYPE = (
        D3D12_BITSTREAM_ENCRYPTION_TYPE_NONE = 0
        );

    TD3D12_VIDEO_DECODE_CONFIGURATION = record
        DecodeProfile: TGUID;
        BitstreamEncryption: TD3D12_BITSTREAM_ENCRYPTION_TYPE;
        InterlaceType: TD3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE;
    end;
    PD3D12_VIDEO_DECODE_CONFIGURATION = ^TD3D12_VIDEO_DECODE_CONFIGURATION;

    TD3D12_VIDEO_DECODER_DESC = record
        NodeMask: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
    end;
    PD3D12_VIDEO_DECODER_DESC = ^TD3D12_VIDEO_DECODER_DESC;

    TD3D12_VIDEO_DECODER_HEAP_DESC = record
        NodeMask: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        DecodeWidth: UINT;
        DecodeHeight: UINT;
        Format: TDXGI_FORMAT;
        FrameRate: TDXGI_RATIONAL;
        BitRate: UINT;
        MaxDecodePictureBufferCount: UINT;
    end;
    PD3D12_VIDEO_DECODER_HEAP_DESC = ^TD3D12_VIDEO_DECODER_HEAP_DESC;

    TD3D12_VIDEO_SIZE_RANGE = record
        MaxWidth: UINT;
        MaxHeight: UINT;
        MinWidth: UINT;
        MinHeight: UINT;
    end;
    PD3D12_VIDEO_SIZE_RANGE = ^TD3D12_VIDEO_SIZE_RANGE;

    TD3D12_VIDEO_PROCESS_FILTER = (
        D3D12_VIDEO_PROCESS_FILTER_BRIGHTNESS = 0,
        D3D12_VIDEO_PROCESS_FILTER_CONTRAST = 1,
        D3D12_VIDEO_PROCESS_FILTER_HUE = 2,
        D3D12_VIDEO_PROCESS_FILTER_SATURATION = 3,
        D3D12_VIDEO_PROCESS_FILTER_NOISE_REDUCTION = 4,
        D3D12_VIDEO_PROCESS_FILTER_EDGE_ENHANCEMENT = 5,
        D3D12_VIDEO_PROCESS_FILTER_ANAMORPHIC_SCALING = 6,
        D3D12_VIDEO_PROCESS_FILTER_STEREO_ADJUSTMENT = 7
        );

    TD3D12_VIDEO_PROCESS_FILTER_FLAGS = (
        D3D12_VIDEO_PROCESS_FILTER_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_FILTER_FLAG_BRIGHTNESS = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_BRIGHTNESS)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_CONTRAST = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_CONTRAST)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_HUE = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_HUE)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_SATURATION = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_SATURATION)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_NOISE_REDUCTION = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_NOISE_REDUCTION)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_EDGE_ENHANCEMENT = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_EDGE_ENHANCEMENT)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_ANAMORPHIC_SCALING = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_ANAMORPHIC_SCALING)),
        D3D12_VIDEO_PROCESS_FILTER_FLAG_STEREO_ADJUSTMENT = (1 shl Ord(D3D12_VIDEO_PROCESS_FILTER_STEREO_ADJUSTMENT))
        );


    TD3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS = (
        D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM = int32($80000000),
        D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB = $1
        );

    TD3D12_VIDEO_PROCESS_ALPHA_BLENDING = record
        Enable: longbool;
        Alpha: single;
    end;
    PD3D12_VIDEO_PROCESS_ALPHA_BLENDING = ^TD3D12_VIDEO_PROCESS_ALPHA_BLENDING;

    TD3D12_VIDEO_PROCESS_LUMA_KEY = record
        Enable: longbool;
        Lower: single;
        Upper: single;
    end;
    PD3D12_VIDEO_PROCESS_LUMA_KEY = ^TD3D12_VIDEO_PROCESS_LUMA_KEY;

    TD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC = record
        Format: TDXGI_FORMAT;
        ColorSpace: TDXGI_COLOR_SPACE_TYPE;
        SourceAspectRatio: TDXGI_RATIONAL;
        DestinationAspectRatio: TDXGI_RATIONAL;
        FrameRate: TDXGI_RATIONAL;
        SourceSizeRange: TD3D12_VIDEO_SIZE_RANGE;
        DestinationSizeRange: TD3D12_VIDEO_SIZE_RANGE;
        EnableOrientation: boolean;
        FilterFlags: TD3D12_VIDEO_PROCESS_FILTER_FLAGS;
        StereoFormat: TD3D12_VIDEO_FRAME_STEREO_FORMAT;
        FieldType: TD3D12_VIDEO_FIELD_TYPE;
        DeinterlaceMode: TD3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS;
        EnableAlphaBlending: boolean;
        LumaKey: TD3D12_VIDEO_PROCESS_LUMA_KEY;
        NumPastFrames: UINT;
        NumFutureFrames: UINT;
        EnableAutoProcessing: boolean;
    end;
    PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC = ^TD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC;


    TD3D12_VIDEO_PROCESS_ALPHA_FILL_MODE = (
        D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_OPAQUE = 0,
        D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_BACKGROUND = 1,
        D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_DESTINATION = 2,
        D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_SOURCE_STREAM = 3
        );

    TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC = record
        Format: TDXGI_FORMAT;
        ColorSpace: TDXGI_COLOR_SPACE_TYPE;
        AlphaFillMode: TD3D12_VIDEO_PROCESS_ALPHA_FILL_MODE;
        AlphaFillModeSourceStreamIndex: UINT;
        BackgroundColor: array [0..3] of single;
        FrameRate: TDXGI_RATIONAL;
        EnableStereo: boolean;
    end;
    PD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC = ^TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC;




    ID3D12VideoDecoderHeap = interface(ID3D12Pageable)
        ['{0946B7C9-EBF6-4047-BB73-8683E27DBB1F}']
        function GetDesc(): TD3D12_VIDEO_DECODER_HEAP_DESC; stdcall;
    end;

    PID3D12VideoDecoderHeap = ^ID3D12VideoDecoderHeap;



    ID3D12VideoDevice = interface(IUnknown)
        ['{1F052807-0B46-4ACC-8A89-364F793718A4}']
        function CheckFeatureSupport(FeatureVideo: TD3D12_FEATURE_VIDEO; var pFeatureSupportData: Pointer; FeatureSupportDataSize: UINT): HResult; stdcall;
        function CreateVideoDecoder(const pDesc: TD3D12_VIDEO_DECODER_DESC; const riid: TGUID; out ppVideoDecoder): HResult; stdcall;
        function CreateVideoDecoderHeap(const pVideoDecoderHeapDesc: TD3D12_VIDEO_DECODER_HEAP_DESC; const riid: TGUID; out ppVideoDecoderHeap): HResult; stdcall;
        function CreateVideoProcessor(NodeMask: UINT; const pOutputStreamDesc: TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC; NumInputStreamDescs: UINT; const pInputStreamDescs: PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC;
            const riid: TGUID; out ppVideoProcessor): HResult; stdcall;
    end;

    PID3D12VideoDevice = ^ID3D12VideoDevice;




    ID3D12VideoDecoder = interface(ID3D12Pageable)
        ['{C59B6BDC-7720-4074-A136-17A156037470}']
        function GetDesc(): TD3D12_VIDEO_DECODER_DESC; stdcall;
    end;

    PID3D12VideoDecoder = ^ID3D12VideoDecoder;


    TD3D12_VIDEO_DECODE_TIER = (
        D3D12_VIDEO_DECODE_TIER_NOT_SUPPORTED = 0,
        D3D12_VIDEO_DECODE_TIER_1 = 1,
        D3D12_VIDEO_DECODE_TIER_2 = 2,
        D3D12_VIDEO_DECODE_TIER_3 = 3
        );

    TD3D12_VIDEO_DECODE_SUPPORT_FLAGS = (
        D3D12_VIDEO_DECODE_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_DECODE_SUPPORT_FLAG_SUPPORTED = $1
        );


    TD3D12_VIDEO_DECODE_CONFIGURATION_FLAGS = (
        D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_NONE = 0,
        D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_HEIGHT_ALIGNMENT_MULTIPLE_32_REQUIRED = $1,
        D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_POST_PROCESSING_SUPPORTED = $2,
        D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_REFERENCE_ONLY_ALLOCATIONS_REQUIRED = $4,
        D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_ALLOW_RESOLUTION_CHANGE_ON_NON_KEY_FRAME = $8
        );


    TD3D12_VIDEO_DECODE_STATUS = (
        D3D12_VIDEO_DECODE_STATUS_OK = 0,
        D3D12_VIDEO_DECODE_STATUS_CONTINUE = 1,
        D3D12_VIDEO_DECODE_STATUS_CONTINUE_SKIP_DISPLAY = 2,
        D3D12_VIDEO_DECODE_STATUS_RESTART = 3,
        D3D12_VIDEO_DECODE_STATUS_RATE_EXCEEDED = 4
        );

    TD3D12_VIDEO_DECODE_ARGUMENT_TYPE = (
        D3D12_VIDEO_DECODE_ARGUMENT_TYPE_PICTURE_PARAMETERS = 0,
        D3D12_VIDEO_DECODE_ARGUMENT_TYPE_INVERSE_QUANTIZATION_MATRIX = 1,
        D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL = 2,
        D3D12_VIDEO_DECODE_ARGUMENT_TYPE_MAX_VALID = 3
        );

    TD3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT = record
        NodeIndex: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        Width: UINT;
        Height: UINT;
        DecodeFormat: TDXGI_FORMAT;
        FrameRate: TDXGI_RATIONAL;
        BitRate: UINT;
        SupportFlags: TD3D12_VIDEO_DECODE_SUPPORT_FLAGS;
        ConfigurationFlags: TD3D12_VIDEO_DECODE_CONFIGURATION_FLAGS;
        DecodeTier: TD3D12_VIDEO_DECODE_TIER;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT;

    TD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILE_COUNT = record
        NodeIndex: UINT;
        ProfileCount: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILE_COUNT = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILE_COUNT;

    TD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILES = record
        NodeIndex: UINT;
        ProfileCount: UINT;
        pProfiles{ProfileCount}: PGUID;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILES = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_PROFILES;

    TD3D12_FEATURE_DATA_VIDEO_DECODE_FORMAT_COUNT = record
        NodeIndex: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        FormatCount: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_FORMAT_COUNT = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_FORMAT_COUNT;

    TD3D12_FEATURE_DATA_VIDEO_DECODE_FORMATS = record
        NodeIndex: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        FormatCount: UINT;
        pOutputFormats{FormatCount}: PDXGI_FORMAT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_FORMATS = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_FORMATS;

    TD3D12_FEATURE_DATA_VIDEO_ARCHITECTURE = record
        IOCoherent: boolean;
    end;
    PD3D12_FEATURE_DATA_VIDEO_ARCHITECTURE = ^TD3D12_FEATURE_DATA_VIDEO_ARCHITECTURE;

    TD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT = (
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_Y = 0,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_R = 0,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_U = 1,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_G = 1,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_V = 2,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_B = 2,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_A = 3
        );
    PD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT = ^TD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT;

    TD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS = (
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_NONE = 0,
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_Y = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_Y),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_R = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_R),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_U = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_U),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_G = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_G),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_V = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_V),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_B = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_B),
        D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_A = 1 shl Ord(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_A)
        );
    PD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS = ^TD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS;


    TD3D12_FEATURE_DATA_VIDEO_DECODE_HISTOGRAM = record
        NodeIndex: UINT;
        DecodeProfile: TGUID;
        Width: UINT;
        Height: UINT;
        DecodeFormat: TDXGI_FORMAT;
        Components: TD3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS;
        BinCount: UINT;
        CounterBitDepth: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_HISTOGRAM = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_HISTOGRAM;


    TD3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS = (
        D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAG_SUPPORTED = $1
        );


    TD3D12_VIDEO_SCALE_SUPPORT_FLAGS = (
        D3D12_VIDEO_SCALE_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_SCALE_SUPPORT_FLAG_POW2_ONLY = $1,
        D3D12_VIDEO_SCALE_SUPPORT_FLAG_EVEN_DIMENSIONS_ONLY = $2
        );


    TD3D12_VIDEO_SCALE_SUPPORT = record
        OutputSizeRange: TD3D12_VIDEO_SIZE_RANGE;
        Flags: TD3D12_VIDEO_SCALE_SUPPORT_FLAGS;
    end;
    PD3D12_VIDEO_SCALE_SUPPORT = ^TD3D12_VIDEO_SCALE_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_DECODE_CONVERSION_SUPPORT = record
        NodeIndex: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        DecodeSample: TD3D12_VIDEO_SAMPLE;
        OutputFormat: TD3D12_VIDEO_FORMAT;
        FrameRate: TDXGI_RATIONAL;
        BitRate: UINT;
        SupportFlags: TD3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS;
        ScaleSupport: TD3D12_VIDEO_SCALE_SUPPORT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_CONVERSION_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_CONVERSION_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE = record
        VideoDecoderHeapDesc: TD3D12_VIDEO_DECODER_HEAP_DESC;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE = ^TD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE;


    TD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE = record
        NodeMask: UINT;
        pOutputStreamDesc: PD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC;
        NumInputStreamDescs: UINT;
        pInputStreamDescs: PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;
    PD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE = ^TD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE;


    TD3D12_QUERY_DATA_VIDEO_DECODE_STATISTICS = record
        Status: uint64;
        NumMacroblocksAffected: uint64;
        FrameRate: TDXGI_RATIONAL;
        BitRate: UINT;
    end;
    PD3D12_QUERY_DATA_VIDEO_DECODE_STATISTICS = ^TD3D12_QUERY_DATA_VIDEO_DECODE_STATISTICS;



    TD3D12_VIDEO_DECODE_SUB_SAMPLE_MAPPING_BLOCK = record
        ClearSize: UINT;
        EncryptedSize: UINT;
    end;
    PD3D12_VIDEO_DECODE_SUB_SAMPLE_MAPPING_BLOCK = ^TD3D12_VIDEO_DECODE_SUB_SAMPLE_MAPPING_BLOCK;


    TD3D12_VIDEO_DECODE_FRAME_ARGUMENT = record
        AType: TD3D12_VIDEO_DECODE_ARGUMENT_TYPE;
        Size: UINT;
        pData: Pointer;
    end;
    PD3D12_VIDEO_DECODE_FRAME_ARGUMENT = ^TD3D12_VIDEO_DECODE_FRAME_ARGUMENT;


    TD3D12_VIDEO_DECODE_REFERENCE_FRAMES = record
        NumTexture2Ds: UINT;
        ppTexture2Ds: PID3D12Resource;
        pSubresources: PUINT;
        ppHeaps: PID3D12VideoDecoderHeap;
    end;
    PD3D12_VIDEO_DECODE_REFERENCE_FRAMES = ^TD3D12_VIDEO_DECODE_REFERENCE_FRAMES;


    TD3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM = record
        pBuffer: ID3D12Resource;
        Offset: uint64;
        Size: uint64;
    end;
    PD3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM = ^TD3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM;


    TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS = record
        Enable: boolean;
        pReferenceTexture2D: ID3D12Resource;
        ReferenceSubresource: UINT;
        OutputColorSpace: TDXGI_COLOR_SPACE_TYPE;
        DecodeColorSpace: TDXGI_COLOR_SPACE_TYPE;
    end;
    PD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS = ^TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS;


    TD3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS = record
        NumFrameArguments: UINT;
        FrameArguments: array [0..9] of TD3D12_VIDEO_DECODE_FRAME_ARGUMENT;
        ReferenceFrames: TD3D12_VIDEO_DECODE_REFERENCE_FRAMES;
        CompressedBitstream: TD3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM;
        pHeap: ID3D12VideoDecoderHeap;
    end;
    PD3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS = ^TD3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS;


    TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS = record
        pOutputTexture2D: ID3D12Resource;
        OutputSubresource: UINT;
        ConversionArguments: TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS;
    end;
    PD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS = ^TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS;



    ID3D12VideoProcessor = interface(ID3D12Pageable)
        ['{304FDB32-BEDE-410A-8545-943AC6A46138}']
        function GetNodeMask(): UINT; stdcall;
        function GetNumInputStreamDescs(): UINT; stdcall;
        function GetInputStreamDescs(NumInputStreamDescs: UINT; out pInputStreamDescs{NumInputStreamDescs}: PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC): HResult;
            stdcall;
        function GetOutputStreamDesc(): TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC; stdcall;
    end;


    TD3D12_VIDEO_PROCESS_FEATURE_FLAGS = (
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_ALPHA_FILL = $1,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_LUMA_KEY = $2,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_STEREO = $4,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_ROTATION = $8,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_FLIP = $10,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_ALPHA_BLENDING = $20,
        D3D12_VIDEO_PROCESS_FEATURE_FLAG_PIXEL_ASPECT_RATIO = $40
        );


    TD3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS = (
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_CUSTOM = int32($80000000),
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_DENOISE = $1,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_DERINGING = $2,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_EDGE_ENHANCEMENT = $4,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_COLOR_CORRECTION = $8,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_FLESH_TONE_MAPPING = $10,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_IMAGE_STABILIZATION = $20,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_SUPER_RESOLUTION = $40,
        D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_ANAMORPHIC_SCALING = $80
        );


    TD3D12_VIDEO_PROCESS_ORIENTATION = (
        D3D12_VIDEO_PROCESS_ORIENTATION_DEFAULT = 0,
        D3D12_VIDEO_PROCESS_ORIENTATION_FLIP_HORIZONTAL = 1,
        D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_90 = 2,
        D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_90_FLIP_HORIZONTAL = 3,
        D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_180 = 4,
        D3D12_VIDEO_PROCESS_ORIENTATION_FLIP_VERTICAL = 5,
        D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_270 = 6,
        D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_270_FLIP_HORIZONTAL = 7
        );

    TD3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS = (
        D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_FRAME_DISCONTINUITY = $1,
        D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_FRAME_REPEAT = $2
        );


    TD3D12_VIDEO_PROCESS_FILTER_RANGE = record
        Minimum: int32;
        Maximum: int32;
        ADefault: int32;
        Multiplier: single;
    end;
    PD3D12_VIDEO_PROCESS_FILTER_RANGE = ^TD3D12_VIDEO_PROCESS_FILTER_RANGE;

    TD3D12_VIDEO_PROCESS_SUPPORT_FLAGS = (
        D3D12_VIDEO_PROCESS_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_PROCESS_SUPPORT_FLAG_SUPPORTED = $1
        );


    TD3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT = record
        NodeIndex: UINT;
        InputSample: TD3D12_VIDEO_SAMPLE;
        InputFieldType: TD3D12_VIDEO_FIELD_TYPE;
        InputStereoFormat: TD3D12_VIDEO_FRAME_STEREO_FORMAT;
        InputFrameRate: TDXGI_RATIONAL;
        OutputFormat: TD3D12_VIDEO_FORMAT;
        OutputStereoFormat: TD3D12_VIDEO_FRAME_STEREO_FORMAT;
        OutputFrameRate: TDXGI_RATIONAL;
        SupportFlags: TD3D12_VIDEO_PROCESS_SUPPORT_FLAGS;
        ScaleSupport: TD3D12_VIDEO_SCALE_SUPPORT;
        FeatureSupport: TD3D12_VIDEO_PROCESS_FEATURE_FLAGS;
        DeinterlaceSupport: TD3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS;
        AutoProcessingSupport: TD3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS;
        FilterSupport: TD3D12_VIDEO_PROCESS_FILTER_FLAGS;
        FilterRangeSupport: array [0.. 31] of TD3D12_VIDEO_PROCESS_FILTER_RANGE;
    end;
    PD3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_PROCESS_MAX_INPUT_STREAMS = record
        NodeIndex: UINT;
        MaxInputStreams: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_PROCESS_MAX_INPUT_STREAMS = ^TD3D12_FEATURE_DATA_VIDEO_PROCESS_MAX_INPUT_STREAMS;


    TD3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO = record
        NodeIndex: UINT;
        DeinterlaceMode: TD3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS;
        Filters: TD3D12_VIDEO_PROCESS_FILTER_FLAGS;
        FeatureSupport: TD3D12_VIDEO_PROCESS_FEATURE_FLAGS;
        InputFrameRate: TDXGI_RATIONAL;
        OutputFrameRate: TDXGI_RATIONAL;
        EnableAutoProcessing: boolean;
        PastFrames: UINT;
        FutureFrames: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO = ^TD3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO;


    TD3D12_VIDEO_PROCESS_REFERENCE_SET = record
        NumPastFrames: UINT;
        ppPastFrames: PID3D12Resource;
        pPastSubresources: PUINT;
        NumFutureFrames: UINT;
        ppFutureFrames: PID3D12Resource;
        pFutureSubresources: PUINT;
    end;
    PD3D12_VIDEO_PROCESS_REFERENCE_SET = ^TD3D12_VIDEO_PROCESS_REFERENCE_SET;


    TD3D12_VIDEO_PROCESS_TRANSFORM = record
        SourceRectangle: TD3D12_RECT;
        DestinationRectangle: TD3D12_RECT;
        Orientation: TD3D12_VIDEO_PROCESS_ORIENTATION;
    end;
    PD3D12_VIDEO_PROCESS_TRANSFORM = ^TD3D12_VIDEO_PROCESS_TRANSFORM;


    TD3D12_VIDEO_PROCESS_INPUT_STREAM_RATE = record
        OutputIndex: UINT;
        InputFrameOrField: UINT;
    end;
    PD3D12_VIDEO_PROCESS_INPUT_STREAM_RATE = ^TD3D12_VIDEO_PROCESS_INPUT_STREAM_RATE;

    TD3D12_VIDEO_PROCESS_INPUT_STREAM = record
        pTexture2D: ID3D12Resource;
        Subresource: UINT;
        ReferenceSet: TD3D12_VIDEO_PROCESS_REFERENCE_SET;
    end;
    PD3D12_VIDEO_PROCESS_INPUT_STREAM = ^TD3D12_VIDEO_PROCESS_INPUT_STREAM;


    TD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS = record
        InputStream: array [0..1] of TD3D12_VIDEO_PROCESS_INPUT_STREAM;
        Transform: TD3D12_VIDEO_PROCESS_TRANSFORM;
        Flags: TD3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS;
        RateInfo: TD3D12_VIDEO_PROCESS_INPUT_STREAM_RATE;
        FilterLevels: array[0..31] of int32;
        AlphaBlending: TD3D12_VIDEO_PROCESS_ALPHA_BLENDING;
    end;
    PD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS = ^TD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS;


    TD3D12_VIDEO_PROCESS_OUTPUT_STREAM = record
        pTexture2D: ID3D12Resource;
        Subresource: UINT;
    end;
    PD3D12_VIDEO_PROCESS_OUTPUT_STREAM = ^TD3D12_VIDEO_PROCESS_OUTPUT_STREAM;


    TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS = record
        OutputStream: array [0..1] of TD3D12_VIDEO_PROCESS_OUTPUT_STREAM;
        TargetRectangle: TD3D12_RECT;
    end;
    PD3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS = ^TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS;


    ID3D12VideoDecodeCommandList = interface(ID3D12CommandList)
        ['{3B60536E-AD29-4E64-A269-F853837E5E53}']
        function Close(): HResult; stdcall;
        function Reset(pAllocator: ID3D12CommandAllocator): HResult; stdcall;
        procedure ClearState(); stdcall;
        procedure ResourceBarrier(NumBarriers: UINT; const pBarriers: PD3D12_RESOURCE_BARRIER); stdcall;
        procedure DiscardResource(pResource: ID3D12Resource; const pRegion: TD3D12_DISCARD_REGION); stdcall;
        procedure BeginQuery(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure EndQuery(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure ResolveQueryData(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; StartIndex: UINT; NumQueries: UINT; pDestinationBuffer: ID3D12Resource; AlignedDestinationBufferOffset: uint64); stdcall;
        procedure SetPredication(pBuffer: ID3D12Resource; AlignedBufferOffset: uint64; Operation: TD3D12_PREDICATION_OP); stdcall;
        procedure SetMarker(Metadata: UINT; const pData: Pointer; Size: UINT); stdcall;
        procedure BeginEvent(Metadata: UINT; const pData: Pointer; Size: UINT); stdcall;
        procedure EndEvent(); stdcall;
        procedure DecodeFrame(pDecoder: ID3D12VideoDecoder; const pOutputArguments: TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS; const pInputArguments: TD3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS); stdcall;
        procedure WriteBufferImmediate(Count: UINT; const pParams: PD3D12_WRITEBUFFERIMMEDIATE_PARAMETER; const pModes: PD3D12_WRITEBUFFERIMMEDIATE_MODE); stdcall;
    end;



    ID3D12VideoProcessCommandList = interface(ID3D12CommandList)
        ['{AEB2543A-167F-4682-ACC8-D159ED4A6209}']
        function Close(): HResult; stdcall;
        function Reset(pAllocator: ID3D12CommandAllocator): HResult; stdcall;
        procedure ClearState(); stdcall;
        procedure ResourceBarrier(NumBarriers: UINT; const pBarriers: PD3D12_RESOURCE_BARRIER); stdcall;
        procedure DiscardResource(pResource: ID3D12Resource; const pRegion: TD3D12_DISCARD_REGION); stdcall;
        procedure BeginQuery(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure EndQuery(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure ResolveQueryData(pQueryHeap: ID3D12QueryHeap; QType: TD3D12_QUERY_TYPE; StartIndex: UINT; NumQueries: UINT; pDestinationBuffer: ID3D12Resource; AlignedDestinationBufferOffset: uint64); stdcall;
        procedure SetPredication(pBuffer: ID3D12Resource; AlignedBufferOffset: uint64; Operation: TD3D12_PREDICATION_OP); stdcall;
        procedure SetMarker(Metadata: UINT; const pData: pointer; Size: UINT); stdcall;
        procedure BeginEvent(Metadata: UINT; const pData: pointer; Size: UINT); stdcall;
        procedure EndEvent(); stdcall;
        procedure ProcessFrames(pVideoProcessor: ID3D12VideoProcessor; const pOutputArguments: TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS; NumInputStreams: UINT; const pInputArguments: PD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS);
            stdcall;
        procedure WriteBufferImmediate(Count: UINT; const pParams: PD3D12_WRITEBUFFERIMMEDIATE_PARAMETER; const pModes: PD3D12_WRITEBUFFERIMMEDIATE_MODE); stdcall;
    end;


    TD3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM = record
        Offset: uint64;
        pBuffer: ID3D12Resource;
    end;
    PD3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM = ^TD3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM;


    TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1 = record
        Enable: boolean;
        pReferenceTexture2D: ID3D12Resource;
        ReferenceSubresource: UINT;
        OutputColorSpace: TDXGI_COLOR_SPACE_TYPE;
        DecodeColorSpace: TDXGI_COLOR_SPACE_TYPE;
        OutputWidth: UINT;
        OutputHeight: UINT;
    end;
    PD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1 = ^TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1;


    TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 = record
        pOutputTexture2D: ID3D12Resource;
        OutputSubresource: UINT;
        ConversionArguments: TD3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1;
        Histograms: array[0..3] of TD3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM;
    end;
    PD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 = ^TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1;


    ID3D12VideoDecodeCommandList1 = interface(ID3D12VideoDecodeCommandList)
        ['{D52F011B-B56E-453C-A05A-A7F311C8F472}']
        procedure DecodeFrame1(pDecoder: ID3D12VideoDecoder; const pOutputArguments: TD3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1; const pInputArguments: TD3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS);
            stdcall;
    end;


    TD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 = record
        InputStream: array[0..1] of TD3D12_VIDEO_PROCESS_INPUT_STREAM;
        Transform: TD3D12_VIDEO_PROCESS_TRANSFORM;
        Flags: TD3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS;
        RateInfo: TD3D12_VIDEO_PROCESS_INPUT_STREAM_RATE;
        FilterLevels: array[0.. 31] of int32;
        AlphaBlending: TD3D12_VIDEO_PROCESS_ALPHA_BLENDING;
        FieldType: TD3D12_VIDEO_FIELD_TYPE;
    end;
    PD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 = ^TD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1;



    ID3D12VideoProcessCommandList1 = interface(ID3D12VideoProcessCommandList)
        ['{542C5C4D-7596-434F-8C93-4EFA6766F267}']
        procedure ProcessFrames1(pVideoProcessor: ID3D12VideoProcessor; const pOutputArguments: TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS; NumInputStreams: UINT;
            const pInputArguments {NumInputStreams}: PD3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1); stdcall;
    end;

    TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE = (
        D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_8X8 = 0,
        D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_16X16 = 1);

    TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_FLAGS = (
        D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_FLAG_NONE = 0,
        D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_FLAG_8X8 = (1 shl Ord(D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_8X8)),
        D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_FLAG_16X16 = (1 shl Ord(D3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_16X16)));

    TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION = (
        D3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_QUARTER_PEL = 0);

    TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_FLAGS = (
        D3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_FLAG_NONE = 0,
        D3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_FLAG_QUARTER_PEL = (1 shl Ord(D3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_QUARTER_PEL)));

    TD3D12_FEATURE_DATA_VIDEO_FEATURE_AREA_SUPPORT = record
        NodeIndex: UINT;
        VideoDecodeSupport: boolean;
        VideoProcessSupport: boolean;
        VideoEncodeSupport: boolean;
    end;
    PD3D12_FEATURE_DATA_VIDEO_FEATURE_AREA_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_FEATURE_AREA_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR = record
        NodeIndex: UINT;
        InputFormat: TDXGI_FORMAT;
        BlockSizeFlags: TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE_FLAGS;
        PrecisionFlags: TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION_FLAGS;
        SizeRange: TD3D12_VIDEO_SIZE_RANGE;
    end;
    PD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR = ^TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR;


    TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_SIZE = record
        NodeIndex: UINT;
        InputFormat: TDXGI_FORMAT;
        BlockSize: TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE;
        Precision: TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION;
        SizeRange: TD3D12_VIDEO_SIZE_RANGE;
        _Protected: boolean;
        MotionVectorHeapMemoryPoolL0Size: uint64;
        MotionVectorHeapMemoryPoolL1Size: uint64;
        MotionEstimatorMemoryPoolL0Size: uint64;
        MotionEstimatorMemoryPoolL1Size: uint64;
    end;
    PD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_SIZE = ^TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_SIZE;


    TD3D12_VIDEO_MOTION_ESTIMATOR_DESC = record
        NodeMask: UINT;
        InputFormat: TDXGI_FORMAT;
        BlockSize: TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE;
        Precision: TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION;
        SizeRange: TD3D12_VIDEO_SIZE_RANGE;
    end;
    PD3D12_VIDEO_MOTION_ESTIMATOR_DESC = ^TD3D12_VIDEO_MOTION_ESTIMATOR_DESC;


    ID3D12VideoMotionEstimator = interface(ID3D12Pageable)
        ['{33FDAE0E-098B-428F-87BB-34B695DE08F8}']
        function GetDesc(): TD3D12_VIDEO_MOTION_ESTIMATOR_DESC; stdcall;
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;


    TD3D12_VIDEO_MOTION_VECTOR_HEAP_DESC = record
        NodeMask: UINT;
        InputFormat: TDXGI_FORMAT;
        BlockSize: TD3D12_VIDEO_MOTION_ESTIMATOR_SEARCH_BLOCK_SIZE;
        Precision: TD3D12_VIDEO_MOTION_ESTIMATOR_VECTOR_PRECISION;
        SizeRange: TD3D12_VIDEO_SIZE_RANGE;
    end;
    PD3D12_VIDEO_MOTION_VECTOR_HEAP_DESC = ^TD3D12_VIDEO_MOTION_VECTOR_HEAP_DESC;


    ID3D12VideoMotionVectorHeap = interface(ID3D12Pageable)
        ['{5BE17987-743A-4061-834B-23D22DAEA505}']
        function GetDesc(): TD3D12_VIDEO_MOTION_VECTOR_HEAP_DESC; stdcall;
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;


    ID3D12VideoDevice1 = interface(ID3D12VideoDevice)
        ['{981611AD-A144-4C83-9890-F30E26D658AB}']
        function CreateVideoMotionEstimator(const pDesc: TD3D12_VIDEO_MOTION_ESTIMATOR_DESC; pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoMotionEstimator): HResult; stdcall;
        function CreateVideoMotionVectorHeap(const pDesc: TD3D12_VIDEO_MOTION_VECTOR_HEAP_DESC; pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoMotionVectorHeap): HResult; stdcall;
    end;


    TD3D12_RESOURCE_COORDINATE = record
        X: uint64;
        Y: UINT;
        Z: UINT;
        SubresourceIndex: UINT;
    end;
    PD3D12_RESOURCE_COORDINATE = ^TD3D12_RESOURCE_COORDINATE;


    TD3D12_VIDEO_MOTION_ESTIMATOR_OUTPUT = record
        pMotionVectorHeap: ID3D12VideoMotionVectorHeap;
    end;
    PD3D12_VIDEO_MOTION_ESTIMATOR_OUTPUT = ^TD3D12_VIDEO_MOTION_ESTIMATOR_OUTPUT;


    TD3D12_VIDEO_MOTION_ESTIMATOR_INPUT = record
        pInputTexture2D: ID3D12Resource;
        InputSubresourceIndex: UINT;
        pReferenceTexture2D: ID3D12Resource;
        ReferenceSubresourceIndex: UINT;
        pHintMotionVectorHeap: ID3D12VideoMotionVectorHeap;
    end;
    PD3D12_VIDEO_MOTION_ESTIMATOR_INPUT = ^TD3D12_VIDEO_MOTION_ESTIMATOR_INPUT;


    TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_OUTPUT = record
        pMotionVectorTexture2D: ID3D12Resource;
        MotionVectorCoordinate: TD3D12_RESOURCE_COORDINATE;
    end;
    PD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_OUTPUT = ^TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_OUTPUT;


    TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_INPUT = record
        pMotionVectorHeap: ID3D12VideoMotionVectorHeap;
        PixelWidth: UINT;
        PixelHeight: UINT;
    end;
    PD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_INPUT = ^TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_INPUT;


    ID3D12VideoEncodeCommandList = interface(ID3D12CommandList)
        ['{8455293A-0CBD-4831-9B39-FBDBAB724723}']
        function Close(): HResult; stdcall;
        function Reset(pAllocator: ID3D12CommandAllocator): HResult; stdcall;
        procedure ClearState(); stdcall;
        procedure ResourceBarrier(NumBarriers: UINT; const pBarriers {NumBarriers}: PD3D12_RESOURCE_BARRIER); stdcall;
        procedure DiscardResource(pResource: ID3D12Resource; const pRegion: TD3D12_DISCARD_REGION); stdcall;
        procedure BeginQuery(pQueryHeap: ID3D12QueryHeap; _Type: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure EndQuery(pQueryHeap: ID3D12QueryHeap; _Type: TD3D12_QUERY_TYPE; Index: UINT); stdcall;
        procedure ResolveQueryData(pQueryHeap: ID3D12QueryHeap; _Type: TD3D12_QUERY_TYPE; StartIndex: UINT; NumQueries: UINT; pDestinationBuffer: ID3D12Resource; AlignedDestinationBufferOffset: uint64); stdcall;
        procedure SetPredication(pBuffer: ID3D12Resource; AlignedBufferOffset: uint64; Operation: TD3D12_PREDICATION_OP); stdcall;
        procedure SetMarker(Metadata: UINT; const pData {Size}: Pointer; Size: UINT); stdcall;
        procedure BeginEvent(Metadata: UINT; const pData {Size}: Pointer; Size: UINT); stdcall;
        procedure EndEvent(); stdcall;
        procedure EstimateMotion(pMotionEstimator: ID3D12VideoMotionEstimator; const pOutputArguments: TD3D12_VIDEO_MOTION_ESTIMATOR_OUTPUT; const pInputArguments: TD3D12_VIDEO_MOTION_ESTIMATOR_INPUT); stdcall;
        procedure ResolveMotionVectorHeap(const pOutputArguments: TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_OUTPUT; const pInputArguments: TD3D12_RESOLVE_VIDEO_MOTION_VECTOR_HEAP_INPUT); stdcall;
        procedure WriteBufferImmediate(Count: UINT; const pParams {Count}: PD3D12_WRITEBUFFERIMMEDIATE_PARAMETER; const pModes {Count}: PD3D12_WRITEBUFFERIMMEDIATE_MODE); stdcall;
        procedure SetProtectedResourceSession(pProtectedResourceSession: ID3D12ProtectedResourceSession); stdcall;
    end;


    TD3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAGS = (
        D3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAG_SUPPORTED = $1);


    TD3D12_FEATURE_DATA_VIDEO_DECODE_PROTECTED_RESOURCES = record
        NodeIndex: UINT;
        Configuration: TD3D12_VIDEO_DECODE_CONFIGURATION;
        SupportFlags: TD3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAGS;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODE_PROTECTED_RESOURCES = ^TD3D12_FEATURE_DATA_VIDEO_DECODE_PROTECTED_RESOURCES;


    TD3D12_FEATURE_DATA_VIDEO_PROCESS_PROTECTED_RESOURCES = record
        NodeIndex: UINT;
        SupportFlags: TD3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAGS;
    end;
    PD3D12_FEATURE_DATA_VIDEO_PROCESS_PROTECTED_RESOURCES = ^TD3D12_FEATURE_DATA_VIDEO_PROCESS_PROTECTED_RESOURCES;


    TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_PROTECTED_RESOURCES = record
        NodeIndex: UINT;
        SupportFlags: TD3D12_VIDEO_PROTECTED_RESOURCE_SUPPORT_FLAGS;
    end;
    PD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_PROTECTED_RESOURCES = ^TD3D12_FEATURE_DATA_VIDEO_MOTION_ESTIMATOR_PROTECTED_RESOURCES;


    TD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 = record
        VideoDecoderHeapDesc: TD3D12_VIDEO_DECODER_HEAP_DESC;
        _Protected: boolean;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;
    PD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 = ^TD3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1;


    TD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE1 = record
        NodeMask: UINT;
        pOutputStreamDesc: PD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC;
        NumInputStreamDescs: UINT;
        pInputStreamDescs: PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC;
        _Protected: boolean;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;

    PD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE1 = ^TD3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE1;


    TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE = (
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_CREATION = 0,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_INITIALIZATION = 1,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_EXECUTION = 2,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_CAPS_INPUT = 3,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_CAPS_OUTPUT = 4,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_DEVICE_EXECUTE_INPUT = 5,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE_DEVICE_EXECUTE_OUTPUT = 6);


    TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE = (
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_UINT8 = 0,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_UINT16 = 1,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_UINT32 = 2,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_UINT64 = 3,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_SINT8 = 4,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_SINT16 = 5,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_SINT32 = 6,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_SINT64 = 7,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_FLOAT = 8,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_DOUBLE = 9,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE_RESOURCE = 10);


    TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_FLAGS = (
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_FLAG_NONE = 0,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_FLAG_READ = $1,
        D3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_FLAG_WRITE = $2);


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_COUNT = record
        NodeIndex: UINT;
        CommandCount: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_COUNT = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_COUNT;



    TD3D12_VIDEO_EXTENSION_COMMAND_INFO = record
        CommandId: TGUID;
        Name: LPCWSTR;
        CommandListSupportFlags: TD3D12_COMMAND_LIST_SUPPORT_FLAGS;
    end;
    PD3D12_VIDEO_EXTENSION_COMMAND_INFO = ^TD3D12_VIDEO_EXTENSION_COMMAND_INFO;


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMANDS = record
        NodeIndex: UINT;
        CommandCount: UINT;
        pCommandInfos {CommandCount}: PD3D12_VIDEO_EXTENSION_COMMAND_INFO;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMANDS = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMANDS;


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETER_COUNT = record
        CommandId: TGUID;
        Stage: TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE;
        ParameterCount: UINT;
        ParameterPacking: UINT;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETER_COUNT = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETER_COUNT;


    TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_INFO = record
        Name: LPCWSTR;
        _Type: TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_TYPE;
        Flags: TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_FLAGS;
    end;
    PD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_INFO = ^TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_INFO;


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETERS = record
        CommandId: TGUID;
        Stage: TD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_STAGE;
        ParameterCount: UINT;
        pParameterInfos {ParameterCount}: PD3D12_VIDEO_EXTENSION_COMMAND_PARAMETER_INFO;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETERS = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_PARAMETERS;


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SUPPORT = record
        NodeIndex: UINT;
        CommandId: TGUID;
        pInputData {InputDataSizeInBytes}: Pointer;
        InputDataSizeInBytes: SIZE_T;
        pOutputData {OutputDataSizeInBytes}: pointer;
        OutputDataSizeInBytes: SIZE_T;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SIZE = record
        NodeIndex: UINT;
        CommandId: TGUID;
        pCreationParameters {CreationParametersDataSizeInBytes}: Pointer;
        CreationParametersSizeInBytes: SIZE_T;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;
    PD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SIZE = ^TD3D12_FEATURE_DATA_VIDEO_EXTENSION_COMMAND_SIZE;


    TD3D12_VIDEO_EXTENSION_COMMAND_DESC = record
        NodeMask: UINT;
        CommandId: TGUID;
    end;
    PD3D12_VIDEO_EXTENSION_COMMAND_DESC = ^TD3D12_VIDEO_EXTENSION_COMMAND_DESC;


    ID3D12VideoDecoder1 = interface(ID3D12VideoDecoder)
        ['{79A2E5FB-CCD2-469A-9FDE-195D10951F7E}']
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;


    ID3D12VideoDecoderHeap1 = interface(ID3D12VideoDecoderHeap)
        ['{DA1D98C5-539F-41B2-BF6B-1198A03B6D26}']
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;


    ID3D12VideoProcessor1 = interface(ID3D12VideoProcessor)
        ['{F3CFE615-553F-425C-86D8-EE8C1B1FB01C}']
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;

    ID3D12VideoExtensionCommand = interface(ID3D12Pageable)
        ['{554E41E8-AE8E-4A8C-B7D2-5B4F274A30E4}']
        function GetDesc(): TD3D12_VIDEO_EXTENSION_COMMAND_DESC; stdcall;
        function GetProtectedResourceSession(const riid: TGUID; out ppProtectedSession): HResult; stdcall;
    end;


    ID3D12VideoDevice2 = interface(ID3D12VideoDevice1)
        ['{F019AC49-F838-4A95-9B17-579437C8F513}']
        function CreateVideoDecoder1(const pDesc: TD3D12_VIDEO_DECODER_DESC; pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoDecoder): HResult; stdcall;
        function CreateVideoDecoderHeap1(const pVideoDecoderHeapDesc: TD3D12_VIDEO_DECODER_HEAP_DESC; pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoDecoderHeap): HResult; stdcall;
        function CreateVideoProcessor1(NodeMask: UINT; const pOutputStreamDesc: TD3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC; NumInputStreamDescs: UINT; const pInputStreamDescs {NumInputStreamDescs}: PD3D12_VIDEO_PROCESS_INPUT_STREAM_DESC;
            pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoProcessor): HResult; stdcall;
        function CreateVideoExtensionCommand(const pDesc: TD3D12_VIDEO_EXTENSION_COMMAND_DESC; const pCreationParameters {CreationParametersDataSizeInBytes}: Pointer; CreationParametersDataSizeInBytes: SIZE_T;
            pProtectedResourceSession: ID3D12ProtectedResourceSession; const riid: TGUID; out ppVideoExtensionCommand): HResult; stdcall;
        function ExecuteExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pExecutionParameters {ExecutionParametersSizeInBytes}: Pointer; ExecutionParametersSizeInBytes: SIZE_T;
            out pOutputData {OutputDataSizeInBytes}: Pointer; OutputDataSizeInBytes: SIZE_T): HResult; stdcall;
    end;


    ID3D12VideoDecodeCommandList2 = interface(ID3D12VideoDecodeCommandList1)
        ['{6e120880-c114-4153-8036-d247051e1729}']
        procedure SetProtectedResourceSession(pProtectedResourceSession: ID3D12ProtectedResourceSession); stdcall;
        procedure InitializeExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pInitializationParameters {InitializationParametersSizeInBytes}: pointer; InitializationParametersSizeInBytes: SIZE_T); stdcall;
        procedure ExecuteExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pExecutionParameters {ExecutionParametersSizeInBytes}: pointer; ExecutionParametersSizeInBytes: SIZE_T); stdcall;
    end;


    ID3D12VideoDecodeCommandList3 = interface(ID3D12VideoDecodeCommandList2)
        ['{2aee8c37-9562-42da-8abf-61efeb2e4513}']
        procedure Barrier(NumBarrierGroups: uint32; const pBarrierGroups {NumBarrierGroups}: PD3D12_BARRIER_GROUP); stdcall;
    end;


    ID3D12VideoProcessCommandList2 = interface(ID3D12VideoProcessCommandList1)
        ['{db525ae4-6ad6-473c-baa7-59b2e37082e4}']
        procedure SetProtectedResourceSession(pProtectedResourceSession: ID3D12ProtectedResourceSession); stdcall;
        procedure InitializeExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pInitializationParameters {InitializationParametersSizeInBytes}: pointer; InitializationParametersSizeInBytes: SIZE_T); stdcall;
        procedure ExecuteExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pExecutionParameters {ExecutionParametersSizeInBytes}: pointer; ExecutionParametersSizeInBytes: SIZE_T); stdcall;
    end;


    ID3D12VideoProcessCommandList3 = interface(ID3D12VideoProcessCommandList2)
        ['{1a0a4ca4-9f08-40ce-9558-b411fd2666ff}']
        procedure Barrier(NumBarrierGroups: uint32; const pBarrierGroups {NumBarrierGroups}: PD3D12_BARRIER_GROUP); stdcall;
    end;


    ID3D12VideoEncodeCommandList1 = interface(ID3D12VideoEncodeCommandList)
        ['{94971eca-2bdb-4769-88cf-3675ea757ebc}']
        procedure InitializeExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pInitializationParameters {InitializationParametersSizeInBytes}: pointer; InitializationParametersSizeInBytes: SIZE_T); stdcall;
        procedure ExecuteExtensionCommand(pExtensionCommand: ID3D12VideoExtensionCommand; const pExecutionParameters {ExecutionParametersSizeInBytes}: pointer; ExecutionParametersSizeInBytes: SIZE_T); stdcall;
    end;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL_MODE = (
        D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_ABSOLUTE_QP_MAP = 0,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_CQP = 1,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_CBR = 2,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_VBR = 3,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE_QVBR = 4);
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_MODE = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_MODE;

    TD3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS = (
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_DELTA_QP = $1,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_FRAME_ANALYSIS = $2,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_QP_RANGE = $4,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_INITIAL_QP = $8,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_MAX_FRAME_SIZE = $10,
        D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAG_ENABLE_VBV_SIZES = $20);
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL_CQP = record
        ConstantQP_FullIntracodedFrame: UINT;
        ConstantQP_InterPredictedFrame_PrevRefOnly: UINT;
        ConstantQP_InterPredictedFrame_BiDirectionalRef: UINT;
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_CQP = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_CQP;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL_CBR = record
        InitialQP: UINT;
        MinQP: UINT;
        MaxQP: UINT;
        MaxFrameBitSize: uint64;
        TargetBitRate: uint64;
        VBVCapacity: uint64;
        InitialVBVFullness: uint64;
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_CBR = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_CBR;

    TD3D12_VIDEO_ENCODER_RATE_CONTROL_VBR = record
        InitialQP: UINT;
        MinQP: UINT;
        MaxQP: UINT;
        MaxFrameBitSize: uint64;
        TargetAvgBitRate: uint64;
        PeakBitRate: uint64;
        VBVCapacity: uint64;
        InitialVBVFullness: uint64;
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_VBR = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_VBR;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR = record
        InitialQP: UINT;
        MinQP: UINT;
        MaxQP: UINT;
        MaxFrameBitSize: uint64;
        TargetAvgBitRate: uint64;
        PeakBitRate: uint64;
        ConstantQualityTarget: UINT;
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS = record
        DataSize: UINT;
        case integer of
            0: (pConfiguration_CQP: PD3D12_VIDEO_ENCODER_RATE_CONTROL_CQP);
            1: (pConfiguration_CBR: PD3D12_VIDEO_ENCODER_RATE_CONTROL_CBR);
            2: (pConfiguration_VBR: PD3D12_VIDEO_ENCODER_RATE_CONTROL_VBR);
            3: (pConfiguration_QVBR: PD3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR);
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS;


    TD3D12_VIDEO_ENCODER_RATE_CONTROL = record
        Mode: TD3D12_VIDEO_ENCODER_RATE_CONTROL_MODE;
        Flags: TD3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS;
        ConfigParams: TD3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS;
        TargetFrameRate: TDXGI_RATIONAL;
    end;
    PD3D12_VIDEO_ENCODER_RATE_CONTROL = ^TD3D12_VIDEO_ENCODER_RATE_CONTROL;


    TD3D12_VIDEO_ENCODER_CODEC = (
        D3D12_VIDEO_ENCODER_CODEC_H264 = 0,
        D3D12_VIDEO_ENCODER_CODEC_HEVC = 1);
    PD3D12_VIDEO_ENCODER_CODEC = ^TD3D12_VIDEO_ENCODER_CODEC;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        IsSupported: boolean;
    end;
    PD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC;


    TD3D12_VIDEO_ENCODER_PROFILE_H264 = (
        D3D12_VIDEO_ENCODER_PROFILE_H264_MAIN = 0,
        D3D12_VIDEO_ENCODER_PROFILE_H264_HIGH = 1,
        D3D12_VIDEO_ENCODER_PROFILE_H264_HIGH_10 = 2);

    PD3D12_VIDEO_ENCODER_PROFILE_H264 = ^TD3D12_VIDEO_ENCODER_PROFILE_H264;


    TD3D12_VIDEO_ENCODER_PROFILE_HEVC = (
        D3D12_VIDEO_ENCODER_PROFILE_HEVC_MAIN = 0,
        D3D12_VIDEO_ENCODER_PROFILE_HEVC_MAIN10 = 1);

    PD3D12_VIDEO_ENCODER_PROFILE_HEVC = ^TD3D12_VIDEO_ENCODER_PROFILE_HEVC;


    TD3D12_VIDEO_ENCODER_PROFILE_DESC = record
        DataSize: UINT;
        case integer of
            0: (pH264Profile: PD3D12_VIDEO_ENCODER_PROFILE_H264);
            1: (pHEVCProfile: PD3D12_VIDEO_ENCODER_PROFILE_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_PROFILE_DESC = ^TD3D12_VIDEO_ENCODER_PROFILE_DESC;


    TD3D12_VIDEO_ENCODER_LEVELS_H264 = (
        D3D12_VIDEO_ENCODER_LEVELS_H264_1 = 0,
        D3D12_VIDEO_ENCODER_LEVELS_H264_1b = 1,
        D3D12_VIDEO_ENCODER_LEVELS_H264_11 = 2,
        D3D12_VIDEO_ENCODER_LEVELS_H264_12 = 3,
        D3D12_VIDEO_ENCODER_LEVELS_H264_13 = 4,
        D3D12_VIDEO_ENCODER_LEVELS_H264_2 = 5,
        D3D12_VIDEO_ENCODER_LEVELS_H264_21 = 6,
        D3D12_VIDEO_ENCODER_LEVELS_H264_22 = 7,
        D3D12_VIDEO_ENCODER_LEVELS_H264_3 = 8,
        D3D12_VIDEO_ENCODER_LEVELS_H264_31 = 9,
        D3D12_VIDEO_ENCODER_LEVELS_H264_32 = 10,
        D3D12_VIDEO_ENCODER_LEVELS_H264_4 = 11,
        D3D12_VIDEO_ENCODER_LEVELS_H264_41 = 12,
        D3D12_VIDEO_ENCODER_LEVELS_H264_42 = 13,
        D3D12_VIDEO_ENCODER_LEVELS_H264_5 = 14,
        D3D12_VIDEO_ENCODER_LEVELS_H264_51 = 15,
        D3D12_VIDEO_ENCODER_LEVELS_H264_52 = 16,
        D3D12_VIDEO_ENCODER_LEVELS_H264_6 = 17,
        D3D12_VIDEO_ENCODER_LEVELS_H264_61 = 18,
        D3D12_VIDEO_ENCODER_LEVELS_H264_62 = 19);

    PD3D12_VIDEO_ENCODER_LEVELS_H264 = ^TD3D12_VIDEO_ENCODER_LEVELS_H264;


    TD3D12_VIDEO_ENCODER_TIER_HEVC = (
        D3D12_VIDEO_ENCODER_TIER_HEVC_MAIN = 0,
        D3D12_VIDEO_ENCODER_TIER_HEVC_HIGH = 1);

    PD3D12_VIDEO_ENCODER_TIER_HEVC = ^TD3D12_VIDEO_ENCODER_TIER_HEVC;


    TD3D12_VIDEO_ENCODER_LEVELS_HEVC = (
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_1 = 0,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_2 = 1,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_21 = 2,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_3 = 3,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_31 = 4,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_4 = 5,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_41 = 6,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_5 = 7,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_51 = 8,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_52 = 9,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_6 = 10,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_61 = 11,
        D3D12_VIDEO_ENCODER_LEVELS_HEVC_62 = 12);
    PD3D12_VIDEO_ENCODER_LEVELS_HEVC = ^TD3D12_VIDEO_ENCODER_LEVELS_HEVC;


    TD3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC = record
        Level: TD3D12_VIDEO_ENCODER_LEVELS_HEVC;
        Tier: TD3D12_VIDEO_ENCODER_TIER_HEVC;
    end;

    PD3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC = ^TD3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC;


    TD3D12_VIDEO_ENCODER_LEVEL_SETTING = record
        DataSize: UINT;
        case integer of
            0: (pH264LevelSetting: PD3D12_VIDEO_ENCODER_LEVELS_H264);
            1: (pHEVCLevelSetting: PD3D12_VIDEO_ENCODER_LEVEL_TIER_CONSTRAINTS_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_LEVEL_SETTING = ^TD3D12_VIDEO_ENCODER_LEVEL_SETTING;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_PROFILE_LEVEL = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        IsSupported: boolean;
        MinSupportedLevel: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
        MaxSupportedLevel: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_PROFILE_LEVEL = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_PROFILE_LEVEL;


    TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = record
        Width: UINT;
        Height: UINT;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = ^TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;


    TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_RATIO_DESC = record
        WidthRatio: UINT;
        HeightRatio: UINT;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_RATIO_DESC = ^TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_RATIO_DESC;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION_RATIOS_COUNT = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        ResolutionRatiosCount: UINT;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION_RATIOS_COUNT = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION_RATIOS_COUNT;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        ResolutionRatiosCount: UINT;
        IsSupported: boolean;
        MinResolutionSupported: TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        MaxResolutionSupported: TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        ResolutionWidthMultipleRequirement: UINT;
        ResolutionHeightMultipleRequirement: UINT;
        pResolutionRatios {ResolutionRatiosCount}: PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_RATIO_DESC;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_OUTPUT_RESOLUTION;



    TD3D12_FEATURE_DATA_VIDEO_ENCODER_INPUT_FORMAT = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        Format: TDXGI_FORMAT;
        IsSupported: boolean;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_INPUT_FORMAT = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_INPUT_FORMAT;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_RATE_CONTROL_MODE = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        RateControlMode: TD3D12_VIDEO_ENCODER_RATE_CONTROL_MODE;
        IsSupported: boolean;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_RATE_CONTROL_MODE = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_RATE_CONTROL_MODE;


    TD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE = (
        D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE_NONE = 0,
        D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE_ROW_BASED = 1);

    PD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE = ^TD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE;

    TD3D12_FEATURE_DATA_VIDEO_ENCODER_INTRA_REFRESH_MODE = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        Level: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
        IntraRefreshMode: TD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE;
        IsSupported: boolean;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_INTRA_REFRESH_MODE = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_INTRA_REFRESH_MODE;


    TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE = (
        D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_FULL_FRAME = 0,
        D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_BYTES_PER_SUBREGION = 1,
        D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_SQUARE_UNITS_PER_SUBREGION_ROW_UNALIGNED = 2,
        D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_UNIFORM_PARTITIONING_ROWS_PER_SUBREGION = 3,
        D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE_UNIFORM_PARTITIONING_SUBREGIONS_PER_FRAME = 4);

    PD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE = ^TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        Level: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
        SubregionMode: TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE;
        IsSupported: boolean;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE;


    TD3D12_VIDEO_ENCODER_HEAP_FLAGS = (
        D3D12_VIDEO_ENCODER_HEAP_FLAG_NONE = 0);

    PD3D12_VIDEO_ENCODER_HEAP_FLAGS = ^TD3D12_VIDEO_ENCODER_HEAP_FLAGS;


    TD3D12_VIDEO_ENCODER_HEAP_DESC = record
        NodeMask: UINT;
        Flags: TD3D12_VIDEO_ENCODER_HEAP_FLAGS;
        EncodeCodec: TD3D12_VIDEO_ENCODER_CODEC;
        EncodeProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        EncodeLevel: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
        ResolutionsListCount: UINT;
        pResolutionList {ResolutionsListCount}: PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
    end;

    PD3D12_VIDEO_ENCODER_HEAP_DESC = ^TD3D12_VIDEO_ENCODER_HEAP_DESC;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_HEAP_SIZE = record
        HeapDesc: TD3D12_VIDEO_ENCODER_HEAP_DESC;
        IsSupported: boolean;
        MemoryPoolL0Size: uint64;
        MemoryPoolL1Size: uint64;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_HEAP_SIZE = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_HEAP_SIZE;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAGS = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_CABAC_ENCODING_SUPPORT = $1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_INTRA_SLICE_CONSTRAINED_ENCODING_SUPPORT = $2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_BFRAME_LTR_COMBINED_SUPPORT = $4,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_ADAPTIVE_8x8_TRANSFORM_ENCODING_SUPPORT = $8,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_DIRECT_SPATIAL_ENCODING_SUPPORT = $10,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_DIRECT_TEMPORAL_ENCODING_SUPPORT = $20,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAG_CONSTRAINED_INTRAPREDICTION_SUPPORT = $40);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAGS = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODES = (
        ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED = 0,
        DISABLE_ALL_SLICE_BLOCK_EDGES = 1,
        DISABLE_SLICE_BOUNDARIES_BLOCKS = 2,
        USE_TWO_STAGE_DEBLOCKING = 3,
        DISABLE_CHROMA_BLOCK_EDGES = 4,
        DISABLE_CHROMA_BLOCK_EDGES_AND_LUMA_BOUNDARIES = 5,
        DISABLE_CHROMA_BLOCK_EDGES_AND_USE_LUMA_TWO_STAGE_DEBLOCKING = 6);

    (*
    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODES = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_0_ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_1_DISABLE_ALL_SLICE_BLOCK_EDGES = 1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_2_DISABLE_SLICE_BOUNDARIES_BLOCKS = 2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_3_USE_TWO_STAGE_DEBLOCKING = 3,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_4_DISABLE_CHROMA_BLOCK_EDGES = 4,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_5_DISABLE_CHROMA_BLOCK_EDGES_AND_LUMA_BOUNDARIES = 5,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_6_DISABLE_CHROMA_BLOCK_EDGES_AND_USE_LUMA_TWO_STAGE_DEBLOCKING = 6);
    *)

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODES = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODES;

    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAGS = (
        H264_SLICES_DEBLOCKING_MODE_FLAG_NONE = 0,
        H264_SLICES_DEBLOCKING_MODE_FLAG_0_ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED =
        1 shl Ord(ALL_LUMA_CHROMA_SLICE_BLOCK_EDGES_ALWAYS_FILTERED),
        H264_SLICES_DEBLOCKING_MODE_FLAG_1_DISABLE_ALL_SLICE_BLOCK_EDGES = 1 shl Ord(DISABLE_ALL_SLICE_BLOCK_EDGES),
        H264_SLICES_DEBLOCKING_MODE_FLAG_2_DISABLE_SLICE_BOUNDARIES_BLOCKS = 1 shl Ord(DISABLE_SLICE_BOUNDARIES_BLOCKS),
        H264_SLICES_DEBLOCKING_MODE_FLAG_3_USE_TWO_STAGE_DEBLOCKING = 1 shl Ord(USE_TWO_STAGE_DEBLOCKING),
        H264_SLICES_DEBLOCKING_MODE_FLAG_4_DISABLE_CHROMA_BLOCK_EDGES = 1 shl Ord(DISABLE_CHROMA_BLOCK_EDGES),
        H264_SLICES_DEBLOCKING_MODE_FLAG_5_DISABLE_CHROMA_BLOCK_EDGES_AND_LUMA_BOUNDARIES =
        1 shl Ord(DISABLE_CHROMA_BLOCK_EDGES_AND_LUMA_BOUNDARIES),
        H264_SLICES_DEBLOCKING_MODE_FLAG_6_DISABLE_CHROMA_BLOCK_EDGES_AND_USE_LUMA_TWO_STAGE_DEBLOCKING =
        1 shl Ord(DISABLE_CHROMA_BLOCK_EDGES_AND_USE_LUMA_TWO_STAGE_DEBLOCKING)
        );

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAGS = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264 = record
        SupportFlags: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264_FLAGS;
        DisableDeblockingFilterSupportedModes: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODE_FLAGS;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264 = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAGS = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_BFRAME_LTR_COMBINED_SUPPORT = $1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_INTRA_SLICE_CONSTRAINED_ENCODING_SUPPORT = $2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_CONSTRAINED_INTRAPREDICTION_SUPPORT = $4,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_SAO_FILTER_SUPPORT = $8,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_ASYMETRIC_MOTION_PARTITION_SUPPORT = $10,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_ASYMETRIC_MOTION_PARTITION_REQUIRED = $20,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_TRANSFORM_SKIP_SUPPORT = $40,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_DISABLING_LOOP_FILTER_ACROSS_SLICES_SUPPORT = $80,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAG_P_FRAMES_IMPLEMENTED_AS_LOW_DELAY_B_FRAMES = $100);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAGS = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE_8x8 = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE_16x16 = 1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE_32x32 = 2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE_64x64 = 3);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE_4x4 = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE_8x8 = 1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE_16x16 = 2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE_32x32 = 3);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC = record
        SupportFlags: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC_FLAGS;
        MinLumaCodingUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE;
        MaxLumaCodingUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE;
        MinLumaTransformUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE;
        MaxLumaTransformUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE;
        max_transform_hierarchy_depth_inter: UCHAR;
        max_transform_hierarchy_depth_intra: UCHAR;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT = record
        DataSize: UINT;
        case integer of
            0: (pH264Support: PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_H264);
            1: (pHEVCSupport: PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT_HEVC);
    end;
    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        IsSupported: boolean;
        CodecSupportLimits: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_CONFIGURATION_SUPPORT;


    TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_H264 = record
        MaxL0ReferencesForP: UINT;
        MaxL0ReferencesForB: UINT;
        MaxL1ReferencesForB: UINT;
        MaxLongTermReferences: UINT;
        MaxDPBCapacity: UINT;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_H264 = ^TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_H264;


    TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_HEVC = record
        MaxL0ReferencesForP: UINT;
        MaxL0ReferencesForB: UINT;
        MaxL1ReferencesForB: UINT;
        MaxLongTermReferences: UINT;
        MaxDPBCapacity: UINT;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_HEVC = ^TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_HEVC;


    TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT = record
        DataSize: UINT;
        case integer of
            0: (
                pH264Support: PD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_H264);
            1: (pHEVCSupport: PD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT = ^TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        IsSupported: boolean;
        PictureSupport: TD3D12_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_CODEC_PICTURE_CONTROL_SUPPORT;


    TD3D12_VIDEO_ENCODER_SUPPORT_FLAGS = (
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_GENERAL_SUPPORT_OK = $1,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_RECONFIGURATION_AVAILABLE = $2,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RESOLUTION_RECONFIGURATION_AVAILABLE = $4,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_VBV_SIZE_CONFIG_AVAILABLE = $8,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_FRAME_ANALYSIS_AVAILABLE = $10,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RECONSTRUCTED_FRAMES_REQUIRE_TEXTURE_ARRAYS = $20,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_DELTA_QP_AVAILABLE = $40,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_SUBREGION_LAYOUT_RECONFIGURATION_AVAILABLE = $80,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_ADJUSTABLE_QP_RANGE_AVAILABLE = $100,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_INITIAL_QP_AVAILABLE = $200,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_MAX_FRAME_SIZE_AVAILABLE = $400,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_SEQUENCE_GOP_RECONFIGURATION_AVAILABLE = $800,
        D3D12_VIDEO_ENCODER_SUPPORT_FLAG_MOTION_ESTIMATION_PRECISION_MODE_LIMIT_AVAILABLE = $1000);

    PD3D12_VIDEO_ENCODER_SUPPORT_FLAGS = ^TD3D12_VIDEO_ENCODER_SUPPORT_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAGS = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_USE_CONSTRAINED_INTRAPREDICTION = $1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_USE_ADAPTIVE_8x8_TRANSFORM = $2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_ENABLE_CABAC_ENCODING = $4,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAG_ALLOW_REQUEST_INTRA_CONSTRAINED_SLICES = $8);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAGS = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES_DISABLED = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES_TEMPORAL = 1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES_SPATIAL = 2);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264 = record
        ConfigurationFlags: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_FLAGS;
        DirectModeConfig: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_DIRECT_MODES;
        DisableDeblockingFilterConfig: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264_SLICES_DEBLOCKING_MODES;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264 = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAGS = (
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_DISABLE_LOOP_FILTER_ACROSS_SLICES = $1,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_ALLOW_REQUEST_INTRA_CONSTRAINED_SLICES = $2,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_ENABLE_SAO_FILTER = $4,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_ENABLE_LONG_TERM_REFERENCES = $8,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_USE_ASYMETRIC_MOTION_PARTITION = $10,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_ENABLE_TRANSFORM_SKIPPING = $20,
        D3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAG_USE_CONSTRAINED_INTRAPREDICTION = $40);

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAGS = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAGS;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC = record
        ConfigurationFlags: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_FLAGS;
        MinLumaCodingUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE;
        MaxLumaCodingUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_CUSIZE;
        MinLumaTransformUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE;
        MaxLumaTransformUnitSize: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC_TUSIZE;
        max_transform_hierarchy_depth_inter: UCHAR;
        max_transform_hierarchy_depth_intra: UCHAR;
    end;

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC;


    TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION = record
        DataSize: UINT;
        case integer of
            0: (
                pH264Config: PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_H264);
            1: (pHEVCConfig: PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION = ^TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION;


    TD3D12_VIDEO_ENCODER_INTRA_REFRESH = record
        Mode: TD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE;
        IntraRefreshDuration: UINT;
    end;

    PD3D12_VIDEO_ENCODER_INTRA_REFRESH = ^TD3D12_VIDEO_ENCODER_INTRA_REFRESH;


    TD3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE = (
        D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE_MAXIMUM = 0,
        D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE_FULL_PIXEL = 1,
        D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE_HALF_PIXEL = 2,
        D3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE_QUARTER_PIXEL = 3);

    PD3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE = ^TD3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS = record
        MaxSubregionsNumber: UINT;
        MaxIntraRefreshFrameDuration: UINT;
        SubregionBlockPixelsSize: UINT;
        QPMapRegionPixelsSize: UINT;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS;


    TD3D12_VIDEO_ENCODER_VALIDATION_FLAGS = (
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_CODEC_NOT_SUPPORTED = $1,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_INPUT_FORMAT_NOT_SUPPORTED = $8,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_CODEC_CONFIGURATION_NOT_SUPPORTED = $10,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_RATE_CONTROL_MODE_NOT_SUPPORTED = $20,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_RATE_CONTROL_CONFIGURATION_NOT_SUPPORTED = $40,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_INTRA_REFRESH_MODE_NOT_SUPPORTED = $80,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_SUBREGION_LAYOUT_MODE_NOT_SUPPORTED = $100,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_RESOLUTION_NOT_SUPPORTED_IN_LIST = $200,
        D3D12_VIDEO_ENCODER_VALIDATION_FLAG_GOP_STRUCTURE_NOT_SUPPORTED = $800);

    PD3D12_VIDEO_ENCODER_VALIDATION_FLAGS = ^TD3D12_VIDEO_ENCODER_VALIDATION_FLAGS;


    TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 = record
        GOPLength: UINT;
        PPicturePeriod: UINT;
        pic_order_cnt_type: UCHAR;
        log2_max_frame_num_minus4: UCHAR;
        log2_max_pic_order_cnt_lsb_minus4: UCHAR;
    end;

    PD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 = ^TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264;


    TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC = record
        GOPLength: UINT;
        PPicturePeriod: UINT;
        log2_max_pic_order_cnt_lsb_minus4: UCHAR;
    end;

    PD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC = ^TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC;


    TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE = record
        DataSize: UINT;
        case integer of
            0: (
                pH264GroupOfPictures: PD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264);
            1: (pHEVCGroupOfPictures: PD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE = ^TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        InputFormat: TDXGI_FORMAT;
        CodecConfiguration: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION;
        CodecGopSequence: TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE;
        RateControl: TD3D12_VIDEO_ENCODER_RATE_CONTROL;
        IntraRefresh: TD3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE;
        SubregionFrameEncoding: TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE;
        ResolutionsListCount: UINT;
        pResolutionList: PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        MaxReferenceFramesInDPB: UINT;
        ValidationFlags: TD3D12_VIDEO_ENCODER_VALIDATION_FLAGS;
        SupportFlags: TD3D12_VIDEO_ENCODER_SUPPORT_FLAGS;
        SuggestedProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        SuggestedLevel: TD3D12_VIDEO_ENCODER_LEVEL_SETTING;
        pResolutionDependentSupport {ResolutionsListCount}: PD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOLUTION_SUPPORT_LIMITS;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_SUPPORT;


    TD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS = record
        NodeIndex: UINT;
        Codec: TD3D12_VIDEO_ENCODER_CODEC;
        Profile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        InputFormat: TDXGI_FORMAT;
        PictureTargetResolution: TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        IsSupported: boolean;
        CompressedBitstreamBufferAccessAlignment: UINT;
        EncoderMetadataBufferAccessAlignment: UINT;
        MaxEncoderOutputMetadataBufferSize: UINT;
    end;

    PD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS = ^TD3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS;


    TD3D12_VIDEO_ENCODER_FLAGS = (
        D3D12_VIDEO_ENCODER_FLAG_NONE = 0);

    PD3D12_VIDEO_ENCODER_FLAGS = ^TD3D12_VIDEO_ENCODER_FLAGS;


    TD3D12_VIDEO_ENCODER_DESC = record
        NodeMask: UINT;
        Flags: TD3D12_VIDEO_ENCODER_FLAGS;
        EncodeCodec: TD3D12_VIDEO_ENCODER_CODEC;
        EncodeProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        InputFormat: TDXGI_FORMAT;
        CodecConfiguration: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION;
        MaxMotionEstimationPrecision: TD3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE;
    end;

    PD3D12_VIDEO_ENCODER_DESC = ^TD3D12_VIDEO_ENCODER_DESC;



    ID3D12VideoEncoder = interface(ID3D12Pageable)
        ['{2E0D212D-8DF9-44A6-A770-BB289B182737}']
        function GetNodeMask(): UINT; stdcall;
        function GetEncoderFlags(): TD3D12_VIDEO_ENCODER_FLAGS; stdcall;
        function GetCodec(): TD3D12_VIDEO_ENCODER_CODEC; stdcall;
        function GetCodecProfile(var dstProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC): HRESULT; stdcall;
        function GetCodecConfiguration(var dstCodecConfig: TD3D12_VIDEO_ENCODER_CODEC_CONFIGURATION): HRESULT; stdcall;
        function GetInputFormat(): TDXGI_FORMAT; stdcall;
        function GetMaxMotionEstimationPrecision(): TD3D12_VIDEO_ENCODER_MOTION_ESTIMATION_PRECISION_MODE; stdcall;
    end;


    ID3D12VideoEncoderHeap = interface(ID3D12Pageable)
        ['{22B35D96-876A-44C0-B25E-FB8C9C7F1C4A}']
        function GetNodeMask(): UINT; stdcall;
        function GetEncoderHeapFlags(): TD3D12_VIDEO_ENCODER_HEAP_FLAGS; stdcall;
        function GetCodec(): TD3D12_VIDEO_ENCODER_CODEC; stdcall;
        function GetCodecProfile(var dstProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC): HRESULT; stdcall;
        function GetCodecLevel(var dstLevel: TD3D12_VIDEO_ENCODER_LEVEL_SETTING): HRESULT; stdcall;
        function GetResolutionListCount(): UINT; stdcall;
        function GetResolutionList(const ResolutionsListCount: UINT; out pResolutionList {ResolutionsListCount}: PD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC): HRESULT; stdcall;
    end;


    ID3D12VideoDevice3 = interface(ID3D12VideoDevice2)
        ['{4243ADB4-3A32-4666-973C-0CCC5625DC44}']
        function CreateVideoEncoder(const pDesc: PD3D12_VIDEO_ENCODER_DESC; constref riid: TGUID; out ppVideoEncoder): HRESULT; stdcall;
        function CreateVideoEncoderHeap(const pDesc: PD3D12_VIDEO_ENCODER_HEAP_DESC; constref riid: TGUID; out ppVideoEncoderHeap): HRESULT; stdcall;
    end;


    TD3D12_VIDEO_ENCODER_FRAME_TYPE_H264 = (
        D3D12_VIDEO_ENCODER_FRAME_TYPE_H264_I_FRAME = 0,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_H264_P_FRAME = 1,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_H264_B_FRAME = 2,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_H264_IDR_FRAME = 3);

    PD3D12_VIDEO_ENCODER_FRAME_TYPE_H264 = ^TD3D12_VIDEO_ENCODER_FRAME_TYPE_H264;


    TD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_H264 = record
        ReconstructedPictureResourceIndex: UINT;
        IsLongTermReference: boolean;
        LongTermPictureIdx: UINT;
        PictureOrderCountNumber: UINT;
        FrameDecodingOrderNumber: UINT;
        TemporalLayerIndex: UINT;
    end;

    PD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_H264 = ^TD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_H264;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAGS = (
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAG_REQUEST_INTRA_CONSTRAINED_SLICES = $1);

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAGS = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAGS;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_MARKING_OPERATION = record
        memory_management_control_operation: UCHAR;
        difference_of_pic_nums_minus1: UINT;
        long_term_pic_num: UINT;
        long_term_frame_idx: UINT;
        max_long_term_frame_idx_plus1: UINT;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_MARKING_OPERATION = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_MARKING_OPERATION;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_LIST_MODIFICATION_OPERATION = record
        modification_of_pic_nums_idc: UCHAR;
        abs_diff_pic_num_minus1: UINT;
        long_term_pic_num: UINT;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_LIST_MODIFICATION_OPERATION = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_LIST_MODIFICATION_OPERATION;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264 = record
        Flags: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_FLAGS;
        FrameType: TD3D12_VIDEO_ENCODER_FRAME_TYPE_H264;
        pic_parameter_set_id: UINT;
        idr_pic_id: UINT;
        PictureOrderCountNumber: UINT;
        FrameDecodingOrderNumber: UINT;
        TemporalLayerIndex: UINT;
        List0ReferenceFramesCount: UINT;
        pList0ReferenceFrames {List0ReferenceFramesCount}: PUINT;
        List1ReferenceFramesCount: UINT;
        pList1ReferenceFrames {List1ReferenceFramesCount}: PUINT;
        ReferenceFramesReconPictureDescriptorsCount: UINT;
        pReferenceFramesReconPictureDescriptors {ReferenceFramesReconPictureDescriptorsCount}: PD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_H264;
        adaptive_ref_pic_marking_mode_flag: UCHAR;
        RefPicMarkingOperationsCommandsCount: UINT;
        pRefPicMarkingOperationsCommands {RefPicMarkingOperationsCommandsCount}: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_MARKING_OPERATION;
        List0RefPicModificationsCount: UINT;
        pList0RefPicModifications {List0RefPicModificationsCount}: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_LIST_MODIFICATION_OPERATION;
        List1RefPicModificationsCount: UINT;
        pList1RefPicModifications {List1RefPicModificationsCount}: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264_REFERENCE_PICTURE_LIST_MODIFICATION_OPERATION;
        QPMapValuesCount: UINT;
        pRateControlQPMap {QPMapValuesCount}: PINT8;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264 = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264;


    TD3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC = (
        D3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC_I_FRAME = 0,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC_P_FRAME = 1,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC_B_FRAME = 2,
        D3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC_IDR_FRAME = 3);

    PD3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC = ^TD3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC;


    TD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_HEVC = record
        ReconstructedPictureResourceIndex: UINT;
        IsRefUsedByCurrentPic: boolean;
        IsLongTermReference: boolean;
        PictureOrderCountNumber: UINT;
        TemporalLayerIndex: UINT;
    end;

    PD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_HEVC = ^TD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_HEVC;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAGS = (
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAG_REQUEST_INTRA_CONSTRAINED_SLICES = $1);

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAGS = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAGS;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC = record
        Flags: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC_FLAGS;
        FrameType: TD3D12_VIDEO_ENCODER_FRAME_TYPE_HEVC;
        slice_pic_parameter_set_id: UINT;
        PictureOrderCountNumber: UINT;
        TemporalLayerIndex: UINT;
        List0ReferenceFramesCount: UINT;
        pList0ReferenceFrames {List0ReferenceFramesCount}: PUINT;
        List1ReferenceFramesCount: UINT;
        pList1ReferenceFrames {List1ReferenceFramesCount}: PUINT;
        ReferenceFramesReconPictureDescriptorsCount: UINT;
        pReferenceFramesReconPictureDescriptors {ReferenceFramesReconPictureDescriptorsCount}: PD3D12_VIDEO_ENCODER_REFERENCE_PICTURE_DESCRIPTOR_HEVC;
        List0RefPicModificationsCount: UINT;
        pList0RefPicModifications {List0RefPicModificationsCount}: PUINT;
        List1RefPicModificationsCount: UINT;
        pList1RefPicModifications {List1RefPicModificationsCount}: PUINT;
        QPMapValuesCount: UINT;
        pRateControlQPMap {QPMapValuesCount}: PINT8;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA = record
        DataSize: UINT;
        case integer of
            0: (
                pH264PicData: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_H264);
            1: (pHEVCPicData: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA_HEVC);
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA;


    TD3D12_VIDEO_ENCODE_REFERENCE_FRAMES = record
        NumTexture2Ds: UINT;
        ppTexture2Ds {NumTexture2Ds}: PID3D12Resource;
        pSubresources {NumTexture2Ds}: PUINT;
    end;

    PD3D12_VIDEO_ENCODE_REFERENCE_FRAMES = ^TD3D12_VIDEO_ENCODE_REFERENCE_FRAMES;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAGS = (
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAG_USED_AS_REFERENCE_PICTURE = $1);

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAGS = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAGS;

    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC = record
        IntraRefreshFrameIndex: UINT;
        Flags: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAGS;
        PictureControlCodecData: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA;
        ReferenceFrames: TD3D12_VIDEO_ENCODE_REFERENCE_FRAMES;
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC;


    TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS = (
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_NONE = 0,
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_RESOLUTION_CHANGE = $1,
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_RATE_CONTROL_CHANGE = $2,
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_SUBREGION_LAYOUT_CHANGE = $4,
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_REQUEST_INTRA_REFRESH = $8,
        D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAG_GOP_SEQUENCE_CHANGE = $10);

    PD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS = ^TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES = record
        case integer of
            0: (MaxBytesPerSlice: UINT);
            1: (NumberOfCodingUnitsPerSlice: UINT);
            2: (NumberOfRowsPerSlice: UINT);
            3: (NumberOfSlicesPerFrame: UINT);
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES;


    TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA = record
        DataSize: UINT;
        case integer of
            0: (
                pSlicesPartition_H264: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES);
            1: (pSlicesPartition_HEVC: PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA_SLICES);
    end;

    PD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA = ^TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA;


    TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC = record
        Flags: TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS;
        IntraRefreshConfig: TD3D12_VIDEO_ENCODER_INTRA_REFRESH;
        RateControl: TD3D12_VIDEO_ENCODER_RATE_CONTROL;
        PictureTargetResolution: TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        SelectedLayoutMode: TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE;
        FrameSubregionsLayoutData: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA;
        CodecGopSequence: TD3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE;
    end;

    PD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC = ^TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC;


    TD3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS = record
        SequenceControlDesc: TD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC;
        PictureControlDesc: TD3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC;
        pInputFrame: PID3D12Resource;
        InputFrameSubresource: UINT;
        CurrentFrameBitstreamMetadataSize: UINT;
    end;

    PD3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS = ^TD3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS;


    TD3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM = record
        pBuffer: PID3D12Resource;
        FrameStartOffset: uint64;
    end;

    PD3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM = ^TD3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM;


    TD3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE = record
        pReconstructedPicture: PID3D12Resource;
        ReconstructedPictureSubresource: UINT;
    end;

    PD3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE = ^TD3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE;


    TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA = record
        bSize: uint64;
        bStartOffset: uint64;
        bHeaderSize: uint64;
    end;

    PD3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA = ^TD3D12_VIDEO_ENCODER_FRAME_SUBREGION_METADATA;


    TD3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAGS = (
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_NO_ERROR = 0,
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_CODEC_PICTURE_CONTROL_NOT_SUPPORTED = $1,
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_SUBREGION_LAYOUT_CONFIGURATION_NOT_SUPPORTED = $2,
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_INVALID_REFERENCE_PICTURES = $4,
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_RECONFIGURATION_REQUEST_NOT_SUPPORTED = $8,
        D3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAG_INVALID_METADATA_BUFFER_SOURCE = $10);

    PD3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAGS = ^TD3D12_VIDEO_ENCODER_ENCODE_ERROR_FLAGS;


    TD3D12_VIDEO_ENCODER_OUTPUT_METADATA_STATISTICS = record
        AverageQP: uint64;
        IntraCodingUnitsCount: uint64;
        InterCodingUnitsCount: uint64;
        SkipCodingUnitsCount: uint64;
        AverageMotionEstimationXDirection: uint64;
        AverageMotionEstimationYDirection: uint64;
    end;

    PD3D12_VIDEO_ENCODER_OUTPUT_METADATA_STATISTICS = ^TD3D12_VIDEO_ENCODER_OUTPUT_METADATA_STATISTICS;


    TD3D12_VIDEO_ENCODER_OUTPUT_METADATA = record
        EncodeErrorFlags: uint64;
        EncodeStats: TD3D12_VIDEO_ENCODER_OUTPUT_METADATA_STATISTICS;
        EncodedBitstreamWrittenBytesCount: uint64;
        WrittenSubregionsCount: uint64;
    end;

    PD3D12_VIDEO_ENCODER_OUTPUT_METADATA = ^TD3D12_VIDEO_ENCODER_OUTPUT_METADATA;


    TD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER = record
        pBuffer: PID3D12Resource;
        Offset: uint64;
    end;

    PD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER = ^TD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER;


    TD3D12_VIDEO_ENCODER_RESOLVE_METADATA_INPUT_ARGUMENTS = record
        EncoderCodec: TD3D12_VIDEO_ENCODER_CODEC;
        EncoderProfile: TD3D12_VIDEO_ENCODER_PROFILE_DESC;
        EncoderInputFormat: TDXGI_FORMAT;
        EncodedPictureEffectiveResolution: TD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
        HWLayoutMetadata: TD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER;
    end;

    PD3D12_VIDEO_ENCODER_RESOLVE_METADATA_INPUT_ARGUMENTS = ^TD3D12_VIDEO_ENCODER_RESOLVE_METADATA_INPUT_ARGUMENTS;


    TD3D12_VIDEO_ENCODER_RESOLVE_METADATA_OUTPUT_ARGUMENTS = record
        ResolvedLayoutMetadata: TD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER;
    end;

    PD3D12_VIDEO_ENCODER_RESOLVE_METADATA_OUTPUT_ARGUMENTS = ^TD3D12_VIDEO_ENCODER_RESOLVE_METADATA_OUTPUT_ARGUMENTS;


    TD3D12_VIDEO_ENCODER_ENCODEFRAME_OUTPUT_ARGUMENTS = record
        Bitstream: TD3D12_VIDEO_ENCODER_COMPRESSED_BITSTREAM;
        ReconstructedPicture: TD3D12_VIDEO_ENCODER_RECONSTRUCTED_PICTURE;
        EncoderOutputMetadata: TD3D12_VIDEO_ENCODER_ENCODE_OPERATION_METADATA_BUFFER;
    end;

    PD3D12_VIDEO_ENCODER_ENCODEFRAME_OUTPUT_ARGUMENTS = ^TD3D12_VIDEO_ENCODER_ENCODEFRAME_OUTPUT_ARGUMENTS;


    ID3D12VideoEncodeCommandList2 = interface(ID3D12VideoEncodeCommandList1)
        ['{895491e2-e701-46a9-9a1f-8d3480ed867a}']
        procedure EncodeFrame(pEncoder: ID3D12VideoEncoder; pHeap: ID3D12VideoEncoderHeap; const pInputArguments: PD3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS; const pOutputArguments: PD3D12_VIDEO_ENCODER_ENCODEFRAME_OUTPUT_ARGUMENTS);
            stdcall;
        procedure ResolveEncoderOutputMetadata(const pInputArguments: PD3D12_VIDEO_ENCODER_RESOLVE_METADATA_INPUT_ARGUMENTS; const pOutputArguments: PD3D12_VIDEO_ENCODER_RESOLVE_METADATA_OUTPUT_ARGUMENTS); stdcall;
    end;



    ID3D12VideoEncodeCommandList3 = interface(ID3D12VideoEncodeCommandList2)
        ['{7f027b22-1515-4e85-aa0d-026486580576}']
        procedure Barrier(NumBarrierGroups: uint32; const pBarrierGroups {NumBarrierGroups}: PD3D12_BARRIER_GROUP); stdcall;
    end;

implementation

end.
