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

Class Encoder

src/main/java/mp3/Encoder.java:29–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27package mp3;
28
29public class Encoder {
30 BitStream bs;
31 public PsyModel psy;
32 VBRTag vbr;
33 QuantizePVT qupvt;
34
35 public final void setModules(BitStream bs, PsyModel psy, QuantizePVT qupvt,
36 VBRTag vbr) {
37 this.bs = bs;
38 this.psy = psy;
39 this.vbr = vbr;
40 this.qupvt = qupvt;
41 }
42
43 private NewMDCT newMDCT = new NewMDCT();
44
45 /***********************************************************************
46 *
47 * encoder and decoder delays
48 *
49 ***********************************************************************/
50
51 /**
52 * <PRE>
53 * layer III enc->dec delay: 1056 (1057?) (observed)
54 * layer II enc->dec delay: 480 (481?) (observed)
55 *
56 * polyphase 256-16 (dec or enc) = 240
57 * mdct 256+32 (9*32) (dec or enc) = 288
58 * total: 512+16
59 *
60 * My guess is that delay of polyphase filterbank is actualy 240.5
61 * (there are technical reasons for this, see postings in mp3encoder).
62 * So total Encode+Decode delay = ENCDELAY + 528 + 1
63 * </PRE>
64 */
65
66 /**
67 * ENCDELAY The encoder delay.
68 *
69 * Minimum allowed is MDCTDELAY (see below)
70 *
71 * The first 96 samples will be attenuated, so using a value less than 96
72 * will result in corrupt data for the first 96-ENCDELAY samples.
73 *
74 * suggested: 576 set to 1160 to sync with FhG.
75 */
76 public static final int ENCDELAY = 576;
77
78 /**
79 * make sure there is at least one complete frame after the last frame
80 * containing real data
81 *
82 * Using a value of 288 would be sufficient for a a very sophisticated
83 * decoder that can decode granule-by-granule instead of frame by frame. But
84 * lets not assume this, and assume the decoder will not decode frame N
85 * unless it also has data for frame N+1
86 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…