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

D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR

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

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

フィールド

フィールドサイズx64x86説明
InitialQPDWORD4+0+0符号化開始時の初期QP値。
MinQPDWORD4+4+4許容する最小QP値。
MaxQPDWORD4+8+8許容する最大QP値。
MaxFrameBitSizeULONGLONG8+16+161フレームの最大ビットサイズ(ビット単位)。
TargetAvgBitRateULONGLONG8+24+24目標とする平均ビットレート(bps単位)。
PeakBitRateULONGLONG8+32+32許容するピークビットレート(bps単位)。
ConstantQualityTargetDWORD4+40+40目標とする一定品質レベル。値が小さいほど高品質となる。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR  (x64 48 / x86 48 バイト)
typedef struct D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR {
    DWORD InitialQP;
    DWORD MinQP;
    DWORD MaxQP;
    ULONGLONG MaxFrameBitSize;
    ULONGLONG TargetAvgBitRate;
    ULONGLONG PeakBitRate;
    DWORD ConstantQualityTarget;
} D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR
{
    public uint InitialQP;
    public uint MinQP;
    public uint MaxQP;
    public ulong MaxFrameBitSize;
    public ulong TargetAvgBitRate;
    public ulong PeakBitRate;
    public uint ConstantQualityTarget;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR
    Public InitialQP As UInteger
    Public MinQP As UInteger
    Public MaxQP As UInteger
    Public MaxFrameBitSize As ULong
    Public TargetAvgBitRate As ULong
    Public PeakBitRate As ULong
    Public ConstantQualityTarget As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR(ctypes.Structure):
    _fields_ = [
        ("InitialQP", wintypes.DWORD),
        ("MinQP", wintypes.DWORD),
        ("MaxQP", wintypes.DWORD),
        ("MaxFrameBitSize", ctypes.c_ulonglong),
        ("TargetAvgBitRate", ctypes.c_ulonglong),
        ("PeakBitRate", ctypes.c_ulonglong),
        ("ConstantQualityTarget", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR {
    pub InitialQP: u32,
    pub MinQP: u32,
    pub MaxQP: u32,
    pub MaxFrameBitSize: u64,
    pub TargetAvgBitRate: u64,
    pub PeakBitRate: u64,
    pub ConstantQualityTarget: u32,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR struct {
	InitialQP uint32
	MinQP uint32
	MaxQP uint32
	MaxFrameBitSize uint64
	TargetAvgBitRate uint64
	PeakBitRate uint64
	ConstantQualityTarget uint32
}
type
  D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR = record
    InitialQP: DWORD;
    MinQP: DWORD;
    MaxQP: DWORD;
    MaxFrameBitSize: UInt64;
    TargetAvgBitRate: UInt64;
    PeakBitRate: UInt64;
    ConstantQualityTarget: DWORD;
  end;
const D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR = extern struct {
    InitialQP: u32,
    MinQP: u32,
    MaxQP: u32,
    MaxFrameBitSize: u64,
    TargetAvgBitRate: u64,
    PeakBitRate: u64,
    ConstantQualityTarget: u32,
};
type
  D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR {.bycopy.} = object
    InitialQP: uint32
    MinQP: uint32
    MaxQP: uint32
    MaxFrameBitSize: uint64
    TargetAvgBitRate: uint64
    PeakBitRate: uint64
    ConstantQualityTarget: uint32
struct D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR
{
    uint InitialQP;
    uint MinQP;
    uint MaxQP;
    ulong MaxFrameBitSize;
    ulong TargetAvgBitRate;
    ulong PeakBitRate;
    uint ConstantQualityTarget;
}

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_RATE_CONTROL_QVBR サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; InitialQP : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; MinQP : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; MaxQP : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; MaxFrameBitSize : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; TargetAvgBitRate : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; PeakBitRate : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ConstantQualityTarget : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3D12_VIDEO_ENCODER_RATE_CONTROL_QVBR
    #field int InitialQP
    #field int MinQP
    #field int MaxQP
    #field int64 MaxFrameBitSize
    #field int64 TargetAvgBitRate
    #field int64 PeakBitRate
    #field int ConstantQualityTarget
#endstruct

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