OROCHI
 
Loading...
Searching...
No Matches
GxMotionEncoder.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12#include <assert.h>
13#include <vector>
14
15using namespace ::gx::core;
16
17//-----------------------------------------------------------------------------
19//-----------------------------------------------------------------------------
21{
22public:
24 KeyCache(void) : _x(0.0f){}
25 f32 _x;
26};
27
28namespace NEW_MOTION_ENCODER
29{
30 //-----------------------------------------------------------------------------
31 // カーブヘッダWORD
32 //-----------------------------------------------------------------------------
33 union Header
34{
35#if GX_BIG_ENDIAN
36 struct {
37 u16 _flags;
38 u16 _frames;
39 union
40 {
41 struct
42 {
43 u8 _gap;
44 s8 _decimalBit;
45 u16 _param;
46 };
47 f32 _constantValue;
48 };
49 };
50 u32 _d[2];
51#else //GX_BIG_ENDIAN
52 struct
53 {
54 u16 _frames;
55 u16 _flags;
56 union
57 {
58 struct
59 {
60 u16 _param;
62 u8 _gap;
63 };
65 };
66 };
67 u32 _d[2];
68#endif // !GX_BIG_ENDIAN
69};
70
71// Header::flags のフラグ定義
72#define KEYFRAME_INTERVAL_MASK 0x0001 // キーフレームの間隔マスク
73#define KEYFRAME_CONSTANT_INTERVAL 0x0000 // 一定間隔でのキーフレーム
74#define KEYFRAME_SPECIFY_POSITION 0x0001 // フレーム位置を指定(未実装)
75#define KEYFRAME_SHORT_TYPE 0x0002 // キーフレームの型は short 型
76#define CONSTANT_DATA 0x0004 // 完全な定数データ
77#define KEYFRAME_RAWDATA 0x0008 // 完全な無圧縮データ
78
79//-----------------------------------------------------------------------------
81//-----------------------------------------------------------------------------
83{
84 struct
85 {
86 s32 _x0;
87 s32 _v0;
88 };
89 u32 _d[2];
90};
91
92// キーフレーム参照配列に、キーフレームが定数であることを示すビット
93#define KEYFRAME_CONSTANT_VALUE 0x8000
94
95//-----------------------------------------------------------------------------
96// キーフレームWORD(int16_t型)
97//-----------------------------------------------------------------------------
99{
100 struct
101 {
102#if GX_BIG_ENDIAN
103 s16 _v0;
104 s16 _x0;
105#else //GX_BIG_ENDIAN
106 s16 _x0;
107 s16 _v0;
108#endif // !GX_BIG_ENDIAN
109 };
111 u32 _d[1];
112};
113
114//-----------------------------------------------------------------------------
115// ビット幅変更WORD
116//-----------------------------------------------------------------------------
118{
119 struct
120 {
121#if GX_BIG_ENDIAN
122 s16 _b;
123 u8 _w;
124 u8 _c;
125#else //GX_BIG_ENDIAN
126 u8 _c;
127 u8 _w;
128 s16 _b;
129#endif // !GX_BIG_ENDIAN
130 };
131 u32 _d[1];
132};
133
134// BitWidthChange::w(圧縮率)の定義
135#define COMPRATE_2BIT 0
136#define COMPRATE_3BIT 1
137#define COMPRATE_4BIT 2
138#define COMPRATE_5BIT 3
139#define COMPRATE_6BIT 4
140#define COMPRATE_8BIT 5
141#define COMPRATE_16BIT 6
142#define COMPRATE_32BIT 7
143#define COMPRATE_RUNLENGTH 8
144
145//-----------------------------------------------------------------------------
147//-----------------------------------------------------------------------------
153
156{
157 { 2, 16 }, // COMPRATE_2BIT
158 { 3, 10 }, // COMPRATE_3BIT
159 { 4, 8 }, // COMPRATE_4BIT
160 { 5, 6 }, // COMPRATE_5BIT
161 { 6, 5 }, // COMPRATE_6BIT
162 { 8, 4 }, // COMPRATE_8BIT
163 { 16, 2 }, // COMPRATE_16BIT
164 { 32, 1 }, // COMPRATE_32BIT
165};
166
167//-----------------------------------------------------------------------------
169//-----------------------------------------------------------------------------
170s32 uncompressData(u32* pCompressData, f32* pData);
171
172//-----------------------------------------------------------------------------
174//-----------------------------------------------------------------------------
175s32 uncompressUnitQuaternion(u32** ppCompressData, f32* pData[4]);
176
177//-----------------------------------------------------------------------------
179//-----------------------------------------------------------------------------
180s32 uncompressUnitQuaternionFrame(u32** ppCompressData, u32 frame0, u32 frame1, f32* pDataStw[3], f32* pData[4]);
181
182//-----------------------------------------------------------------------------
184//-----------------------------------------------------------------------------
185f32 inverseQuantize(s32 in, s8 width);
186
187//-----------------------------------------------------------------------------
189//-----------------------------------------------------------------------------
190void getQuaternion(f32 data[3], f32 outData[4]);
191
192//-----------------------------------------------------------------------------
194//-----------------------------------------------------------------------------
195f32 getCurveValueFromFrame(u32* pCompressData, u32 frame, KeyCache* pCache);
196
197//-----------------------------------------------------------------------------
199//-----------------------------------------------------------------------------
200f32 getCurveValueFromCache(u32* pCompressData, u32 frame, KeyCache* pCache, u32 cacheFrame);
201
202}
const CompressBitType COMPRESS_BIT_TYPE_TABLE[]
比較用ビット種類テーブル
Definition GxMotionEncoder.h:155
キーキャッシュクラス
Definition GxMotionEncoder.h:21
KeyCache(void)
デフォルトコンストラクタ
Definition GxMotionEncoder.h:24
f32 _x
X値
Definition GxMotionEncoder.h:25
圧縮率ごとの、圧縮ブロックの情報
Definition GxMotionEncoder.h:149
u32 _bitPerFrame
1フレームを何bitに圧縮するか
Definition GxMotionEncoder.h:150
u32 _framePerBlock
1ブロックに何フレーム入るか
Definition GxMotionEncoder.h:151
Definition GxMotionEncoder.h:118
u32 _d[1]
データ
Definition GxMotionEncoder.h:131
u8 _w
圧縮率
Definition GxMotionEncoder.h:127
u8 _c
データ数
Definition GxMotionEncoder.h:126
s16 _b
データ(加速度)のバイアス
Definition GxMotionEncoder.h:128
Definition GxMotionEncoder.h:34
u32 _d[2]
データ
Definition GxMotionEncoder.h:67
s8 _decimalBit
小数点以下の桁数(2進数)
Definition GxMotionEncoder.h:61
u16 _frames
圧縮データ全体のフレーム数
Definition GxMotionEncoder.h:54
u8 _gap
未使用
Definition GxMotionEncoder.h:62
f32 _constantValue
定数データ値
Definition GxMotionEncoder.h:64
u16 _flags
フラグ
Definition GxMotionEncoder.h:55
u16 _param
フラグパラメータ
Definition GxMotionEncoder.h:60
キーフレームWORD(int32_t型)
Definition GxMotionEncoder.h:83
s32 _x0
初期値
Definition GxMotionEncoder.h:86
s32 _v0
初速度
Definition GxMotionEncoder.h:87
u32 _d[2]
データ
Definition GxMotionEncoder.h:89
Definition GxMotionEncoder.h:99
s16 _v0
初速度
Definition GxMotionEncoder.h:107
u32 _d[1]
データ
Definition GxMotionEncoder.h:111
f32 _constantValue
定数データ値
Definition GxMotionEncoder.h:110
s16 _x0
初期値
Definition GxMotionEncoder.h:106