From 92281850a2d878dae1d50e271886ba87013b6ff3 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 12 Oct 2012 17:29:43 +0200 Subject: [PATCH 1/6] nut: support pcm codecs not mapped in avi The native tags will be used when available. --- doc/nut.texi | 2 +- libavformat/nut.c | 27 ++++++++++++++++++++++++++- libavformat/nut.h | 1 + libavformat/nutdec.c | 7 ++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/doc/nut.texi b/doc/nut.texi index dafbb392e7..1c23934f6a 100644 --- a/doc/nut.texi +++ b/doc/nut.texi @@ -50,7 +50,7 @@ to be read big-endian. @end multitable is S for signed integer, U for unsigned integer, F for IEEE float - is D for default, as a historical artefact. + is D for default, P is for planar. is 8/16/24/32 @example diff --git a/libavformat/nut.c b/libavformat/nut.c index b666bff716..e367d1c649 100644 --- a/libavformat/nut.c +++ b/libavformat/nut.c @@ -90,8 +90,33 @@ const AVCodecTag ff_nut_video_tags[] = { { AV_CODEC_ID_NONE , 0 } }; +const AVCodecTag ff_nut_audio_tags[] = { + { AV_CODEC_ID_PCM_ALAW, MKTAG('A', 'L', 'A', 'W') }, + { AV_CODEC_ID_PCM_MULAW, MKTAG('U', 'L', 'A', 'W') }, + { AV_CODEC_ID_PCM_F32BE, MKTAG(32 , 'D', 'F', 'P') }, + { AV_CODEC_ID_PCM_F32LE, MKTAG('P', 'F', 'D', 32 ) }, + { AV_CODEC_ID_PCM_F64BE, MKTAG(64 , 'D', 'F', 'P') }, + { AV_CODEC_ID_PCM_F64LE, MKTAG('P', 'F', 'D', 64 ) }, + { AV_CODEC_ID_PCM_S16BE, MKTAG(16 , 'D', 'S', 'P') }, + { AV_CODEC_ID_PCM_S16LE, MKTAG('P', 'S', 'D', 16 ) }, + { AV_CODEC_ID_PCM_S24BE, MKTAG(24 , 'D', 'S', 'P') }, + { AV_CODEC_ID_PCM_S24LE, MKTAG('P', 'S', 'D', 24 ) }, + { AV_CODEC_ID_PCM_S32BE, MKTAG(32 , 'D', 'S', 'P') }, + { AV_CODEC_ID_PCM_S32LE, MKTAG('P', 'S', 'D', 32 ) }, + { AV_CODEC_ID_PCM_S8, MKTAG('P', 'S', 'D', 8 ) }, + { AV_CODEC_ID_PCM_U16BE, MKTAG(16 , 'D', 'U', 'P') }, + { AV_CODEC_ID_PCM_U16LE, MKTAG('P', 'U', 'D', 16 ) }, + { AV_CODEC_ID_PCM_U24BE, MKTAG(24 , 'D', 'U', 'P') }, + { AV_CODEC_ID_PCM_U24LE, MKTAG('P', 'U', 'D', 24 ) }, + { AV_CODEC_ID_PCM_U32BE, MKTAG(32 , 'D', 'U', 'P') }, + { AV_CODEC_ID_PCM_U32LE, MKTAG('P', 'U', 'D', 32 ) }, + { AV_CODEC_ID_PCM_U8, MKTAG('P', 'U', 'D', 8 ) }, + { AV_CODEC_ID_PCM_S16LE_PLANAR, MKTAG('P', 'S', 'P', 16 ) }, + { AV_CODEC_ID_NONE, 0 } +}; + const AVCodecTag * const ff_nut_codec_tags[] = { - ff_nut_video_tags, ff_nut_subtitle_tags, + ff_nut_video_tags, ff_nut_audio_tags, ff_nut_subtitle_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0 }; diff --git a/libavformat/nut.h b/libavformat/nut.h index 335eceb440..a91a109d40 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -105,6 +105,7 @@ typedef struct NUTContext { extern const AVCodecTag ff_nut_subtitle_tags[]; extern const AVCodecTag ff_nut_video_tags[]; +extern const AVCodecTag ff_nut_audio_tags[]; extern const AVCodecTag * const ff_nut_codec_tags[]; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 8448e13702..9b1891f92e 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -358,7 +358,12 @@ static int decode_stream_header(NUTContext *nut) break; case 1: st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, tmp); + st->codec->codec_id = av_codec_get_id((const AVCodecTag * const []) { + ff_nut_audio_tags, + ff_codec_wav_tags, + 0 + }, + tmp); break; case 2: st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; From 10e645e9cb06dc87074232740d4366db18e7ba56 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Fri, 12 Oct 2012 15:46:53 -0400 Subject: [PATCH 2/6] lavr: handle clipping in the float to s32 conversion We cannot clip to INT_MAX because that value cannot be exactly represented by a float value and ends up overflowing during conversion anyway. We need to use a slightly smaller float value, which ends up with slightly inaccurate results for samples which clip or nearly clip, but it is close enough. Using doubles as intermediates in the conversion would be more accurate, but it takes about twice as much time. Signed-off-by: Luca Barbato --- libavresample/x86/audio_convert.asm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavresample/x86/audio_convert.asm b/libavresample/x86/audio_convert.asm index 2ebdbc1ec0..25166afff2 100644 --- a/libavresample/x86/audio_convert.asm +++ b/libavresample/x86/audio_convert.asm @@ -28,6 +28,7 @@ SECTION_RODATA 32 pf_s32_inv_scale: times 8 dd 0x30000000 pf_s32_scale: times 8 dd 0x4f000000 +pf_s32_clip: times 8 dd 0x4effffff pf_s16_inv_scale: times 4 dd 0x38000000 pf_s16_scale: times 4 dd 0x47000000 pb_shuf_unpack_even: db -1, -1, 0, 1, -1, -1, 2, 3, -1, -1, 8, 9, -1, -1, 10, 11 @@ -197,17 +198,22 @@ cglobal conv_flt_to_s16, 3,3,5, dst, src, len ;------------------------------------------------------------------------------ %macro CONV_FLT_TO_S32 0 -cglobal conv_flt_to_s32, 3,3,5, dst, src, len +cglobal conv_flt_to_s32, 3,3,6, dst, src, len lea lenq, [lend*4] add srcq, lenq add dstq, lenq neg lenq mova m4, [pf_s32_scale] + mova m5, [pf_s32_clip] .loop: mulps m0, m4, [srcq+lenq ] mulps m1, m4, [srcq+lenq+1*mmsize] mulps m2, m4, [srcq+lenq+2*mmsize] mulps m3, m4, [srcq+lenq+3*mmsize] + minps m0, m0, m5 + minps m1, m1, m5 + minps m2, m2, m5 + minps m3, m3, m5 cvtps2dq m0, m0 cvtps2dq m1, m1 cvtps2dq m2, m2 From 74c39bc682717022065aa79e2a3673d2592eb863 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 12 Oct 2012 19:35:11 +0100 Subject: [PATCH 3/6] eval-test: make table static const Signed-off-by: Mans Rullgard --- libavutil/eval.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/eval.c b/libavutil/eval.c index 9d179309b7..7a28dbe12d 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -564,7 +564,8 @@ int main(int argc, char **argv) { int i; double d; - const char **expr, *exprs[] = { + const char *const *expr; + static const char *const exprs[] = { "", "1;2", "-20", From ac17ccf73ad0cb6be74845ca05a1c18b2c5f7416 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 12 Oct 2012 21:40:07 +0000 Subject: [PATCH 4/6] configure: work around bug in ash shell The ash 'test' builtin misbehaves if the first operand of a binary operator looks like a unary operator. Signed-off-by: Mans Rullgard --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 26cd7ea73a..22becbff01 100755 --- a/configure +++ b/configure @@ -593,7 +593,7 @@ print_config(){ } print_enabled(){ - test "$1" = -n && end=" " && shift || end="\n" + test x"$1" = x-n && end=" " && shift || end="\n" suf=$1 shift for v; do From 741a8b724e47557c74df8950da5c879787ef55f5 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Fri, 12 Oct 2012 21:42:27 +0000 Subject: [PATCH 5/6] configure: recognise Minix as OS No special setup is required for Minix. Signed-off-by: Mans Rullgard --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 22becbff01..534c80d41b 100755 --- a/configure +++ b/configure @@ -2875,6 +2875,8 @@ case $target_os in add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT AVSERVERLDFLAGS= ;; + minix) + ;; none) ;; *) From b5198a2637b7b45b0049a1d4b386a06f016f2520 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 13 Oct 2012 01:34:42 +0100 Subject: [PATCH 6/6] configure: tms470: add mapping for -mfpu=vfpv3-d16 flag Signed-off-by: Mans Rullgard --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 534c80d41b..3dbacd3adb 100755 --- a/configure +++ b/configure @@ -2209,6 +2209,7 @@ tms470_flags(){ -mfpu=neon) echo --float_support=vfpv3 --neon ;; -mfpu=vfp) echo --float_support=vfpv2 ;; -mfpu=vfpv3) echo --float_support=vfpv3 ;; + -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;; -msoft-float) echo --float_support=vfplib ;; -O[0-3]|-mf=*) echo $flag ;; -g) echo -g -mn ;;