incorporate miroslav's speedup for little-endian 16bps mono/stereo
authorJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 4 Sep 2002 07:59:28 +0000 (07:59 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Wed, 4 Sep 2002 07:59:28 +0000 (07:59 +0000)
src/libFLAC/md5.c

index c1387bb4007eaa9b7c907370907cb5ba8c14e78a..83e86ed96da15e45a6da5388d23e9543208bc60e 100644 (file)
@@ -241,6 +241,19 @@ FLAC__MD5Accumulate(struct MD5Context *ctx, const FLAC__int32 * const signal[],
 
        buf_ = ctx->internal_buf;
 
+#ifdef FLAC__CPU_IA32
+       if(channels == 2 && bytes_per_sample == 2) {
+               memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples);
+               buf_ += sizeof(FLAC__int16);
+               for(sample = 0; sample < samples; sample++)
+                       ((FLAC__int16 *)buf_)[2 * sample] = (FLAC__int16)signal[1][sample];
+       }
+       else if(channels == 1 && bytes_per_sample == 2) {
+               for(sample = 0; sample < samples; sample++)
+                       ((FLAC__int16 *)buf_)[sample] = (FLAC__int16)signal[0][sample];
+       }
+       else
+#endif
        for(sample = 0; sample < samples; sample++) {
                for(channel = 0; channel < channels; channel++) {
                        a_word = signal[channel][sample];