| 28 | |
| 29 | |
| 30 | public class QuantizePVT { |
| 31 | |
| 32 | Takehiro tak; |
| 33 | Reservoir rv; |
| 34 | PsyModel psy; |
| 35 | |
| 36 | public final void setModules(Takehiro tk, Reservoir rv, PsyModel psy) { |
| 37 | this.tak = tk; |
| 38 | this.rv = rv; |
| 39 | this.psy = psy; |
| 40 | } |
| 41 | |
| 42 | public final float POW20(final int x) { |
| 43 | assert (0 <= (x + QuantizePVT.Q_MAX2) && x < QuantizePVT.Q_MAX); |
| 44 | return pow20[x + QuantizePVT.Q_MAX2]; |
| 45 | } |
| 46 | |
| 47 | public final float IPOW20(final int x) { |
| 48 | assert (0 <= x && x < QuantizePVT.Q_MAX); |
| 49 | return ipow20[x]; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * smallest such that 1.0+DBL_EPSILON != 1.0 |
| 54 | */ |
| 55 | private static final float DBL_EPSILON = 2.2204460492503131e-016f; |
| 56 | |
| 57 | /** |
| 58 | * ix always <= 8191+15. see count_bits() |
| 59 | */ |
| 60 | public static final int IXMAX_VAL = 8206; |
| 61 | |
| 62 | private static final int PRECALC_SIZE = (IXMAX_VAL + 2); |
| 63 | |
| 64 | private static final int Q_MAX =(256+1); |
| 65 | |
| 66 | /** |
| 67 | * <CODE> |
| 68 | * minimum possible number of |
| 69 | * -cod_info.global_gain + ((scalefac[] + (cod_info.preflag ? pretab[sfb] : 0)) |
| 70 | * << (cod_info.scalefac_scale + 1)) + cod_info.subblock_gain[cod_info.window[sfb]] * 8; |
| 71 | * |
| 72 | * for long block, 0+((15+3)<<2) = 18*4 = 72 |
| 73 | * for short block, 0+(15<<2)+7*8 = 15*4+56 = 116 |
| 74 | * </CODE> |
| 75 | */ |
| 76 | public static final int Q_MAX2 = 116; |
| 77 | |
| 78 | public static final int LARGE_BITS =100000; |
| 79 | |
| 80 | /** |
| 81 | * Assuming dynamic range=96dB, this value should be 92 |
| 82 | */ |
| 83 | private static final int NSATHSCALE = 100; |
| 84 | |
| 85 | /** |
| 86 | * The following table is used to implement the scalefactor partitioning for |
| 87 | * MPEG2 as described in section 2.4.3.2 of the IS. The indexing corresponds |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…