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

D3D12_VIDEO_ENCODER_MOVEREGION_INFO

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

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

フィールド

フィールドサイズx64x86説明
NumMoveRegionsDWORD4+0+0pMoveRegionsが指す移動矩形配列の要素数を指定する。
pMoveRegionsD3D12_VIDEO_ENCODER_MOVE_RECT*8/4+8+4移動領域(移動元/移動先)を示す矩形配列へのポインタである。
MotionSearchModeConfigurationD3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG8+16+8移動領域に適用する動き探索モードの構成を指定する。
SourceDPBFrameReferenceDWORD4+24+16移動の基準となるDPB内参照フレームのインデックスを指定する。
MotionUnitPrecisionD3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION4+28+20移動ベクトルの単位精度(整数/分数画素)を指定する。
FlagsD3D12_VIDEO_ENCODER_MOVEREGION_INFO_FLAGS4+32+24移動領域情報の動作オプションを示すフラグである。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG  (x64 8 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG {
    D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE MotionSearchMode;
    DWORD SearchDeviationLimit;
} D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG;

// D3D12_VIDEO_ENCODER_MOVEREGION_INFO  (x64 40 / x86 28 バイト)
typedef struct D3D12_VIDEO_ENCODER_MOVEREGION_INFO {
    DWORD NumMoveRegions;
    D3D12_VIDEO_ENCODER_MOVE_RECT* pMoveRegions;
    D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG MotionSearchModeConfiguration;
    DWORD SourceDPBFrameReference;
    D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION MotionUnitPrecision;
    D3D12_VIDEO_ENCODER_MOVEREGION_INFO_FLAGS Flags;
} D3D12_VIDEO_ENCODER_MOVEREGION_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
{
    public int MotionSearchMode;
    public uint SearchDeviationLimit;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_MOVEREGION_INFO
{
    public uint NumMoveRegions;
    public IntPtr pMoveRegions;
    public D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG MotionSearchModeConfiguration;
    public uint SourceDPBFrameReference;
    public int MotionUnitPrecision;
    public int Flags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
    Public MotionSearchMode As Integer
    Public SearchDeviationLimit As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_MOVEREGION_INFO
    Public NumMoveRegions As UInteger
    Public pMoveRegions As IntPtr
    Public MotionSearchModeConfiguration As D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
    Public SourceDPBFrameReference As UInteger
    Public MotionUnitPrecision As Integer
    Public Flags As Integer
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG(ctypes.Structure):
    _fields_ = [
        ("MotionSearchMode", ctypes.c_int),
        ("SearchDeviationLimit", wintypes.DWORD),
    ]

class D3D12_VIDEO_ENCODER_MOVEREGION_INFO(ctypes.Structure):
    _fields_ = [
        ("NumMoveRegions", wintypes.DWORD),
        ("pMoveRegions", ctypes.c_void_p),
        ("MotionSearchModeConfiguration", D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG),
        ("SourceDPBFrameReference", wintypes.DWORD),
        ("MotionUnitPrecision", ctypes.c_int),
        ("Flags", ctypes.c_int),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG {
    pub MotionSearchMode: i32,
    pub SearchDeviationLimit: u32,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_MOVEREGION_INFO {
    pub NumMoveRegions: u32,
    pub pMoveRegions: *mut core::ffi::c_void,
    pub MotionSearchModeConfiguration: D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG,
    pub SourceDPBFrameReference: u32,
    pub MotionUnitPrecision: i32,
    pub Flags: i32,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG struct {
	MotionSearchMode int32
	SearchDeviationLimit uint32
}

type D3D12_VIDEO_ENCODER_MOVEREGION_INFO struct {
	NumMoveRegions uint32
	pMoveRegions uintptr
	MotionSearchModeConfiguration D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
	SourceDPBFrameReference uint32
	MotionUnitPrecision int32
	Flags int32
}
type
  D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG = record
    MotionSearchMode: Integer;
    SearchDeviationLimit: DWORD;
  end;

  D3D12_VIDEO_ENCODER_MOVEREGION_INFO = record
    NumMoveRegions: DWORD;
    pMoveRegions: Pointer;
    MotionSearchModeConfiguration: D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG;
    SourceDPBFrameReference: DWORD;
    MotionUnitPrecision: Integer;
    Flags: Integer;
  end;
const D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG = extern struct {
    MotionSearchMode: i32,
    SearchDeviationLimit: u32,
};

const D3D12_VIDEO_ENCODER_MOVEREGION_INFO = extern struct {
    NumMoveRegions: u32,
    pMoveRegions: ?*anyopaque,
    MotionSearchModeConfiguration: D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG,
    SourceDPBFrameReference: u32,
    MotionUnitPrecision: i32,
    Flags: i32,
};
type
  D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG {.bycopy.} = object
    MotionSearchMode: int32
    SearchDeviationLimit: uint32

  D3D12_VIDEO_ENCODER_MOVEREGION_INFO {.bycopy.} = object
    NumMoveRegions: uint32
    pMoveRegions: pointer
    MotionSearchModeConfiguration: D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
    SourceDPBFrameReference: uint32
    MotionUnitPrecision: int32
    Flags: int32
struct D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
{
    int MotionSearchMode;
    uint SearchDeviationLimit;
}

struct D3D12_VIDEO_ENCODER_MOVEREGION_INFO
{
    uint NumMoveRegions;
    void* pMoveRegions;
    D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG MotionSearchModeConfiguration;
    uint SourceDPBFrameReference;
    int MotionUnitPrecision;
    int Flags;
}

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_MOVEREGION_INFO サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; NumMoveRegions : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pMoveRegions : D3D12_VIDEO_ENCODER_MOVE_RECT* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; MotionSearchModeConfiguration : D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; SourceDPBFrameReference : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; MotionUnitPrecision : D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Flags : D3D12_VIDEO_ENCODER_MOVEREGION_INFO_FLAGS (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_VIDEO_ENCODER_MOVEREGION_INFO サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; NumMoveRegions : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pMoveRegions : D3D12_VIDEO_ENCODER_MOVE_RECT* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; MotionSearchModeConfiguration : D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; SourceDPBFrameReference : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; MotionUnitPrecision : D3D12_VIDEO_ENCODER_FRAME_INPUT_MOTION_UNIT_PRECISION (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Flags : D3D12_VIDEO_ENCODER_MOVEREGION_INFO_FLAGS (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG
    #field int MotionSearchMode
    #field int SearchDeviationLimit
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_MOVEREGION_INFO
    #field int NumMoveRegions
    #field intptr pMoveRegions
    #field D3D12_VIDEO_ENCODER_FRAME_MOTION_SEARCH_MODE_CONFIG MotionSearchModeConfiguration
    #field int SourceDPBFrameReference
    #field int MotionUnitPrecision
    #field int Flags
#endstruct

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