Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 30 matching lines...) Expand all Loading... | |
| 41 /*----------------------------------------------------------------* | 41 /*----------------------------------------------------------------* |
| 42 * main encoder function | 42 * main encoder function |
| 43 *---------------------------------------------------------------*/ | 43 *---------------------------------------------------------------*/ |
| 44 | 44 |
| 45 void WebRtcIlbcfix_EncodeImpl( | 45 void WebRtcIlbcfix_EncodeImpl( |
| 46 uint16_t *bytes, /* (o) encoded data bits iLBC */ | 46 uint16_t *bytes, /* (o) encoded data bits iLBC */ |
| 47 const int16_t *block, /* (i) speech vector to encode */ | 47 const int16_t *block, /* (i) speech vector to encode */ |
| 48 IlbcEncoder *iLBCenc_inst /* (i/o) the general encoder | 48 IlbcEncoder *iLBCenc_inst /* (i/o) the general encoder |
| 49 state */ | 49 state */ |
| 50 ){ | 50 ){ |
| 51 int n, meml_gotten, Nfor, Nback; | 51 int n, meml_gotten, Nfor; |
| 52 int16_t diff, start_pos; | 52 int16_t diff, start_pos; |
| 53 int index; | 53 int index; |
| 54 int subcount, subframe; | 54 int subcount, subframe; |
| 55 int16_t start_count, end_count; | 55 int16_t start_count, end_count; |
| 56 int16_t *residual; | 56 int16_t *residual; |
| 57 int32_t en1, en2; | 57 int32_t en1, en2; |
| 58 int16_t scale, max; | 58 int16_t scale, max; |
| 59 int16_t *syntdenum; | 59 int16_t *syntdenum; |
| 60 int16_t *decresidual; | 60 int16_t *decresidual; |
| 61 int16_t *reverseResidual; | 61 int16_t *reverseResidual; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 /* Packetize the parameters into the frame */ | 372 /* Packetize the parameters into the frame */ |
| 373 WebRtcIlbcfix_PackBits (iLBCenc_inst->bytes, iLBCbits_inst, iLBCenc_inst->mo de); | 373 WebRtcIlbcfix_PackBits (iLBCenc_inst->bytes, iLBCbits_inst, iLBCenc_inst->mo de); |
| 374 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, | 374 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, |
| 375 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); | 375 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); |
| 376 return; | 376 return; |
| 377 } | 377 } |
| 378 #endif | 378 #endif |
| 379 | 379 |
| 380 /* backward prediction of subframes */ | 380 /* backward prediction of subframes */ |
| 381 | 381 |
| 382 Nback = iLBCbits_inst->startIdx-1; | 382 if (iLBCbits_inst->startIdx > 1) { |
| 383 | |
| 384 if( Nback > 0 ){ | |
| 385 | 383 |
| 386 /* create reverse order vectors | 384 /* create reverse order vectors |
| 387 (The decresidual does not need to be copied since it is | 385 (The decresidual does not need to be copied since it is |
| 388 contained in the same vector as the residual) | 386 contained in the same vector as the residual) |
| 389 */ | 387 */ |
| 390 | 388 |
| 389 int Nback = iLBCbits_inst->startIdx - 1; | |
| 391 WebRtcSpl_MemCpyReversedOrder(&reverseResidual[Nback*SUBL-1], residual, Nbac k*SUBL); | 390 WebRtcSpl_MemCpyReversedOrder(&reverseResidual[Nback*SUBL-1], residual, Nbac k*SUBL); |
| 392 | 391 |
| 393 /* setup memory */ | 392 /* setup memory */ |
| 394 | 393 |
| 395 meml_gotten = SUBL*(iLBCenc_inst->nsub+1-iLBCbits_inst->startIdx); | 394 meml_gotten = SUBL*(iLBCenc_inst->nsub+1-iLBCbits_inst->startIdx); |
| 396 if( meml_gotten > CB_MEML ) { | 395 if( meml_gotten > CB_MEML ) { |
| 397 meml_gotten=CB_MEML; | 396 meml_gotten=CB_MEML; |
| 398 } | 397 } |
| 399 | 398 |
| 400 WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[Nback*SUBL], mem l_gotten); | 399 WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[Nback*SUBL], mem l_gotten); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 418 if (iLBCenc_inst->mode == 20) | 417 if (iLBCenc_inst->mode == 20) |
| 419 { | 418 { |
| 420 start_count = 0; | 419 start_count = 0; |
| 421 end_count = Nback; | 420 end_count = Nback; |
| 422 } | 421 } |
| 423 if (iLBCenc_inst->mode == 30) | 422 if (iLBCenc_inst->mode == 30) |
| 424 { | 423 { |
| 425 if (iLBCenc_inst->section == 1) | 424 if (iLBCenc_inst->section == 1) |
| 426 { | 425 { |
| 427 start_count = 0; | 426 start_count = 0; |
| 428 end_count = WEBRTC_SPL_MAX (2 - Nfor, 0); | 427 end_count = (Nfor > 1) ? 0 : (2 - NFor); |
| 429 } | 428 } |
| 430 if (iLBCenc_inst->section == 2) | 429 if (iLBCenc_inst->section == 2) |
| 431 { | 430 { |
| 432 start_count = WEBRTC_SPL_MAX (2 - Nfor, 0); | 431 start_count = (Nfor > 1) ? 0 : (2 - NFor); |
|
kwiberg-webrtc
2015/06/10 07:49:10
See previous comment.
kwiberg-webrtc
2015/06/10 07:49:10
Nit: it'd be slightly easier to read if you said N
Peter Kasting
2015/06/11 04:14:53
Done (for both).
| |
| 433 end_count = Nback; | 432 end_count = Nback; |
| 434 } | 433 } |
| 435 } | 434 } |
| 436 #else | 435 #else |
| 437 start_count = 0; | 436 start_count = 0; |
| 438 end_count = (int16_t)Nback; | 437 end_count = (int16_t)Nback; |
| 439 #endif | 438 #endif |
| 440 | 439 |
| 441 /* loop over subframes to encode */ | 440 /* loop over subframes to encode */ |
| 442 | 441 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 } | 509 } |
| 511 else | 510 else |
| 512 { | 511 { |
| 513 iLBCenc_inst->section++; | 512 iLBCenc_inst->section++; |
| 514 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, | 513 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, |
| 515 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); | 514 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); |
| 516 } | 515 } |
| 517 #endif | 516 #endif |
| 518 | 517 |
| 519 } | 518 } |
| OLD | NEW |