Revision 6bb6fb05 libavcodec/mpegaudiodec.c

View differences:

libavcodec/mpegaudiodec.c
31 31

  
32 32
/*
33 33
 * TODO:
34
 *  - in low precision mode, use more 16 bit multiplies in synth filter
35 34
 *  - test lsf / mpeg25 extensively.
36 35
 */
37 36

  
......
540 539

  
541 540
#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
542 541

  
543
#elif FRAC_BITS <= 15
544

  
545
static inline int round_sample(int *sum)
546
{
547
    int sum1;
548
    sum1 = (*sum) >> OUT_SHIFT;
549
    *sum &= (1<<OUT_SHIFT)-1;
550
    return av_clip(sum1, OUT_MIN, OUT_MAX);
551
}
552

  
553
/* signed 16x16 -> 32 multiply add accumulate */
554
#define MACS(rt, ra, rb) MAC16(rt, ra, rb)
555

  
556
/* signed 16x16 -> 32 multiply */
557
#define MULS(ra, rb) MUL16(ra, rb)
558

  
559
#define MLSS(rt, ra, rb) MLS16(rt, ra, rb)
560

  
561 542
#else
562 543

  
563 544
static inline int round_sample(int64_t *sum)
......
624 605
        v = ff_mpa_enwindow[i];
625 606
#if CONFIG_FLOAT
626 607
        v *= 1.0 / (1LL<<(16 + FRAC_BITS));
627
#elif WFRAC_BITS < 16
628
        v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
629 608
#endif
630 609
        window[i] = v;
631 610
        if ((i & 63) != 0)
......
652 631
    OUT_INT *samples2;
653 632
#if CONFIG_FLOAT
654 633
    float sum, sum2;
655
#elif FRAC_BITS <= 15
656
    int sum, sum2;
657 634
#else
658 635
    int64_t sum, sum2;
659 636
#endif
......
710 687
{
711 688
    register MPA_INT *synth_buf;
712 689
    int offset;
713
#if FRAC_BITS <= 15
714
    int32_t tmp[32];
715
    int j;
716
#endif
717 690

  
718 691
    offset = *synth_buf_offset;
719 692
    synth_buf = synth_buf_ptr + offset;
720 693

  
721
#if FRAC_BITS <= 15
722
    dct32(tmp, sb_samples);
723
    for(j=0;j<32;j++) {
724
        /* NOTE: can cause a loss in precision if very high amplitude
725
           sound */
726
        synth_buf[j] = av_clip_int16(tmp[j]);
727
    }
728
#else
729 694
    dct32(synth_buf, sb_samples);
730
#endif
731

  
732 695
    apply_window_mp3_c(synth_buf, window, dither_state, samples, incr);
733 696

  
734 697
    offset = (offset - 32) & 511;

Also available in: Unified diff