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

Side by Side Diff: silk/control_codec.c

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « silk/control.h ('k') | silk/dec_API.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 silk_encoder_state_Fxx *psEnc, /* I/O */ 48 silk_encoder_state_Fxx *psEnc, /* I/O */
49 opus_int fs_kHz, /* I */ 49 opus_int fs_kHz, /* I */
50 opus_int PacketSize_ms /* I */ 50 opus_int PacketSize_ms /* I */
51 ); 51 );
52 52
53 static opus_int silk_setup_complexity( 53 static opus_int silk_setup_complexity(
54 silk_encoder_state *psEncC, /* I/O */ 54 silk_encoder_state *psEncC, /* I/O */
55 opus_int Complexity /* I */ 55 opus_int Complexity /* I */
56 ); 56 );
57 57
58 static inline opus_int silk_setup_LBRR( 58 static OPUS_INLINE opus_int silk_setup_LBRR(
59 silk_encoder_state *psEncC, /* I/O */ 59 silk_encoder_state *psEncC, /* I/O */
60 const opus_int32 TargetRate_bps /* I */ 60 const opus_int32 TargetRate_bps /* I */
61 ); 61 );
62 62
63 63
64 /* Control encoder */ 64 /* Control encoder */
65 opus_int silk_control_encoder( 65 opus_int silk_control_encoder(
66 silk_encoder_state_Fxx *psEnc, /* I /O Pointer to Silk encoder state */ 66 silk_encoder_state_Fxx *psEnc, /* I /O Pointer to Silk encoder state */
67 silk_EncControlStruct *encControl, /* I Control structure */ 67 silk_EncControlStruct *encControl, /* I Control structure */
68 const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */ 68 const opus_int32 TargetRate_bps, /* I Target max bitrate (bps) */
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 silk_assert( psEncC->shapingLPCOrder <= MAX_SHAPE_LPC_ORDER ); 385 silk_assert( psEncC->shapingLPCOrder <= MAX_SHAPE_LPC_ORDER );
386 silk_assert( psEncC->nStatesDelayedDecision <= MAX_DEL_DEC_STATES ); 386 silk_assert( psEncC->nStatesDelayedDecision <= MAX_DEL_DEC_STATES );
387 silk_assert( psEncC->warping_Q16 <= 32767 ); 387 silk_assert( psEncC->warping_Q16 <= 32767 );
388 silk_assert( psEncC->la_shape <= LA_SHAPE_MAX ); 388 silk_assert( psEncC->la_shape <= LA_SHAPE_MAX );
389 silk_assert( psEncC->shapeWinLength <= SHAPE_LPC_WIN_MAX ); 389 silk_assert( psEncC->shapeWinLength <= SHAPE_LPC_WIN_MAX );
390 silk_assert( psEncC->NLSF_MSVQ_Survivors <= NLSF_VQ_MAX_SURVIVORS ); 390 silk_assert( psEncC->NLSF_MSVQ_Survivors <= NLSF_VQ_MAX_SURVIVORS );
391 391
392 return ret; 392 return ret;
393 } 393 }
394 394
395 static inline opus_int silk_setup_LBRR( 395 static OPUS_INLINE opus_int silk_setup_LBRR(
396 silk_encoder_state *psEncC, /* I/O */ 396 silk_encoder_state *psEncC, /* I/O */
397 const opus_int32 TargetRate_bps /* I */ 397 const opus_int32 TargetRate_bps /* I */
398 ) 398 )
399 { 399 {
400 opus_int ret = SILK_NO_ERROR; 400 opus_int ret = SILK_NO_ERROR;
401 opus_int32 LBRR_rate_thres_bps; 401 opus_int32 LBRR_rate_thres_bps;
402 402
403 psEncC->LBRR_enabled = 0; 403 psEncC->LBRR_enabled = 0;
404 if( psEncC->useInBandFEC && psEncC->PacketLoss_perc > 0 ) { 404 if( psEncC->useInBandFEC && psEncC->PacketLoss_perc > 0 ) {
405 if( psEncC->fs_kHz == 8 ) { 405 if( psEncC->fs_kHz == 8 ) {
406 LBRR_rate_thres_bps = LBRR_NB_MIN_RATE_BPS; 406 LBRR_rate_thres_bps = LBRR_NB_MIN_RATE_BPS;
407 } else if( psEncC->fs_kHz == 12 ) { 407 } else if( psEncC->fs_kHz == 12 ) {
408 LBRR_rate_thres_bps = LBRR_MB_MIN_RATE_BPS; 408 LBRR_rate_thres_bps = LBRR_MB_MIN_RATE_BPS;
409 } else { 409 } else {
410 LBRR_rate_thres_bps = LBRR_WB_MIN_RATE_BPS; 410 LBRR_rate_thres_bps = LBRR_WB_MIN_RATE_BPS;
411 } 411 }
412 LBRR_rate_thres_bps = silk_SMULWB( silk_MUL( LBRR_rate_thres_bps, 125 - silk_min( psEncC->PacketLoss_perc, 25 ) ), SILK_FIX_CONST( 0.01, 16 ) ); 412 LBRR_rate_thres_bps = silk_SMULWB( silk_MUL( LBRR_rate_thres_bps, 125 - silk_min( psEncC->PacketLoss_perc, 25 ) ), SILK_FIX_CONST( 0.01, 16 ) );
413 413
414 if( TargetRate_bps > LBRR_rate_thres_bps ) { 414 if( TargetRate_bps > LBRR_rate_thres_bps ) {
415 /* Set gain increase for coding LBRR excitation */ 415 /* Set gain increase for coding LBRR excitation */
416 psEncC->LBRR_enabled = 1; 416 psEncC->LBRR_enabled = 1;
417 psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_in t32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 ); 417 psEncC->LBRR_GainIncreases = silk_max_int( 7 - silk_SMULWB( (opus_in t32)psEncC->PacketLoss_perc, SILK_FIX_CONST( 0.4, 16 ) ), 2 );
418 } 418 }
419 } 419 }
420 420
421 return ret; 421 return ret;
422 } 422 }
OLDNEW
« no previous file with comments | « silk/control.h ('k') | silk/dec_API.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698