Hi,

I was just looking through the mpd source and noticed that the optimisations
in ReplayGainFilter::FilterPCM duplicate code in pcm_volume.  So the following
code would be equivalent.

Here's the volume code: 
http://git.musicpd.org/cgit/master/mpd.git/tree/src/pcm/PcmVolume.cxx#n146

Cheers,
Andrew

PS First suggested edit; apologies in advance if lueless for some reason.


diff --git a/src/filter/ReplayGainFilterPlugin.cxx
b/src/filter/ReplayGainFilterPlugin.cxx
index 446264c..3b320c3 100644
--- a/src/filter/ReplayGainFilterPlugin.cxx
+++ b/src/filter/ReplayGainFilterPlugin.cxx
@@ -181,20 +181,7 @@ ReplayGainFilter::FilterPCM(const void *src, size_t
src_size,
 {
 
        *dest_size_r = src_size;
-
-       if (volume == PCM_VOLUME_1)
-               /* optimized special case: 100% volume = no-op */
-               return src;
-
        void *dest = buffer.Get(src_size);
-       if (volume <= 0) {
-               /* optimized special case: 0% volume = memset(0) */
-               /* XXX is this valid for all sample formats? What
-                  about floating point? */
-               memset(dest, 0, src_size);
-               return dest;
-       }
-
        memcpy(dest, src, src_size);
 
        bool success = pcm_volume(dest, src_size,

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to