summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-10 04:01:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-10 04:03:17 +0200
commitb97b4b58a6e1ac595002b3e3f3469161771c6003 (patch)
tree8c2833931fb16084f95bf0adf8317e1fa28aca12 /libavcodec/mpegaudiodec.c
parent67d441499a042edcfb0f8a120e6196d10b1d13db (diff)
parenta88ef93b4abbea9f18c8750113dc9e99931f2f8a (diff)
Merge remote branch 'qatar/master'
* qatar/master: mpegaudiodec: group #includes more sanely mpegaudio: remove #if 0 blocks ffmpeg.c: reset avoptions after each input/output file. ffmpeg.c: store per-output stream sws flags. mpegaudio: remove CONFIG_MPEGAUDIO_HP option mpegtsenc: Clear st->priv_data when freeing it udp: Fix receiving RTP data over multicast rtpproto: Remove an unused variable regtest: fix wma tests NOT pulled: mpegaudio: remove CONFIG_AUDIO_NONSHORT regtest: separate flags for encoding and decoding Conflicts: ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c95
1 files changed, 1 insertions, 94 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 5d420dca3e..d7bc89f837 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -28,18 +28,16 @@
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "mathops.h"
/*
* TODO:
- * - in low precision mode, use more 16 bit multiplies in synth filter
* - test lsf / mpeg25 extensively.
*/
#include "mpegaudio.h"
#include "mpegaudiodecheader.h"
-#include "mathops.h"
-
#if CONFIG_FLOAT
# define SHR(a,b) ((a)*(1.0f/(1<<(b))))
# define compute_antialias compute_antialias_float
@@ -248,14 +246,6 @@ static inline int l3_unscale(int value, int exponent)
static int dev_4_3_coefs[DEV_ORDER];
-#if 0 /* unused */
-static int pow_mult3[3] = {
- POW_FIX(1.0),
- POW_FIX(1.25992104989487316476),
- POW_FIX(1.58740105196819947474),
-};
-#endif
-
static av_cold void int_pow_init(void)
{
int i, a;
@@ -267,53 +257,6 @@ static av_cold void int_pow_init(void)
}
}
-#if 0 /* unused, remove? */
-/* return the mantissa and the binary exponent */
-static int int_pow(int i, int *exp_ptr)
-{
- int e, er, eq, j;
- int a, a1;
-
- /* renormalize */
- a = i;
- e = POW_FRAC_BITS;
- while (a < (1 << (POW_FRAC_BITS - 1))) {
- a = a << 1;
- e--;
- }
- a -= (1 << POW_FRAC_BITS);
- a1 = 0;
- for(j = DEV_ORDER - 1; j >= 0; j--)
- a1 = POW_MULL(a, dev_4_3_coefs[j] + a1);
- a = (1 << POW_FRAC_BITS) + a1;
- /* exponent compute (exact) */
- e = e * 4;
- er = e % 3;
- eq = e / 3;
- a = POW_MULL(a, pow_mult3[er]);
- while (a >= 2 * POW_FRAC_ONE) {
- a = a >> 1;
- eq++;
- }
- /* convert to float */
- while (a < POW_FRAC_ONE) {
- a = a << 1;
- eq--;
- }
- /* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */
-#if POW_FRAC_BITS > FRAC_BITS
- a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS);
- /* correct overflow */
- if (a >= 2 * (1 << FRAC_BITS)) {
- a = a >> 1;
- eq++;
- }
-#endif
- *exp_ptr = eq;
- return a;
-}
-#endif
-
static av_cold int decode_init(AVCodecContext * avctx)
{
MPADecodeContext *s = avctx->priv_data;
@@ -540,24 +483,6 @@ static inline float round_sample(float *sum)
#define MLSS(rt, ra, rb) rt-=(ra)*(rb)
-#elif FRAC_BITS <= 15
-
-static inline int round_sample(int *sum)
-{
- int sum1;
- sum1 = (*sum) >> OUT_SHIFT;
- *sum &= (1<<OUT_SHIFT)-1;
- return av_clip(sum1, OUT_MIN, OUT_MAX);
-}
-
-/* signed 16x16 -> 32 multiply add accumulate */
-#define MACS(rt, ra, rb) MAC16(rt, ra, rb)
-
-/* signed 16x16 -> 32 multiply */
-#define MULS(ra, rb) MUL16(ra, rb)
-
-#define MLSS(rt, ra, rb) MLS16(rt, ra, rb)
-
#else
static inline int round_sample(int64_t *sum)
@@ -624,8 +549,6 @@ void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
v = ff_mpa_enwindow[i];
#if CONFIG_FLOAT
v *= 1.0 / (1LL<<(16 + FRAC_BITS));
-#elif WFRAC_BITS < 16
- v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
#endif
window[i] = v;
if ((i & 63) != 0)
@@ -652,8 +575,6 @@ static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,
OUT_INT *samples2;
#if CONFIG_FLOAT
float sum, sum2;
-#elif FRAC_BITS <= 15
- int sum, sum2;
#else
int64_t sum, sum2;
#endif
@@ -710,25 +631,11 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
{
register MPA_INT *synth_buf;
int offset;
-#if FRAC_BITS <= 15
- int32_t tmp[32];
- int j;
-#endif
offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset;
-#if FRAC_BITS <= 15
- dct32(tmp, sb_samples);
- for(j=0;j<32;j++) {
- /* NOTE: can cause a loss in precision if very high amplitude
- sound */
- synth_buf[j] = av_clip_int16(tmp[j]);
- }
-#else
dct32(synth_buf, sb_samples);
-#endif
-
apply_window_mp3_c(synth_buf, window, dither_state, samples, incr);
offset = (offset - 32) & 511;