1
=============================================
2
SNOW Video Codec Specification Draft 20070103
3
=============================================
9
MUST the specific part must be done to conform to this standard
10
SHOULD it is recommended to be done that way, but not strictly required
12
ilog2(x) is the rounded down logarithm of x with basis 2
19
u unsigned scalar value range coded
20
s signed scalar value range coded
33
if(keyframe || always_reset)
36
version u header_state
37
always_reset b header_state
38
temporal_decomposition_type u header_state
39
temporal_decomposition_count u header_state
40
spatial_decomposition_count u header_state
41
colorspace_type u header_state
42
chroma_h_shift u header_state
43
chroma_v_shift u header_state
44
spatial_scalability b header_state
45
max_ref_frames-1 u header_state
49
spatial_decomposition_type s header_state
51
mv_scale s header_state
53
block_max_depth s header_state
56
for(plane=0; plane<2; plane++){
57
quant_table[plane][0][0] s header_state
58
for(level=0; level < spatial_decomposition_count; level++){
59
quant_table[plane][level][1]s header_state
60
quant_table[plane][level][3]s header_state
68
for(y=0; y<block_count_vertical; y++)
69
for(x=0; x<block_count_horizontal; x++)
75
y_diff=cb_diff=cr_diff=0
77
if(level!=max_block_depth){
78
s_context= 2*left->level + 2*top->level + topleft->level + topright->level
79
leaf b block_state[4 + s_context]
81
if(level==max_block_depth || leaf){
82
intra b block_state[1 + left->intra + top->intra]
84
y_diff s block_state[32]
85
cb_diff s block_state[64]
86
cr_diff s block_state[96]
88
ref_context= ilog2(2*left->ref) + ilog2(2*top->ref)
90
ref u block_state[128 + 1024 + 32*ref_context]
91
mx_context= ilog2(2*abs(left->mx - top->mx))
92
my_context= ilog2(2*abs(left->my - top->my))
93
mvx_diff s block_state[128 + 32*(mx_context + 16*!!ref)]
94
mvy_diff s block_state[128 + 32*(my_context + 16*!!ref)]
115
this MUST NOT change within a bitstream
118
if 1 then the range coder contexts will be reset after each frame
120
temporal_decomposition_type
123
temporal_decomposition_count
126
spatial_decomposition_count
131
this MUST NOT change within a bitstream
134
log2(luma.width / chroma.width)
135
this MUST NOT change within a bitstream
138
log2(luma.height / chroma.height)
139
this MUST NOT change within a bitstream
145
maximum number of reference frames
146
this MUST NOT change within a bitstream
149
minimum of the number of available reference frames and max_ref_frames
150
for example the first frame after a key frame always has ref_frames=1
152
spatial_decomposition_type
154
0 is a 9/7 symmetric compact integer wavelet
155
1 is a 5/3 symmetric compact integer wavelet
157
stored as delta from last, last is reset to 0 if always_reset || keyframe
160
quality (logarthmic quantizer scale)
161
stored as delta from last, last is reset to 0 if always_reset || keyframe
164
stored as delta from last, last is reset to 0 if always_reset || keyframe
165
FIXME check that everything works fine if this changes between frames
169
stored as delta from last, last is reset to 0 if always_reset || keyframe
172
maximum depth of the block tree
173
stored as delta from last, last is reset to 0 if always_reset || keyframe
184
left and top are set to the respective blocks unless they are outside of
185
the image in which case they are set to the Null block
187
top-left is set to the top left block unless its outside of the image in
188
which case it is set to the left block
190
if this block has no larger parent block or its at the left side of its
191
parent block and the top right block is not outside of the image then the
192
top right block is used for top-right else the top-left block is used
196
level, ref, mx and my are 0
199
Motion Vector Prediction:
200
=========================
201
1. the motion vectors of all the neighboring blocks are scaled to
202
compensate for the difference of reference frames
204
scaled_mv= (mv * (256 * (current_reference+1) / (mv.reference+1)) + 128)>>8
206
2. the median of the scaled left, top and top-right vectors is used as
207
motion vector prediction
209
3. the used motion vector is the sum of the predictor and
210
(mvx_diff, mvy_diff)*mv_scale
214
======================
215
the luma and chroma values of the left block are used as predictors
217
the used luma and chroma is the sum of the predictor and y_diff, cb_diff, cr_diff
239
finetune initial contexts
240
spatial_decomposition_count per frame?
242
try to use the wavelet transformed predicted image (motion compensated image) as context for coding the residual coefficients
243
try the MV length as context for coding the residual coefficients
244
use extradata for stuff which is in the keyframes now?
245
the MV median predictor is patented IIRC
248
spatial_scalability b vs u (!= 0 breaks syntax anyway so we can add a u later)
259
GPL + GFDL + whatever is needed to make this a RFC