QTheora Core API 仕様

初期化

  1. BOOL QT_Initialize(void);
  2. BOOL QT_SetEnableX86(BOOL b);
  3. BOOL QT_SetEnableMMX(BOOL b);
  4. BOOL QT_SetEnableSSE2(BOOL b);

QT_Initialize()

ライブラリ初期化のため、プロセス開始時に一度だけ呼び出す。

QT_SetEnableX86()

QT_SetEnableMMX()

QT_SetEnableSSE2()

x86, MMX, SSE2 拡張ルーチンを使用するかどうかを変更する。使用 CPU によって QT_Initialize() 関数が 自動的に設定するため、テスト以外の用途では呼び出す必要はない。

デコーダーセットアップ

  1. struct QTheoraDecoderSetup;
  2. typedef struct QTheoraDecoderSetup QTheoraDecoderSetup_t;
  3. QTheoraDecoderSetup_t* QT_CreateDecoderSetup(void);
  4. void QT_ReleaseDecoderSetup(QTheoraDecoderSetup_t* setup);
  5. BOOL QT_SetupDecoderSetupLacing(
  6. QTheoraDecoderSetup_t* setup,
  7. const VOID* packet,
  8. SIZE_T size);

QT_CreateDecoderSetup()

デコーダーセットアップオブジェクトを作成する。

QT_ReleaseDecoderSetup()

デコーダーセットアップオブジェクトを解放する。

QT_SetupDecoderSetupLacing()

Theora の Identification header および Setup header を入力して、 デコーダーセットアップを準備する。入力パケットは、Xiph Lacing で区切られる ものとする。(Matroska CODEC Private 準拠) セットアップデーターが不正な場合は、エラーとして、FALSE を返す。

フォーマット

  1. struct QT_Format {
  2. INT32 CX;
  3. INT32 CY;
  4. INT32 PX;
  5. INT32 PY;
  6. INT32 PW;
  7. INT32 PH;
  8. INT32 FRN;
  9. INT32 FRD;
  10. INT32 PRN;
  11. INT32 PRD;
  12. };
  13. typedef struct QT_Format QT_Format_t;
  14. BOOL QT_GetFormatSetup(
  15. QTheoraDecoderSetup_t* setup,
  16. QT_Format_t* format);

QT_Format_t 構造体

CX, CY フレームバッファーのサイズ

PX, PY, PW, PH フレームバッファー内での有効ピクチャーの領域 (起点座標, サイズ)

FRN, FRD フレームレート

PRN, PRD ピクセルアスペクト比

QT_GetFormatSetup()

ビデオフォーマット情報を取得する。

デコーダー

  1. struct QTheoraDecoder;
  2. typedef struct QTheoraDecoder QTheoraDecoder_t;
  3. QTheoraDecoder_t* QT_CreateDecoder(void);
  4. void QT_ReleaseDecoder(QTheoraDecoder_t* d);
  5. BOOL QT_SetupDecoder(
  6. QTheoraDecoder_t* d,
  7. QTheoraDecoderSetup_t* setup);
  8. struct QT_Output {
  9. const UINT8* Plane[3];
  10. INT32 CX;
  11. INT32 CY;
  12. };
  13. typedef struct QT_Output QT_Output_t;
  14. BOOL QT_DecodeFrame(
  15. QTheoraDecoder_t* d,
  16. const VOID* packet,
  17. SIZE_T size,
  18. QT_Output_t* output);

QT_CreateDecoder()

デコーダーオブジェクトを作成する。

QT_ReleaseDecoder()

デコーダーオブジェクトを解放する。

QT_SetupDecoder()

デコーダーオブジェクトを準備する。

setup には、セットアップオブジェクトを指定する。 単一のセットアップオブジェクトから、複数のデコーダーを準備することも可能である。

QT_DecodeFrame()

1 フレーム分のビットストリームをデコードし、YUV フレームサンプルを返す。

packet, size には、1 フレーム分の入力ビットストリームを指定する。 (1 フレームごとのパケット化は、上位のコンテナフォーマットで処理される。)

output へ、出力結果が返される。

QT_Output_t 構造体

Plane[0] には、Y プレーンデータを返す。

Plane[1] には、U (Cb) プレーンデータを返す。

Plane[2] には、V (Cr) プレーンデータを返す。

CX, CY は、フレームのサイズを返す。UV プレーンのサイズは、それぞれ 1/2 となる。

Theora 仕様により、プレーンのデータは配置は、ボトムアップ型となっている。 表示を行う際は、必要に応じて、上下方向の反転を行うこと。

フレームサンプルのカラーフォーマットは、YUV 4:2:0p のみを想定している。