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

D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264

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

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

フィールド

フィールドサイズx64x86説明
GOPLengthDWORD4+0+0GOP(Group Of Pictures)の長さ。0で無限GOPを意味する。
PPicturePeriodDWORD4+4+4連続するPフレーム間の間隔(Bフレーム数に依存)を指定する。
pic_order_cnt_typeBYTE1+8+8ピクチャ順序カウント(POC)の符号化方式を示すH264構文要素である。
log2_max_frame_num_minus4BYTE1+9+9frame_numの最大値を定めるlog2値から4を引いた構文要素である。
log2_max_pic_order_cnt_lsb_minus4BYTE1+10+10POC下位ビットの最大値を定めるlog2値から4を引いた構文要素である。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264  (x64 12 / x86 12 バイト)
typedef struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 {
    DWORD GOPLength;
    DWORD PPicturePeriod;
    BYTE pic_order_cnt_type;
    BYTE log2_max_frame_num_minus4;
    BYTE log2_max_pic_order_cnt_lsb_minus4;
} D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264
{
    public uint GOPLength;
    public uint PPicturePeriod;
    public byte pic_order_cnt_type;
    public byte log2_max_frame_num_minus4;
    public byte log2_max_pic_order_cnt_lsb_minus4;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264
    Public GOPLength As UInteger
    Public PPicturePeriod As UInteger
    Public pic_order_cnt_type As Byte
    Public log2_max_frame_num_minus4 As Byte
    Public log2_max_pic_order_cnt_lsb_minus4 As Byte
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264(ctypes.Structure):
    _fields_ = [
        ("GOPLength", wintypes.DWORD),
        ("PPicturePeriod", wintypes.DWORD),
        ("pic_order_cnt_type", ctypes.c_ubyte),
        ("log2_max_frame_num_minus4", ctypes.c_ubyte),
        ("log2_max_pic_order_cnt_lsb_minus4", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 {
    pub GOPLength: u32,
    pub PPicturePeriod: u32,
    pub pic_order_cnt_type: u8,
    pub log2_max_frame_num_minus4: u8,
    pub log2_max_pic_order_cnt_lsb_minus4: u8,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 struct {
	GOPLength uint32
	PPicturePeriod uint32
	pic_order_cnt_type byte
	log2_max_frame_num_minus4 byte
	log2_max_pic_order_cnt_lsb_minus4 byte
}
type
  D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 = record
    GOPLength: DWORD;
    PPicturePeriod: DWORD;
    pic_order_cnt_type: Byte;
    log2_max_frame_num_minus4: Byte;
    log2_max_pic_order_cnt_lsb_minus4: Byte;
  end;
const D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 = extern struct {
    GOPLength: u32,
    PPicturePeriod: u32,
    pic_order_cnt_type: u8,
    log2_max_frame_num_minus4: u8,
    log2_max_pic_order_cnt_lsb_minus4: u8,
};
type
  D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 {.bycopy.} = object
    GOPLength: uint32
    PPicturePeriod: uint32
    pic_order_cnt_type: uint8
    log2_max_frame_num_minus4: uint8
    log2_max_pic_order_cnt_lsb_minus4: uint8
struct D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264
{
    uint GOPLength;
    uint PPicturePeriod;
    ubyte pic_order_cnt_type;
    ubyte log2_max_frame_num_minus4;
    ubyte log2_max_pic_order_cnt_lsb_minus4;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264 サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; GOPLength : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PPicturePeriod : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pic_order_cnt_type : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; log2_max_frame_num_minus4 : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; log2_max_pic_order_cnt_lsb_minus4 : BYTE (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_VIDEO_ENCODER_SEQUENCE_GOP_STRUCTURE_H264
    #field int GOPLength
    #field int PPicturePeriod
    #field byte pic_order_cnt_type
    #field byte log2_max_frame_num_minus4
    #field byte log2_max_pic_order_cnt_lsb_minus4
#endstruct

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