Revision 6bb6fb05

View differences:

configure
94 94
  --enable-w32threads      use Win32 threads [no]
95 95
  --enable-x11grab         enable X11 grabbing [no]
96 96
  --disable-network        disable network support [no]
97
  --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
98 97
  --enable-gray            enable full grayscale support (slower color)
99 98
  --disable-swscale-alpha  disable alpha channel support in swscale
100 99
  --disable-fastdiv        disable table-based division
......
953 952
    mdct
954 953
    memalign_hack
955 954
    mlib
956
    mpegaudio_hp
957 955
    network
958 956
    nonfree
959 957
    pic
......
1643 1641
enable ffplay
1644 1642
enable ffprobe
1645 1643
enable ffserver
1646
enable mpegaudio_hp
1647 1644
enable network
1648 1645
enable optimizations
1649 1646
enable protocols
libavcodec/Makefile
682 682
$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
683 683
	$(M)./$< sin > $@
684 684

  
685
ifdef CONFIG_MPEGAUDIO_HP
686
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=23
687
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=23
688
else
689
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=15
690
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=15
691
endif
692

  
693 685
ifdef CONFIG_SMALL
694 686
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
695 687
else
libavcodec/bfin/mathops.h
24 24

  
25 25
#include "config.h"
26 26

  
27
#if CONFIG_MPEGAUDIO_HP
28 27
#define MULH(X,Y) ({ int xxo;                           \
29 28
    __asm__ (                                               \
30 29
        "a1 = %2.L * %1.L (FU);\n\t"                    \
......
34 33
        "a1 = a1 >>> 16;\n\t"                           \
35 34
        "%0 = (a0 += a1);\n\t"                          \
36 35
        : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
37
#else
38
#define MULH(X,Y) ({ int xxo;                           \
39
    __asm__ (                                               \
40
        "a1 = %2.H * %1.L (IS,M);\n\t"                  \
41
        "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
42
        "a1 = a1 >>> 16;\n\t"                           \
43
        "%0 = (a0 += a1);\n\t"                          \
44
        : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
45
#endif
46 36

  
47 37
/* signed 16x16 -> 32 multiply */
48 38
#define MUL16(a, b) ({ int xxo;                         \
libavcodec/mpegaudio.h
56 56

  
57 57
#define MP3_MASK 0xFFFE0CCF
58 58

  
59
#if CONFIG_MPEGAUDIO_HP
59
#ifndef FRAC_BITS
60 60
#define FRAC_BITS   23   /* fractional bits for sb_samples and dct */
61 61
#define WFRAC_BITS  16   /* fractional bits for window */
62
#else
63
#define FRAC_BITS   15   /* fractional bits for sb_samples and dct */
64
#define WFRAC_BITS  14   /* fractional bits for window */
65 62
#endif
66 63

  
67 64
#define FRAC_ONE    (1 << FRAC_BITS)
libavcodec/mpegaudio_tablegen.h
38 38
static float exp_table_float[512];
39 39
static float expval_table_float[512][16];
40 40

  
41
#define FRAC_BITS 23
42

  
41 43
static void mpegaudio_tableinit(void)
42 44
{
43 45
    int i, value, exponent;
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;
libavcodec/mpegaudioenc.c
27 27
#include "avcodec.h"
28 28
#include "put_bits.h"
29 29

  
30
#undef  CONFIG_MPEGAUDIO_HP
31
#define CONFIG_MPEGAUDIO_HP 0
30
#define FRAC_BITS   15   /* fractional bits for sb_samples and dct */
31
#define WFRAC_BITS  14   /* fractional bits for window */
32

  
32 33
#include "mpegaudio.h"
33 34

  
34 35
/* currently, cannot change these constants (need to modify

Also available in: Unified diff