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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c

Issue 1208993010: iSAC: Make separate AudioEncoder and AudioDecoder objects (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: AudioDecoderIsac*Test: Encoder and decoder must be separate, like they used to be Created 5 years, 4 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 WebRtcIsacfix_HighpassFilterFixDec32 = 234 WebRtcIsacfix_HighpassFilterFixDec32 =
235 WebRtcIsacfix_HighpassFilterFixDec32MIPS; 235 WebRtcIsacfix_HighpassFilterFixDec32MIPS;
236 #endif 236 #endif
237 #if defined(MIPS_DSP_R2_LE) 237 #if defined(MIPS_DSP_R2_LE)
238 WebRtcIsacfix_CalculateResidualEnergy = 238 WebRtcIsacfix_CalculateResidualEnergy =
239 WebRtcIsacfix_CalculateResidualEnergyMIPS; 239 WebRtcIsacfix_CalculateResidualEnergyMIPS;
240 #endif 240 #endif
241 } 241 }
242 #endif 242 #endif
243 243
244 static void InitFunctionPointers(void) {
245 // Initiaze function pointers.
hlundin-webrtc 2015/08/24 08:06:54 Copy-paste typo.
kwiberg-webrtc 2015/08/24 08:16:06 Done. (Comment removed on account of not being use
246 WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrC;
247 WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopC;
248 WebRtcIsacfix_CalculateResidualEnergy =
249 WebRtcIsacfix_CalculateResidualEnergyC;
250 WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16C;
251 WebRtcIsacfix_HighpassFilterFixDec32 = WebRtcIsacfix_HighpassFilterFixDec32C;
252 WebRtcIsacfix_Time2Spec = WebRtcIsacfix_Time2SpecC;
253 WebRtcIsacfix_Spec2Time = WebRtcIsacfix_Spec2TimeC;
254 WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C;
255 WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C;
256
257 #ifdef WEBRTC_DETECT_NEON
258 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
259 WebRtcIsacfix_InitNeon();
260 }
261 #elif defined(WEBRTC_HAS_NEON)
262 WebRtcIsacfix_InitNeon();
263 #endif
264
265 #if defined(MIPS32_LE)
266 WebRtcIsacfix_InitMIPS();
267 #endif
268 }
269
244 /**************************************************************************** 270 /****************************************************************************
245 * WebRtcIsacfix_EncoderInit(...) 271 * WebRtcIsacfix_EncoderInit(...)
246 * 272 *
247 * This function initializes a ISAC instance prior to the encoder calls. 273 * This function initializes a ISAC instance prior to the encoder calls.
248 * 274 *
249 * Input: 275 * Input:
250 * - ISAC_main_inst : ISAC instance. 276 * - ISAC_main_inst : ISAC instance.
251 * - CodingMode : 0 -> Bit rate and frame length are automatically 277 * - CodingMode : 0 -> Bit rate and frame length are automatically
252 * adjusted to available bandwidth on 278 * adjusted to available bandwidth on
253 * transmission channel. 279 * transmission channel.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 336
311 /* Init the bistream data area to zero */ 337 /* Init the bistream data area to zero */
312 for (k=0; k<STREAM_MAXW16_60MS; k++){ 338 for (k=0; k<STREAM_MAXW16_60MS; k++){
313 ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0; 339 ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0;
314 } 340 }
315 341
316 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED 342 #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
317 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj); 343 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj);
318 #endif 344 #endif
319 345
320 // Initiaze function pointers. 346 InitFunctionPointers();
321 WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrC;
322 WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopC;
323 WebRtcIsacfix_CalculateResidualEnergy =
324 WebRtcIsacfix_CalculateResidualEnergyC;
325 WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16C;
326 WebRtcIsacfix_HighpassFilterFixDec32 = WebRtcIsacfix_HighpassFilterFixDec32C;
327 WebRtcIsacfix_Time2Spec = WebRtcIsacfix_Time2SpecC;
328 WebRtcIsacfix_Spec2Time = WebRtcIsacfix_Spec2TimeC;
329 WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C;
330 WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C;
331
332 #ifdef WEBRTC_DETECT_NEON
333 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
334 WebRtcIsacfix_InitNeon();
335 }
336 #elif defined(WEBRTC_HAS_NEON)
337 WebRtcIsacfix_InitNeon();
338 #endif
339
340 #if defined(MIPS32_LE)
341 WebRtcIsacfix_InitMIPS();
342 #endif
343 347
344 return statusInit; 348 return statusInit;
345 } 349 }
346 350
347 /* Read the given number of bytes of big-endian 16-bit integers from |src| and 351 /* Read the given number of bytes of big-endian 16-bit integers from |src| and
348 write them to |dest| in host endian. If |nbytes| is odd, the number of 352 write them to |dest| in host endian. If |nbytes| is odd, the number of
349 output elements is rounded up, and the least significant byte of the last 353 output elements is rounded up, and the least significant byte of the last
350 element is set to 0. */ 354 element is set to 0. */
351 static void read_be16(const uint8_t* src, size_t nbytes, uint16_t* dest) { 355 static void read_be16(const uint8_t* src, size_t nbytes, uint16_t* dest) {
352 size_t i; 356 size_t i;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 * 572 *
569 * Return value 573 * Return value
570 * : 0 - Ok 574 * : 0 - Ok
571 * -1 - Error 575 * -1 - Error
572 */ 576 */
573 577
574 int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst) 578 int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
575 { 579 {
576 ISACFIX_SubStruct *ISAC_inst; 580 ISACFIX_SubStruct *ISAC_inst;
577 581
582 InitFunctionPointers();
583
578 /* typecast pointer to real structure */ 584 /* typecast pointer to real structure */
579 ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; 585 ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst;
580 586
581 /* flag decoder init */ 587 /* flag decoder init */
582 ISAC_inst->initflag |= 1; 588 ISAC_inst->initflag |= 1;
583 589
584 WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj); 590 WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj);
585 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj); 591 WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj);
586 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj); 592 WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj);
587 593
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 assert(inst->initflag & 1); // Decoder initialized. 1551 assert(inst->initflag & 1); // Decoder initialized.
1546 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo); 1552 WebRtcIsacfixBw_GetBandwidthInfo(&inst->bwestimator_obj, bwinfo);
1547 } 1553 }
1548 1554
1549 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst, 1555 void WebRtcIsacfix_SetBandwidthInfo(ISACFIX_MainStruct* ISAC_main_inst,
1550 const IsacBandwidthInfo* bwinfo) { 1556 const IsacBandwidthInfo* bwinfo) {
1551 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst; 1557 ISACFIX_SubStruct* inst = (ISACFIX_SubStruct*)ISAC_main_inst;
1552 assert(inst->initflag & 2); // Encoder initialized. 1558 assert(inst->initflag & 2); // Encoder initialized.
1553 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo); 1559 WebRtcIsacfixBw_SetBandwidthInfo(&inst->bwestimator_obj, bwinfo);
1554 } 1560 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698