📄 snow.txt
字号:
=============================================SNOW Video Codec Specification Draft 20070103=============================================Intro:======This Specification describes the snow syntax and semmantics as well ashow to decode snow.The decoding process is precissely described and any compliant decoderMUST produce the exactly same output for a spec conformant snow stream.For encoding though any process which generates a stream compliant tothe syntactical and semmantical requirements and which is decodeable bythe process described in this spec shall be considered a conformantsnow encoder.Definitions:============MUST the specific part must be done to conform to this standardSHOULD it is recommended to be done that way, but not strictly requiredilog2(x) is the rounded down logarithm of x with basis 2ilog2(0) = 0Type definitions:=================b 1-bit range codedu unsigned scalar value range codeds signed scalar value range codedBitstream syntax:=================frame: header prediction residualheader: keyframe b MID_STATE if(keyframe || always_reset) reset_contexts if(keyframe){ version u header_state always_reset b header_state temporal_decomposition_type u header_state temporal_decomposition_count u header_state spatial_decomposition_count u header_state colorspace_type u header_state chroma_h_shift u header_state chroma_v_shift u header_state spatial_scalability b header_state max_ref_frames-1 u header_state qlogs } if(!keyframe){ update_mc b header_state if(update_mc){ for(plane=0; plane<2; plane++){ diag_mc b header_state htaps/2-1 u header_state for(i= p->htaps/2; i; i--) |hcoeff[i]| u header_state } } update_qlogs b header_state if(update_qlogs){ spatial_decomposition_count u header_state qlogs } } spatial_decomposition_type s header_state qlog s header_state mv_scale s header_state qbias s header_state block_max_depth s header_stateqlogs: for(plane=0; plane<2; plane++){ quant_table[plane][0][0] s header_state for(level=0; level < spatial_decomposition_count; level++){ quant_table[plane][level][1]s header_state quant_table[plane][level][3]s header_state } }reset_contexts *_state[*]= MID_STATEprediction: for(y=0; y<block_count_vertical; y++) for(x=0; x<block_count_horizontal; x++) block(0)block(level): mvx_diff=mvy_diff=y_diff=cb_diff=cr_diff=0 if(keyframe){ intra=1 }else{ if(level!=max_block_depth){ s_context= 2*left->level + 2*top->level + topleft->level + topright->level leaf b block_state[4 + s_context] } if(level==max_block_depth || leaf){ intra b block_state[1 + left->intra + top->intra] if(intra){ y_diff s block_state[32] cb_diff s block_state[64] cr_diff s block_state[96] }else{ ref_context= ilog2(2*left->ref) + ilog2(2*top->ref) if(ref_frames > 1) ref u block_state[128 + 1024 + 32*ref_context] mx_context= ilog2(2*abs(left->mx - top->mx)) my_context= ilog2(2*abs(left->my - top->my)) mvx_diff s block_state[128 + 32*(mx_context + 16*!!ref)] mvy_diff s block_state[128 + 32*(my_context + 16*!!ref)] } }else{ block(level+1) block(level+1) block(level+1) block(level+1) } }residual: residual2(luma) residual2(chroma_cr) residual2(chroma_cb)residual2: for(level=0; level<spatial_decomposition_count; level++){ if(level==0) subband(LL, 0) subband(HL, level) subband(LH, level) subband(HH, level) }subband: FIXMETag description:----------------version 0 this MUST NOT change within a bitstreamalways_reset if 1 then the range coder contexts will be reset after each frametemporal_decomposition_type 0temporal_decomposition_count 0spatial_decomposition_count FIXMEcolorspace_type 0 this MUST NOT change within a bitstreamchroma_h_shift log2(luma.width / chroma.width) this MUST NOT change within a bitstreamchroma_v_shift log2(luma.height / chroma.height) this MUST NOT change within a bitstreamspatial_scalability 0max_ref_frames maximum number of reference frames this MUST NOT change within a bitstreamupdate_mc indicates that motion compensation filter parameters are stored in the headerdiag_mc flag to enable faster diagonal interpolation this SHOULD be 1 unless it turns out to be covered by a valid patenthtaps number of half pel interpolation filter taps, MUST be even, >0 and <10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients [1] are the next outer ones and so on, resulting in a filter like: ...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]= 32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps= 6 hcoeff={40,-10,2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps= 8 hcoeff={42,-14,6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset || keyframeqlog quality (logarthmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset || keyframemv_scale stored as delta from last, last is reset to 0 if always_reset || keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset || keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset || keyframequant_table quantiztation tableHighlevel bitstream structure:============================= --------------------------------------------| Header | --------------------------------------------| ------------------------------------ || | Block0 | || | split? | || | yes no | || | ......... intra? | || | : Block01 : yes no | || | : Block02 : ....... .......... | || | : Block03 : : y DC : : ref index: | || | : Block04 : : cb DC : : motion x : | || | ......... : cr DC : : motion y : | || | ....... .......... | || ------------------------------------ || ------------------------------------ || | Block1 | || ... | --------------------------------------------| ------------ ------------ ------------ ||| Y subbands | | Cb subbands| | Cr subbands|||| --- --- | | --- --- | | --- --- |||| |LL0||HL0| | | |LL0||HL0| | | |LL0||HL0| |||| --- --- | | --- --- | | --- --- |||| --- --- | | --- --- | | --- --- |||| |LH0||HH0| | | |LH0||HH0| | | |LH0||HH0| |||| --- --- | | --- --- | | --- --- |||| --- --- | | --- --- | | --- --- |||| |HL1||LH1| | | |HL1||LH1| | | |HL1||LH1| |||| --- --- | | --- --- | | --- --- |||| --- --- | | --- --- | | --- --- |||| |HH1||HL2| | | |HH1||HL2| | | |HH1||HL2| |||| ... | | ... | | ... ||| ------------ ------------ ------------ | --------------------------------------------Decoding process:================= ------------ | | | Subbands | ------------ | | | | ------------ | Intra DC | | | | LL0 subband prediction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -