示例#1
0
  private void vorbis_encode_noisebias_setup(
      float s, int block, int[] suppress, noise3[] in, noiseguard[] guard, float userbias) {

    int i, j;
    int is = new Float(s).intValue();
    float ds = s - is;
    codec_setup_info ci = vi.codec_setup;
    vorbis_info_psy p = ci.psy_param[block];

    p.noisemaxsupp = new Double(suppress[is] * (1. - ds) + suppress[is + 1] * ds).floatValue();
    p.noisewindowlomin = guard[block].lo;
    p.noisewindowhimin = guard[block].hi;
    p.noisewindowfixed = guard[block].fixed;

    for (j = 0; j < P_NOISECURVES; j++)
      for (i = 0; i < P_BANDS; i++)
        p.noiseoff[j][i] =
            new Double(in[is].data[j][i] * (1. - ds) + in[is + 1].data[j][i] * ds).floatValue();

    // impulse blocks may take a user specified bias to boost the nominal/high noise encoding depth
    for (j = 0; j < P_NOISECURVES; j++) {
      float min = p.noiseoff[j][0] + 6; // the lowest it can go
      for (i = 0; i < P_BANDS; i++) {
        p.noiseoff[j][i] += userbias;
        if (p.noiseoff[j][i] < min) p.noiseoff[j][i] = min;
      }
    }
  }
示例#2
0
  private void vorbis_encode_tonemask_setup(
      float s, int block, att3[] att, int[] max, vp_adjblock[] in) {

    int i;
    int is = new Float(s).intValue();
    float ds = s - is;
    codec_setup_info ci = vi.codec_setup;
    vorbis_info_psy p = ci.psy_param[block];

    // 0 and 2 are only used by bitmanagement, but there's no harm to always filling the values in
    // here
    p.tone_masteratt[0] =
        new Double(att[is].att[0] * (1. - ds) + att[is + 1].att[0] * ds).floatValue();
    p.tone_masteratt[1] =
        new Double(att[is].att[1] * (1. - ds) + att[is + 1].att[1] * ds).floatValue();
    p.tone_masteratt[2] =
        new Double(att[is].att[2] * (1. - ds) + att[is + 1].att[2] * ds).floatValue();
    p.tone_centerboost =
        new Double(att[is].boost * (1. - ds) + att[is + 1].boost * ds).floatValue();
    p.tone_decay = new Double(att[is].decay * (1. - ds) + att[is + 1].decay * ds).floatValue();

    p.max_curve_dB = new Double(max[is] * (1. - ds) + max[is + 1] * ds).floatValue();

    for (i = 0; i < P_BANDS; i++)
      p.toneatt[i] =
          new Double(in[is].block[i] * (1. - ds) + in[is + 1].block[i] * ds).floatValue();
  }
示例#3
0
  private void vorbis_encode_ath_setup(int block) {

    codec_setup_info ci = vi.codec_setup;
    vorbis_info_psy p = ci.psy_param[block];

    p.ath_adjatt = ci.hi.ath_floating_dB;
    p.ath_maxatt = ci.hi.ath_absolute_dB;
  }
示例#4
0
  private void vorbis_encode_peak_setup(float s, int block, int[] suppress) {

    int is = new Float(s).intValue();
    float ds = s - is;
    codec_setup_info ci = vi.codec_setup;
    vorbis_info_psy p = ci.psy_param[block];

    p.tone_abs_limit = new Double(suppress[is] * (1. - ds) + suppress[is + 1] * ds).floatValue();
  }
示例#5
0
  private void vorbis_encode_psyset_setup(
      float s, int[] nn_start, int[] nn_partition, float[] nn_thresh, int block) {

    codec_setup_info ci = vi.codec_setup;
    highlevel_encode_setup hi = ci.hi;
    int is = new Float(s).intValue();

    if (block >= ci.psys) ci.psys = block + 1;

    ci.psy_param[block] =
        new vorbis_info_psy(

            // static vorbis_info_psy _psy_info_template = {
            -1,
            -140.f,
            -140.f,

            // tonemask att boost/decay,suppr,curves
            new float[] {0.f, 0.f, 0.f},
            0.f,
            0.f,
            -40.f,
            new float[] {0.f},

            // noisemaskp,supp, low/high window, low/hi guard, minimum
            1,
            -0.f,
            .5f,
            .5f,
            0,
            0,
            0,
            new float[][] {{-1}, {-1}, {-1}},
            new float[] {-1},
            105.f,
            0,
            0,
            -1,
            -1,
            0.0f);

    vorbis_info_psy p = ci.psy_param[block];

    p.blockflag = block >> 1;

    if (hi.noise_normalize_p != 0) {
      p.normal_channel_p = 1;
      p.normal_point_p = 1;
      p.normal_start = nn_start[is];
      p.normal_partition = nn_partition[is];
      p.normal_thresh = nn_thresh[is];
    }
  }