Esempio n. 1
0
  private void vorbis_encode_global_psych_setup(float s, vorbis_info_psy_global[] in, float[] x) {

    int i;
    int is = new Float(s).intValue();
    float ds = s - is;
    codec_setup_info ci = vi.codec_setup;

    // memcpy(g,in+(int)x[is],sizeof(*g));
    ci.psy_g_param = new vorbis_info_psy_global(in[new Float(x[is]).intValue()]);
    vorbis_info_psy_global g = ci.psy_g_param;

    ds = x[is] * (1.0f - ds) + x[is + 1] * ds;

    is = new Float(ds).intValue();
    ds -= is;
    if (ds == 0 && is > 0) {
      is--;
      ds = 1.0f;
    }

    // interpolate the trigger threshholds
    for (i = 0; i < 4; i++) {
      g.preecho_thresh[i] =
          new Double(in[is].preecho_thresh[i] * (1. - ds) + in[is + 1].preecho_thresh[i] * ds)
              .floatValue();
      g.postecho_thresh[i] =
          new Double(in[is].postecho_thresh[i] * (1. - ds) + in[is + 1].postecho_thresh[i] * ds)
              .floatValue();
    }
    g.ampmax_att_per_sec = ci.hi.amplitude_track_dBpersec;
  }
Esempio n. 2
0
  private void vorbis_encode_global_stereo(highlevel_encode_setup hi, adj_stereo[] p) {

    float s = hi.stereo_point_setting;
    int i;
    int is = new Float(s).intValue();
    float ds = s - is;
    codec_setup_info ci = vi.codec_setup;
    vorbis_info_psy_global g = ci.psy_g_param;

    if (p != null) {

      // memcpy(g.coupling_prepointamp, p[is].pre, sizeof(*p[is].pre)*PACKETBLOBS);
      // memcpy(g.coupling_postpointamp, p[is].post, sizeof(*p[is].post)*PACKETBLOBS);

      g.coupling_prepointamp = (int[]) p[is].pre.clone();
      g.coupling_postpointamp = (int[]) p[is].post.clone();

      if (hi.managed != 0) {
        // interpolate the kHz threshholds
        for (i = 0; i < PACKETBLOBS; i++) {
          float kHz = new Double(p[is].kHz[i] * (1. - ds) + p[is + 1].kHz[i] * ds).floatValue();
          g.coupling_pointlimit[0][i] =
              new Double(kHz * 1000. / vi.rate * ci.blocksizes[0]).intValue();
          g.coupling_pointlimit[1][i] =
              new Double(kHz * 1000. / vi.rate * ci.blocksizes[1]).intValue();
          g.coupling_pkHz[i] = new Float(kHz).intValue();

          kHz =
              new Double(p[is].lowpasskHz[i] * (1. - ds) + p[is + 1].lowpasskHz[i] * ds)
                  .floatValue();
          g.sliding_lowpass[0][i] = new Double(kHz * 1000. / vi.rate * ci.blocksizes[0]).intValue();
          g.sliding_lowpass[1][i] = new Double(kHz * 1000. / vi.rate * ci.blocksizes[1]).intValue();
        }
      } else {
        float kHz =
            new Double(p[is].kHz[PACKETBLOBS / 2] * (1. - ds) + p[is + 1].kHz[PACKETBLOBS / 2] * ds)
                .floatValue();
        for (i = 0; i < PACKETBLOBS; i++) {
          g.coupling_pointlimit[0][i] =
              new Double(kHz * 1000. / vi.rate * ci.blocksizes[0]).intValue();
          g.coupling_pointlimit[1][i] =
              new Double(kHz * 1000. / vi.rate * ci.blocksizes[1]).intValue();
          g.coupling_pkHz[i] = new Float(kHz).intValue();
        }

        kHz =
            new Double(
                    p[is].lowpasskHz[PACKETBLOBS / 2] * (1. - ds)
                        + p[is + 1].lowpasskHz[PACKETBLOBS / 2] * ds)
                .floatValue();
        for (i = 0; i < PACKETBLOBS; i++) {
          g.sliding_lowpass[0][i] = new Double(kHz * 1000. / vi.rate * ci.blocksizes[0]).intValue();
          g.sliding_lowpass[1][i] = new Double(kHz * 1000. / vi.rate * ci.blocksizes[1]).intValue();
        }
      }
    } else {
      for (i = 0; i < PACKETBLOBS; i++) {
        g.sliding_lowpass[0][i] = ci.blocksizes[0];
        g.sliding_lowpass[1][i] = ci.blocksizes[1];
      }
    }
  }