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

MACROBLOCK_DATA

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

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

フィールド

フィールドサイズx64x86説明
flagsDWORD4+0+0マクロブロックの属性を示すビットフラグ。
motionVectorXSHORT2+4+4動きベクトルのX成分。
motionVectorYSHORT2+6+6動きベクトルのY成分。
QPDeltaINT4+8+8このマクロブロックに適用する量子化パラメータ(QP)の差分値。

各言語での定義

#include <windows.h>

// MACROBLOCK_DATA  (x64 12 / x86 12 バイト)
typedef struct MACROBLOCK_DATA {
    DWORD flags;
    SHORT motionVectorX;
    SHORT motionVectorY;
    INT QPDelta;
} MACROBLOCK_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MACROBLOCK_DATA
{
    public uint flags;
    public short motionVectorX;
    public short motionVectorY;
    public int QPDelta;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MACROBLOCK_DATA
    Public flags As UInteger
    Public motionVectorX As Short
    Public motionVectorY As Short
    Public QPDelta As Integer
End Structure
import ctypes
from ctypes import wintypes

class MACROBLOCK_DATA(ctypes.Structure):
    _fields_ = [
        ("flags", wintypes.DWORD),
        ("motionVectorX", ctypes.c_short),
        ("motionVectorY", ctypes.c_short),
        ("QPDelta", ctypes.c_int),
    ]
#[repr(C)]
pub struct MACROBLOCK_DATA {
    pub flags: u32,
    pub motionVectorX: i16,
    pub motionVectorY: i16,
    pub QPDelta: i32,
}
import "golang.org/x/sys/windows"

type MACROBLOCK_DATA struct {
	flags uint32
	motionVectorX int16
	motionVectorY int16
	QPDelta int32
}
type
  MACROBLOCK_DATA = record
    flags: DWORD;
    motionVectorX: Smallint;
    motionVectorY: Smallint;
    QPDelta: Integer;
  end;
const MACROBLOCK_DATA = extern struct {
    flags: u32,
    motionVectorX: i16,
    motionVectorY: i16,
    QPDelta: i32,
};
type
  MACROBLOCK_DATA {.bycopy.} = object
    flags: uint32
    motionVectorX: int16
    motionVectorY: int16
    QPDelta: int32
struct MACROBLOCK_DATA
{
    uint flags;
    short motionVectorX;
    short motionVectorY;
    int QPDelta;
}

HSP用 定義

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

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

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