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 11 matching lines...) Loading... |
22 #include "lpc_encode.h" | 22 #include "lpc_encode.h" |
23 #include "frame_classify.h" | 23 #include "frame_classify.h" |
24 #include "state_search.h" | 24 #include "state_search.h" |
25 #include "state_construct.h" | 25 #include "state_construct.h" |
26 #include "constants.h" | 26 #include "constants.h" |
27 #include "cb_search.h" | 27 #include "cb_search.h" |
28 #include "cb_construct.h" | 28 #include "cb_construct.h" |
29 #include "index_conv_enc.h" | 29 #include "index_conv_enc.h" |
30 #include "pack_bits.h" | 30 #include "pack_bits.h" |
31 #include "hp_input.h" | 31 #include "hp_input.h" |
| 32 #include "webrtc/base/checks.h" |
32 | 33 |
33 #ifdef SPLIT_10MS | 34 #ifdef SPLIT_10MS |
34 #include "unpack_bits.h" | 35 #include "unpack_bits.h" |
35 #include "index_conv_dec.h" | 36 #include "index_conv_dec.h" |
36 #endif | 37 #endif |
37 #ifndef WEBRTC_ARCH_BIG_ENDIAN | 38 #ifndef WEBRTC_ARCH_BIG_ENDIAN |
38 #include "swap_bytes.h" | 39 #include "swap_bytes.h" |
39 #endif | 40 #endif |
40 | 41 |
41 /*----------------------------------------------------------------* | 42 /*----------------------------------------------------------------* |
(...skipping 157 matching lines...) Loading... |
199 | 200 |
200 /* encode subframes */ | 201 /* encode subframes */ |
201 | 202 |
202 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index, iLBCbits_ins
t->gain_index, | 203 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index, iLBCbits_ins
t->gain_index, |
203 &residual[start_pos+iLBCenc_inst->state_short_len], | 204 &residual[start_pos+iLBCenc_inst->state_short_len], |
204 mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L_TBL, diff, | 205 mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L_TBL, diff, |
205 &weightdenum[iLBCbits_inst->startIdx*(LPC_FILTERORD
ER+1)], 0); | 206 &weightdenum[iLBCbits_inst->startIdx*(LPC_FILTERORD
ER+1)], 0); |
206 | 207 |
207 /* construct decoded vector */ | 208 /* construct decoded vector */ |
208 | 209 |
209 WebRtcIlbcfix_CbConstruct(&decresidual[start_pos+iLBCenc_inst->state_short
_len], | 210 RTC_CHECK(WebRtcIlbcfix_CbConstruct( |
210 iLBCbits_inst->cb_index, iLBCbits_inst->gain_ind
ex, | 211 &decresidual[start_pos + iLBCenc_inst->state_short_len], |
211 mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L_TBL, | 212 iLBCbits_inst->cb_index, iLBCbits_inst->gain_index, |
212 diff | 213 mem + CB_MEML - ST_MEM_L_TBL, ST_MEM_L_TBL, diff)); |
213 ); | |
214 | 214 |
215 } | 215 } |
216 else { /* put adaptive part in the beginning */ | 216 else { /* put adaptive part in the beginning */ |
217 | 217 |
218 /* create reversed vectors for prediction */ | 218 /* create reversed vectors for prediction */ |
219 | 219 |
220 WebRtcSpl_MemCpyReversedOrder(&reverseResidual[diff-1], | 220 WebRtcSpl_MemCpyReversedOrder(&reverseResidual[diff-1], |
221 &residual[(iLBCbits_inst->startIdx+1)*SUBL-S
TATE_LEN], diff); | 221 &residual[(iLBCbits_inst->startIdx+1)*SUBL-S
TATE_LEN], diff); |
222 | 222 |
223 /* setup memory */ | 223 /* setup memory */ |
224 | 224 |
225 meml_gotten = iLBCenc_inst->state_short_len; | 225 meml_gotten = iLBCenc_inst->state_short_len; |
226 WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[start_pos], me
ml_gotten); | 226 WebRtcSpl_MemCpyReversedOrder(&mem[CB_MEML-1], &decresidual[start_pos], me
ml_gotten); |
227 WebRtcSpl_MemSetW16(mem, 0, CB_MEML - iLBCenc_inst->state_short_len); | 227 WebRtcSpl_MemSetW16(mem, 0, CB_MEML - iLBCenc_inst->state_short_len); |
228 | 228 |
229 /* encode subframes */ | 229 /* encode subframes */ |
230 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index, iLBCbits_ins
t->gain_index, | 230 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index, iLBCbits_ins
t->gain_index, |
231 reverseResidual, mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L
_TBL, diff, | 231 reverseResidual, mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L
_TBL, diff, |
232 &weightdenum[(iLBCbits_inst->startIdx-1)*(LPC_FILTE
RORDER+1)], | 232 &weightdenum[(iLBCbits_inst->startIdx-1)*(LPC_FILTE
RORDER+1)], |
233 0); | 233 0); |
234 | 234 |
235 /* construct decoded vector */ | 235 /* construct decoded vector */ |
236 | 236 RTC_CHECK(WebRtcIlbcfix_CbConstruct( |
237 WebRtcIlbcfix_CbConstruct(reverseDecresidual, | 237 reverseDecresidual, iLBCbits_inst->cb_index, |
238 iLBCbits_inst->cb_index, iLBCbits_inst->gain_ind
ex, | 238 iLBCbits_inst->gain_index, mem + CB_MEML - ST_MEM_L_TBL, |
239 mem+CB_MEML-ST_MEM_L_TBL, ST_MEM_L_TBL, | 239 ST_MEM_L_TBL, diff)); |
240 diff | |
241 ); | |
242 | 240 |
243 /* get decoded residual from reversed vector */ | 241 /* get decoded residual from reversed vector */ |
244 | 242 |
245 WebRtcSpl_MemCpyReversedOrder(&decresidual[start_pos-1], reverseDecresidua
l, diff); | 243 WebRtcSpl_MemCpyReversedOrder(&decresidual[start_pos-1], reverseDecresidua
l, diff); |
246 } | 244 } |
247 | 245 |
248 #ifdef SPLIT_10MS | 246 #ifdef SPLIT_10MS |
249 iLBCenc_inst->start_pos = start_pos; | 247 iLBCenc_inst->start_pos = start_pos; |
250 iLBCenc_inst->diff = diff; | 248 iLBCenc_inst->diff = diff; |
251 iLBCenc_inst->section++; | 249 iLBCenc_inst->section++; |
(...skipping 85 matching lines...) Loading... |
337 /* encode subframe */ | 335 /* encode subframe */ |
338 | 336 |
339 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index+subcount*CB_N
STAGES, | 337 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index+subcount*CB_N
STAGES, |
340 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, | 338 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, |
341 &residual[(iLBCbits_inst->startIdx+1+subframe)*SUBL
], | 339 &residual[(iLBCbits_inst->startIdx+1+subframe)*SUBL
], |
342 mem, MEM_LF_TBL, SUBL, | 340 mem, MEM_LF_TBL, SUBL, |
343 &weightdenum[(iLBCbits_inst->startIdx+1+subframe)*(
LPC_FILTERORDER+1)], | 341 &weightdenum[(iLBCbits_inst->startIdx+1+subframe)*(
LPC_FILTERORDER+1)], |
344 subcount); | 342 subcount); |
345 | 343 |
346 /* construct decoded vector */ | 344 /* construct decoded vector */ |
347 | 345 RTC_CHECK(WebRtcIlbcfix_CbConstruct( |
348 WebRtcIlbcfix_CbConstruct(&decresidual[(iLBCbits_inst->startIdx+1+subframe
)*SUBL], | 346 &decresidual[(iLBCbits_inst->startIdx + 1 + subframe) * SUBL], |
349 iLBCbits_inst->cb_index+subcount*CB_NSTAGES, | 347 iLBCbits_inst->cb_index + subcount * CB_NSTAGES, |
350 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, | 348 iLBCbits_inst->gain_index + subcount * CB_NSTAGES, mem, MEM_LF_TBL, |
351 mem, MEM_LF_TBL, | 349 SUBL)); |
352 SUBL | |
353 ); | |
354 | 350 |
355 /* update memory */ | 351 /* update memory */ |
356 | 352 |
357 memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); | 353 memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); |
358 WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-SUBL, | 354 WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-SUBL, |
359 &decresidual[(iLBCbits_inst->startIdx+1+subframe)*SU
BL], SUBL); | 355 &decresidual[(iLBCbits_inst->startIdx+1+subframe)*SU
BL], SUBL); |
360 | 356 |
361 subcount++; | 357 subcount++; |
362 } | 358 } |
363 } | 359 } |
(...skipping 79 matching lines...) Loading... |
443 | 439 |
444 /* encode subframe */ | 440 /* encode subframe */ |
445 | 441 |
446 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index+subcount*CB_N
STAGES, | 442 WebRtcIlbcfix_CbSearch(iLBCenc_inst, iLBCbits_inst->cb_index+subcount*CB_N
STAGES, |
447 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, &rev
erseResidual[subframe*SUBL], | 443 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, &rev
erseResidual[subframe*SUBL], |
448 mem, MEM_LF_TBL, SUBL, | 444 mem, MEM_LF_TBL, SUBL, |
449 &weightdenum[(iLBCbits_inst->startIdx-2-subframe)*(
LPC_FILTERORDER+1)], | 445 &weightdenum[(iLBCbits_inst->startIdx-2-subframe)*(
LPC_FILTERORDER+1)], |
450 subcount); | 446 subcount); |
451 | 447 |
452 /* construct decoded vector */ | 448 /* construct decoded vector */ |
453 | 449 RTC_CHECK(WebRtcIlbcfix_CbConstruct( |
454 WebRtcIlbcfix_CbConstruct(&reverseDecresidual[subframe*SUBL], | 450 &reverseDecresidual[subframe * SUBL], |
455 iLBCbits_inst->cb_index+subcount*CB_NSTAGES, | 451 iLBCbits_inst->cb_index + subcount * CB_NSTAGES, |
456 iLBCbits_inst->gain_index+subcount*CB_NSTAGES, | 452 iLBCbits_inst->gain_index + subcount * CB_NSTAGES, mem, MEM_LF_TBL, |
457 mem, MEM_LF_TBL, SUBL | 453 SUBL)); |
458 ); | |
459 | 454 |
460 /* update memory */ | 455 /* update memory */ |
461 memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); | 456 memmove(mem, mem + SUBL, (CB_MEML - SUBL) * sizeof(*mem)); |
462 WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-SUBL, | 457 WEBRTC_SPL_MEMCPY_W16(mem+CB_MEML-SUBL, |
463 &reverseDecresidual[subframe*SUBL], SUBL); | 458 &reverseDecresidual[subframe*SUBL], SUBL); |
464 | 459 |
465 subcount++; | 460 subcount++; |
466 | 461 |
467 } | 462 } |
468 | 463 |
(...skipping 40 matching lines...) Loading... |
509 } | 504 } |
510 else | 505 else |
511 { | 506 { |
512 iLBCenc_inst->section++; | 507 iLBCenc_inst->section++; |
513 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, | 508 WEBRTC_SPL_MEMCPY_W16 (weightdenumbuf, weightdenum, |
514 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); | 509 SCRATCH_ENCODE_DATAVEC - SCRATCH_ENCODE_WEIGHTDENUM); |
515 } | 510 } |
516 #endif | 511 #endif |
517 | 512 |
518 } | 513 } |
OLD | NEW |