Am Thu, 15 Aug 2013 22:57:25 -0400
schrieb andrew cooke and...@acooke.org:
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.
Hi,
While I agree on the second case we save one memcpy on the first case.
In my opinion we could save a memcpy for each filter by removing the const
attribute of first parameter... Maybe we need one memcpy at start of filter
chain (not sure) but not at every filter.
Regards,
Matthias
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,
signature.asc
Description: PGP signature
--
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=48897031iu=/4140/ostg.clktrk___
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team