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

KS_DVD_YCrCb

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

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

フィールド

フィールドサイズx64x86説明
ReservedBYTE1+0+0予約バイトで、0を設定する。
YBYTE1+1+1輝度(Y)成分の値を示す。
CrBYTE1+2+2赤系の色差(Cr)成分の値を示す。
CbBYTE1+3+3青系の色差(Cb)成分の値を示す。

各言語での定義

#include <windows.h>

// KS_DVD_YCrCb  (x64 4 / x86 4 バイト)
typedef struct KS_DVD_YCrCb {
    BYTE Reserved;
    BYTE Y;
    BYTE Cr;
    BYTE Cb;
} KS_DVD_YCrCb;
using System;
using System.Runtime.InteropServices;

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

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

class KS_DVD_YCrCb(ctypes.Structure):
    _fields_ = [
        ("Reserved", ctypes.c_ubyte),
        ("Y", ctypes.c_ubyte),
        ("Cr", ctypes.c_ubyte),
        ("Cb", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct KS_DVD_YCrCb {
    pub Reserved: u8,
    pub Y: u8,
    pub Cr: u8,
    pub Cb: u8,
}
import "golang.org/x/sys/windows"

type KS_DVD_YCrCb struct {
	Reserved byte
	Y byte
	Cr byte
	Cb byte
}
type
  KS_DVD_YCrCb = record
    Reserved: Byte;
    Y: Byte;
    Cr: Byte;
    Cb: Byte;
  end;
const KS_DVD_YCrCb = extern struct {
    Reserved: u8,
    Y: u8,
    Cr: u8,
    Cb: u8,
};
type
  KS_DVD_YCrCb {.bycopy.} = object
    Reserved: uint8
    Y: uint8
    Cr: uint8
    Cb: uint8
struct KS_DVD_YCrCb
{
    ubyte Reserved;
    ubyte Y;
    ubyte Cr;
    ubyte Cb;
}

HSP用 定義

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

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

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