mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
remove libdts decoder, we have a native dts decoder
Originally committed as revision 9051 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
facbea9596
commit
670a6b133b
7
configure
vendored
7
configure
vendored
@ -85,7 +85,6 @@ show_help(){
|
||||
echo " --enable-avisynth allow reading AVISynth script files [default=no]"
|
||||
echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
|
||||
echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
|
||||
echo " --enable-libdts enable GPLed libdts support [default=no]"
|
||||
echo " --enable-libfaac enable FAAC support via libfaac [default=no]"
|
||||
echo " --enable-libfaad enable FAAD support via libfaad [default=no]"
|
||||
echo " --enable-libfaadbin build FAAD support with runtime linking [default=no]"
|
||||
@ -578,7 +577,6 @@ CONFIG_LIST='
|
||||
libamr
|
||||
libamr_nb
|
||||
libamr_wb
|
||||
libdts
|
||||
libfaac
|
||||
libfaad
|
||||
libfaadbin
|
||||
@ -710,7 +708,6 @@ libamr_nb_decoder_deps="libamr_nb"
|
||||
libamr_nb_encoder_deps="libamr_nb"
|
||||
libamr_wb_decoder_deps="libamr_wb"
|
||||
libamr_wb_encoder_deps="libamr_wb"
|
||||
libdts_decoder_deps="libdts"
|
||||
libgsm_decoder_deps="libgsm"
|
||||
libgsm_encoder_deps="libgsm"
|
||||
libgsm_ms_decoder_deps="libgsm"
|
||||
@ -826,7 +823,6 @@ liba52="no"
|
||||
liba52bin="no"
|
||||
libamr_nb="no"
|
||||
libamr_wb="no"
|
||||
libdts="no"
|
||||
libfaac="no"
|
||||
libfaad2="no"
|
||||
libfaad="no"
|
||||
@ -1282,7 +1278,6 @@ if disabled gpl ; then
|
||||
die_gpl_disabled "liba52" liba52
|
||||
die_gpl_disabled "libxvidcore" xvid
|
||||
die_gpl_disabled "x264" x264
|
||||
die_gpl_disabled "libdts" libdts
|
||||
die_gpl_disabled "FAAD2" libfaad2
|
||||
die_gpl_disabled "The X11 grabber" x11grab
|
||||
die_gpl_disabled "The software scaler" swscaler
|
||||
@ -1619,7 +1614,6 @@ enabled_any libamr_nb libamr_wb && enable libamr
|
||||
enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
|
||||
enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
|
||||
enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
|
||||
enabled libdts && require libdts dts.h dts_init -ldts -lm
|
||||
enabled libgsm && require libgsm gsm.h gsm_create -lgsm
|
||||
enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
|
||||
enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
|
||||
@ -1881,7 +1875,6 @@ echo "liba52 support $liba52"
|
||||
echo "liba52 dlopened $liba52bin"
|
||||
echo "libamr-nb support $libamr_nb"
|
||||
echo "libamr-wb support $libamr_wb"
|
||||
echo "libdts support $libdts"
|
||||
echo "libfaac enabled $libfaac"
|
||||
echo "libfaad enabled $libfaad"
|
||||
echo "faadbin enabled $libfaadbin"
|
||||
|
@ -278,7 +278,6 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcm.o
|
||||
# external codec libraries
|
||||
OBJS-$(CONFIG_LIBAMR) += amr.o
|
||||
OBJS-$(CONFIG_LIBA52) += a52dec.o
|
||||
OBJS-$(CONFIG_LIBDTS) += dtsdec.o
|
||||
OBJS-$(CONFIG_LIBFAAC) += faac.o
|
||||
OBJS-$(CONFIG_LIBFAAD) += faad.o
|
||||
OBJS-$(CONFIG_LIBGSM) += libgsm.o
|
||||
|
@ -178,7 +178,6 @@ void avcodec_register_all(void)
|
||||
REGISTER_ENCDEC (LIBAMR_NB, libamr_nb);
|
||||
REGISTER_ENCDEC (LIBAMR_WB, libamr_wb);
|
||||
REGISTER_DECODER(LIBA52, liba52);
|
||||
REGISTER_DECODER(LIBDTS, libdts);
|
||||
REGISTER_ENCDEC (LIBGSM, libgsm);
|
||||
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
|
||||
REGISTER_ENCODER(LIBTHEORA, libtheora);
|
||||
|
@ -2428,7 +2428,6 @@ extern AVCodec libamr_nb_decoder;
|
||||
extern AVCodec libamr_nb_encoder;
|
||||
extern AVCodec libamr_wb_decoder;
|
||||
extern AVCodec libamr_wb_encoder;
|
||||
extern AVCodec libdts_decoder;
|
||||
extern AVCodec libgsm_decoder;
|
||||
extern AVCodec libgsm_encoder;
|
||||
extern AVCodec libgsm_ms_decoder;
|
||||
|
@ -1,278 +0,0 @@
|
||||
/*
|
||||
* dtsdec.c : free DTS Coherent Acoustics stream decoder.
|
||||
* Copyright (C) 2004 Benjamin Zores <ben@geexbox.org>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
#include <dts.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BUFFER_SIZE 18726
|
||||
#define HEADER_SIZE 14
|
||||
|
||||
#define CONVERT_LEVEL 1
|
||||
#define CONVERT_BIAS 0
|
||||
|
||||
typedef struct DTSContext {
|
||||
dts_state_t *state;
|
||||
uint8_t buf[BUFFER_SIZE];
|
||||
uint8_t *bufptr;
|
||||
uint8_t *bufpos;
|
||||
} DTSContext;
|
||||
|
||||
static inline int16_t
|
||||
convert(sample_t s)
|
||||
{
|
||||
return s * 0x7fff;
|
||||
}
|
||||
|
||||
static void
|
||||
convert2s16_multi(sample_t *f, int16_t *s16, int flags)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch(flags & (DTS_CHANNEL_MASK | DTS_LFE)){
|
||||
case DTS_MONO:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[5*i] = s16[5*i+1] = s16[5*i+2] = s16[5*i+3] = 0;
|
||||
s16[5*i+4] = convert(f[i]);
|
||||
}
|
||||
break;
|
||||
case DTS_CHANNEL:
|
||||
case DTS_STEREO:
|
||||
case DTS_DOLBY:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[2*i] = convert(f[i]);
|
||||
s16[2*i+1] = convert(f[i+256]);
|
||||
}
|
||||
break;
|
||||
case DTS_3F:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[5*i] = convert(f[i+256]);
|
||||
s16[5*i+1] = convert(f[i+512]);
|
||||
s16[5*i+2] = s16[5*i+3] = 0;
|
||||
s16[5*i+4] = convert(f[i]);
|
||||
}
|
||||
break;
|
||||
case DTS_2F2R:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[4*i] = convert(f[i]);
|
||||
s16[4*i+1] = convert(f[i+256]);
|
||||
s16[4*i+2] = convert(f[i+512]);
|
||||
s16[4*i+3] = convert(f[i+768]);
|
||||
}
|
||||
break;
|
||||
case DTS_3F2R:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[5*i] = convert(f[i+256]);
|
||||
s16[5*i+1] = convert(f[i+512]);
|
||||
s16[5*i+2] = convert(f[i+768]);
|
||||
s16[5*i+3] = convert(f[i+1024]);
|
||||
s16[5*i+4] = convert(f[i]);
|
||||
}
|
||||
break;
|
||||
case DTS_MONO | DTS_LFE:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[6*i] = s16[6*i+1] = s16[6*i+2] = s16[6*i+3] = 0;
|
||||
s16[6*i+4] = convert(f[i]);
|
||||
s16[6*i+5] = convert(f[i+256]);
|
||||
}
|
||||
break;
|
||||
case DTS_CHANNEL | DTS_LFE:
|
||||
case DTS_STEREO | DTS_LFE:
|
||||
case DTS_DOLBY | DTS_LFE:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[6*i] = convert(f[i]);
|
||||
s16[6*i+1] = convert(f[i+256]);
|
||||
s16[6*i+2] = s16[6*i+3] = s16[6*i+4] = 0;
|
||||
s16[6*i+5] = convert(f[i+512]);
|
||||
}
|
||||
break;
|
||||
case DTS_3F | DTS_LFE:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[6*i] = convert(f[i+256]);
|
||||
s16[6*i+1] = convert(f[i+512]);
|
||||
s16[6*i+2] = s16[6*i+3] = 0;
|
||||
s16[6*i+4] = convert(f[i]);
|
||||
s16[6*i+5] = convert(f[i+768]);
|
||||
}
|
||||
break;
|
||||
case DTS_2F2R | DTS_LFE:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[6*i] = convert(f[i]);
|
||||
s16[6*i+1] = convert(f[i+256]);
|
||||
s16[6*i+2] = convert(f[i+512]);
|
||||
s16[6*i+3] = convert(f[i+768]);
|
||||
s16[6*i+4] = 0;
|
||||
s16[6*i+5] = convert(f[i+1024]);
|
||||
}
|
||||
break;
|
||||
case DTS_3F2R | DTS_LFE:
|
||||
for(i = 0; i < 256; i++){
|
||||
s16[6*i] = convert(f[i+256]);
|
||||
s16[6*i+1] = convert(f[i+512]);
|
||||
s16[6*i+2] = convert(f[i+768]);
|
||||
s16[6*i+3] = convert(f[i+1024]);
|
||||
s16[6*i+4] = convert(f[i]);
|
||||
s16[6*i+5] = convert(f[i+1280]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
channels_multi(int flags)
|
||||
{
|
||||
switch(flags & (DTS_CHANNEL_MASK | DTS_LFE)){
|
||||
case DTS_CHANNEL:
|
||||
case DTS_STEREO:
|
||||
case DTS_DOLBY:
|
||||
return 2;
|
||||
case DTS_2F2R:
|
||||
return 4;
|
||||
case DTS_MONO:
|
||||
case DTS_3F:
|
||||
case DTS_3F2R:
|
||||
return 5;
|
||||
case DTS_MONO | DTS_LFE:
|
||||
case DTS_CHANNEL | DTS_LFE:
|
||||
case DTS_STEREO | DTS_LFE:
|
||||
case DTS_DOLBY | DTS_LFE:
|
||||
case DTS_3F | DTS_LFE:
|
||||
case DTS_2F2R | DTS_LFE:
|
||||
case DTS_3F2R | DTS_LFE:
|
||||
return 6;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
dts_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
uint8_t * buff, int buff_size)
|
||||
{
|
||||
DTSContext *s = avctx->priv_data;
|
||||
uint8_t *start = buff;
|
||||
uint8_t *end = buff + buff_size;
|
||||
int16_t *out_samples = data;
|
||||
int sample_rate;
|
||||
int frame_length;
|
||||
int flags;
|
||||
int bit_rate;
|
||||
int len;
|
||||
level_t level;
|
||||
sample_t bias;
|
||||
int nblocks;
|
||||
int i;
|
||||
|
||||
*data_size = 0;
|
||||
|
||||
while(1) {
|
||||
int length;
|
||||
|
||||
len = end - start;
|
||||
if(!len)
|
||||
break;
|
||||
if(len > s->bufpos - s->bufptr)
|
||||
len = s->bufpos - s->bufptr;
|
||||
memcpy(s->bufptr, start, len);
|
||||
s->bufptr += len;
|
||||
start += len;
|
||||
if(s->bufptr != s->bufpos)
|
||||
return start - buff;
|
||||
if(s->bufpos != s->buf + HEADER_SIZE)
|
||||
break;
|
||||
|
||||
length = dts_syncinfo(s->state, s->buf, &flags, &sample_rate,
|
||||
&bit_rate, &frame_length);
|
||||
if(!length) {
|
||||
av_log(NULL, AV_LOG_INFO, "skip\n");
|
||||
for(s->bufptr = s->buf; s->bufptr < s->buf + HEADER_SIZE - 1; s->bufptr++)
|
||||
s->bufptr[0] = s->bufptr[1];
|
||||
continue;
|
||||
}
|
||||
s->bufpos = s->buf + length;
|
||||
}
|
||||
|
||||
level = CONVERT_LEVEL;
|
||||
bias = CONVERT_BIAS;
|
||||
|
||||
flags |= DTS_ADJUST_LEVEL;
|
||||
if(dts_frame(s->state, s->buf, &flags, &level, bias)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "dts_frame() failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
avctx->sample_rate = sample_rate;
|
||||
avctx->channels = channels_multi(flags);
|
||||
avctx->bit_rate = bit_rate;
|
||||
|
||||
nblocks = dts_blocks_num(s->state);
|
||||
|
||||
for(i = 0; i < nblocks; i++) {
|
||||
if(dts_block(s->state)) {
|
||||
av_log(avctx, AV_LOG_ERROR, "dts_block() failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
convert2s16_multi(dts_samples(s->state), out_samples, flags);
|
||||
|
||||
out_samples += 256 * avctx->channels;
|
||||
*data_size += 256 * sizeof(int16_t) * avctx->channels;
|
||||
}
|
||||
|
||||
end:
|
||||
s->bufptr = s->buf;
|
||||
s->bufpos = s->buf + HEADER_SIZE;
|
||||
return start - buff;
|
||||
}
|
||||
|
||||
static int
|
||||
dts_decode_init(AVCodecContext * avctx)
|
||||
{
|
||||
DTSContext *s = avctx->priv_data;
|
||||
s->bufptr = s->buf;
|
||||
s->bufpos = s->buf + HEADER_SIZE;
|
||||
s->state = dts_init(0);
|
||||
if(s->state == NULL)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dts_decode_end(AVCodecContext * avctx)
|
||||
{
|
||||
DTSContext *s = avctx->priv_data;
|
||||
dts_free(s->state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVCodec libdts_decoder = {
|
||||
"libdts",
|
||||
CODEC_TYPE_AUDIO,
|
||||
CODEC_ID_DTS,
|
||||
sizeof(DTSContext),
|
||||
dts_decode_init,
|
||||
NULL,
|
||||
dts_decode_end,
|
||||
dts_decode_frame,
|
||||
};
|
Loading…
Reference in New Issue
Block a user