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

Side by Side Diff: third_party/opus/src/silk/enc_API.c

Issue 2962373002: [Opus] Update to v1.2.1 (Closed)
Patch Set: Pre-increment instead of post-increment Created 3 years, 5 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) 2006-2011, Skype Limited. All rights reserved. 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3 Redistribution and use in source and binary forms, with or without 3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions 4 modification, are permitted provided that the following conditions
5 are met: 5 are met:
6 - Redistributions of source code must retain the above copyright notice, 6 - Redistributions of source code must retain the above copyright notice,
7 this list of conditions and the following disclaimer. 7 this list of conditions and the following disclaimer.
8 - Redistributions in binary form must reproduce the above copyright 8 - Redistributions in binary form must reproduce the above copyright
9 notice, this list of conditions and the following disclaimer in the 9 notice, this list of conditions and the following disclaimer in the
10 documentation and/or other materials provided with the distribution. 10 documentation and/or other materials provided with the distribution.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES; 226 return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
227 } 227 }
228 /* Make sure no more than one packet can be produced */ 228 /* Make sure no more than one packet can be produced */
229 if( 1000 * (opus_int32)nSamplesIn > encControl->payloadSize_ms * encCont rol->API_sampleRate ) { 229 if( 1000 * (opus_int32)nSamplesIn > encControl->payloadSize_ms * encCont rol->API_sampleRate ) {
230 silk_assert( 0 ); 230 silk_assert( 0 );
231 RESTORE_STACK; 231 RESTORE_STACK;
232 return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES; 232 return SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
233 } 233 }
234 } 234 }
235 235
236 TargetRate_bps = silk_RSHIFT32( encControl->bitRate, encControl->nChannelsIn ternal - 1 );
237 for( n = 0; n < encControl->nChannelsInternal; n++ ) { 236 for( n = 0; n < encControl->nChannelsInternal; n++ ) {
238 /* Force the side channel to the same rate as the mid */ 237 /* Force the side channel to the same rate as the mid */
239 opus_int force_fs_kHz = (n==1) ? psEnc->state_Fxx[0].sCmn.fs_kHz : 0; 238 opus_int force_fs_kHz = (n==1) ? psEnc->state_Fxx[0].sCmn.fs_kHz : 0;
240 if( ( ret = silk_control_encoder( &psEnc->state_Fxx[ n ], encControl, Ta rgetRate_bps, psEnc->allowBandwidthSwitch, n, force_fs_kHz ) ) != 0 ) { 239 if( ( ret = silk_control_encoder( &psEnc->state_Fxx[ n ], encControl, ps Enc->allowBandwidthSwitch, n, force_fs_kHz ) ) != 0 ) {
241 silk_assert( 0 ); 240 silk_assert( 0 );
242 RESTORE_STACK; 241 RESTORE_STACK;
243 return ret; 242 return ret;
244 } 243 }
245 if( psEnc->state_Fxx[n].sCmn.first_frame_after_reset || transition ) { 244 if( psEnc->state_Fxx[n].sCmn.first_frame_after_reset || transition ) {
246 for( i = 0; i < psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket; i++ ) { 245 for( i = 0; i < psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket; i++ ) {
247 psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i ] = 0; 246 psEnc->state_Fxx[ n ].sCmn.LBRR_flags[ i ] = 0;
248 } 247 }
249 } 248 }
250 psEnc->state_Fxx[ n ].sCmn.inDTX = psEnc->state_Fxx[ n ].sCmn.useDTX; 249 psEnc->state_Fxx[ n ].sCmn.inDTX = psEnc->state_Fxx[ n ].sCmn.useDTX;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 /* Convert Left/Right to Mid/Side */ 408 /* Convert Left/Right to Mid/Side */
410 if( encControl->nChannelsInternal == 2 ) { 409 if( encControl->nChannelsInternal == 2 ) {
411 silk_stereo_LR_to_MS( &psEnc->sStereo, &psEnc->state_Fxx[ 0 ].sC mn.inputBuf[ 2 ], &psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ 2 ], 410 silk_stereo_LR_to_MS( &psEnc->sStereo, &psEnc->state_Fxx[ 0 ].sC mn.inputBuf[ 2 ], &psEnc->state_Fxx[ 1 ].sCmn.inputBuf[ 2 ],
412 psEnc->sStereo.predIx[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEnc oded ], &psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncode d ], 411 psEnc->sStereo.predIx[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEnc oded ], &psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nFramesEncode d ],
413 MStargetRates_bps, TargetRate_bps, psEnc->state_Fxx[ 0 ].sCm n.speech_activity_Q8, encControl->toMono, 412 MStargetRates_bps, TargetRate_bps, psEnc->state_Fxx[ 0 ].sCm n.speech_activity_Q8, encControl->toMono,
414 psEnc->state_Fxx[ 0 ].sCmn.fs_kHz, psEnc->state_Fxx[ 0 ].sCm n.frame_length ); 413 psEnc->state_Fxx[ 0 ].sCmn.fs_kHz, psEnc->state_Fxx[ 0 ].sCm n.frame_length );
415 if( psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nF ramesEncoded ] == 0 ) { 414 if( psEnc->sStereo.mid_only_flags[ psEnc->state_Fxx[ 0 ].sCmn.nF ramesEncoded ] == 0 ) {
416 /* Reset side channel encoder memory for first frame with si de coding */ 415 /* Reset side channel encoder memory for first frame with si de coding */
417 if( psEnc->prev_decode_only_middle == 1 ) { 416 if( psEnc->prev_decode_only_middle == 1 ) {
418 silk_memset( &psEnc->state_Fxx[ 1 ].sShape, 0, sizeof( psEnc->state_Fxx[ 1 ].sShape ) ); 417 silk_memset( &psEnc->state_Fxx[ 1 ].sShape, 0, sizeof( psEnc->state_Fxx[ 1 ].sShape ) );
419 silk_memset( &psEnc->state_Fxx[ 1 ].sPrefilt, 0, sizeof( psEnc->state_Fxx[ 1 ].sPrefilt ) );
420 silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sNSQ, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sNSQ ) ); 418 silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sNSQ, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sNSQ ) );
421 silk_memset( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15 ) ); 419 silk_memset( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15 ) );
422 silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State , 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State ) ); 420 silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State , 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State ) );
423 psEnc->state_Fxx[ 1 ].sCmn.prevLag = 100 ; 421 psEnc->state_Fxx[ 1 ].sCmn.prevLag = 100 ;
424 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.lagPrev = 100 ; 422 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.lagPrev = 100 ;
425 psEnc->state_Fxx[ 1 ].sShape.LastGainIndex = 10; 423 psEnc->state_Fxx[ 1 ].sShape.LastGainIndex = 10;
426 psEnc->state_Fxx[ 1 ].sCmn.prevSignalType = TYP E_NO_VOICE_ACTIVITY; 424 psEnc->state_Fxx[ 1 ].sCmn.prevSignalType = TYP E_NO_VOICE_ACTIVITY;
427 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.prev_gain_Q16 = 655 36; 425 psEnc->state_Fxx[ 1 ].sCmn.sNSQ.prev_gain_Q16 = 655 36;
428 psEnc->state_Fxx[ 1 ].sCmn.first_frame_after_reset = 1; 426 psEnc->state_Fxx[ 1 ].sCmn.first_frame_after_reset = 1;
429 } 427 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 encControl->stereoWidth_Q14 = encControl->toMono ? 0 : psEnc->sStereo.smth_w idth_Q14; 548 encControl->stereoWidth_Q14 = encControl->toMono ? 0 : psEnc->sStereo.smth_w idth_Q14;
551 if( prefillFlag ) { 549 if( prefillFlag ) {
552 encControl->payloadSize_ms = tmp_payloadSize_ms; 550 encControl->payloadSize_ms = tmp_payloadSize_ms;
553 encControl->complexity = tmp_complexity; 551 encControl->complexity = tmp_complexity;
554 for( n = 0; n < encControl->nChannelsInternal; n++ ) { 552 for( n = 0; n < encControl->nChannelsInternal; n++ ) {
555 psEnc->state_Fxx[ n ].sCmn.controlled_since_last_payload = 0; 553 psEnc->state_Fxx[ n ].sCmn.controlled_since_last_payload = 0;
556 psEnc->state_Fxx[ n ].sCmn.prefillFlag = 0; 554 psEnc->state_Fxx[ n ].sCmn.prefillFlag = 0;
557 } 555 }
558 } 556 }
559 557
558 encControl->signalType = psEnc->state_Fxx[0].sCmn.indices.signalType;
559 encControl->offset = silk_Quantization_Offsets_Q10
560 [ psEnc->state_Fxx[0].sCmn.indices.signalType >> 1 ]
561 [ psEnc->state_Fxx[0].sCmn.indices.quantOffsetType ];
560 RESTORE_STACK; 562 RESTORE_STACK;
561 return ret; 563 return ret;
562 } 564 }
563 565
OLDNEW
« no previous file with comments | « third_party/opus/src/silk/define.h ('k') | third_party/opus/src/silk/fixed/arm/warped_autocorrelation_FIX_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698