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

Side by Side Diff: silk/fixed/encode_frame_FIX.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/fixed/burg_modified_FIX.c ('k') | silk/fixed/find_LPC_FIX.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 16 matching lines...) Expand all
27 27
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include "config.h" 29 #include "config.h"
30 #endif 30 #endif
31 31
32 #include "main_FIX.h" 32 #include "main_FIX.h"
33 #include "stack_alloc.h" 33 #include "stack_alloc.h"
34 #include "tuning_parameters.h" 34 #include "tuning_parameters.h"
35 35
36 /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */ 36 /* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate */
37 static inline void silk_LBRR_encode_FIX( 37 static OPUS_INLINE void silk_LBRR_encode_FIX(
38 silk_encoder_state_FIX *psEnc, /* I /O Pointer to Silk FIX encoder state */ 38 silk_encoder_state_FIX *psEnc, /* I /O Pointer to Silk FIX encoder state */
39 silk_encoder_control_FIX *psEncCtrl, /* I /O Pointer to Silk FIX encoder control struct */ 39 silk_encoder_control_FIX *psEncCtrl, /* I /O Pointer to Silk FIX encoder control struct */
40 const opus_int32 xfw_Q3[], /* I Input signal */ 40 const opus_int32 xfw_Q3[], /* I Input signal */
41 opus_int condCoding /* I The type of conditional coding used so far for this frame */ 41 opus_int condCoding /* I The type of conditional coding used so far for this frame */
42 ); 42 );
43 43
44 void silk_encode_do_VAD_FIX( 44 void silk_encode_do_VAD_FIX(
45 silk_encoder_state_FIX *psEnc /* I /O Pointer to Silk FIX encoder state */ 45 silk_encoder_state_FIX *psEnc /* I /O Pointer to Silk FIX encoder state */
46 ) 46 )
47 { 47 {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 ALLOC( res_pitch, 126 ALLOC( res_pitch,
127 psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length 127 psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length
128 + psEnc->sCmn.ltp_mem_length, opus_int16 ); 128 + psEnc->sCmn.ltp_mem_length, opus_int16 );
129 /* start of pitch LPC residual frame */ 129 /* start of pitch LPC residual frame */
130 res_pitch_frame = res_pitch + psEnc->sCmn.ltp_mem_length; 130 res_pitch_frame = res_pitch + psEnc->sCmn.ltp_mem_length;
131 131
132 /*****************************************/ 132 /*****************************************/
133 /* Find pitch lags, initial LPC analysis */ 133 /* Find pitch lags, initial LPC analysis */
134 /*****************************************/ 134 /*****************************************/
135 silk_find_pitch_lags_FIX( psEnc, &sEncCtrl, res_pitch, x_frame ); 135 silk_find_pitch_lags_FIX( psEnc, &sEncCtrl, res_pitch, x_frame, psEnc->s Cmn.arch );
136 136
137 /************************/ 137 /************************/
138 /* Noise shape analysis */ 138 /* Noise shape analysis */
139 /************************/ 139 /************************/
140 silk_noise_shape_analysis_FIX( psEnc, &sEncCtrl, res_pitch_frame, x_fram e ); 140 silk_noise_shape_analysis_FIX( psEnc, &sEncCtrl, res_pitch_frame, x_fram e, psEnc->sCmn.arch );
141 141
142 /***************************************************/ 142 /***************************************************/
143 /* Find linear prediction coefficients (LPC + LTP) */ 143 /* Find linear prediction coefficients (LPC + LTP) */
144 /***************************************************/ 144 /***************************************************/
145 silk_find_pred_coefs_FIX( psEnc, &sEncCtrl, res_pitch, x_frame, condCodi ng ); 145 silk_find_pred_coefs_FIX( psEnc, &sEncCtrl, res_pitch, x_frame, condCodi ng );
146 146
147 /****************************************/ 147 /****************************************/
148 /* Process gains */ 148 /* Process gains */
149 /****************************************/ 149 /****************************************/
150 silk_process_gains_FIX( psEnc, &sEncCtrl, condCoding ); 150 silk_process_gains_FIX( psEnc, &sEncCtrl, condCoding );
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 /* Unique identifier of gains vector */ 296 /* Unique identifier of gains vector */
297 gainsID = silk_gains_ID( psEnc->sCmn.indices.GainsIndices, psEnc->sC mn.nb_subfr ); 297 gainsID = silk_gains_ID( psEnc->sCmn.indices.GainsIndices, psEnc->sC mn.nb_subfr );
298 } 298 }
299 } 299 }
300 300
301 /* Update input buffer */ 301 /* Update input buffer */
302 silk_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ], 302 silk_memmove( psEnc->x_buf, &psEnc->x_buf[ psEnc->sCmn.frame_length ],
303 ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * size of( opus_int16 ) ); 303 ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * size of( opus_int16 ) );
304 304
305 /* Parameters needed for next frame */
306 psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ];
307 psEnc->sCmn.prevSignalType = psEnc->sCmn.indices.signalType;
308
309 /* Exit without entropy coding */ 305 /* Exit without entropy coding */
310 if( psEnc->sCmn.prefillFlag ) { 306 if( psEnc->sCmn.prefillFlag ) {
311 /* No payload */ 307 /* No payload */
312 *pnBytesOut = 0; 308 *pnBytesOut = 0;
313 RESTORE_STACK; 309 RESTORE_STACK;
314 return ret; 310 return ret;
315 } 311 }
316 312
313 /* Parameters needed for next frame */
314 psEnc->sCmn.prevLag = sEncCtrl.pitchL[ psEnc->sCmn.nb_subfr - 1 ];
315 psEnc->sCmn.prevSignalType = psEnc->sCmn.indices.signalType;
316
317 /****************************************/ 317 /****************************************/
318 /* Finalize payload */ 318 /* Finalize payload */
319 /****************************************/ 319 /****************************************/
320 psEnc->sCmn.first_frame_after_reset = 0; 320 psEnc->sCmn.first_frame_after_reset = 0;
321 /* Payload size */ 321 /* Payload size */
322 *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 ); 322 *pnBytesOut = silk_RSHIFT( ec_tell( psRangeEnc ) + 7, 3 );
323 323
324 RESTORE_STACK; 324 RESTORE_STACK;
325 return ret; 325 return ret;
326 } 326 }
327 327
328 /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excit ation at lower bitrate */ 328 /* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode excit ation at lower bitrate */
329 static inline void silk_LBRR_encode_FIX( 329 static OPUS_INLINE void silk_LBRR_encode_FIX(
330 silk_encoder_state_FIX *psEnc, /* I /O Pointer to Silk FIX encoder state */ 330 silk_encoder_state_FIX *psEnc, /* I /O Pointer to Silk FIX encoder state */
331 silk_encoder_control_FIX *psEncCtrl, /* I /O Pointer to Silk FIX encoder control struct */ 331 silk_encoder_control_FIX *psEncCtrl, /* I /O Pointer to Silk FIX encoder control struct */
332 const opus_int32 xfw_Q3[], /* I Input signal */ 332 const opus_int32 xfw_Q3[], /* I Input signal */
333 opus_int condCoding /* I The type of conditional coding used so far for this frame */ 333 opus_int condCoding /* I The type of conditional coding used so far for this frame */
334 ) 334 )
335 { 335 {
336 opus_int32 TempGains_Q16[ MAX_NB_SUBFR ]; 336 opus_int32 TempGains_Q16[ MAX_NB_SUBFR ];
337 SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFr amesEncoded ]; 337 SideInfoIndices *psIndices_LBRR = &psEnc->sCmn.indices_LBRR[ psEnc->sCmn.nFr amesEncoded ];
338 silk_nsq_state sNSQ_LBRR; 338 silk_nsq_state sNSQ_LBRR;
339 339
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 silk_NSQ( &psEnc->sCmn, &sNSQ_LBRR, psIndices_LBRR, xfw_Q3, 376 silk_NSQ( &psEnc->sCmn, &sNSQ_LBRR, psIndices_LBRR, xfw_Q3,
377 psEnc->sCmn.pulses_LBRR[ psEnc->sCmn.nFramesEncoded ], psEncCtrl ->PredCoef_Q12[ 0 ], psEncCtrl->LTPCoef_Q14, 377 psEnc->sCmn.pulses_LBRR[ psEnc->sCmn.nFramesEncoded ], psEncCtrl ->PredCoef_Q12[ 0 ], psEncCtrl->LTPCoef_Q14,
378 psEncCtrl->AR2_Q13, psEncCtrl->HarmShapeGain_Q14, psEncCtrl->Til t_Q14, psEncCtrl->LF_shp_Q14, 378 psEncCtrl->AR2_Q13, psEncCtrl->HarmShapeGain_Q14, psEncCtrl->Til t_Q14, psEncCtrl->LF_shp_Q14,
379 psEncCtrl->Gains_Q16, psEncCtrl->pitchL, psEncCtrl->Lambda_Q10, psEncCtrl->LTP_scale_Q14 ); 379 psEncCtrl->Gains_Q16, psEncCtrl->pitchL, psEncCtrl->Lambda_Q10, psEncCtrl->LTP_scale_Q14 );
380 } 380 }
381 381
382 /* Restore original gains */ 382 /* Restore original gains */
383 silk_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) ); 383 silk_memcpy( psEncCtrl->Gains_Q16, TempGains_Q16, psEnc->sCmn.nb_subfr * sizeof( opus_int32 ) );
384 } 384 }
385 } 385 }
OLDNEW
« no previous file with comments | « silk/fixed/burg_modified_FIX.c ('k') | silk/fixed/find_LPC_FIX.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698