Lines Matching +full:- +full:lm
1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2010 Xiph.Org Foundation
4 Written by Jean-Marc Valin and Gregory Maxwell */
10 - Redistributions of source code must retain the above copyright
13 - Redistributions in binary form must reproduce the above copyright
106 /* VBR-related parameters */
122 celt_sig in_mem[1]; /* Size = channels*mode->overlap */
124 /* opus_val16 oldBandE[], Size = channels*mode->nbEBands */
125 /* opus_val16 oldLogE[], Size = channels*mode->nbEBands */
126 /* opus_val16 oldLogE2[], Size = channels*mode->nbEBands */
127 /* opus_val16 energyError[], Size = channels*mode->nbEBands */
139 … + (channels*mode->overlap-1)*sizeof(celt_sig) /* celt_sig in_mem[channels*mode->overlap]; */ in opus_custom_encoder_get_size()
141 …+ 4*channels*mode->nbEBands*sizeof(opus_val16); /* opus_val16 oldBandE[channels*mode->nbEBands]; … in opus_custom_encoder_get_size()
142 … /* opus_val16 oldLogE[channels*mode->nbEBands]; */ in opus_custom_encoder_get_size()
143 … /* opus_val16 oldLogE2[channels*mode->nbEBands]; */ in opus_custom_encoder_get_size()
144 … /* opus_val16 energyError[channels*mode->nbEBands]; */ in opus_custom_encoder_get_size()
177 st->mode = mode; in opus_custom_encoder_init_arch()
178 st->stream_channels = st->channels = channels; in opus_custom_encoder_init_arch()
180 st->upsample = 1; in opus_custom_encoder_init_arch()
181 st->start = 0; in opus_custom_encoder_init_arch()
182 st->end = st->mode->effEBands; in opus_custom_encoder_init_arch()
183 st->signalling = 1; in opus_custom_encoder_init_arch()
184 st->arch = arch; in opus_custom_encoder_init_arch()
186 st->constrained_vbr = 1; in opus_custom_encoder_init_arch()
187 st->clip = 1; in opus_custom_encoder_init_arch()
189 st->bitrate = OPUS_BITRATE_MAX; in opus_custom_encoder_init_arch()
190 st->vbr = 0; in opus_custom_encoder_init_arch()
191 st->force_intra = 0; in opus_custom_encoder_init_arch()
192 st->complexity = 5; in opus_custom_encoder_init_arch()
193 st->lsb_depth=24; in opus_custom_encoder_init_arch()
215 st->upsample = resampling_factor(sampling_rate); in celt_encoder_init()
281 /* High-pass filter: (1 - 2*z^-1 + z^-2) / (1 - z^-1 + .5*z^-2) */ in transient_analysis()
291 mem0 = mem1 + y - SHL32(x,1); in transient_analysis()
292 mem1 = x - SHR32(y,1); in transient_analysis()
295 mem0 = mem1 + y - 2*x; in transient_analysis()
296 mem1 = x - .5f*y; in transient_analysis()
299 mem0 = mem0 - x + .5f*mem1; in transient_analysis()
300 mem1 = x - mem00; in transient_analysis()
313 shift = 14-celt_ilog2(MAX16(1, celt_maxabs16(tmp, len))); in transient_analysis()
325 /* Forward pass to compute the post-echo threshold*/ in transient_analysis()
332 tmp[i] = mem0 + PSHR32(x2-mem0,forward_shift); in transient_analysis()
335 mem0 = x2 + (1.f-forward_decay)*mem0; in transient_analysis()
342 /* Backward pass to compute the pre-echo threshold */ in transient_analysis()
343 for (i=len2-1;i>=0;i--) in transient_analysis()
348 tmp[i] = mem0 + PSHR32(tmp[i]-mem0,3); in transient_analysis()
360 This essentially corresponds to a bitrate-normalized temporal noise-to-mask in transient_analysis()
378 … lookup a few lines below (id = ...) is likely to crash dur to an out-of-bounds read. DO NOT FIX in transient_analysis()
382 for (i=12;i<len2-5;i+=4) in transient_analysis()
394 unmask = 64*unmask*4/(6*(len2-17)); in transient_analysis()
409 tf_max = MAX16(0,celt_sqrt(27*mask_metric)-42); in transient_analysis()
410 /* *tf_estimate = 1 + MIN16(1, sqrt(MAX16(0, tf_max-30))/20); */ in transient_analysis()
411 …*tf_estimate = celt_sqrt(MAX32(0, SHL32(MULT16_16(QCONST16(0.0069,14),MIN16(163,tf_max)),14)-QCONS… in transient_analysis()
429 /* Apply an aggressive (-6 dB/Bark) spreading function to the old frame to in patch_transient_decision()
435 spread_old[i] = MAX16(spread_old[i-1]-QCONST16(1.0f, DB_SHIFT), oldE[i]); in patch_transient_decision()
439 spread_old[i] = MAX16(spread_old[i-1]-QCONST16(1.0f, DB_SHIFT), in patch_transient_decision()
442 for (i=end-2;i>=start;i--) in patch_transient_decision()
443 spread_old[i] = MAX16(spread_old[i], spread_old[i+1]-QCONST16(1.0f, DB_SHIFT)); in patch_transient_decision()
446 for (i=IMAX(2,start);i<end-1;i++) in patch_transient_decision()
454 mean_diff = DIV32(mean_diff, C*(end-1-IMAX(2,start))); in patch_transient_decision()
459 /** Apply window and compute the MDCT for all sub-frames and
462 celt_sig * OPUS_RESTRICT out, int C, int CC, int LM, int upsample, in compute_mdcts() argument
465 const int overlap = mode->overlap; in compute_mdcts()
473 N = mode->shortMdctSize; in compute_mdcts()
474 shift = mode->maxLM; in compute_mdcts()
477 N = mode->shortMdctSize<<LM; in compute_mdcts()
478 shift = mode->maxLM-LM; in compute_mdcts()
483 /* Interleaving the sub-frames while doing the MDCTs */ in compute_mdcts()
484 clt_mdct_forward(&mode->mdct, in+c*(B*N+overlap)+b*N, in compute_mdcts()
485 &out[b+c*N*B], mode->window, overlap, shift, B, in compute_mdcts()
501 OPUS_CLEAR(&out[c*B*N+bound], B*N-bound); in compute_mdcts()
525 /* Apply pre-emphasis */ in celt_preemphasis()
526 inp[i] = SHL32(x, SIG_SHIFT) - m; in celt_preemphasis()
527 m = SHR32(MULT16_16(coef0, x), 15-SIG_SHIFT); in celt_preemphasis()
544 /* Clip input to avoid encoding non-portable files */ in celt_preemphasis()
546 inp[i*upsample] = MAX32(-65536.f, MIN32(65536.f,inp[i*upsample])); in celt_preemphasis()
560 /* Apply pre-emphasis */ in celt_preemphasis()
563 m = MULT16_32_Q15(coef1, inp[i]) - MULT16_32_Q15(coef0, tmp); in celt_preemphasis()
572 /* Apply pre-emphasis */ in celt_preemphasis()
573 inp[i] = SHL32(x, SIG_SHIFT) - m; in celt_preemphasis()
574 m = SHR32(MULT16_16(coef0, x), 15-SIG_SHIFT); in celt_preemphasis()
582 static opus_val32 l1_metric(const celt_norm *tmp, int N, int LM, opus_val16 bias) in l1_metric() argument
590 L1 = MAC16_32_Q15(L1, LM*bias, L1); in l1_metric()
596 int *tf_res, int lambda, celt_norm *X, int N0, int LM, in tf_analysis() argument
613 bias = MULT16_16_Q14(QCONST16(.04f,15), MAX16(-QCONST16(.25f,14), QCONST16(.5f,14)-tf_estimate)); in tf_analysis()
617 ALLOC(tmp, (m->eBands[len]-m->eBands[len-1])<<LM, celt_norm); in tf_analysis()
618 ALLOC(tmp_1, (m->eBands[len]-m->eBands[len-1])<<LM, celt_norm); in tf_analysis()
628 N = (m->eBands[i+1]-m->eBands[i])<<LM; in tf_analysis()
629 /* band is too narrow to be split down to LM=-1 */ in tf_analysis()
630 narrow = (m->eBands[i+1]-m->eBands[i])==1; in tf_analysis()
631 OPUS_COPY(tmp, &X[tf_chan*N0 + (m->eBands[i]<<LM)], N); in tf_analysis()
635 tmp[j] = ADD16(SHR16(tmp[j], 1),SHR16(X[N0+j+(m->eBands[i]<<LM)], 1));*/ in tf_analysis()
636 L1 = l1_metric(tmp, N, isTransient ? LM : 0, bias); in tf_analysis()
638 /* Check the -1 case for transients */ in tf_analysis()
642 haar1(tmp_1, N>>LM, 1<<LM); in tf_analysis()
643 L1 = l1_metric(tmp_1, N, LM+1, bias); in tf_analysis()
647 best_level = -1; in tf_analysis()
651 for (k=0;k<LM+!(isTransient||narrow);k++) in tf_analysis()
656 B = (LM-k-1); in tf_analysis()
670 /*printf ("%d ", isTransient ? LM-best_level : best_level);*/ in tf_analysis()
671 /* metric is in Q1 to be able to select the mid-point (-0.5) for narrower bands */ in tf_analysis()
675 metric[i] = -2*best_level; in tf_analysis()
676 /* For bands that can't be split to -1, set the metric to the half-way point to avoid in tf_analysis()
678 if (narrow && (metric[i]==0 || metric[i]==-2*LM)) in tf_analysis()
679 metric[i]-=1; in tf_analysis()
680 /*printf("%d ", metric[i]/2 + (!isTransient)*LM);*/ in tf_analysis()
687 cost0 = importance[0]*abs(metric[0]-2*tf_select_table[LM][4*isTransient+2*sel+0]); in tf_analysis()
688 …cost1 = importance[0]*abs(metric[0]-2*tf_select_table[LM][4*isTransient+2*sel+1]) + (isTransient ?… in tf_analysis()
694 cost0 = curr0 + importance[i]*abs(metric[i]-2*tf_select_table[LM][4*isTransient+2*sel+0]); in tf_analysis()
695 cost1 = curr1 + importance[i]*abs(metric[i]-2*tf_select_table[LM][4*isTransient+2*sel+1]); in tf_analysis()
701 * If tests confirm it's useful for non-transients, we could allow it. */ in tf_analysis()
704 cost0 = importance[0]*abs(metric[0]-2*tf_select_table[LM][4*isTransient+2*tf_select+0]); in tf_analysis()
705 …cost1 = importance[0]*abs(metric[0]-2*tf_select_table[LM][4*isTransient+2*tf_select+1]) + (isTrans… in tf_analysis()
733 … cost0 = curr0 + importance[i]*abs(metric[i]-2*tf_select_table[LM][4*isTransient+2*tf_select+0]); in tf_analysis()
734 … cost1 = curr1 + importance[i]*abs(metric[i]-2*tf_select_table[LM][4*isTransient+2*tf_select+1]); in tf_analysis()
736 tf_res[len-1] = cost0 < cost1 ? 0 : 1; in tf_analysis()
738 for (i=len-2;i>=0;i--) in tf_analysis()
751 tf_res[i] = tf_res[i-1] ^ ((rand()&0xF) == 0); in tf_analysis()
756 static void tf_encode(int start, int end, int isTransient, int *tf_res, int LM, int tf_select, ec_e… in tf_encode() argument
764 budget = enc->storage*8; in tf_encode()
768 tf_select_rsv = LM>0 && tell+logp+1 <= budget; in tf_encode()
769 budget -= tf_select_rsv; in tf_encode()
786 tf_select_table[LM][4*isTransient+0+tf_changed]!= in tf_encode()
787 tf_select_table[LM][4*isTransient+2+tf_changed]) in tf_encode()
792 tf_res[i] = tf_select_table[LM][4*isTransient+2*tf_select+tf_res[i]]; in tf_encode()
793 /*for(i=0;i<end;i++)printf("%d ", isTransient ? tf_res[i] : LM+tf_res[i]);printf("\n");*/ in tf_encode()
798 const opus_val16 *bandLogE, int end, int LM, int C, int N0, in alloc_trim_analysis() argument
813 opus_int32 frac = (equiv_rate-64000) >> 10; in alloc_trim_analysis()
820 /* Compute inter-channel correlation for low frequencies */ in alloc_trim_analysis()
824 partial = celt_inner_prod(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)], in alloc_trim_analysis()
825 (m->eBands[i+1]-m->eBands[i])<<LM, arch); in alloc_trim_analysis()
834 partial = celt_inner_prod(&X[m->eBands[i]<<LM], &X[N0+(m->eBands[i]<<LM)], in alloc_trim_analysis()
835 (m->eBands[i+1]-m->eBands[i])<<LM, arch); in alloc_trim_analysis()
840 /* mid-side savings estimations based on the LF average*/ in alloc_trim_analysis()
841 logXC = celt_log2(QCONST32(1.001f, 20)-MULT16_16(sum, sum)); in alloc_trim_analysis()
842 /* mid-side savings estimations based on min correlation */ in alloc_trim_analysis()
843 logXC2 = MAX16(HALF16(logXC), celt_log2(QCONST32(1.001f, 20)-MULT16_16(minXC, minXC))); in alloc_trim_analysis()
846 logXC = PSHR32(logXC-QCONST16(6.f, DB_SHIFT),DB_SHIFT-8); in alloc_trim_analysis()
847 logXC2 = PSHR32(logXC2-QCONST16(6.f, DB_SHIFT),DB_SHIFT-8); in alloc_trim_analysis()
850 trim += MAX16(-QCONST16(4.f, 8), MULT16_16_Q15(QCONST16(.75f,15),logXC)); in alloc_trim_analysis()
851 *stereo_saving = MIN16(*stereo_saving + QCONST16(0.25f, 8), -HALF16(logXC2)); in alloc_trim_analysis()
856 for (i=0;i<end-1;i++) in alloc_trim_analysis()
858 diff += bandLogE[i+c*m->nbEBands]*(opus_int32)(2+2*i-end); in alloc_trim_analysis()
861 diff /= C*(end-1); in alloc_trim_analysis()
863 …trim -= MAX32(-QCONST16(2.f, 8), MIN32(QCONST16(2.f, 8), SHR32(diff+QCONST16(1.f, DB_SHIFT),DB_SHI… in alloc_trim_analysis()
864 trim -= SHR16(surround_trim, DB_SHIFT-8); in alloc_trim_analysis()
865 trim -= 2*SHR16(tf_estimate, 14-8); in alloc_trim_analysis()
867 if (analysis->valid) in alloc_trim_analysis()
869 trim -= MAX16(-QCONST16(2.f, 8), MIN16(QCONST16(2.f, 8), in alloc_trim_analysis()
870 (opus_val16)(QCONST16(2.f, 8)*(analysis->tonality_slope+.05f)))); in alloc_trim_analysis()
890 int LM, int N0) in stereo_analysis() argument
900 for (j=m->eBands[i]<<LM;j<m->eBands[i+1]<<LM;j++) in stereo_analysis()
903 /* We cast to 32-bit first because of the -32768 case */ in stereo_analysis()
914 /* We don't need thetas for lower bands with LM<=1 */ in stereo_analysis()
915 if (LM<=1) in stereo_analysis()
916 thetas -= 8; in stereo_analysis()
917 return MULT16_32_Q15((m->eBands[13]<<(LM+1))+thetas, sumMS) in stereo_analysis()
918 > MULT16_32_Q15(m->eBands[13]<<(LM+1), sumLR); in stereo_analysis()
983 int isTransient, int vbr, int constrained_vbr, const opus_int16 *eBands, int LM, in dynalloc_analysis() argument
999 maxDepth=-QCONST16(31.9f, DB_SHIFT); in dynalloc_analysis()
1005 +QCONST16(.5f,DB_SHIFT)+SHL16(9-lsb_depth,DB_SHIFT)-SHL16(eMeans[i],6) in dynalloc_analysis()
1011 maxDepth = MAX16(maxDepth, bandLogE[c*nbEBands+i]-noise_floor[i]); in dynalloc_analysis()
1021 mask[i] = bandLogE[i]-noise_floor[i]; in dynalloc_analysis()
1025 mask[i] = MAX16(mask[i], bandLogE[nbEBands+i]-noise_floor[i]); in dynalloc_analysis()
1029 mask[i] = MAX16(mask[i], mask[i-1] - QCONST16(2.f, DB_SHIFT)); in dynalloc_analysis()
1030 for (i=end-2;i>=0;i--) in dynalloc_analysis()
1031 mask[i] = MAX16(mask[i], mask[i+1] - QCONST16(3.f, DB_SHIFT)); in dynalloc_analysis()
1035 opus_val16 smr = sig[i]-MAX16(MAX16(0, maxDepth-QCONST16(12.f, DB_SHIFT)), mask[i]); in dynalloc_analysis()
1039 int shift = -PSHR32(MAX16(-QCONST16(5.f, DB_SHIFT), MIN16(0, smr)), DB_SHIFT); in dynalloc_analysis()
1041 int shift = IMIN(5, IMAX(0, -(int)floor(.5f + smr))); in dynalloc_analysis()
1050 We enable the feature starting at 24 kb/s for 20-ms frames in dynalloc_analysis()
1052 if (effectiveBytes >= (30 + 5*LM) && !lfe) in dynalloc_analysis()
1061 if (LM==0) { in dynalloc_analysis()
1075 if (bandLogE3[i] > bandLogE3[i-1]+QCONST16(.5f,DB_SHIFT)) in dynalloc_analysis()
1077 f[i] = MIN16(f[i-1]+QCONST16(1.5f,DB_SHIFT), bandLogE3[i]); in dynalloc_analysis()
1079 for (i=last-1;i>=0;i--) in dynalloc_analysis()
1083 The "offset" value controls how conservative we are -- a higher offset in dynalloc_analysis()
1086 for (i=2;i<end-2;i++) in dynalloc_analysis()
1087 f[i] = MAX16(f[i], median_of_5(&bandLogE3[i-2])-offset); in dynalloc_analysis()
1088 tmp = median_of_3(&bandLogE3[0])-offset; in dynalloc_analysis()
1091 tmp = median_of_3(&bandLogE3[end-3])-offset; in dynalloc_analysis()
1092 f[end-2] = MAX16(f[end-2], tmp); in dynalloc_analysis()
1093 f[end-1] = MAX16(f[end-1], tmp); in dynalloc_analysis()
1102 /* Consider 24 dB "cross-talk" */ in dynalloc_analysis()
1103 … follower[nbEBands+i] = MAX16(follower[nbEBands+i], follower[ i]-QCONST16(4.f,DB_SHIFT)); in dynalloc_analysis()
1104 … follower[ i] = MAX16(follower[ i], follower[nbEBands+i]-QCONST16(4.f,DB_SHIFT)); in dynalloc_analysis()
1105 …follower[i] = HALF16(MAX16(0, bandLogE[i]-follower[i]) + MAX16(0, bandLogE[nbEBands+i]-follower[nb… in dynalloc_analysis()
1110 follower[i] = MAX16(0, bandLogE[i]-follower[i]); in dynalloc_analysis()
1123 /* For non-transient CBR/CVBR frames, halve the dynalloc contribution */ in dynalloc_analysis()
1139 if (analysis->valid) in dynalloc_analysis()
1142 follower[i] = follower[i] + QCONST16(1.f/64.f, DB_SHIFT)*analysis->leak_boost[i]; in dynalloc_analysis()
1153 width = C*(eBands[i+1]-eBands[i])<<LM; in dynalloc_analysis()
1165 /* For CBR and non-transient CVBR frames, limit dynalloc to 2/3 of the bits */ in dynalloc_analysis()
1170 offsets[i] = cap-tot_boost; in dynalloc_analysis()
1203 mode = st->mode; in run_prefilter()
1204 overlap = mode->overlap; in run_prefilter()
1221 pitch_downsample(pre, pitch_buf, COMBFILTER_MAXPERIOD+N, CC, st->arch); in run_prefilter()
1223 there's too many false-positives due to short-term correlation */ in run_prefilter()
1225 COMBFILTER_MAXPERIOD-3*COMBFILTER_MINPERIOD, &pitch_index, in run_prefilter()
1226 st->arch); in run_prefilter()
1227 pitch_index = COMBFILTER_MAXPERIOD-pitch_index; in run_prefilter()
1230 N, &pitch_index, st->prefilter_period, st->prefilter_gain, st->arch); in run_prefilter()
1231 if (pitch_index > COMBFILTER_MAXPERIOD-2) in run_prefilter()
1232 pitch_index = COMBFILTER_MAXPERIOD-2; in run_prefilter()
1234 /*printf("%d %d %f %f\n", pitch_change, pitch_index, gain1, st->analysis.tonality);*/ in run_prefilter()
1235 if (st->loss_rate>2) in run_prefilter()
1237 if (st->loss_rate>4) in run_prefilter()
1239 if (st->loss_rate>8) in run_prefilter()
1246 if (analysis->valid) in run_prefilter()
1247 gain1 = (opus_val16)(gain1 * analysis->max_pitch_ratio); in run_prefilter()
1255 if (abs(pitch_index-st->prefilter_period)*10>pitch_index) in run_prefilter()
1261 if (st->prefilter_gain > QCONST16(.4f,15)) in run_prefilter()
1262 pf_threshold -= QCONST16(.1f,15); in run_prefilter()
1263 if (st->prefilter_gain > QCONST16(.55f,15)) in run_prefilter()
1264 pf_threshold -= QCONST16(.1f,15); in run_prefilter()
1276 if (ABS16(gain1-st->prefilter_gain)<QCONST16(.1f,15)) in run_prefilter()
1277 gain1=st->prefilter_gain; in run_prefilter()
1280 qg = ((gain1+1536)>>10)/3-1; in run_prefilter()
1282 qg = (int)floor(.5f+gain1*32/3)-1; in run_prefilter()
1291 int offset = mode->shortMdctSize-overlap; in run_prefilter()
1292 st->prefilter_period=IMAX(st->prefilter_period, COMBFILTER_MINPERIOD); in run_prefilter()
1293 OPUS_COPY(in+c*(N+overlap), st->in_mem+c*(overlap), overlap); in run_prefilter()
1296 … st->prefilter_period, st->prefilter_period, offset, -st->prefilter_gain, -st->prefilter_gain, in run_prefilter()
1297 st->prefilter_tapset, st->prefilter_tapset, NULL, 0, st->arch); in run_prefilter()
1300 st->prefilter_period, pitch_index, N-offset, -st->prefilter_gain, -gain1, in run_prefilter()
1301 st->prefilter_tapset, prefilter_tapset, mode->window, overlap, st->arch); in run_prefilter()
1302 OPUS_COPY(st->in_mem+c*(overlap), in+c*(N+overlap)+N, overlap); in run_prefilter()
1308 …filter_mem+c*COMBFILTER_MAXPERIOD, prefilter_mem+c*COMBFILTER_MAXPERIOD+N, COMBFILTER_MAXPERIOD-N); in run_prefilter()
1309 …OPUS_COPY(prefilter_mem+c*COMBFILTER_MAXPERIOD+COMBFILTER_MAXPERIOD-N, pre[c]+COMBFILTER_MAXPERIOD… in run_prefilter()
1321 int LM, opus_int32 bitrate, int lastCodedBands, int C, int intensity, in compute_vbr() argument
1335 nbEBands = mode->nbEBands; in compute_vbr()
1336 eBands = mode->eBands; in compute_vbr()
1339 coded_bins = eBands[coded_bands]<<LM; in compute_vbr()
1341 coded_bins += eBands[IMIN(intensity, coded_bands)]<<LM; in compute_vbr()
1345 …/*printf("%f %f %f %f %d %d ", st->analysis.activity, st->analysis.tonality, tf_estimate, st->ster… in compute_vbr()
1347 if (analysis->valid && analysis->activity<.4) in compute_vbr()
1348 target -= (opus_int32)((coded_bins<<BITRES)*(.4f-analysis->activity)); in compute_vbr()
1357 coded_stereo_dof = (eBands[coded_stereo_bands]<<LM)-coded_stereo_bands; in compute_vbr()
1362 target -= (opus_int32)MIN32(MULT16_32_Q15(max_frac,target), in compute_vbr()
1363 … SHR32(MULT16_16(stereo_saving-QCONST16(0.1f,8),(coded_stereo_dof<<BITRES)),8)); in compute_vbr()
1366 target += tot_boost-(19<<LM); in compute_vbr()
1369 target += (opus_int32)SHL32(MULT16_32_Q15(tf_estimate-tf_calibration, target),1); in compute_vbr()
1373 if (analysis->valid && !lfe) in compute_vbr()
1379 tonal = MAX16(0.f,analysis->tonality-.15f)-0.12f; in compute_vbr()
1383 /*printf("%f %f ", analysis->tonality, tonal);*/ in compute_vbr()
1394 … %d %d %d %d %d ", surround_masking, coded_bins, st->end, st->intensity, surround_target, target, … in compute_vbr()
1401 bins = eBands[nbEBands-2]<<LM; in compute_vbr()
1413 target = base_target + (opus_int32)MULT16_32_Q15(QCONST16(0.67f, 15), target-base_target); in compute_vbr()
1420 amount = MULT16_16_Q15(QCONST16(.0000031f, 30), IMAX(0, IMIN(32000, 96000-bitrate))); in compute_vbr()
1456 const int CC = st->channels; in celt_encode_with_ec()
1457 const int C = st->stream_channels; in celt_encode_with_ec()
1458 int LM, M; in celt_encode_with_ec() local
1505 mode = st->mode; in celt_encode_with_ec()
1506 nbEBands = mode->nbEBands; in celt_encode_with_ec()
1507 overlap = mode->overlap; in celt_encode_with_ec()
1508 eBands = mode->eBands; in celt_encode_with_ec()
1509 start = st->start; in celt_encode_with_ec()
1510 end = st->end; in celt_encode_with_ec()
1519 frame_size *= st->upsample; in celt_encode_with_ec()
1520 for (LM=0;LM<=mode->maxLM;LM++) in celt_encode_with_ec()
1521 if (mode->shortMdctSize<<LM==frame_size) in celt_encode_with_ec()
1523 if (LM>mode->maxLM) in celt_encode_with_ec()
1528 M=1<<LM; in celt_encode_with_ec()
1529 N = M*mode->shortMdctSize; in celt_encode_with_ec()
1531 prefilter_mem = st->in_mem+CC*(overlap); in celt_encode_with_ec()
1532 oldBandE = (opus_val16*)(st->in_mem+CC*(overlap+COMBFILTER_MAXPERIOD)); in celt_encode_with_ec()
1548 if (st->signalling && enc==NULL) in celt_encode_with_ec()
1550 int tmp = (mode->effEBands-end)>>1; in celt_encode_with_ec()
1551 end = st->end = IMAX(1, mode->effEBands-tmp); in celt_encode_with_ec()
1553 compressed[0] |= LM<<3; in celt_encode_with_ec()
1556 if (mode->Fs==48000 && mode->shortMdctSize==120) in celt_encode_with_ec()
1567 nbCompressedBytes--; in celt_encode_with_ec()
1570 celt_assert(st->signalling==0); in celt_encode_with_ec()
1575 nbAvailableBytes = nbCompressedBytes - nbFilledBytes; in celt_encode_with_ec()
1577 if (st->vbr && st->bitrate!=OPUS_BITRATE_MAX) in celt_encode_with_ec()
1579 opus_int32 den=mode->Fs>>BITRES; in celt_encode_with_ec()
1580 vbr_rate=(st->bitrate*frame_size+(den>>1))/den; in celt_encode_with_ec()
1582 if (st->signalling) in celt_encode_with_ec()
1583 vbr_rate -= 8<<BITRES; in celt_encode_with_ec()
1589 tmp = st->bitrate*frame_size; in celt_encode_with_ec()
1591 tmp += tell*mode->Fs; in celt_encode_with_ec()
1592 if (st->bitrate!=OPUS_BITRATE_MAX) in celt_encode_with_ec()
1595 (tmp+4*mode->Fs)/(8*mode->Fs)-!!st->signalling)); in celt_encode_with_ec()
1598 effectiveBytes = nbCompressedBytes - nbFilledBytes; in celt_encode_with_ec()
1600 equiv_rate = ((opus_int32)nbCompressedBytes*8*50 << (3-LM)) - (40*C+20)*((400>>LM) - 50); in celt_encode_with_ec()
1601 if (st->bitrate != OPUS_BITRATE_MAX) in celt_encode_with_ec()
1602 equiv_rate = IMIN(equiv_rate, st->bitrate - (40*C+20)*((400>>LM) - 50)); in celt_encode_with_ec()
1612 /* Computes the max bit-rate allowed in VBR mode to avoid violating the in celt_encode_with_ec()
1614 We must do this up front so that bust-prevention logic triggers in celt_encode_with_ec()
1616 if (st->constrained_vbr) in celt_encode_with_ec()
1626 (vbr_rate+vbr_bound-st->vbr_reservoir)>>(BITRES+3)), in celt_encode_with_ec()
1639 if (effEnd > mode->effEBands) in celt_encode_with_ec()
1640 effEnd = mode->effEBands; in celt_encode_with_ec()
1644 sample_max=MAX32(st->overlap_max, celt_maxabs16(pcm, C*(N-overlap)/st->upsample)); in celt_encode_with_ec()
1645 st->overlap_max=celt_maxabs16(pcm+C*(N-overlap)/st->upsample, C*overlap/st->upsample); in celt_encode_with_ec()
1646 sample_max=MAX32(sample_max, st->overlap_max); in celt_encode_with_ec()
1650 silence = (sample_max <= (opus_val16)1/(1<<st->lsb_depth)); in celt_encode_with_ec()
1673 enc->nbits_total+=tell-ec_tell(enc); in celt_encode_with_ec()
1678 need_clip = st->clip && sample_max>65536.f; in celt_encode_with_ec()
1680 celt_preemphasis(pcm+c, in+c*(N+overlap)+overlap, N, CC, st->upsample, in celt_encode_with_ec()
1681 mode->preemph, st->preemph_memE+c, need_clip); in celt_encode_with_ec()
1690 …enabled = ((st->lfe&&nbAvailableBytes>3) || nbAvailableBytes>12*C) && !hybrid && !silence && !st->… in celt_encode_with_ec()
1691 && st->complexity >= 5; in celt_encode_with_ec()
1693 prefilter_tapset = st->tapset_decision; in celt_encode_with_ec()
1694 …mem, CC, N, prefilter_tapset, &pitch_index, &gain1, &qg, enabled, nbAvailableBytes, &st->analysis); in celt_encode_with_ec()
1695 …if ((gain1 > QCONST16(.4f,15) || st->prefilter_gain > QCONST16(.4f,15)) && (!st->analysis.valid ||… in celt_encode_with_ec()
1696 && (pitch_index > 1.26*st->prefilter_period || pitch_index < .79*st->prefilter_period)) in celt_encode_with_ec()
1708 octave = EC_ILOG(pitch_index)-5; in celt_encode_with_ec()
1710 ec_enc_bits(enc, pitch_index-(16<<octave), 4+octave); in celt_encode_with_ec()
1711 pitch_index -= 1; in celt_encode_with_ec()
1719 if (st->complexity >= 1 && !st->lfe) in celt_encode_with_ec()
1724 int allow_weak_transients = hybrid && effectiveBytes<15 && st->silk_info.signalType != 2; in celt_encode_with_ec()
1728 if (LM>0 && ec_tell(enc)+3<=total_bits) in celt_encode_with_ec()
1741 secondMdct = shortBlocks && st->complexity>=8; in celt_encode_with_ec()
1745 compute_mdcts(mode, 0, in, freq, C, CC, LM, st->upsample, st->arch); in celt_encode_with_ec()
1746 compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch); in celt_encode_with_ec()
1751 bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT)); in celt_encode_with_ec()
1755 compute_mdcts(mode, shortBlocks, in, freq, C, CC, LM, st->upsample, st->arch); in celt_encode_with_ec()
1761 compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch); in celt_encode_with_ec()
1763 if (st->lfe) in celt_encode_with_ec()
1767 bandE[i] = IMIN(bandE[i], MULT16_32_Q15(QCONST16(1e-4f,15),bandE[0])); in celt_encode_with_ec()
1776 if (!hybrid&&st->energy_mask&&!st->lfe) in celt_encode_with_ec()
1784 mask_end = IMAX(2,st->lastCodedBands); in celt_encode_with_ec()
1790 mask = MAX16(MIN16(st->energy_mask[nbEBands*c+i], in celt_encode_with_ec()
1791 QCONST16(.25f, DB_SHIFT)), -QCONST16(2.0f, DB_SHIFT)); in celt_encode_with_ec()
1794 mask_avg += MULT16_16(mask, eBands[i+1]-eBands[i]); in celt_encode_with_ec()
1795 count += eBands[i+1]-eBands[i]; in celt_encode_with_ec()
1796 diff += MULT16_16(mask, 1+2*i-mask_end); in celt_encode_with_ec()
1802 diff = diff*6/(C*(mask_end-1)*(mask_end+1)*mask_end); in celt_encode_with_ec()
1805 diff = MAX32(MIN32(diff, QCONST32(.031f, DB_SHIFT)), -QCONST32(.031f, DB_SHIFT)); in celt_encode_with_ec()
1813 lin = mask_avg + diff*(i-midband); in celt_encode_with_ec()
1815 unmask = MAX16(st->energy_mask[i], st->energy_mask[nbEBands+i]); in celt_encode_with_ec()
1817 unmask = st->energy_mask[i]; in celt_encode_with_ec()
1819 unmask -= lin; in celt_encode_with_ec()
1822 surround_dynalloc[i] = unmask - QCONST16(.25f, DB_SHIFT); in celt_encode_with_ec()
1840 surround_dynalloc[i] = MAX16(0, surround_dynalloc[i]-QCONST16(.25f, DB_SHIFT)); in celt_encode_with_ec()
1850 if (!st->lfe) in celt_encode_with_ec()
1852 opus_val16 follow=-QCONST16(10.0f,DB_SHIFT); in celt_encode_with_ec()
1854 opus_val16 offset = shortBlocks?HALF16(SHL16(LM, DB_SHIFT)):0; in celt_encode_with_ec()
1857 follow = MAX16(follow-QCONST16(1.f, DB_SHIFT), bandLogE[i]-offset); in celt_encode_with_ec()
1859 follow = MAX16(follow, bandLogE[i+nbEBands]-offset); in celt_encode_with_ec()
1862 frame_avg /= (end-start); in celt_encode_with_ec()
1863 temporal_vbr = SUB16(frame_avg,st->spec_avg); in celt_encode_with_ec()
1864 temporal_vbr = MIN16(QCONST16(3.f, DB_SHIFT), MAX16(-QCONST16(1.5f, DB_SHIFT), temporal_vbr)); in celt_encode_with_ec()
1865 st->spec_avg += MULT16_16_Q15(QCONST16(.02f, 15), temporal_vbr); in celt_encode_with_ec()
1877 time-domain analysis */ in celt_encode_with_ec()
1878 …if (LM>0 && ec_tell(enc)+3<=total_bits && !isTransient && st->complexity>=5 && !st->lfe && !hybrid) in celt_encode_with_ec()
1884 compute_mdcts(mode, shortBlocks, in, freq, C, CC, LM, st->upsample, st->arch); in celt_encode_with_ec()
1885 compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch); in celt_encode_with_ec()
1891 bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT)); in celt_encode_with_ec()
1897 if (LM>0 && ec_tell(enc)+3<=total_bits) in celt_encode_with_ec()
1905 enable_tf_analysis = effectiveBytes>=15*C && !hybrid && st->complexity>=2 && !st->lfe; in celt_encode_with_ec()
1912 st->lsb_depth, mode->logN, isTransient, st->vbr, st->constrained_vbr, in celt_encode_with_ec()
1913 …eBands, LM, effectiveBytes, &tot_boost, st->lfe, surround_dynalloc, &st->analysis, importance, spr… in celt_encode_with_ec()
1921 …tf_select = tf_analysis(mode, effEnd, isTransient, tf_res, lambda, X, N, LM, tf_estimate, tf_chan,… in celt_encode_with_ec()
1923 tf_res[i] = tf_res[effEnd-1]; in celt_encode_with_ec()
1932 } else if (hybrid && effectiveBytes<15 && st->silk_info.signalType != 2) in celt_encode_with_ec()
1954 bandLogE[i+c*nbEBands] -= MULT16_16_Q15(energyError[i+c*nbEBands], QCONST16(0.25f, 15)); in celt_encode_with_ec()
1960 C, LM, nbAvailableBytes, st->force_intra, in celt_encode_with_ec()
1961 &st->delayedIntra, st->complexity >= 4, st->loss_rate, st->lfe); in celt_encode_with_ec()
1963 tf_encode(start, end, isTransient, tf_res, LM, tf_select, enc); in celt_encode_with_ec()
1967 if (st->lfe) in celt_encode_with_ec()
1969 st->tapset_decision = 0; in celt_encode_with_ec()
1970 st->spread_decision = SPREAD_NORMAL; in celt_encode_with_ec()
1973 if (st->complexity == 0) in celt_encode_with_ec()
1974 st->spread_decision = SPREAD_NONE; in celt_encode_with_ec()
1976 st->spread_decision = SPREAD_NORMAL; in celt_encode_with_ec()
1978 st->spread_decision = SPREAD_AGGRESSIVE; in celt_encode_with_ec()
1979 } else if (shortBlocks || st->complexity < 3 || nbAvailableBytes < 10*C) in celt_encode_with_ec()
1981 if (st->complexity == 0) in celt_encode_with_ec()
1982 st->spread_decision = SPREAD_NONE; in celt_encode_with_ec()
1984 st->spread_decision = SPREAD_NORMAL; in celt_encode_with_ec()
1990 if (st->analysis.valid) in celt_encode_with_ec()
1992 …static const opus_val16 spread_thresholds[3] = {-QCONST16(.6f, 15), -QCONST16(.2f, 15), -QCONST16(… in celt_encode_with_ec()
1996 …st->spread_decision = hysteresis_decision(-st->analysis.tonality, spread_thresholds, spread_hister… in celt_encode_with_ec()
1997 …st->tapset_decision = hysteresis_decision(st->analysis.tonality_slope, tapset_thresholds, tapset_h… in celt_encode_with_ec()
2001 st->spread_decision = spreading_decision(mode, X, in celt_encode_with_ec()
2002 &st->tonal_average, st->spread_decision, &st->hf_average, in celt_encode_with_ec()
2003 &st->tapset_decision, pf_on&&!shortBlocks, effEnd, C, M, spread_weight); in celt_encode_with_ec()
2005 /*printf("%d %d\n", st->tapset_decision, st->spread_decision);*/ in celt_encode_with_ec()
2006 …/*printf("%f %d %f %d\n\n", st->analysis.tonality, st->spread_decision, st->analysis.tonality_slop… in celt_encode_with_ec()
2008 ec_enc_icdf(enc, st->spread_decision, spread_icdf, 5); in celt_encode_with_ec()
2012 if (st->lfe) in celt_encode_with_ec()
2015 init_caps(mode,cap,LM,C); in celt_encode_with_ec()
2027 width = C*(eBands[i+1]-eBands[i])<<LM; in celt_encode_with_ec()
2033 for (j = 0; tell+(dynalloc_loop_logp<<BITRES) < total_bits-total_boost in celt_encode_with_ec()
2048 dynalloc_logp = IMAX(2, dynalloc_logp-1); in celt_encode_with_ec()
2061 if (LM!=0) in celt_encode_with_ec()
2062 dual_stereo = stereo_analysis(mode, X, LM, N); in celt_encode_with_ec()
2064 st->intensity = hysteresis_decision((opus_val16)(equiv_rate/1000), in celt_encode_with_ec()
2065 intensity_thresholds, intensity_histeresis, 21, st->intensity); in celt_encode_with_ec()
2066 st->intensity = IMIN(end,IMAX(start, st->intensity)); in celt_encode_with_ec()
2070 if (tell+(6<<BITRES) <= total_bits - total_boost) in celt_encode_with_ec()
2072 if (start > 0 || st->lfe) in celt_encode_with_ec()
2074 st->stereo_saving = 0; in celt_encode_with_ec()
2078 end, LM, C, N, &st->analysis, &st->stereo_saving, tf_estimate, in celt_encode_with_ec()
2079 st->intensity, surround_trim, equiv_rate, st->arch); in celt_encode_with_ec()
2093 int lm_diff = mode->maxLM - LM; in celt_encode_with_ec()
2097 nbCompressedBytes = IMIN(nbCompressedBytes,1275>>(3-LM)); in celt_encode_with_ec()
2100 base_target = vbr_rate - ((40*C+20)<<BITRES); in celt_encode_with_ec()
2102 base_target = IMAX(0, vbr_rate - ((9*C+4)<<BITRES)); in celt_encode_with_ec()
2105 if (st->constrained_vbr) in celt_encode_with_ec()
2106 base_target += (st->vbr_offset>>lm_diff); in celt_encode_with_ec()
2110 target = compute_vbr(mode, &st->analysis, base_target, LM, equiv_rate, in celt_encode_with_ec()
2111 st->lastCodedBands, C, st->intensity, st->constrained_vbr, in celt_encode_with_ec()
2112 st->stereo_saving, tot_boost, tf_estimate, pitch_change, maxDepth, in celt_encode_with_ec()
2113 st->lfe, st->energy_mask!=NULL, surround_masking, in celt_encode_with_ec()
2118 if (st->silk_info.offset < 100) target += 12 << BITRES >> (3-LM); in celt_encode_with_ec()
2119 if (st->silk_info.offset > 100) target -= 18 << BITRES >> (3-LM); in celt_encode_with_ec()
2122 target += (opus_int32)MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES)); in celt_encode_with_ec()
2133 The margin of 2 bytes ensures that none of the bust-prevention logic in celt_encode_with_ec()
2135 min_allowed = ((tell+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3)) + 2; in celt_encode_with_ec()
2140 …min_allowed = IMAX(min_allowed, (tell0_frac+(37<<BITRES)+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3… in celt_encode_with_ec()
2147 delta = target - vbr_rate; in celt_encode_with_ec()
2163 if (st->vbr_count < 970) in celt_encode_with_ec()
2165 st->vbr_count++; in celt_encode_with_ec()
2166 alpha = celt_rcp(SHL32(EXTEND32(st->vbr_count+20),16)); in celt_encode_with_ec()
2170 if (st->constrained_vbr) in celt_encode_with_ec()
2171 st->vbr_reservoir += target - vbr_rate; in celt_encode_with_ec()
2172 /*printf ("%d\n", st->vbr_reservoir);*/ in celt_encode_with_ec()
2175 if (st->constrained_vbr) in celt_encode_with_ec()
2177 …st->vbr_drift += (opus_int32)MULT16_32_Q15(alpha,(delta*(1<<lm_diff))-st->vbr_offset-st->vbr_drift… in celt_encode_with_ec()
2178 st->vbr_offset = -st->vbr_drift; in celt_encode_with_ec()
2180 /*printf ("%d\n", st->vbr_drift);*/ in celt_encode_with_ec()
2182 if (st->constrained_vbr && st->vbr_reservoir < 0) in celt_encode_with_ec()
2184 /* We're under the min value -- increase rate */ in celt_encode_with_ec()
2185 int adjust = (-st->vbr_reservoir)/(8<<BITRES); in celt_encode_with_ec()
2188 st->vbr_reservoir = 0; in celt_encode_with_ec()
2202 /* bits = packet size - where we are - safety*/ in celt_encode_with_ec()
2203 bits = (((opus_int32)nbCompressedBytes*8)<<BITRES) - ec_tell_frac(enc) - 1; in celt_encode_with_ec()
2204 anti_collapse_rsv = isTransient&&LM>=2&&bits>=((LM+2)<<BITRES) ? (1<<BITRES) : 0; in celt_encode_with_ec()
2205 bits -= anti_collapse_rsv; in celt_encode_with_ec()
2206 signalBandwidth = end-1; in celt_encode_with_ec()
2208 if (st->analysis.valid) in celt_encode_with_ec()
2221 signalBandwidth = IMAX(st->analysis.bandwidth, min_bandwidth); in celt_encode_with_ec()
2224 if (st->lfe) in celt_encode_with_ec()
2227 alloc_trim, &st->intensity, &dual_stereo, bits, &balance, pulses, in celt_encode_with_ec()
2228 fine_quant, fine_priority, C, LM, enc, 1, st->lastCodedBands, signalBandwidth); in celt_encode_with_ec()
2229 if (st->lastCodedBands) in celt_encode_with_ec()
2230 st->lastCodedBands = IMIN(st->lastCodedBands+1,IMAX(st->lastCodedBands-1,codedBands)); in celt_encode_with_ec()
2232 st->lastCodedBands = codedBands; in celt_encode_with_ec()
2239 bandE, pulses, shortBlocks, st->spread_decision, in celt_encode_with_ec()
2240 dual_stereo, st->intensity, tf_res, nbCompressedBytes*(8<<BITRES)-anti_collapse_rsv, in celt_encode_with_ec()
2241 balance, enc, LM, codedBands, &st->rng, st->complexity, st->arch, st->disable_inv); in celt_encode_with_ec()
2245 anti_collapse_on = st->consec_transient<2; in celt_encode_with_ec()
2251 … start, end, oldBandE, error, fine_quant, fine_priority, nbCompressedBytes*8-ec_tell(enc), enc, C); in celt_encode_with_ec()
2257 …energyError[i+c*nbEBands] = MAX16(-QCONST16(0.5f, 15), MIN16(QCONST16(0.5f, 15), error[i+c*nbEBand… in celt_encode_with_ec()
2264 oldBandE[i] = -QCONST16(28.f,DB_SHIFT); in celt_encode_with_ec()
2268 /* Re-synthesis of the coded audio if required */ in celt_encode_with_ec()
2274 anti_collapse(mode, X, collapse_masks, LM, C, N, in celt_encode_with_ec()
2275 start, end, oldBandE, oldLogE, oldLogE2, pulses, st->rng, st->arch); in celt_encode_with_ec()
2279 OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap/2); in celt_encode_with_ec()
2283 out_mem[c] = st->syn_mem[c]+2*MAX_PERIOD-N; in celt_encode_with_ec()
2287 C, CC, isTransient, LM, st->upsample, silence, st->arch); in celt_encode_with_ec()
2290 st->prefilter_period=IMAX(st->prefilter_period, COMBFILTER_MINPERIOD); in celt_encode_with_ec()
2291 st->prefilter_period_old=IMAX(st->prefilter_period_old, COMBFILTER_MINPERIOD); in celt_encode_with_ec()
2292 …comb_filter(out_mem[c], out_mem[c], st->prefilter_period_old, st->prefilter_period, mode->shortMdc… in celt_encode_with_ec()
2293 … st->prefilter_gain_old, st->prefilter_gain, st->prefilter_tapset_old, st->prefilter_tapset, in celt_encode_with_ec()
2294 mode->window, overlap, st->arch); in celt_encode_with_ec()
2295 if (LM!=0) in celt_encode_with_ec()
2296 …comb_filter(out_mem[c]+mode->shortMdctSize, out_mem[c]+mode->shortMdctSize, st->prefilter_period, … in celt_encode_with_ec()
2297 st->prefilter_gain, gain1, st->prefilter_tapset, prefilter_tapset, in celt_encode_with_ec()
2298 mode->window, overlap, st->arch); in celt_encode_with_ec()
2301 /* We reuse freq[] as scratch space for the de-emphasis */ in celt_encode_with_ec()
2302 … deemphasis(out_mem, (opus_val16*)pcm, N, CC, st->upsample, mode->preemph, st->preemph_memD, 0); in celt_encode_with_ec()
2303 st->prefilter_period_old = st->prefilter_period; in celt_encode_with_ec()
2304 st->prefilter_gain_old = st->prefilter_gain; in celt_encode_with_ec()
2305 st->prefilter_tapset_old = st->prefilter_tapset; in celt_encode_with_ec()
2309 st->prefilter_period = pitch_index; in celt_encode_with_ec()
2310 st->prefilter_gain = gain1; in celt_encode_with_ec()
2311 st->prefilter_tapset = prefilter_tapset; in celt_encode_with_ec()
2313 if (LM!=0) in celt_encode_with_ec()
2315 st->prefilter_period_old = st->prefilter_period; in celt_encode_with_ec()
2316 st->prefilter_gain_old = st->prefilter_gain; in celt_encode_with_ec()
2317 st->prefilter_tapset_old = st->prefilter_tapset; in celt_encode_with_ec()
2339 oldLogE[c*nbEBands+i]=oldLogE2[c*nbEBands+i]=-QCONST16(28.f,DB_SHIFT); in celt_encode_with_ec()
2344 oldLogE[c*nbEBands+i]=oldLogE2[c*nbEBands+i]=-QCONST16(28.f,DB_SHIFT); in celt_encode_with_ec()
2349 st->consec_transient++; in celt_encode_with_ec()
2351 st->consec_transient=0; in celt_encode_with_ec()
2352 st->rng = enc->rng; in celt_encode_with_ec()
2359 if (st->signalling) in celt_encode_with_ec()
2389 C = st->channels; in opus_custom_encode_float()
2416 C=st->channels; in opus_custom_encode()
2453 st->complexity = value; in opus_custom_encoder_ctl()
2459 if (value<0 || value>=st->mode->nbEBands) in opus_custom_encoder_ctl()
2461 st->start = value; in opus_custom_encoder_ctl()
2467 if (value<1 || value>st->mode->nbEBands) in opus_custom_encoder_ctl()
2469 st->end = value; in opus_custom_encoder_ctl()
2477 st->disable_pf = value<=1; in opus_custom_encoder_ctl()
2478 st->force_intra = value==0; in opus_custom_encoder_ctl()
2486 st->loss_rate = value; in opus_custom_encoder_ctl()
2492 st->constrained_vbr = value; in opus_custom_encoder_ctl()
2498 st->vbr = value; in opus_custom_encoder_ctl()
2506 value = IMIN(value, 260000*st->channels); in opus_custom_encoder_ctl()
2507 st->bitrate = value; in opus_custom_encoder_ctl()
2515 st->stream_channels = value; in opus_custom_encoder_ctl()
2523 st->lsb_depth=value; in opus_custom_encoder_ctl()
2529 *value=st->lsb_depth; in opus_custom_encoder_ctl()
2539 st->disable_inv = value; in opus_custom_encoder_ctl()
2549 *value = st->disable_inv; in opus_custom_encoder_ctl()
2556 oldBandE = (opus_val16*)(st->in_mem+st->channels*(st->mode->overlap+COMBFILTER_MAXPERIOD)); in opus_custom_encoder_ctl()
2557 oldLogE = oldBandE + st->channels*st->mode->nbEBands; in opus_custom_encoder_ctl()
2558 oldLogE2 = oldLogE + st->channels*st->mode->nbEBands; in opus_custom_encoder_ctl()
2559 OPUS_CLEAR((char*)&st->ENCODER_RESET_START, in opus_custom_encoder_ctl()
2560 opus_custom_encoder_get_size(st->mode, st->channels)- in opus_custom_encoder_ctl()
2561 ((char*)&st->ENCODER_RESET_START - (char*)st)); in opus_custom_encoder_ctl()
2562 for (i=0;i<st->channels*st->mode->nbEBands;i++) in opus_custom_encoder_ctl()
2563 oldLogE[i]=oldLogE2[i]=-QCONST16(28.f,DB_SHIFT); in opus_custom_encoder_ctl()
2564 st->vbr_offset = 0; in opus_custom_encoder_ctl()
2565 st->delayedIntra = 1; in opus_custom_encoder_ctl()
2566 st->spread_decision = SPREAD_NORMAL; in opus_custom_encoder_ctl()
2567 st->tonal_average = 256; in opus_custom_encoder_ctl()
2568 st->hf_average = 0; in opus_custom_encoder_ctl()
2569 st->tapset_decision = 0; in opus_custom_encoder_ctl()
2576 st->clip = value; in opus_custom_encoder_ctl()
2583 st->signalling = value; in opus_custom_encoder_ctl()
2590 OPUS_COPY(&st->analysis, info, 1); in opus_custom_encoder_ctl()
2597 OPUS_COPY(&st->silk_info, info, 1); in opus_custom_encoder_ctl()
2605 *value=st->mode; in opus_custom_encoder_ctl()
2613 *value=st->rng; in opus_custom_encoder_ctl()
2619 st->lfe = value; in opus_custom_encoder_ctl()
2625 st->energy_mask = value; in opus_custom_encoder_ctl()