Mercurial > libavcodec.hg
comparison cabac.h @ 1300:e18667d1e94d libavcodec
FFV1 codec (our very simple lossless intra only codec, compresses much better then huffyuv)
author | michaelni |
---|---|
date | Mon, 09 Jun 2003 02:24:51 +0000 |
parents | 5bc3184810dc |
children | 9d02a1859891 |
comparison
equal
deleted
inserted
replaced
1299:9c3bfa79631f | 1300:e18667d1e94d |
---|---|
35 int symCount; | 35 int symCount; |
36 #endif | 36 #endif |
37 uint8_t lps_range[2*64][4]; ///< rangeTabLPS | 37 uint8_t lps_range[2*64][4]; ///< rangeTabLPS |
38 uint8_t lps_state[2*64]; ///< transIdxLPS | 38 uint8_t lps_state[2*64]; ///< transIdxLPS |
39 uint8_t mps_state[2*64]; ///< transIdxMPS | 39 uint8_t mps_state[2*64]; ///< transIdxMPS |
40 uint8_t *bytestream_start; | |
40 uint8_t *bytestream; | 41 uint8_t *bytestream; |
41 int bits_left; ///< | 42 int bits_left; ///< |
42 PutBitContext pb; | 43 PutBitContext pb; |
43 }CABACContext; | 44 }CABACContext; |
44 | 45 |
136 #ifdef STRICT_LIMITS | 137 #ifdef STRICT_LIMITS |
137 c->symCount++; | 138 c->symCount++; |
138 #endif | 139 #endif |
139 } | 140 } |
140 | 141 |
141 static inline void put_cabac_terminate(CABACContext *c, int bit){ | 142 /** |
143 * | |
144 * @return the number of bytes written | |
145 */ | |
146 static inline int put_cabac_terminate(CABACContext *c, int bit){ | |
142 c->range -= 2; | 147 c->range -= 2; |
143 | 148 |
144 if(!bit){ | 149 if(!bit){ |
145 renorm_cabac_encoder(c); | 150 renorm_cabac_encoder(c); |
146 }else{ | 151 }else{ |
157 } | 162 } |
158 | 163 |
159 #ifdef STRICT_LIMITS | 164 #ifdef STRICT_LIMITS |
160 c->symCount++; | 165 c->symCount++; |
161 #endif | 166 #endif |
167 | |
168 return (get_bit_count(&c->pb)+7)>>3; | |
162 } | 169 } |
163 | 170 |
164 /** | 171 /** |
165 * put (truncated) unary binarization. | 172 * put (truncated) unary binarization. |
166 */ | 173 */ |
301 c->low -= c->range; | 308 c->low -= c->range; |
302 return 1; | 309 return 1; |
303 } | 310 } |
304 } | 311 } |
305 | 312 |
313 /** | |
314 * | |
315 * @return the number of bytes read or 0 if no end | |
316 */ | |
306 static inline int get_cabac_terminate(CABACContext *c){ | 317 static inline int get_cabac_terminate(CABACContext *c){ |
307 c->range -= 2<<8; | 318 c->range -= 2<<8; |
308 if(c->low < c->range){ | 319 if(c->low < c->range){ |
309 renorm_cabac_decoder(c); | 320 renorm_cabac_decoder(c); |
310 return 0; | 321 return 0; |
311 }else{ | 322 }else{ |
312 return 1; | 323 return c->bytestream - c->bytestream_start; |
313 } | 324 } |
314 } | 325 } |
315 | 326 |
316 /** | 327 /** |
317 * get (truncated) unnary binarization. | 328 * get (truncated) unnary binarization. |