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

DXVA2_AYUVSample16

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

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

フィールド

フィールドサイズx64x86説明
CrWORD2+0+016ビットのCr(赤色差)成分値。
CbWORD2+2+216ビットのCb(青色差)成分値。
YWORD2+4+416ビットのY(輝度)成分値。
AlphaWORD2+6+616ビットのアルファ(不透明度)成分値。

各言語での定義

#include <windows.h>

// DXVA2_AYUVSample16  (x64 8 / x86 8 バイト)
typedef struct DXVA2_AYUVSample16 {
    WORD Cr;
    WORD Cb;
    WORD Y;
    WORD Alpha;
} DXVA2_AYUVSample16;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVA2_AYUVSample16
{
    public ushort Cr;
    public ushort Cb;
    public ushort Y;
    public ushort Alpha;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVA2_AYUVSample16
    Public Cr As UShort
    Public Cb As UShort
    Public Y As UShort
    Public Alpha As UShort
End Structure
import ctypes
from ctypes import wintypes

class DXVA2_AYUVSample16(ctypes.Structure):
    _fields_ = [
        ("Cr", ctypes.c_ushort),
        ("Cb", ctypes.c_ushort),
        ("Y", ctypes.c_ushort),
        ("Alpha", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct DXVA2_AYUVSample16 {
    pub Cr: u16,
    pub Cb: u16,
    pub Y: u16,
    pub Alpha: u16,
}
import "golang.org/x/sys/windows"

type DXVA2_AYUVSample16 struct {
	Cr uint16
	Cb uint16
	Y uint16
	Alpha uint16
}
type
  DXVA2_AYUVSample16 = record
    Cr: Word;
    Cb: Word;
    Y: Word;
    Alpha: Word;
  end;
const DXVA2_AYUVSample16 = extern struct {
    Cr: u16,
    Cb: u16,
    Y: u16,
    Alpha: u16,
};
type
  DXVA2_AYUVSample16 {.bycopy.} = object
    Cr: uint16
    Cb: uint16
    Y: uint16
    Alpha: uint16
struct DXVA2_AYUVSample16
{
    ushort Cr;
    ushort Cb;
    ushort Y;
    ushort Alpha;
}

HSP用 定義

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

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

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