Пример #1
0
void
iteration_init( lame_global_flags *gfp)
{
  lame_internal_flags *gfc=gfp->internal_flags;
  III_side_info_t * const l3_side = &gfc->l3_side;
  int i;

  if ( gfc->iteration_init_init==0 ) {
    gfc->iteration_init_init=1;

    l3_side->main_data_begin = 0;
    compute_ath(gfp,gfc->ATH->l,gfc->ATH->s);

    pow43[0] = 0.0;
    for(i=1;i<PRECALC_SIZE;i++)
        pow43[i] = pow((FLOAT8)i, 4.0/3.0);

    adj43asm[0] = 0.0;
    for (i = 1; i < PRECALC_SIZE; i++)
      adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]),0.75);
    for (i = 0; i < PRECALC_SIZE-1; i++)
	adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);
    adj43[i] = 0.5;
    iipow20_ = &iipow20[210];
    for (i = 0; i < Q_MAX; i++) {
        iipow20[i] = pow(2.0, (double)(i - 210) * 0.1875);
	ipow20[i] = pow(2.0, (double)(i - 210) * -0.1875);
	pow20[i] = pow(2.0, (double)(i - 210) * 0.25);
    }
    huffman_init(gfc);
  }
}
Пример #2
0
void
iteration_init(lame_internal_flags * gfc)
{
    SessionConfig_t const *const cfg = &gfc->cfg;
    III_side_info_t *const l3_side = &gfc->l3_side;
    FLOAT   adjust, db;
    int     i, sel;

    if (gfc->iteration_init_init == 0) {
        gfc->iteration_init_init = 1;

        l3_side->main_data_begin = 0;
        compute_ath(gfc);

        pow43[0] = 0.0;
        for (i = 1; i < PRECALC_SIZE; i++)
            pow43[i] = pow((FLOAT) i, 4.0 / 3.0);

#ifdef TAKEHIRO_IEEE754_HACK
        adj43asm[0] = 0.0;
        for (i = 1; i < PRECALC_SIZE; i++)
            adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]), 0.75);
#else
        for (i = 0; i < PRECALC_SIZE - 1; i++)
            adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);
        adj43[i] = 0.5;
#endif
        for (i = 0; i < Q_MAX; i++)
            ipow20[i] = pow(2.0, (double) (i - 210) * -0.1875);
        for (i = 0; i <= Q_MAX + Q_MAX2; i++)
            pow20[i] = pow(2.0, (double) (i - 210 - Q_MAX2) * 0.25);

        huffman_init(gfc);
        init_xrpow_core_init(gfc);

        sel = 1;/* RH: all modes like vbr-new (cfg->vbr == vbr_mt || cfg->vbr == vbr_mtrh) ? 1 : 0;*/

        /* long */
        db = cfg->adjust_bass_db + payload_long[sel][0];
        adjust = powf(10.f, db * 0.1f);
        for (i = 0; i <= 6; ++i) {
            gfc->sv_qnt.longfact[i] = adjust;
        }
        db = cfg->adjust_alto_db + payload_long[sel][1];
        adjust = powf(10.f, db * 0.1f);
        for (; i <= 13; ++i) {
            gfc->sv_qnt.longfact[i] = adjust;
        }
        db = cfg->adjust_treble_db + payload_long[sel][2];
        adjust = powf(10.f, db * 0.1f);
        for (; i <= 20; ++i) {
            gfc->sv_qnt.longfact[i] = adjust;
        }
        db = cfg->adjust_sfb21_db + payload_long[sel][3];
        adjust = powf(10.f, db * 0.1f);
        for (; i < SBMAX_l; ++i) {
            gfc->sv_qnt.longfact[i] = adjust;
        }

        /* short */
        db = cfg->adjust_bass_db + payload_short[sel][0];
        adjust = powf(10.f, db * 0.1f);
        for (i = 0; i <= 2; ++i) {
            gfc->sv_qnt.shortfact[i] = adjust;
        }
        db = cfg->adjust_alto_db + payload_short[sel][1];
        adjust = powf(10.f, db * 0.1f);
        for (; i <= 6; ++i) {
            gfc->sv_qnt.shortfact[i] = adjust;
        }
        db = cfg->adjust_treble_db + payload_short[sel][2];
        adjust = powf(10.f, db * 0.1f);
        for (; i <= 11; ++i) {
            gfc->sv_qnt.shortfact[i] = adjust;
        }
        db = cfg->adjust_sfb21_db + payload_short[sel][3];
        adjust = powf(10.f, db * 0.1f);
        for (; i < SBMAX_s; ++i) {
            gfc->sv_qnt.shortfact[i] = adjust;
        }
    }
}
Пример #3
0
void
iteration_init(lame_internal_flags * gfc)
{
    SessionConfig_t const *const cfg = &gfc->cfg;
    III_side_info_t *const l3_side = &gfc->l3_side;
    int     i;

    if (gfc->iteration_init_init == 0) {
        gfc->iteration_init_init = 1;

        l3_side->main_data_begin = 0;
        compute_ath(gfc);

        pow43[0] = 0.0;
        for (i = 1; i < PRECALC_SIZE; i++)
            pow43[i] = pow((FLOAT) i, 4.0 / 3.0);

#ifdef TAKEHIRO_IEEE754_HACK
        adj43asm[0] = 0.0;
        for (i = 1; i < PRECALC_SIZE; i++)
            adj43asm[i] = i - 0.5 - pow(0.5 * (pow43[i - 1] + pow43[i]), 0.75);
#else
        for (i = 0; i < PRECALC_SIZE - 1; i++)
            adj43[i] = (i + 1) - pow(0.5 * (pow43[i] + pow43[i + 1]), 0.75);
        adj43[i] = 0.5;
#endif
        for (i = 0; i < Q_MAX; i++)
            ipow20[i] = pow(2.0, (double) (i - 210) * -0.1875);
        for (i = 0; i <= Q_MAX + Q_MAX2; i++)
            pow20[i] = pow(2.0, (double) (i - 210 - Q_MAX2) * 0.25);

        huffman_init(gfc);
        init_xrpow_core_init(gfc);

        for (i = 0; i < SBMAX_l; i++) {
            FLOAT   f;
            if (i <= 6)
                f = cfg->adjust_bass;
            else if (i <= 13)
                f = cfg->adjust_alto;
            else if (i <= 20)
                f = cfg->adjust_treble;
            else
                f = cfg->adjust_sfb21;

            gfc->sv_qnt.longfact[i] = f;
        }
        for (i = 0; i < SBMAX_s; i++) {
            FLOAT   f;
            if (i <= 5)
                f = cfg->adjust_bass;
            else if (i <= 10)
                f = cfg->adjust_alto;
            else if (i <= 11)
                f = cfg->adjust_treble;
            else
                f = cfg->adjust_sfb21;

            gfc->sv_qnt.shortfact[i] = f;
        }
    }
}