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

Side by Side Diff: third_party/opus/src/celt/quant_bands.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
« no previous file with comments | « third_party/opus/src/celt/pitch.c ('k') | third_party/opus/src/celt/rate.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 /* 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 int q2; 411 int q2;
412 opus_val16 offset; 412 opus_val16 offset;
413 q2 = error[i+c*m->nbEBands]<0 ? 0 : 1; 413 q2 = error[i+c*m->nbEBands]<0 ? 0 : 1;
414 ec_enc_bits(enc, q2, 1); 414 ec_enc_bits(enc, q2, 1);
415 #ifdef FIXED_POINT 415 #ifdef FIXED_POINT
416 offset = SHR16(SHL16(q2,DB_SHIFT)-QCONST16(.5f,DB_SHIFT),fine_quant[ i]+1); 416 offset = SHR16(SHL16(q2,DB_SHIFT)-QCONST16(.5f,DB_SHIFT),fine_quant[ i]+1);
417 #else 417 #else
418 offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384); 418 offset = (q2-.5f)*(1<<(14-fine_quant[i]-1))*(1.f/16384);
419 #endif 419 #endif
420 oldEBands[i+c*m->nbEBands] += offset; 420 oldEBands[i+c*m->nbEBands] += offset;
421 error[i+c*m->nbEBands] -= offset;
421 bits_left--; 422 bits_left--;
422 } while (++c < C); 423 } while (++c < C);
423 } 424 }
424 } 425 }
425 } 426 }
426 427
427 void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol dEBands, int intra, ec_dec *dec, int C, int LM) 428 void unquant_coarse_energy(const CELTMode *m, int start, int end, opus_val16 *ol dEBands, int intra, ec_dec *dec, int C, int LM)
428 { 429 {
429 const unsigned char *prob_model = e_prob_model[LM][intra]; 430 const unsigned char *prob_model = e_prob_model[LM][intra];
430 int i, c; 431 int i, c;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 541 }
541 } 542 }
542 543
543 void amp2Log2(const CELTMode *m, int effEnd, int end, 544 void amp2Log2(const CELTMode *m, int effEnd, int end,
544 celt_ener *bandE, opus_val16 *bandLogE, int C) 545 celt_ener *bandE, opus_val16 *bandLogE, int C)
545 { 546 {
546 int c, i; 547 int c, i;
547 c=0; 548 c=0;
548 do { 549 do {
549 for (i=0;i<effEnd;i++) 550 for (i=0;i<effEnd;i++)
551 {
550 bandLogE[i+c*m->nbEBands] = 552 bandLogE[i+c*m->nbEBands] =
551 celt_log2(SHL32(bandE[i+c*m->nbEBands],2)) 553 celt_log2(bandE[i+c*m->nbEBands])
552 - SHL16((opus_val16)eMeans[i],6); 554 - SHL16((opus_val16)eMeans[i],6);
555 #ifdef FIXED_POINT
556 /* Compensate for bandE[] being Q12 but celt_log2() taking a Q14 input. */
557 bandLogE[i+c*m->nbEBands] += QCONST16(2.f, DB_SHIFT);
558 #endif
559 }
553 for (i=effEnd;i<end;i++) 560 for (i=effEnd;i<end;i++)
554 bandLogE[c*m->nbEBands+i] = -QCONST16(14.f,DB_SHIFT); 561 bandLogE[c*m->nbEBands+i] = -QCONST16(14.f,DB_SHIFT);
555 } while (++c < C); 562 } while (++c < C);
556 } 563 }
OLDNEW
« no previous file with comments | « third_party/opus/src/celt/pitch.c ('k') | third_party/opus/src/celt/rate.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698