Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: webrtc/common_audio/resampler/resampler.cc

Issue 1172163004: Reformat existing code. There should be no functional effects. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 // data is now actually in 96 kHz sampling rate, despite the 833 // data is now actually in 96 kHz sampling rate, despite the
834 // function name, and with a resampling factor of 1/3 becomes 834 // function name, and with a resampling factor of 1/3 becomes
835 // 32 kHz. 835 // 32 kHz.
836 WebRtcSpl_Resample48khzTo16khz(samplesIn + i, tmp + i / 3, 836 WebRtcSpl_Resample48khzTo16khz(samplesIn + i, tmp + i / 3,
837 (WebRtcSpl_State48khzTo16khz*) stat e1_, 837 (WebRtcSpl_State48khzTo16khz*) stat e1_,
838 tmp_mem); 838 tmp_mem);
839 } 839 }
840 outLen = lengthIn / 3; 840 outLen = lengthIn / 3;
841 free(tmp_mem); 841 free(tmp_mem);
842 // 4:2 842 // 4:2
843 WebRtcSpl_DownsampleBy2(tmp, outLen, tmp_2, 843 WebRtcSpl_DownsampleBy2(tmp, outLen, tmp_2, (int32_t*) state2_);
844 (int32_t*) state2_);
845 outLen = outLen / 2; 844 outLen = outLen / 2;
846 free(tmp); 845 free(tmp);
847 // 2:1 846 // 2:1
848 WebRtcSpl_DownsampleBy2(tmp_2, outLen, samplesOut, 847 WebRtcSpl_DownsampleBy2(tmp_2, outLen, samplesOut,
849 (int32_t*) state3_); 848 (int32_t*) state3_);
850 free(tmp_2); 849 free(tmp_2);
851 outLen = outLen / 2; 850 outLen = outLen / 2;
852 return 0; 851 return 0;
853 case kResamplerMode3To2: 852 case kResamplerMode3To2:
854 if (maxLen < (lengthIn * 2 / 3)) 853 if (maxLen < (lengthIn * 2 / 3))
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 tmp = (int16_t*)malloc((lengthIn * 4) / 11 * sizeof(int16_t)); 892 tmp = (int16_t*)malloc((lengthIn * 4) / 11 * sizeof(int16_t));
894 893
895 for (int i = 0; i < lengthIn; i += 220) 894 for (int i = 0; i < lengthIn; i += 220)
896 { 895 {
897 WebRtcSpl_Resample22khzTo8khz(samplesIn + i, tmp + (i * 4) / 11, 896 WebRtcSpl_Resample22khzTo8khz(samplesIn + i, tmp + (i * 4) / 11,
898 (WebRtcSpl_State22khzTo8khz *)stat e1_, 897 (WebRtcSpl_State22khzTo8khz *)stat e1_,
899 tmp_mem); 898 tmp_mem);
900 } 899 }
901 lengthIn = (lengthIn * 4) / 11; 900 lengthIn = (lengthIn * 4) / 11;
902 901
903 WebRtcSpl_DownsampleBy2(tmp, lengthIn, samplesOut, (int32_t*)state2_ ); 902 WebRtcSpl_DownsampleBy2(tmp, lengthIn, samplesOut,
903 (int32_t*)state2_);
904 outLen = lengthIn / 2; 904 outLen = lengthIn / 2;
905 905
906 free(tmp_mem); 906 free(tmp_mem);
907 free(tmp); 907 free(tmp);
908 return 0; 908 return 0;
909 case kResamplerMode11To4: 909 case kResamplerMode11To4:
910 // We can only handle blocks of 220 samples 910 // We can only handle blocks of 220 samples
911 // Can be fixed, but I don't think it's needed 911 // Can be fixed, but I don't think it's needed
912 if ((lengthIn % 220) != 0) 912 if ((lengthIn % 220) != 0)
913 { 913 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 outLen = (lengthIn * 8) / 11; 950 outLen = (lengthIn * 8) / 11;
951 free(tmp_mem); 951 free(tmp_mem);
952 return 0; 952 return 0;
953 break; 953 break;
954 954
955 } 955 }
956 return 0; 956 return 0;
957 } 957 }
958 958
959 } // namespace webrtc 959 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698