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

Side by Side Diff: celt/rate.c

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « celt/rate.h ('k') | celt/stack_alloc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2007-2008 CSIRO 1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation 2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */ 3 Written by Jean-Marc Valin */
4 /* 4 /*
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions 6 modification, are permitted provided that the following conditions
7 are met: 7 are met:
8 8
9 - Redistributions of source code must retain the above copyright 9 - Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer. 10 notice, this list of conditions and the following disclaimer.
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 } 242 }
243 243
244 #endif /* CUSTOM_MODES */ 244 #endif /* CUSTOM_MODES */
245 245
246 #define ALLOC_STEPS 6 246 #define ALLOC_STEPS 6
247 247
248 static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start, 248 static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int skip_start,
249 const int *bits1, const int *bits2, const int *thresh, const int *cap, opu s_int32 total, opus_int32 *_balance, 249 const int *bits1, const int *bits2, const int *thresh, const int *cap, opu s_int32 total, opus_int32 *_balance,
250 int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dua l_stereo_rsv, int *bits, 250 int skip_rsv, int *intensity, int intensity_rsv, int *dual_stereo, int dua l_stereo_rsv, int *bits,
251 int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev) 251 int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)
252 { 252 {
253 opus_int32 psum; 253 opus_int32 psum;
254 int lo, hi; 254 int lo, hi;
255 int i, j; 255 int i, j;
256 int logM; 256 int logM;
257 int stereo; 257 int stereo;
258 int codedBands=-1; 258 int codedBands=-1;
259 int alloc_floor; 259 int alloc_floor;
260 opus_int32 left, percoeff; 260 opus_int32 left, percoeff;
261 int done; 261 int done;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (encode) 346 if (encode)
347 { 347 {
348 /*This if() block is the only part of the allocation function that 348 /*This if() block is the only part of the allocation function that
349 is not a mandatory part of the bitstream: any bands we choose to 349 is not a mandatory part of the bitstream: any bands we choose to
350 skip here must be explicitly signaled.*/ 350 skip here must be explicitly signaled.*/
351 /*Choose a threshold with some hysteresis to keep bands from 351 /*Choose a threshold with some hysteresis to keep bands from
352 fluctuating in and out.*/ 352 fluctuating in and out.*/
353 #ifdef FUZZING 353 #ifdef FUZZING
354 if ((rand()&0x1) == 0) 354 if ((rand()&0x1) == 0)
355 #else 355 #else
356 if (codedBands<=start+2 || band_bits > ((j<prev?7:9)*band_width<<LM< <BITRES)>>4) 356 if (codedBands<=start+2 || (band_bits > ((j<prev?7:9)*band_width<<LM <<BITRES)>>4 && j<=signalBandwidth))
357 #endif 357 #endif
358 { 358 {
359 ec_enc_bit_logp(ec, 1, 1); 359 ec_enc_bit_logp(ec, 1, 1);
360 break; 360 break;
361 } 361 }
362 ec_enc_bit_logp(ec, 0, 1); 362 ec_enc_bit_logp(ec, 0, 1);
363 } else if (ec_dec_bit_logp(ec, 1)) { 363 } else if (ec_dec_bit_logp(ec, 1)) {
364 break; 364 break;
365 } 365 }
366 /*We used a bit to skip this band.*/ 366 /*We used a bit to skip this band.*/
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 ebits[j] = bits[j] >> stereo >> BITRES; 517 ebits[j] = bits[j] >> stereo >> BITRES;
518 celt_assert(C*ebits[j]<<BITRES == bits[j]); 518 celt_assert(C*ebits[j]<<BITRES == bits[j]);
519 bits[j] = 0; 519 bits[j] = 0;
520 fine_priority[j] = ebits[j]<1; 520 fine_priority[j] = ebits[j]<1;
521 } 521 }
522 RESTORE_STACK; 522 RESTORE_STACK;
523 return codedBands; 523 return codedBands;
524 } 524 }
525 525
526 int compute_allocation(const CELTMode *m, int start, int end, const int *offsets , const int *cap, int alloc_trim, int *intensity, int *dual_stereo, 526 int compute_allocation(const CELTMode *m, int start, int end, const int *offsets , const int *cap, int alloc_trim, int *intensity, int *dual_stereo,
527 opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_ priority, int C, int LM, ec_ctx *ec, int encode, int prev) 527 opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_ priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth)
528 { 528 {
529 int lo, hi, len, j; 529 int lo, hi, len, j;
530 int codedBands; 530 int codedBands;
531 int skip_start; 531 int skip_start;
532 int skip_rsv; 532 int skip_rsv;
533 int intensity_rsv; 533 int intensity_rsv;
534 int dual_stereo_rsv; 534 int dual_stereo_rsv;
535 VARDECL(int, bits1); 535 VARDECL(int, bits1);
536 VARDECL(int, bits2); 536 VARDECL(int, bits2);
537 VARDECL(int, thresh); 537 VARDECL(int, thresh);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 bits1j += offsets[j]; 624 bits1j += offsets[j];
625 bits2j += offsets[j]; 625 bits2j += offsets[j];
626 if (offsets[j]>0) 626 if (offsets[j]>0)
627 skip_start = j; 627 skip_start = j;
628 bits2j = IMAX(0,bits2j-bits1j); 628 bits2j = IMAX(0,bits2j-bits1j);
629 bits1[j] = bits1j; 629 bits1[j] = bits1j;
630 bits2[j] = bits2j; 630 bits2[j] = bits2j;
631 } 631 }
632 codedBands = interp_bits2pulses(m, start, end, skip_start, bits1, bits2, thre sh, cap, 632 codedBands = interp_bits2pulses(m, start, end, skip_start, bits1, bits2, thre sh, cap,
633 total, balance, skip_rsv, intensity, intensity_rsv, dual_stereo, dual_s tereo_rsv, 633 total, balance, skip_rsv, intensity, intensity_rsv, dual_stereo, dual_s tereo_rsv,
634 pulses, ebits, fine_priority, C, LM, ec, encode, prev); 634 pulses, ebits, fine_priority, C, LM, ec, encode, prev, signalBandwidth) ;
635 RESTORE_STACK; 635 RESTORE_STACK;
636 return codedBands; 636 return codedBands;
637 } 637 }
638 638
OLDNEW
« no previous file with comments | « celt/rate.h ('k') | celt/stack_alloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698