MCPcopy Create free account
hub / github.com/zhuker/lamejs / lame_encode_frame_init

Method lame_encode_frame_init

src/main/java/mp3/Encoder.java:280–320  ·  view source on GitHub ↗
(final LameGlobalFlags gfp,
			final float inbuf[][])

Source from the content-addressed store, hash-verified

278 }
279
280 private void lame_encode_frame_init(final LameGlobalFlags gfp,
281 final float inbuf[][]) {
282 final LameInternalFlags gfc = gfp.internal_flags;
283
284 int ch, gr;
285
286 if (gfc.lame_encode_frame_init == 0) {
287 /* prime the MDCT/polyphase filterbank with a short block */
288 int i, j;
289 float primebuff0[] = new float[286 + 1152 + 576];
290 float primebuff1[] = new float[286 + 1152 + 576];
291 gfc.lame_encode_frame_init = 1;
292 for (i = 0, j = 0; i < 286 + 576 * (1 + gfc.mode_gr); ++i) {
293 if (i < 576 * gfc.mode_gr) {
294 primebuff0[i] = 0;
295 if (gfc.channels_out == 2)
296 primebuff1[i] = 0;
297 } else {
298 primebuff0[i] = inbuf[0][j];
299 if (gfc.channels_out == 2)
300 primebuff1[i] = inbuf[1][j];
301 ++j;
302 }
303 }
304 /* polyphase filtering / mdct */
305 for (gr = 0; gr < gfc.mode_gr; gr++) {
306 for (ch = 0; ch < gfc.channels_out; ch++) {
307 gfc.l3_side.tt[gr][ch].block_type = SHORT_TYPE;
308 }
309 }
310 newMDCT.mdct_sub48(gfc, primebuff0, primebuff1);
311
312 /* check FFT will not use a negative starting offset */
313 assert (576 >= FFTOFFSET);
314 /* check if we have enough data for FFT */
315 assert (gfc.mf_size >= (BLKSIZE + gfp.framesize - FFTOFFSET));
316 /* check if we have enough data for polyphase filterbank */
317 assert (gfc.mf_size >= (512 + gfp.framesize - 32));
318 }
319
320 }
321
322 /**
323 * <PRE>

Callers 1

lame_encode_mp3_frameMethod · 0.95

Calls 1

mdct_sub48Method · 0.80

Tested by

no test coverage detected