Commit 08aa2c9b authored by Aurelien Jacobs's avatar Aurelien Jacobs

remove dependency of mpeg audio encoder over mpeg audio decoder

Originally committed as revision 9082 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ca6e50af
...@@ -19,7 +19,7 @@ OBJS= bitstream.o \ ...@@ -19,7 +19,7 @@ OBJS= bitstream.o \
motion_est.o \ motion_est.o \
imgconvert.o \ imgconvert.o \
mpeg12.o \ mpeg12.o \
mpegaudiodec.o mpegaudiodecheader.o mpegaudiodata.o \ mpegaudiodec.o mpegaudiodecheader.o mpegaudiodata.o mpegaudio.o \
simple_idct.o \ simple_idct.o \
ratecontrol.o \ ratecontrol.o \
eval.o \ eval.o \
...@@ -108,7 +108,7 @@ OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o ...@@ -108,7 +108,7 @@ OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o
OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o mpegvideo.o OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o mpegvideo.o
OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_MJPEGB_DECODER) += mjpegbdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
OBJS-$(CONFIG_MP2_ENCODER) += mpegaudio.o mpegaudiodata.o OBJS-$(CONFIG_MP2_ENCODER) += mpegaudioenc.o mpegaudio.o mpegaudiodata.o
OBJS-$(CONFIG_MPC7_DECODER) += mpc.o OBJS-$(CONFIG_MPC7_DECODER) += mpc.o
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V1_ENCODER) += msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V1_ENCODER) += msmpeg4.o msmpeg4data.o
......
This diff is collapsed.
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#ifndef MPEGAUDIO_H #ifndef MPEGAUDIO_H
#define MPEGAUDIO_H #define MPEGAUDIO_H
#include "avcodec.h"
#include "bitstream.h" #include "bitstream.h"
#include "dsputil.h" #include "dsputil.h"
...@@ -115,7 +116,7 @@ typedef struct MPADecodeContext { ...@@ -115,7 +116,7 @@ typedef struct MPADecodeContext {
AVCodecContext* avctx; AVCodecContext* avctx;
} MPADecodeContext; } MPADecodeContext;
int l2_select_table(int bitrate, int nb_channels, int freq, int lsf); int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate); int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate);
void ff_mpa_synth_init(MPA_INT *window); void ff_mpa_synth_init(MPA_INT *window);
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
......
...@@ -1140,28 +1140,6 @@ static int mp_decode_layer1(MPADecodeContext *s) ...@@ -1140,28 +1140,6 @@ static int mp_decode_layer1(MPADecodeContext *s)
return 12; return 12;
} }
/* bitrate is in kb/s */
int l2_select_table(int bitrate, int nb_channels, int freq, int lsf)
{
int ch_bitrate, table;
ch_bitrate = bitrate / nb_channels;
if (!lsf) {
if ((freq == 48000 && ch_bitrate >= 56) ||
(ch_bitrate >= 56 && ch_bitrate <= 80))
table = 0;
else if (freq != 48000 && ch_bitrate >= 96)
table = 1;
else if (freq != 32000 && ch_bitrate <= 48)
table = 2;
else
table = 3;
} else {
table = 4;
}
return table;
}
static int mp_decode_layer2(MPADecodeContext *s) static int mp_decode_layer2(MPADecodeContext *s)
{ {
int sblimit; /* number of used subbands */ int sblimit; /* number of used subbands */
...@@ -1173,7 +1151,7 @@ static int mp_decode_layer2(MPADecodeContext *s) ...@@ -1173,7 +1151,7 @@ static int mp_decode_layer2(MPADecodeContext *s)
int scale, qindex, bits, steps, k, l, m, b; int scale, qindex, bits, steps, k, l, m, b;
/* select decoding table */ /* select decoding table */
table = l2_select_table(s->bit_rate / 1000, s->nb_channels, table = ff_mpa_l2_select_table(s->bit_rate / 1000, s->nb_channels,
s->sample_rate, s->lsf); s->sample_rate, s->lsf);
sblimit = ff_mpa_sblimit_table[table]; sblimit = ff_mpa_sblimit_table[table];
alloc_table = ff_mpa_alloc_tables[table]; alloc_table = ff_mpa_alloc_tables[table];
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment