Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1

D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1

構造体
サイズx64: 248 バイト / x86: 160 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
SequenceControlDescD3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC96/64+0+0シーケンスレベルの制御記述子を指定する入力引数である。
PictureControlDescD3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1128/80+96+64ピクチャレベルの制御記述子(拡張版)を指定する入力引数である。
pInputFrameID3D12Resource*8/4+224+144符号化対象の入力フレームを保持するID3D12Resourceへのポインタである。
InputFrameSubresourceDWORD4+232+148入力フレームリソース内で使用するサブリソースインデックスを指定する。
CurrentFrameBitstreamMetadataSizeDWORD4+236+152現フレームのビットストリームに先行付加するメタデータのバイトサイズである。
OptionalMetadataD3D12_VIDEO_ENCODER_OPTIONAL_METADATA_ENABLE_FLAGS4+240+156有効化するオプションメタデータ(PSNR/QPマップ等)の種類を示すフラグである。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_ENCODER_INTRA_REFRESH  (x64 8 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_INTRA_REFRESH {
    D3D12_VIDEO_ENCODER_INTRA_REFRESH_MODE Mode;
    DWORD IntraRefreshDuration;
} D3D12_VIDEO_ENCODER_INTRA_REFRESH;

// D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS {
    DWORD DataSize;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS;

// DXGI_RATIONAL  (x64 8 / x86 8 バイト)
typedef struct DXGI_RATIONAL {
    DWORD Numerator;
    DWORD Denominator;
} DXGI_RATIONAL;

// D3D12_VIDEO_ENCODER_RATE_CONTROL  (x64 32 / x86 24 バイト)
typedef struct D3D12_VIDEO_ENCODER_RATE_CONTROL {
    D3D12_VIDEO_ENCODER_RATE_CONTROL_MODE Mode;
    D3D12_VIDEO_ENCODER_RATE_CONTROL_FLAGS Flags;
    D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS ConfigParams;
    DXGI_RATIONAL TargetFrameRate;
} D3D12_VIDEO_ENCODER_RATE_CONTROL;

// D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC  (x64 8 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {
    DWORD Width;
    DWORD Height;
} D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;

// D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA {
    DWORD DataSize;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA;

// D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE {
    DWORD DataSize;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE;

// D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC  (x64 96 / x86 64 バイト)
typedef struct D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC {
    D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_FLAGS Flags;
    D3D12_VIDEO_ENCODER_INTRA_REFRESH IntraRefreshConfig;
    D3D12_VIDEO_ENCODER_RATE_CONTROL RateControl;
    D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    D3D12_VIDEO_ENCODER_FRAME_SUBREGION_LAYOUT_MODE SelectedLayoutMode;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA FrameSubregionsLayoutData;
    D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE CodecGopSequence;
} D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC;

// D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 {
    DWORD DataSize;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1;

// D3D12_VIDEO_ENCODE_REFERENCE_FRAMES  (x64 24 / x86 12 バイト)
typedef struct D3D12_VIDEO_ENCODE_REFERENCE_FRAMES {
    DWORD NumTexture2Ds;
    ID3D12Resource** ppTexture2Ds;
    DWORD* pSubresources;
} D3D12_VIDEO_ENCODE_REFERENCE_FRAMES;

// D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS {
    D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE MapSource;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS;

// D3D12_VIDEO_ENCODER_DIRTY_REGIONS  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_DIRTY_REGIONS {
    D3D12_VIDEO_ENCODER_INPUT_MAP_SOURCE MapSource;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_DIRTY_REGIONS;

// D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP  (x64 8 / x86 4 バイト)
typedef struct D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP {
    ID3D12Resource* pOpaqueQuantizationMap;
} D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP;

// D3D12_VIDEO_ENCODER_FRAME_ANALYSIS  (x64 40 / x86 32 バイト)
typedef struct D3D12_VIDEO_ENCODER_FRAME_ANALYSIS {
    ID3D12Resource* pDownscaledFrame;
    ULONGLONG Subresource;
    D3D12_VIDEO_ENCODE_REFERENCE_FRAMES DownscaledReferences;
} D3D12_VIDEO_ENCODER_FRAME_ANALYSIS;

// D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1  (x64 128 / x86 80 バイト)
typedef struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 {
    DWORD IntraRefreshFrameIndex;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAGS Flags;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 PictureControlCodecData;
    D3D12_VIDEO_ENCODE_REFERENCE_FRAMES ReferenceFrames;
    D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS MotionVectors;
    D3D12_VIDEO_ENCODER_DIRTY_REGIONS DirtyRects;
    D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP QuantizationTextureMap;
    D3D12_VIDEO_ENCODER_FRAME_ANALYSIS FrameAnalysis;
} D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1;

// D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1  (x64 248 / x86 160 バイト)
typedef struct D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 {
    D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC SequenceControlDesc;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 PictureControlDesc;
    ID3D12Resource* pInputFrame;
    DWORD InputFrameSubresource;
    DWORD CurrentFrameBitstreamMetadataSize;
    D3D12_VIDEO_ENCODER_OPTIONAL_METADATA_ENABLE_FLAGS OptionalMetadata;
} D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_INTRA_REFRESH
{
    public int Mode;
    public uint IntraRefreshDuration;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
{
    public uint DataSize;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_RATIONAL
{
    public uint Numerator;
    public uint Denominator;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_RATE_CONTROL
{
    public int Mode;
    public int Flags;
    public D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS ConfigParams;
    public DXGI_RATIONAL TargetFrameRate;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
{
    public uint Width;
    public uint Height;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
{
    public uint DataSize;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
{
    public uint DataSize;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
{
    public int Flags;
    public D3D12_VIDEO_ENCODER_INTRA_REFRESH IntraRefreshConfig;
    public D3D12_VIDEO_ENCODER_RATE_CONTROL RateControl;
    public D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    public int SelectedLayoutMode;
    public D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA FrameSubregionsLayoutData;
    public D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE CodecGopSequence;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
{
    public uint DataSize;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
{
    public uint NumTexture2Ds;
    public IntPtr ppTexture2Ds;
    public IntPtr pSubresources;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
{
    public int MapSource;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_DIRTY_REGIONS
{
    public int MapSource;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
{
    public IntPtr pOpaqueQuantizationMap;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
{
    public IntPtr pDownscaledFrame;
    public ulong Subresource;
    public D3D12_VIDEO_ENCODE_REFERENCE_FRAMES DownscaledReferences;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
{
    public uint IntraRefreshFrameIndex;
    public int Flags;
    public D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 PictureControlCodecData;
    public D3D12_VIDEO_ENCODE_REFERENCE_FRAMES ReferenceFrames;
    public D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS MotionVectors;
    public D3D12_VIDEO_ENCODER_DIRTY_REGIONS DirtyRects;
    public D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP QuantizationTextureMap;
    public D3D12_VIDEO_ENCODER_FRAME_ANALYSIS FrameAnalysis;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1
{
    public D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC SequenceControlDesc;
    public D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 PictureControlDesc;
    public IntPtr pInputFrame;
    public uint InputFrameSubresource;
    public uint CurrentFrameBitstreamMetadataSize;
    public int OptionalMetadata;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_INTRA_REFRESH
    Public Mode As Integer
    Public IntraRefreshDuration As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
    Public DataSize As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_RATIONAL
    Public Numerator As UInteger
    Public Denominator As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_RATE_CONTROL
    Public Mode As Integer
    Public Flags As Integer
    Public ConfigParams As D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
    Public TargetFrameRate As DXGI_RATIONAL
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    Public Width As UInteger
    Public Height As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
    Public DataSize As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
    Public DataSize As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
    Public Flags As Integer
    Public IntraRefreshConfig As D3D12_VIDEO_ENCODER_INTRA_REFRESH
    Public RateControl As D3D12_VIDEO_ENCODER_RATE_CONTROL
    Public PictureTargetResolution As D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    Public SelectedLayoutMode As Integer
    Public FrameSubregionsLayoutData As D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
    Public CodecGopSequence As D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
    Public DataSize As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
    Public NumTexture2Ds As UInteger
    Public ppTexture2Ds As IntPtr
    Public pSubresources As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
    Public MapSource As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_DIRTY_REGIONS
    Public MapSource As Integer
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
    Public pOpaqueQuantizationMap As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
    Public pDownscaledFrame As IntPtr
    Public Subresource As ULong
    Public DownscaledReferences As D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
    Public IntraRefreshFrameIndex As UInteger
    Public Flags As Integer
    Public PictureControlCodecData As D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
    Public ReferenceFrames As D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
    Public MotionVectors As D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
    Public DirtyRects As D3D12_VIDEO_ENCODER_DIRTY_REGIONS
    Public QuantizationTextureMap As D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
    Public FrameAnalysis As D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1
    Public SequenceControlDesc As D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
    Public PictureControlDesc As D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
    Public pInputFrame As IntPtr
    Public InputFrameSubresource As UInteger
    Public CurrentFrameBitstreamMetadataSize As UInteger
    Public OptionalMetadata As Integer
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_ENCODER_INTRA_REFRESH(ctypes.Structure):
    _fields_ = [
        ("Mode", ctypes.c_int),
        ("IntraRefreshDuration", wintypes.DWORD),
    ]

class D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS(ctypes.Structure):
    _fields_ = [
        ("DataSize", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class DXGI_RATIONAL(ctypes.Structure):
    _fields_ = [
        ("Numerator", wintypes.DWORD),
        ("Denominator", wintypes.DWORD),
    ]

class D3D12_VIDEO_ENCODER_RATE_CONTROL(ctypes.Structure):
    _fields_ = [
        ("Mode", ctypes.c_int),
        ("Flags", ctypes.c_int),
        ("ConfigParams", D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS),
        ("TargetFrameRate", DXGI_RATIONAL),
    ]

class D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC(ctypes.Structure):
    _fields_ = [
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
    ]

class D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA(ctypes.Structure):
    _fields_ = [
        ("DataSize", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE(ctypes.Structure):
    _fields_ = [
        ("DataSize", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC(ctypes.Structure):
    _fields_ = [
        ("Flags", ctypes.c_int),
        ("IntraRefreshConfig", D3D12_VIDEO_ENCODER_INTRA_REFRESH),
        ("RateControl", D3D12_VIDEO_ENCODER_RATE_CONTROL),
        ("PictureTargetResolution", D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC),
        ("SelectedLayoutMode", ctypes.c_int),
        ("FrameSubregionsLayoutData", D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA),
        ("CodecGopSequence", D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE),
    ]

class D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1(ctypes.Structure):
    _fields_ = [
        ("DataSize", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODE_REFERENCE_FRAMES(ctypes.Structure):
    _fields_ = [
        ("NumTexture2Ds", wintypes.DWORD),
        ("ppTexture2Ds", ctypes.c_void_p),
        ("pSubresources", ctypes.c_void_p),
    ]

class D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS(ctypes.Structure):
    _fields_ = [
        ("MapSource", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODER_DIRTY_REGIONS(ctypes.Structure):
    _fields_ = [
        ("MapSource", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP(ctypes.Structure):
    _fields_ = [
        ("pOpaqueQuantizationMap", ctypes.c_void_p),
    ]

class D3D12_VIDEO_ENCODER_FRAME_ANALYSIS(ctypes.Structure):
    _fields_ = [
        ("pDownscaledFrame", ctypes.c_void_p),
        ("Subresource", ctypes.c_ulonglong),
        ("DownscaledReferences", D3D12_VIDEO_ENCODE_REFERENCE_FRAMES),
    ]

class D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1(ctypes.Structure):
    _fields_ = [
        ("IntraRefreshFrameIndex", wintypes.DWORD),
        ("Flags", ctypes.c_int),
        ("PictureControlCodecData", D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1),
        ("ReferenceFrames", D3D12_VIDEO_ENCODE_REFERENCE_FRAMES),
        ("MotionVectors", D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS),
        ("DirtyRects", D3D12_VIDEO_ENCODER_DIRTY_REGIONS),
        ("QuantizationTextureMap", D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP),
        ("FrameAnalysis", D3D12_VIDEO_ENCODER_FRAME_ANALYSIS),
    ]

class D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1(ctypes.Structure):
    _fields_ = [
        ("SequenceControlDesc", D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC),
        ("PictureControlDesc", D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1),
        ("pInputFrame", ctypes.c_void_p),
        ("InputFrameSubresource", wintypes.DWORD),
        ("CurrentFrameBitstreamMetadataSize", wintypes.DWORD),
        ("OptionalMetadata", ctypes.c_int),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_INTRA_REFRESH {
    pub Mode: i32,
    pub IntraRefreshDuration: u32,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS {
    pub DataSize: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct DXGI_RATIONAL {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_RATE_CONTROL {
    pub Mode: i32,
    pub Flags: i32,
    pub ConfigParams: D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS,
    pub TargetFrameRate: DXGI_RATIONAL,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {
    pub Width: u32,
    pub Height: u32,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA {
    pub DataSize: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE {
    pub DataSize: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC {
    pub Flags: i32,
    pub IntraRefreshConfig: D3D12_VIDEO_ENCODER_INTRA_REFRESH,
    pub RateControl: D3D12_VIDEO_ENCODER_RATE_CONTROL,
    pub PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC,
    pub SelectedLayoutMode: i32,
    pub FrameSubregionsLayoutData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA,
    pub CodecGopSequence: D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 {
    pub DataSize: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODE_REFERENCE_FRAMES {
    pub NumTexture2Ds: u32,
    pub ppTexture2Ds: *mut core::ffi::c_void,
    pub pSubresources: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS {
    pub MapSource: i32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_DIRTY_REGIONS {
    pub MapSource: i32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP {
    pub pOpaqueQuantizationMap: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_FRAME_ANALYSIS {
    pub pDownscaledFrame: *mut core::ffi::c_void,
    pub Subresource: u64,
    pub DownscaledReferences: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 {
    pub IntraRefreshFrameIndex: u32,
    pub Flags: i32,
    pub PictureControlCodecData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1,
    pub ReferenceFrames: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES,
    pub MotionVectors: D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS,
    pub DirtyRects: D3D12_VIDEO_ENCODER_DIRTY_REGIONS,
    pub QuantizationTextureMap: D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP,
    pub FrameAnalysis: D3D12_VIDEO_ENCODER_FRAME_ANALYSIS,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 {
    pub SequenceControlDesc: D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC,
    pub PictureControlDesc: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1,
    pub pInputFrame: *mut core::ffi::c_void,
    pub InputFrameSubresource: u32,
    pub CurrentFrameBitstreamMetadataSize: u32,
    pub OptionalMetadata: i32,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_ENCODER_INTRA_REFRESH struct {
	Mode int32
	IntraRefreshDuration uint32
}

type D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS struct {
	DataSize uint32
	Anonymous _Anonymous_e__Union
}

type DXGI_RATIONAL struct {
	Numerator uint32
	Denominator uint32
}

type D3D12_VIDEO_ENCODER_RATE_CONTROL struct {
	Mode int32
	Flags int32
	ConfigParams D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
	TargetFrameRate DXGI_RATIONAL
}

type D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC struct {
	Width uint32
	Height uint32
}

type D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA struct {
	DataSize uint32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE struct {
	DataSize uint32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC struct {
	Flags int32
	IntraRefreshConfig D3D12_VIDEO_ENCODER_INTRA_REFRESH
	RateControl D3D12_VIDEO_ENCODER_RATE_CONTROL
	PictureTargetResolution D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
	SelectedLayoutMode int32
	FrameSubregionsLayoutData D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
	CodecGopSequence D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
}

type D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 struct {
	DataSize uint32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODE_REFERENCE_FRAMES struct {
	NumTexture2Ds uint32
	ppTexture2Ds uintptr
	pSubresources uintptr
}

type D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS struct {
	MapSource int32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODER_DIRTY_REGIONS struct {
	MapSource int32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP struct {
	pOpaqueQuantizationMap uintptr
}

type D3D12_VIDEO_ENCODER_FRAME_ANALYSIS struct {
	pDownscaledFrame uintptr
	Subresource uint64
	DownscaledReferences D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
}

type D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 struct {
	IntraRefreshFrameIndex uint32
	Flags int32
	PictureControlCodecData D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
	ReferenceFrames D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
	MotionVectors D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
	DirtyRects D3D12_VIDEO_ENCODER_DIRTY_REGIONS
	QuantizationTextureMap D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
	FrameAnalysis D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
}

type D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 struct {
	SequenceControlDesc D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
	PictureControlDesc D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
	pInputFrame uintptr
	InputFrameSubresource uint32
	CurrentFrameBitstreamMetadataSize uint32
	OptionalMetadata int32
}
type
  D3D12_VIDEO_ENCODER_INTRA_REFRESH = record
    Mode: Integer;
    IntraRefreshDuration: DWORD;
  end;

  D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS = record
    DataSize: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  DXGI_RATIONAL = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  D3D12_VIDEO_ENCODER_RATE_CONTROL = record
    Mode: Integer;
    Flags: Integer;
    ConfigParams: D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS;
    TargetFrameRate: DXGI_RATIONAL;
  end;

  D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = record
    Width: DWORD;
    Height: DWORD;
  end;

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA = record
    DataSize: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE = record
    DataSize: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC = record
    Flags: Integer;
    IntraRefreshConfig: D3D12_VIDEO_ENCODER_INTRA_REFRESH;
    RateControl: D3D12_VIDEO_ENCODER_RATE_CONTROL;
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
    SelectedLayoutMode: Integer;
    FrameSubregionsLayoutData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA;
    CodecGopSequence: D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE;
  end;

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 = record
    DataSize: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODE_REFERENCE_FRAMES = record
    NumTexture2Ds: DWORD;
    ppTexture2Ds: Pointer;
    pSubresources: Pointer;
  end;

  D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS = record
    MapSource: Integer;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODER_DIRTY_REGIONS = record
    MapSource: Integer;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP = record
    pOpaqueQuantizationMap: Pointer;
  end;

  D3D12_VIDEO_ENCODER_FRAME_ANALYSIS = record
    pDownscaledFrame: Pointer;
    Subresource: UInt64;
    DownscaledReferences: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES;
  end;

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 = record
    IntraRefreshFrameIndex: DWORD;
    Flags: Integer;
    PictureControlCodecData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1;
    ReferenceFrames: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES;
    MotionVectors: D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS;
    DirtyRects: D3D12_VIDEO_ENCODER_DIRTY_REGIONS;
    QuantizationTextureMap: D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP;
    FrameAnalysis: D3D12_VIDEO_ENCODER_FRAME_ANALYSIS;
  end;

  D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 = record
    SequenceControlDesc: D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC;
    PictureControlDesc: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1;
    pInputFrame: Pointer;
    InputFrameSubresource: DWORD;
    CurrentFrameBitstreamMetadataSize: DWORD;
    OptionalMetadata: Integer;
  end;
const D3D12_VIDEO_ENCODER_INTRA_REFRESH = extern struct {
    Mode: i32,
    IntraRefreshDuration: u32,
};

const D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS = extern struct {
    DataSize: u32,
    Anonymous: _Anonymous_e__Union,
};

const DXGI_RATIONAL = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const D3D12_VIDEO_ENCODER_RATE_CONTROL = extern struct {
    Mode: i32,
    Flags: i32,
    ConfigParams: D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS,
    TargetFrameRate: DXGI_RATIONAL,
};

const D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = extern struct {
    Width: u32,
    Height: u32,
};

const D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA = extern struct {
    DataSize: u32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE = extern struct {
    DataSize: u32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC = extern struct {
    Flags: i32,
    IntraRefreshConfig: D3D12_VIDEO_ENCODER_INTRA_REFRESH,
    RateControl: D3D12_VIDEO_ENCODER_RATE_CONTROL,
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC,
    SelectedLayoutMode: i32,
    FrameSubregionsLayoutData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA,
    CodecGopSequence: D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE,
};

const D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 = extern struct {
    DataSize: u32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODE_REFERENCE_FRAMES = extern struct {
    NumTexture2Ds: u32,
    ppTexture2Ds: ?*anyopaque,
    pSubresources: ?*anyopaque,
};

const D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS = extern struct {
    MapSource: i32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODER_DIRTY_REGIONS = extern struct {
    MapSource: i32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP = extern struct {
    pOpaqueQuantizationMap: ?*anyopaque,
};

const D3D12_VIDEO_ENCODER_FRAME_ANALYSIS = extern struct {
    pDownscaledFrame: ?*anyopaque,
    Subresource: u64,
    DownscaledReferences: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES,
};

const D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 = extern struct {
    IntraRefreshFrameIndex: u32,
    Flags: i32,
    PictureControlCodecData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1,
    ReferenceFrames: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES,
    MotionVectors: D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS,
    DirtyRects: D3D12_VIDEO_ENCODER_DIRTY_REGIONS,
    QuantizationTextureMap: D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP,
    FrameAnalysis: D3D12_VIDEO_ENCODER_FRAME_ANALYSIS,
};

const D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 = extern struct {
    SequenceControlDesc: D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC,
    PictureControlDesc: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1,
    pInputFrame: ?*anyopaque,
    InputFrameSubresource: u32,
    CurrentFrameBitstreamMetadataSize: u32,
    OptionalMetadata: i32,
};
type
  D3D12_VIDEO_ENCODER_INTRA_REFRESH {.bycopy.} = object
    Mode: int32
    IntraRefreshDuration: uint32

  D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS {.bycopy.} = object
    DataSize: uint32
    Anonymous: _Anonymous_e__Union

  DXGI_RATIONAL {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  D3D12_VIDEO_ENCODER_RATE_CONTROL {.bycopy.} = object
    Mode: int32
    Flags: int32
    ConfigParams: D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
    TargetFrameRate: DXGI_RATIONAL

  D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {.bycopy.} = object
    Width: uint32
    Height: uint32

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA {.bycopy.} = object
    DataSize: uint32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE {.bycopy.} = object
    DataSize: uint32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC {.bycopy.} = object
    Flags: int32
    IntraRefreshConfig: D3D12_VIDEO_ENCODER_INTRA_REFRESH
    RateControl: D3D12_VIDEO_ENCODER_RATE_CONTROL
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    SelectedLayoutMode: int32
    FrameSubregionsLayoutData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
    CodecGopSequence: D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 {.bycopy.} = object
    DataSize: uint32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODE_REFERENCE_FRAMES {.bycopy.} = object
    NumTexture2Ds: uint32
    ppTexture2Ds: pointer
    pSubresources: pointer

  D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS {.bycopy.} = object
    MapSource: int32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODER_DIRTY_REGIONS {.bycopy.} = object
    MapSource: int32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP {.bycopy.} = object
    pOpaqueQuantizationMap: pointer

  D3D12_VIDEO_ENCODER_FRAME_ANALYSIS {.bycopy.} = object
    pDownscaledFrame: pointer
    Subresource: uint64
    DownscaledReferences: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES

  D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 {.bycopy.} = object
    IntraRefreshFrameIndex: uint32
    Flags: int32
    PictureControlCodecData: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
    ReferenceFrames: D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
    MotionVectors: D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
    DirtyRects: D3D12_VIDEO_ENCODER_DIRTY_REGIONS
    QuantizationTextureMap: D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
    FrameAnalysis: D3D12_VIDEO_ENCODER_FRAME_ANALYSIS

  D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 {.bycopy.} = object
    SequenceControlDesc: D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
    PictureControlDesc: D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
    pInputFrame: pointer
    InputFrameSubresource: uint32
    CurrentFrameBitstreamMetadataSize: uint32
    OptionalMetadata: int32
struct D3D12_VIDEO_ENCODER_INTRA_REFRESH
{
    int Mode;
    uint IntraRefreshDuration;
}

struct D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
{
    uint DataSize;
    _Anonymous_e__Union Anonymous;
}

struct DXGI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct D3D12_VIDEO_ENCODER_RATE_CONTROL
{
    int Mode;
    int Flags;
    D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS ConfigParams;
    DXGI_RATIONAL TargetFrameRate;
}

struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
{
    uint Width;
    uint Height;
}

struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
{
    uint DataSize;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
{
    uint DataSize;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
{
    int Flags;
    D3D12_VIDEO_ENCODER_INTRA_REFRESH IntraRefreshConfig;
    D3D12_VIDEO_ENCODER_RATE_CONTROL RateControl;
    D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    int SelectedLayoutMode;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA FrameSubregionsLayoutData;
    D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE CodecGopSequence;
}

struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
{
    uint DataSize;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
{
    uint NumTexture2Ds;
    void* ppTexture2Ds;
    void* pSubresources;
}

struct D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
{
    int MapSource;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODER_DIRTY_REGIONS
{
    int MapSource;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
{
    void* pOpaqueQuantizationMap;
}

struct D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
{
    void* pDownscaledFrame;
    ulong Subresource;
    D3D12_VIDEO_ENCODE_REFERENCE_FRAMES DownscaledReferences;
}

struct D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
{
    uint IntraRefreshFrameIndex;
    int Flags;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 PictureControlCodecData;
    D3D12_VIDEO_ENCODE_REFERENCE_FRAMES ReferenceFrames;
    D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS MotionVectors;
    D3D12_VIDEO_ENCODER_DIRTY_REGIONS DirtyRects;
    D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP QuantizationTextureMap;
    D3D12_VIDEO_ENCODER_FRAME_ANALYSIS FrameAnalysis;
}

struct D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1
{
    D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC SequenceControlDesc;
    D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 PictureControlDesc;
    void* pInputFrame;
    uint InputFrameSubresource;
    uint CurrentFrameBitstreamMetadataSize;
    int OptionalMetadata;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 サイズ: 160 バイト(x86)
dim st, 40    ; 4byte整数×40(構造体サイズ 160 / 4 切り上げ)
; SequenceControlDesc : D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC (+0, 64byte)  varptr(st)+0 を基点に操作(64byte:入れ子/配列)
; PictureControlDesc : D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 (+64, 80byte)  varptr(st)+64 を基点に操作(80byte:入れ子/配列)
; pInputFrame : ID3D12Resource* (+144, 4byte)  st.36 = 値  /  値 = st.36   (lpoke/lpeek も可)
; InputFrameSubresource : DWORD (+148, 4byte)  st.37 = 値  /  値 = st.37   (lpoke/lpeek も可)
; CurrentFrameBitstreamMetadataSize : DWORD (+152, 4byte)  st.38 = 値  /  値 = st.38   (lpoke/lpeek も可)
; OptionalMetadata : D3D12_VIDEO_ENCODER_OPTIONAL_METADATA_ENABLE_FLAGS (+156, 4byte)  st.39 = 値  /  値 = st.39   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1 サイズ: 248 バイト(x64)
dim st, 62    ; 4byte整数×62(構造体サイズ 248 / 4 切り上げ)
; SequenceControlDesc : D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC (+0, 96byte)  varptr(st)+0 を基点に操作(96byte:入れ子/配列)
; PictureControlDesc : D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 (+96, 128byte)  varptr(st)+96 を基点に操作(128byte:入れ子/配列)
; pInputFrame : ID3D12Resource* (+224, 8byte)  qpoke st,224,値 / qpeek(st,224)  ※IronHSPのみ。3.7/3.8は lpoke st,224,下位 : lpoke st,228,上位
; InputFrameSubresource : DWORD (+232, 4byte)  st.58 = 値  /  値 = st.58   (lpoke/lpeek も可)
; CurrentFrameBitstreamMetadataSize : DWORD (+236, 4byte)  st.59 = 値  /  値 = st.59   (lpoke/lpeek も可)
; OptionalMetadata : D3D12_VIDEO_ENCODER_OPTIONAL_METADATA_ENABLE_FLAGS (+240, 4byte)  st.60 = 値  /  値 = st.60   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_VIDEO_ENCODER_INTRA_REFRESH
    #field int Mode
    #field int IntraRefreshDuration
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS
    #field int DataSize
    #field byte Anonymous 8
#endstruct

#defstruct global DXGI_RATIONAL
    #field int Numerator
    #field int Denominator
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_RATE_CONTROL
    #field int Mode
    #field int Flags
    #field D3D12_VIDEO_ENCODER_RATE_CONTROL_CONFIGURATION_PARAMS ConfigParams
    #field DXGI_RATIONAL TargetFrameRate
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    #field int Width
    #field int Height
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA
    #field int DataSize
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE
    #field int DataSize
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC
    #field int Flags
    #field D3D12_VIDEO_ENCODER_INTRA_REFRESH IntraRefreshConfig
    #field D3D12_VIDEO_ENCODER_RATE_CONTROL RateControl
    #field D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution
    #field int SelectedLayoutMode
    #field D3D12_VIDEO_ENCODER_PICTURE_CONTROL_SUBREGIONS_LAYOUT_DATA FrameSubregionsLayoutData
    #field D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE CodecGopSequence
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1
    #field int DataSize
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODE_REFERENCE_FRAMES
    #field int NumTexture2Ds
    #field intptr ppTexture2Ds
    #field intptr pSubresources
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS
    #field int MapSource
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_DIRTY_REGIONS
    #field int MapSource
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP
    #field intptr pOpaqueQuantizationMap
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_FRAME_ANALYSIS
    #field intptr pDownscaledFrame
    #field int64 Subresource
    #field D3D12_VIDEO_ENCODE_REFERENCE_FRAMES DownscaledReferences
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1
    #field int IntraRefreshFrameIndex
    #field int Flags
    #field D3D12_VIDEO_ENCODER_PICTURE_CONTROL_CODEC_DATA1 PictureControlCodecData
    #field D3D12_VIDEO_ENCODE_REFERENCE_FRAMES ReferenceFrames
    #field D3D12_VIDEO_ENCODER_FRAME_MOTION_VECTORS MotionVectors
    #field D3D12_VIDEO_ENCODER_DIRTY_REGIONS DirtyRects
    #field D3D12_VIDEO_ENCODER_QUANTIZATION_OPAQUE_MAP QuantizationTextureMap
    #field D3D12_VIDEO_ENCODER_FRAME_ANALYSIS FrameAnalysis
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1
    #field D3D12_VIDEO_ENCODER_SEQUENCE_CONTROL_DESC SequenceControlDesc
    #field D3D12_VIDEO_ENCODER_PICTURE_CONTROL_DESC1 PictureControlDesc
    #field intptr pInputFrame
    #field int InputFrameSubresource
    #field int CurrentFrameBitstreamMetadataSize
    #field int OptionalMetadata
#endstruct

stdim st, D3D12_VIDEO_ENCODER_ENCODEFRAME_INPUT_ARGUMENTS1        ; NSTRUCT 変数を確保
st->InputFrameSubresource = 100
mes "InputFrameSubresource=" + st->InputFrameSubresource