[vlc-devel] [PATCH] demux: mpc: fix replaygain calculation (fixes #13176)

Jean-Baptiste Kempf jb at videolan.org
Sun Dec 28 18:09:08 CET 2014


Fails to build here, because of MPC_OLD_GAIN_REF.

On 26 Dec, Anatoliy Anischovich wrote :
> ---
>  modules/demux/mpc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/modules/demux/mpc.c b/modules/demux/mpc.c
> index a450c11..40a6eae 100644
> --- a/modules/demux/mpc.c
> +++ b/modules/demux/mpc.c
> @@ -195,16 +195,16 @@ static int Open( vlc_object_t * p_this )
>      if( p_sys->info.peak_title > 0 )
>      {
>          fmt.audio_replay_gain.pb_peak[AUDIO_REPLAY_GAIN_TRACK] = true;
> -        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_TRACK] = (float)p_sys->info.peak_title / 32767.0;
> +        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_TRACK] = powf(10, p_sys->info.peak_title / 256.f / 20.f) / 32767.f;
>          fmt.audio_replay_gain.pb_gain[AUDIO_REPLAY_GAIN_TRACK] = true;
> -        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_TRACK] = (float)p_sys->info.gain_title / 100.0;
> +        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_TRACK] = MPC_OLD_GAIN_REF - p_sys->info.gain_title / 256.f;
>      }
>      if( p_sys->info.peak_album > 0 )
>      {
>          fmt.audio_replay_gain.pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true;
> -        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = (float)p_sys->info.peak_album / 32767.0;
> +        fmt.audio_replay_gain.pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = powf(10, p_sys->info.peak_title / 256.f / 20.f) / 32767.f;
>          fmt.audio_replay_gain.pb_gain[AUDIO_REPLAY_GAIN_ALBUM] = true;
> -        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = (float)p_sys->info.gain_album / 100.0;
> +        fmt.audio_replay_gain.pf_gain[AUDIO_REPLAY_GAIN_ALBUM] = MPC_OLD_GAIN_REF - p_sys->info.gain_album  / 256.f;
>      }
>  
>      p_sys->p_es = es_out_Add( p_demux->out, &fmt );
> -- 
> 1.9.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list