Commit f11288da authored by Michael Niedermayer's avatar Michael Niedermayer

AIFF format support by (Patrick Guimond <patg a.t patg d.o.t homeunix d.o.t org)

Originally committed as revision 4924 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 93d3e278
...@@ -33,6 +33,7 @@ version <next> ...@@ -33,6 +33,7 @@ version <next>
- CamStudio video decoder - CamStudio video decoder
- build system improvements - build system improvements
- tabs and trailing whitespace removed from the codebase - tabs and trailing whitespace removed from the codebase
- AIFF/AIFF-C audio format, encoding and decoding
version 0.4.9-pre1: version 0.4.9-pre1:
......
...@@ -22,7 +22,7 @@ OBJS+=mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o img2.o raw.o rm.o \ ...@@ -22,7 +22,7 @@ OBJS+=mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o img2.o raw.o rm.o \
yuv4mpeg.o 4xm.o flvdec.o psxstr.o idroq.o ipmovie.o \ yuv4mpeg.o 4xm.o flvdec.o psxstr.o idroq.o ipmovie.o \
nut.o wc3movie.o mp3.o westwood.o segafilm.o idcin.o flic.o \ nut.o wc3movie.o mp3.o westwood.o segafilm.o idcin.o flic.o \
sierravmd.o matroska.o sol.o electronicarts.o nsvdec.o asf.o \ sierravmd.o matroska.o sol.o electronicarts.o nsvdec.o asf.o \
ogg2.o oggparsevorbis.o oggparsetheora.o oggparseflac.o daud.o ogg2.o oggparsevorbis.o oggparsetheora.o oggparseflac.o daud.o aiff.o
# muxers # muxers
ifeq ($(CONFIG_MUXERS),yes) ifeq ($(CONFIG_MUXERS),yes)
......
This diff is collapsed.
...@@ -54,6 +54,7 @@ void av_register_all(void) ...@@ -54,6 +54,7 @@ void av_register_all(void)
ff_mmf_init(); ff_mmf_init();
swf_init(); swf_init();
au_init(); au_init();
ff_aiff_init();
#ifdef CONFIG_MUXERS #ifdef CONFIG_MUXERS
gif_init(); gif_init();
#endif //CONFIG_MUXERS #endif //CONFIG_MUXERS
......
...@@ -549,6 +549,9 @@ int nsvdec_init(void); ...@@ -549,6 +549,9 @@ int nsvdec_init(void);
/* daud.c */ /* daud.c */
int daud_init(void); int daud_init(void);
/* aiff.c */
int ff_aiff_init(void);
#include "rtp.h" #include "rtp.h"
#include "rtsp.h" #include "rtsp.h"
......
...@@ -38,6 +38,23 @@ float av_int2flt(int32_t v){ ...@@ -38,6 +38,23 @@ float av_int2flt(int32_t v){
return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150); return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150);
} }
double av_ext2dbl(const AVExtFloat ext){
uint64_t m = 0;
int e, i;
for (i = 0; i < 8; i++)
m |= (uint64_t)ext.mantissa[i]<<(56-(i<<3));
e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
if (e == 0x7fff && m)
return 0.0/0.0;
e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx)
* mantissa bit is written as opposed to the
* single and double precision formats */
if (ext.exponent[0]&0x80)
return ldexp(-m, e);
return ldexp(m, e);
}
int64_t av_dbl2int(double d){ int64_t av_dbl2int(double d){
int e; int e;
if ( !d) return 0; if ( !d) return 0;
...@@ -53,3 +70,29 @@ int32_t av_flt2int(float d){ ...@@ -53,3 +70,29 @@ int32_t av_flt2int(float d){
d= frexp(d, &e); d= frexp(d, &e);
return (d<0)<<31 | (e+126)<<23 | (int64_t)((fabs(d)-0.5)*(1<<24)); return (d<0)<<31 | (e+126)<<23 | (int64_t)((fabs(d)-0.5)*(1<<24));
} }
AVExtFloat av_dbl2ext(double d){
struct AVExtFloat ext;
int e, i; double f; uint64_t m;
f = fabs(frexp(d, &e));
if (f >= 0.5 && f < 1) {
e += 16382;
ext.exponent[0] = e>>8;
ext.exponent[1] = e;
m = (uint64_t)ldexp(f, 64);
for (i=0; i < 8; i++)
ext.mantissa[i] = m>>(56-(i<<3));
} else if (f == 0.0) {
memset (&ext, 0, 10);
} else {
ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
memset (&ext.mantissa, 0, 8);
if (f != 1/0.0)
ext.mantissa[0] = ~0;
}
if (d < 0)
ext.exponent[0] |= 0x80;
return ext;
}
...@@ -3,9 +3,17 @@ ...@@ -3,9 +3,17 @@
#include "common.h" #include "common.h"
/* IEEE 80 bits extended float */
typedef struct AVExtFloat {
uint8_t exponent[2];
uint8_t mantissa[8];
} AVExtFloat;
double av_int2dbl(int64_t v); double av_int2dbl(int64_t v);
float av_int2flt(int32_t v); float av_int2flt(int32_t v);
double av_ext2dbl(const AVExtFloat ext);
int64_t av_dbl2int(double d); int64_t av_dbl2int(double d);
int32_t av_flt2int(float d); int32_t av_flt2int(float d);
AVExtFloat av_dbl2ext(double d);
#endif /* INTFLOAT_READWRITE_H */ #endif /* INTFLOAT_READWRITE_H */
...@@ -62,6 +62,9 @@ e2a6d6fae17394dfe87cb5bb8ae11837 *./data/b-libav.al ...@@ -62,6 +62,9 @@ e2a6d6fae17394dfe87cb5bb8ae11837 *./data/b-libav.al
20f9fa55b3c5bebe3520f5667ee4928b *./data/b-libav.mmf 20f9fa55b3c5bebe3520f5667ee4928b *./data/b-libav.mmf
22609 ./data/b-libav.mmf 22609 ./data/b-libav.mmf
./data/b-libav.mmf CRC=0x7e78cffe ./data/b-libav.mmf CRC=0x7e78cffe
a324baee6d76c53ab7c74616cfc31616 *./data/b-libav.aif
89168 ./data/b-libav.aif
./data/b-libav.aif CRC=0x2a09519c
ce356ce2708cb6033ab5d762da93cfd4 *./data/b-libav-yuv420p.yuv ce356ce2708cb6033ab5d762da93cfd4 *./data/b-libav-yuv420p.yuv
304128 ./data/b-libav-yuv420p.yuv 304128 ./data/b-libav-yuv420p.yuv
ce356ce2708cb6033ab5d762da93cfd4 *./data/b-libav-yuv422p.yuv ce356ce2708cb6033ab5d762da93cfd4 *./data/b-libav-yuv422p.yuv
......
...@@ -696,6 +696,11 @@ file=${outfile}libav.mmf ...@@ -696,6 +696,11 @@ file=${outfile}libav.mmf
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file do_ffmpeg_crc $file -i $file
# aiff
file=${outfile}libav.aif
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file
#################### ####################
# pix_fmt conversions # pix_fmt conversions
conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \ conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
......
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