Changeset 204 for libmpc/branches/r2d/libmpcenc
- Timestamp:
- 02/08/07 21:36:52 (18 years ago)
- Location:
- libmpc/branches/r2d/libmpcenc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcenc/bitstream.c
r194 r204 194 194 } 195 195 196 void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC)196 mpc_uint32_t writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC, mpc_uint32_t min_size) 197 197 { 198 198 FILE * fp = e->outputFile; … … 200 200 mpc_uint8_t * datas = e->buffer; 201 201 char blockSize[10]; 202 mpc_uint _t len;202 mpc_uint32_t len; 203 203 204 204 writeBits(e, 0, (8 - e->bitsCount) % 8); … … 206 206 207 207 // write block header (key / length) 208 len = encodeSize(e->pos + 2 + (addCRC ? 4 : 0), blockSize, MPC_TRUE); 208 len = e->pos + 2 + (addCRC > 0) * 4; 209 if (min_size <= len) 210 min_size = len; 211 else { 212 mpc_uint32_t pad = min_size - len, i; 213 for(i = 0; i < pad; i++) 214 writeBits(e, 0, 8); 215 } 216 len = encodeSize(min_size, blockSize, MPC_TRUE); 209 217 fwrite(key, sizeof(char), 2, fp); 210 218 fwrite(blockSize, sizeof(char), len, fp); 211 219 e->outputBits += (len + 2) * 8; 212 213 220 214 221 if (addCRC) { … … 236 243 } 237 244 e->framesInBlock = 0; 245 246 return min_size; 238 247 } 239 248 -
libmpc/branches/r2d/libmpcenc/encode_sv7.c
r203 r204 24 24 #include <mpc/minimax.h> 25 25 26 // bitstream.c 27 void writeBits (mpc_encoder_t * e, mpc_uint32_t input, unsigned int bits ); 28 unsigned int encodeSize(mpc_uint64_t, char *, mpc_bool_t); 29 void encodeEnum(mpc_encoder_t * e, const mpc_uint32_t bits, const mpc_uint_t N); 30 void encodeLog(mpc_encoder_t * e, mpc_uint32_t value, mpc_uint32_t max); 31 void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC); 32 33 void Init_Huffman_Encoder_SV7 ( void ); 34 35 void Klemm ( void ); 36 37 void Init_Skalenfaktoren ( void ); 26 void Klemm ( void ); 27 void Init_Skalenfaktoren ( void ); 38 28 39 29 // huffsv7.c … … 358 348 } 359 349 e->block_cnt++; 360 writeBlock(e, "AD", MPC_FALSE );350 writeBlock(e, "AD", MPC_FALSE, 0); 361 351 } 362 352 } -
libmpc/branches/r2d/libmpcenc/libmpcenc.h
r203 r204 88 88 const int version_implement, 89 89 const int version_build ); 90 void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC);90 mpc_uint32_t writeBlock ( mpc_encoder_t *, const char *, const mpc_bool_t, mpc_uint32_t); 91 91 void writeMagic (mpc_encoder_t * e); 92 92 void writeBits (mpc_encoder_t * e, mpc_uint32_t input, unsigned int bits ); … … 94 94 void writeBitstream_SV8 ( mpc_encoder_t*, int); 95 95 96 unsigned int encodeSize(mpc_uint64_t, char *, mpc_bool_t); 97 void encodeEnum(mpc_encoder_t * e, const mpc_uint32_t bits, const mpc_uint_t N); 98 void encodeLog(mpc_encoder_t * e, mpc_uint32_t value, mpc_uint32_t max); 99 100
Note: See TracChangeset
for help on using the changeset viewer.