Skip to main content

Module h264

Module h264 

Source

Structs§

BitReader
MSB-first のビットリーダ。H.264 の RBSP を読むための最小実装。
DecodedVideoFrame
H264Decoder
NalUnit
Pps
Sps

Constants§

NORM_ADJUST_4X4 🔒
normAdjust4x4(m, class)。class: 0=偶偶, 1=奇奇, 2=その他。

Functions§

clip1 🔒
dequant_4x4
4x4 残差ブロックの逆量子化(in-place、raster 順)。qp は 0..=51。 LevelScale = weightScale(=16) * normAdjust4x4(qp%6, class)。
describe_sps
デバッグ用の文字列表現。
extract_rbsp
RBSP 抽出: NAL ペイロードから emulation_prevention_three_byte(0x03) を除去する。 0x00 0x00 0x03 のシーケンスで 0x03 を落とす(0x000000/0x000001 の誤検出回避用バイト)。
has_start_code 🔒
intra_4x4_predict
Intra_4x4 予測(9 モード)。 top: p[x,-1] x=0..7(上 + 右上), corner: p[-1,-1], left: p[-1,y] y=0..3。 DC モードのみ可用性で式が変わるため top_avail/left_avail を渡す。
intra_16x16_predict
Intra_16x16 予測(4 モード: 0=Vertical, 1=Horizontal, 2=DC, 3=Plane)。 top: p[x,-1] x=0..15, corner: p[-1,-1], left: p[-1,y] y=0..15。
intra_chroma_predict
Intra chroma 8x8 予測(4:2:0、4 モード: 0=DC, 1=Horizontal, 2=Vertical, 3=Plane)。 仕様 8.3.4。top: p[x,-1] x=0..7, corner: p[-1,-1], left: p[-1,y] y=0..7。
inverse_transform_4x4
4x4 逆整数変換(in-place、raster 順)。最後に (x + 32) >> 6 で正規化。
parse_avcc
avcC(AVCDecoderConfigurationRecord)から SPS/PPS と length_size を抽出。 返り値: (length_size, sps_nal_payloads, pps_nal_payloads)。各 payload は NAL ヘッダ込み。
parse_pps
parse_sps
SPS RBSP をパースして解像度等を得る(baseline/main で必要な範囲)。
pos_class_4x4 🔒
selftest
既知解ベクタによる検証(起動時に実行)。
split_annexb
Annex-B(00 00 01 / 00 00 00 01 区切り)のバイト列を NAL 群に分割。
split_avcc
AVCC(長さ前置)の1サンプルを NAL 群に分割。length_size は 1/2/4。