Changeset 226 for libmpc/branches/r2d/libmpcenc/encode_sv7.c
- Timestamp:
- 03/16/07 16:54:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcenc/encode_sv7.c
r221 r226 50 50 // initialize SV8 51 51 void 52 Init_SV8 ( mpc_encoder_t * e ) 52 mpc_encoder_init ( mpc_encoder_t * e, 53 mpc_uint64_t SamplesInWAVE, 54 unsigned int FramesBlockPwr, 55 unsigned int SeekDistance ) 53 56 { 54 57 Init_Skalenfaktoren (); … … 56 59 57 60 memset(e, 0, sizeof(*e)); 58 e->seek_pwr = 1; 61 62 if (SeekDistance > 15) 63 SeekDistance = 1; 64 if (FramesBlockPwr > 14) 65 FramesBlockPwr = 6; 66 67 e->seek_pwr = SeekDistance; 68 e->frames_per_block_pwr = FramesBlockPwr; 69 70 if (SamplesInWAVE == 0) 71 e->seek_table = malloc((1 << 16) * sizeof(mpc_uint32_t)); 72 else 73 e->seek_table = malloc((size_t)(2 + SamplesInWAVE / (MPC_FRAME_LENGTH << (e->seek_pwr + e->frames_per_block_pwr))) * sizeof(mpc_uint32_t)); 74 75 e->buffer = malloc(MAX_FRAME_SIZE * (1 << e->frames_per_block_pwr) * sizeof(mpc_uint8_t)); 76 } 77 78 void 79 mpc_encoder_exit ( mpc_encoder_t * e ) 80 { 81 free(e->seek_table); 82 free(e->buffer); 59 83 } 60 84 … … 105 129 writeBits ( e, ChannelCount - 1 , 4 ); // Channels 106 130 writeBits ( e, MS_on , 1 ); // MS-Coding Flag 107 writeBits ( e, FRAMES_PER_BLOCK_PWR>> 1, 3 ); // frames per block (log4 unit)131 writeBits ( e, e->frames_per_block_pwr >> 1, 3 ); // frames per block (log4 unit) 108 132 } 109 133 … … 350 374 351 375 e->framesInBlock++; 352 if (e->framesInBlock == FRAMES_PER_BLOCK) {376 if (e->framesInBlock == (1 << e->frames_per_block_pwr)) { 353 377 if ((e->block_cnt & ((1 << e->seek_pwr) - 1)) == 0) { 354 378 e->seek_table[e->seek_pos] = ftell(e->outputFile);
Note: See TracChangeset
for help on using the changeset viewer.