| 465 | } |
| 466 | |
| 467 | static void decode_ppc(TwinContext *tctx, int period_coef, const float *shape, |
| 468 | float ppc_gain, float *speech) |
| 469 | { |
| 470 | const ModeTab *mtab = tctx->mtab; |
| 471 | int isampf = tctx->avctx->sample_rate/1000; |
| 472 | int ibps = tctx->avctx->bit_rate/(1000 * tctx->avctx->channels); |
| 473 | int min_period = ROUNDED_DIV( 40*2*mtab->size, isampf); |
| 474 | int max_period = ROUNDED_DIV(6*40*2*mtab->size, isampf); |
| 475 | int period_range = max_period - min_period; |
| 476 | |
| 477 | // This is actually the period multiplied by 400. It is just linearly coded |
| 478 | // between its maximum and minimum value. |
| 479 | int period = min_period + |
| 480 | ROUNDED_DIV(period_coef*period_range, (1 << mtab->ppc_period_bit) - 1); |
| 481 | int width; |
| 482 | |
| 483 | if (isampf == 22 && ibps == 32) { |
| 484 | // For some unknown reason, NTT decided to code this case differently... |
| 485 | width = ROUNDED_DIV((period + 800)* mtab->peak_per2wid, 400*mtab->size); |
| 486 | } else |
| 487 | width = (period )* mtab->peak_per2wid/(400*mtab->size); |
| 488 | |
| 489 | add_peak(period, width, shape, ppc_gain, speech, mtab->ppc_shape_len); |
| 490 | } |
| 491 | |
| 492 | static void dec_gain(TwinContext *tctx, GetBitContext *gb, enum FrameType ftype, |
| 493 | float *out) |
no test coverage detected