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

Method lame_encode_mp3_frame

src/main/java/mp3/Encoder.java:385–652  ·  view source on GitHub ↗
(final LameGlobalFlags gfp,
			final float[] inbuf_l, final float[] inbuf_r, byte[] mp3buf,
			int mp3bufPos, int mp3buf_size)

Source from the content-addressed store, hash-verified

383 0.10091f * 5, 0.151365f * 5, 0.187098f * 5 };
384
385 public final int lame_encode_mp3_frame(final LameGlobalFlags gfp,
386 final float[] inbuf_l, final float[] inbuf_r, byte[] mp3buf,
387 int mp3bufPos, int mp3buf_size) {
388 int mp3count;
389 III_psy_ratio masking_LR[][] = new III_psy_ratio[2][2]; /*
390 * LR masking &
391 * energy
392 */
393 masking_LR[0][0] = new III_psy_ratio();
394 masking_LR[0][1] = new III_psy_ratio();
395 masking_LR[1][0] = new III_psy_ratio();
396 masking_LR[1][1] = new III_psy_ratio();
397 III_psy_ratio masking_MS[][] = new III_psy_ratio[2][2];
398 /* MS masking & energy */
399 masking_MS[0][0] = new III_psy_ratio();
400 masking_MS[0][1] = new III_psy_ratio();
401 masking_MS[1][0] = new III_psy_ratio();
402 masking_MS[1][1] = new III_psy_ratio();
403 III_psy_ratio masking[][];
404 /* pointer to selected maskings */
405 final float[] inbuf[] = new float[2][];
406 final LameInternalFlags gfc = gfp.internal_flags;
407
408 float tot_ener[][] = new float[2][4];
409 float ms_ener_ratio[] = { .5f, .5f };
410 float[][] pe = { { 0.f, 0.f }, { 0.f, 0.f } }, pe_MS = { { 0.f, 0.f },
411 { 0.f, 0.f } };
412 float[][] pe_use;
413
414 int ch, gr;
415
416 inbuf[0] = inbuf_l;
417 inbuf[1] = inbuf_r;
418
419 if (gfc.lame_encode_frame_init == 0) {
420 /* first run? */
421 lame_encode_frame_init(gfp, inbuf);
422
423 }
424
425 /********************** padding *****************************/
426 /**
427 * <PRE>
428 * padding method as described in
429 * "MPEG-Layer3 / Bitstream Syntax and Decoding"
430 * by Martin Sieler, Ralph Sperschneider
431 *
432 * note: there is no padding for the very first frame
433 *
434 * Robert Hegemann 2000-06-22
435 * </PRE>
436 */
437 gfc.padding = 0;
438 if ((gfc.slot_lag -= gfc.frac_SpF) < 0) {
439 gfc.slot_lag += gfp.out_samplerate;
440 gfc.padding = 1;
441 }
442

Callers 4

lame_encode_frameFunction · 0.80
vFunction · 0.80
lame_encode_frameFunction · 0.80
lame_encode_frameMethod · 0.80

Calls 11

adjust_ATHMethod · 0.95
updateStatsMethod · 0.95
L3psycho_anal_vbrMethod · 0.80
L3psycho_anal_nsMethod · 0.80
mdct_sub48Method · 0.80
format_bitstreamMethod · 0.80
copy_bufferMethod · 0.80
addVbrFrameMethod · 0.80
set_frame_pinfoMethod · 0.80
iteration_loopMethod · 0.65

Tested by

no test coverage detected