Ignore:
Timestamp:
09/23/07 18:17:28 (17 years ago)
Author:
r2d
Message:

changed replay gain rounding and reference

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/trunk/libmpcdec/streaminfo.c

    r314 r347  
    127127
    128128// This is the gain reference used in old replaygain
    129 #define OLD_GAIN_REF 65.
     129#define OLD_GAIN_REF 64.82
    130130
    131131        // convert gain info
    132132        if (si->gain_title != 0) {
    133                 int tmp = (int)((OLD_GAIN_REF - (mpc_int16_t)si->gain_title / 100.) * 256);
     133                int tmp = OLD_GAIN_REF * 256 - ((int)(mpc_int16_t)si->gain_title * 256 + 50) / 100;
    134134                if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
    135135                si->gain_title = (mpc_int16_t) tmp;
     
    137137
    138138        if (si->gain_album != 0) {
    139                 int tmp = (int)((OLD_GAIN_REF - (mpc_int16_t)si->gain_album / 100.) * 256);
     139                int tmp = OLD_GAIN_REF * 256 - ((int)(mpc_int16_t)si->gain_album * 256 + 50) / 100;
    140140                if (tmp >= (1 << 16) || tmp < 0) tmp = 0;
    141141                si->gain_album = (mpc_int16_t) tmp;
     
    143143
    144144        if (si->peak_title != 0)
    145                 si->peak_title = (mpc_uint16_t) (log10(si->peak_title) * 20 * 256);
     145                si->peak_title = (mpc_uint16_t) (log10(si->peak_title) * 20 * 256 + .5);
    146146
    147147        if (si->peak_album != 0)
    148                 si->peak_album = (mpc_uint16_t) (log10(si->peak_album) * 20 * 256);
     148                si->peak_album = (mpc_uint16_t) (log10(si->peak_album) * 20 * 256 + .5);
    149149
    150150        mpc_get_encoder_string(si);
Note: See TracChangeset for help on using the changeset viewer.