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

D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1

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

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

フィールド

フィールドサイズx64x86説明
VideoDecoderHeapDescD3D12_VIDEO_DECODER_HEAP_DESC56+0+0サイズを問い合わせるデコーダヒープの記述子D3D12_VIDEO_DECODER_HEAP_DESC。
ProtectedBOOL4+56+56保護リソースとして確保するか否かを示すBOOL。
MemoryPoolL0SizeULONGLONG8+64+64メモリプールL0に必要なサイズ(バイト単位、出力)。
MemoryPoolL1SizeULONGLONG8+72+72メモリプールL1に必要なサイズ(バイト単位、出力)。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_DECODE_CONFIGURATION  (x64 24 / x86 24 バイト)
typedef struct D3D12_VIDEO_DECODE_CONFIGURATION {
    GUID DecodeProfile;
    D3D12_BITSTREAM_ENCRYPTION_TYPE BitstreamEncryption;
    D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE InterlaceType;
} D3D12_VIDEO_DECODE_CONFIGURATION;

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

// D3D12_VIDEO_DECODER_HEAP_DESC  (x64 56 / x86 56 バイト)
typedef struct D3D12_VIDEO_DECODER_HEAP_DESC {
    DWORD NodeMask;
    D3D12_VIDEO_DECODE_CONFIGURATION Configuration;
    DWORD DecodeWidth;
    DWORD DecodeHeight;
    DXGI_FORMAT Format;
    DXGI_RATIONAL FrameRate;
    DWORD BitRate;
    DWORD MaxDecodePictureBufferCount;
} D3D12_VIDEO_DECODER_HEAP_DESC;

// D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1  (x64 80 / x86 80 バイト)
typedef struct D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 {
    D3D12_VIDEO_DECODER_HEAP_DESC VideoDecoderHeapDesc;
    BOOL Protected;
    ULONGLONG MemoryPoolL0Size;
    ULONGLONG MemoryPoolL1Size;
} D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_DECODE_CONFIGURATION
{
    public Guid DecodeProfile;
    public int BitstreamEncryption;
    public int InterlaceType;
}

[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_DECODER_HEAP_DESC
{
    public uint NodeMask;
    public D3D12_VIDEO_DECODE_CONFIGURATION Configuration;
    public uint DecodeWidth;
    public uint DecodeHeight;
    public int Format;
    public DXGI_RATIONAL FrameRate;
    public uint BitRate;
    public uint MaxDecodePictureBufferCount;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1
{
    public D3D12_VIDEO_DECODER_HEAP_DESC VideoDecoderHeapDesc;
    [MarshalAs(UnmanagedType.Bool)] public bool Protected;
    public ulong MemoryPoolL0Size;
    public ulong MemoryPoolL1Size;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_DECODE_CONFIGURATION
    Public DecodeProfile As Guid
    Public BitstreamEncryption As Integer
    Public InterlaceType As Integer
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_DECODER_HEAP_DESC
    Public NodeMask As UInteger
    Public Configuration As D3D12_VIDEO_DECODE_CONFIGURATION
    Public DecodeWidth As UInteger
    Public DecodeHeight As UInteger
    Public Format As Integer
    Public FrameRate As DXGI_RATIONAL
    Public BitRate As UInteger
    Public MaxDecodePictureBufferCount As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1
    Public VideoDecoderHeapDesc As D3D12_VIDEO_DECODER_HEAP_DESC
    <MarshalAs(UnmanagedType.Bool)> Public Protected As Boolean
    Public MemoryPoolL0Size As ULong
    Public MemoryPoolL1Size As ULong
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_DECODE_CONFIGURATION(ctypes.Structure):
    _fields_ = [
        ("DecodeProfile", GUID),
        ("BitstreamEncryption", ctypes.c_int),
        ("InterlaceType", ctypes.c_int),
    ]

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

class D3D12_VIDEO_DECODER_HEAP_DESC(ctypes.Structure):
    _fields_ = [
        ("NodeMask", wintypes.DWORD),
        ("Configuration", D3D12_VIDEO_DECODE_CONFIGURATION),
        ("DecodeWidth", wintypes.DWORD),
        ("DecodeHeight", wintypes.DWORD),
        ("Format", ctypes.c_int),
        ("FrameRate", DXGI_RATIONAL),
        ("BitRate", wintypes.DWORD),
        ("MaxDecodePictureBufferCount", wintypes.DWORD),
    ]

class D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1(ctypes.Structure):
    _fields_ = [
        ("VideoDecoderHeapDesc", D3D12_VIDEO_DECODER_HEAP_DESC),
        ("Protected", wintypes.BOOL),
        ("MemoryPoolL0Size", ctypes.c_ulonglong),
        ("MemoryPoolL1Size", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_DECODE_CONFIGURATION {
    pub DecodeProfile: GUID,
    pub BitstreamEncryption: i32,
    pub InterlaceType: i32,
}

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

#[repr(C)]
pub struct D3D12_VIDEO_DECODER_HEAP_DESC {
    pub NodeMask: u32,
    pub Configuration: D3D12_VIDEO_DECODE_CONFIGURATION,
    pub DecodeWidth: u32,
    pub DecodeHeight: u32,
    pub Format: i32,
    pub FrameRate: DXGI_RATIONAL,
    pub BitRate: u32,
    pub MaxDecodePictureBufferCount: u32,
}

#[repr(C)]
pub struct D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 {
    pub VideoDecoderHeapDesc: D3D12_VIDEO_DECODER_HEAP_DESC,
    pub Protected: i32,
    pub MemoryPoolL0Size: u64,
    pub MemoryPoolL1Size: u64,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_DECODE_CONFIGURATION struct {
	DecodeProfile windows.GUID
	BitstreamEncryption int32
	InterlaceType int32
}

type DXGI_RATIONAL struct {
	Numerator uint32
	Denominator uint32
}

type D3D12_VIDEO_DECODER_HEAP_DESC struct {
	NodeMask uint32
	Configuration D3D12_VIDEO_DECODE_CONFIGURATION
	DecodeWidth uint32
	DecodeHeight uint32
	Format int32
	FrameRate DXGI_RATIONAL
	BitRate uint32
	MaxDecodePictureBufferCount uint32
}

type D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 struct {
	VideoDecoderHeapDesc D3D12_VIDEO_DECODER_HEAP_DESC
	Protected int32
	MemoryPoolL0Size uint64
	MemoryPoolL1Size uint64
}
type
  D3D12_VIDEO_DECODE_CONFIGURATION = record
    DecodeProfile: TGUID;
    BitstreamEncryption: Integer;
    InterlaceType: Integer;
  end;

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

  D3D12_VIDEO_DECODER_HEAP_DESC = record
    NodeMask: DWORD;
    Configuration: D3D12_VIDEO_DECODE_CONFIGURATION;
    DecodeWidth: DWORD;
    DecodeHeight: DWORD;
    Format: Integer;
    FrameRate: DXGI_RATIONAL;
    BitRate: DWORD;
    MaxDecodePictureBufferCount: DWORD;
  end;

  D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 = record
    VideoDecoderHeapDesc: D3D12_VIDEO_DECODER_HEAP_DESC;
    Protected: BOOL;
    MemoryPoolL0Size: UInt64;
    MemoryPoolL1Size: UInt64;
  end;
const D3D12_VIDEO_DECODE_CONFIGURATION = extern struct {
    DecodeProfile: GUID,
    BitstreamEncryption: i32,
    InterlaceType: i32,
};

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

const D3D12_VIDEO_DECODER_HEAP_DESC = extern struct {
    NodeMask: u32,
    Configuration: D3D12_VIDEO_DECODE_CONFIGURATION,
    DecodeWidth: u32,
    DecodeHeight: u32,
    Format: i32,
    FrameRate: DXGI_RATIONAL,
    BitRate: u32,
    MaxDecodePictureBufferCount: u32,
};

const D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 = extern struct {
    VideoDecoderHeapDesc: D3D12_VIDEO_DECODER_HEAP_DESC,
    Protected: i32,
    MemoryPoolL0Size: u64,
    MemoryPoolL1Size: u64,
};
type
  D3D12_VIDEO_DECODE_CONFIGURATION {.bycopy.} = object
    DecodeProfile: GUID
    BitstreamEncryption: int32
    InterlaceType: int32

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

  D3D12_VIDEO_DECODER_HEAP_DESC {.bycopy.} = object
    NodeMask: uint32
    Configuration: D3D12_VIDEO_DECODE_CONFIGURATION
    DecodeWidth: uint32
    DecodeHeight: uint32
    Format: int32
    FrameRate: DXGI_RATIONAL
    BitRate: uint32
    MaxDecodePictureBufferCount: uint32

  D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 {.bycopy.} = object
    VideoDecoderHeapDesc: D3D12_VIDEO_DECODER_HEAP_DESC
    Protected: int32
    MemoryPoolL0Size: uint64
    MemoryPoolL1Size: uint64
struct D3D12_VIDEO_DECODE_CONFIGURATION
{
    GUID DecodeProfile;
    int BitstreamEncryption;
    int InterlaceType;
}

struct DXGI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct D3D12_VIDEO_DECODER_HEAP_DESC
{
    uint NodeMask;
    D3D12_VIDEO_DECODE_CONFIGURATION Configuration;
    uint DecodeWidth;
    uint DecodeHeight;
    int Format;
    DXGI_RATIONAL FrameRate;
    uint BitRate;
    uint MaxDecodePictureBufferCount;
}

struct D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1
{
    D3D12_VIDEO_DECODER_HEAP_DESC VideoDecoderHeapDesc;
    int Protected;
    ulong MemoryPoolL0Size;
    ulong MemoryPoolL1Size;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1 サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; VideoDecoderHeapDesc : D3D12_VIDEO_DECODER_HEAP_DESC (+0, 56byte)  varptr(st)+0 を基点に操作(56byte:入れ子/配列)
; Protected : BOOL (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; MemoryPoolL0Size : ULONGLONG (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; MemoryPoolL1Size : ULONGLONG (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global D3D12_VIDEO_DECODE_CONFIGURATION
    #field GUID DecodeProfile
    #field int BitstreamEncryption
    #field int InterlaceType
#endstruct

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

#defstruct global D3D12_VIDEO_DECODER_HEAP_DESC
    #field int NodeMask
    #field D3D12_VIDEO_DECODE_CONFIGURATION Configuration
    #field int DecodeWidth
    #field int DecodeHeight
    #field int Format
    #field DXGI_RATIONAL FrameRate
    #field int BitRate
    #field int MaxDecodePictureBufferCount
#endstruct

#defstruct global D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE1
    #field D3D12_VIDEO_DECODER_HEAP_DESC VideoDecoderHeapDesc
    #field bool Protected
    #field int64 MemoryPoolL0Size
    #field int64 MemoryPoolL1Size
#endstruct

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