From 4d1f443c3d579cf9495c7a289282634908f6a538 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Mon, 10 Sep 2012 07:07:56 +0200 Subject: [PATCH 1/6] avformat: simplify avformat_close_input avio_close checks by itself for NULL condition. --- libavformat/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 81a4b34c4c..3a829a9d27 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2709,8 +2709,8 @@ void avformat_close_input(AVFormatContext **ps) s->iformat->read_close(s); avformat_free_context(s); *ps = NULL; - if (pb) - avio_close(pb); + + avio_close(pb); } AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) From 44272c1cccfb92415801ae60693a7ed04e458916 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Tue, 4 Sep 2012 16:05:28 +0200 Subject: [PATCH 2/6] avformat: refactor avformat_close_input Do not crash if the input format is not allocated yet. --- libavformat/utils.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 3a829a9d27..c0da7f2fb9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2702,12 +2702,21 @@ void av_close_input_file(AVFormatContext *s) void avformat_close_input(AVFormatContext **ps) { AVFormatContext *s = *ps; - AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ? - NULL : s->pb; + AVIOContext *pb = s->pb; + + if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) && + (s->flags & AVFMT_FLAG_CUSTOM_IO)) + pb = NULL; + flush_packet_queue(s); - if (s->iformat->read_close) - s->iformat->read_close(s); + + if (s->iformat) { + if (s->iformat->read_close) + s->iformat->read_close(s); + } + avformat_free_context(s); + *ps = NULL; avio_close(pb); From 714508bcb91057868a96588b9fba4d29c6c4fc77 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 13 Sep 2012 19:45:21 +0200 Subject: [PATCH 3/6] vorbisdec: ensure FASTDIV denominator is never 1 In both usages of FASTDIV the denominator might be 1. Using a branch could make the function slower than using a normal division. Both denominator and numerator can be multiplied by 2 safely and using shifts is faster than using a branch. --- libavcodec/vorbisdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index f11e2f5d61..f5a541adae 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1354,8 +1354,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) { unsigned coffs; unsigned dim = vc->codebooks[vqbook].dimensions; - unsigned step = dim == 1 ? vr->partition_size - : FASTDIV(vr->partition_size, dim); + unsigned step = FASTDIV(vr->partition_size << 1, dim << 1); vorbis_codebook codebook = vc->codebooks[vqbook]; if (vr_type == 0) { @@ -1409,7 +1408,7 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc, } } else if (vr_type == 2) { - unsigned voffs_div = FASTDIV(voffset, ch); + unsigned voffs_div = FASTDIV(voffset << 1, ch <<1); unsigned voffs_mod = voffset - voffs_div * ch; for (k = 0; k < step; ++k) { From 692dd8ed2617f390ff53b1152a21170e886be726 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 13 Sep 2012 20:17:54 +0100 Subject: [PATCH 4/6] configure: x86: improve ebp availability check Some compilers are extra strict about register usage in main(), disallowing ebp in inline asm there while allowing it elsewhere. This change makes the test better reflect actual usage. Signed-off-by: Mans Rullgard --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2e28124348..7c377aa061 100755 --- a/configure +++ b/configure @@ -863,6 +863,9 @@ check_exec_crash(){ static void sighandler(int sig){ raise(SIGTERM); } +int foo(void){ + $code +} int main(void){ signal(SIGILL, sighandler); signal(SIGFPE, sighandler); @@ -870,7 +873,7 @@ int main(void){ #ifdef SIGBUS signal(SIGBUS, sighandler); #endif - { $code } + foo(); } EOF } From 07e87858d4fb48dae6c0dc75338eb869f41bfcf0 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Wed, 12 Sep 2012 23:24:50 +0100 Subject: [PATCH 5/6] fate: ac3: add 4.0 and downmix tests Signed-off-by: Mans Rullgard --- tests/fate/ac3.mak | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/fate/ac3.mak b/tests/fate/ac3.mak index 6abda8099c..256947c357 100644 --- a/tests/fate/ac3.mak +++ b/tests/fate/ac3.mak @@ -3,11 +3,36 @@ fate-ac3-2.0: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_2.0_192_small.ac3 fate-ac3-2.0: CMP = oneoff fate-ac3-2.0: REF = $(SAMPLES)/ac3/monsters_inc_2.0_192_small.pcm +FATE_AC3 += fate-ac3-4.0 +fate-ac3-4.0: CMD = pcm -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3 +fate-ac3-4.0: CMP = oneoff +fate-ac3-4.0: REF = $(SAMPLES)/ac3/millers_crossing_4.0.pcm + +FATE_AC3 += fate-ac3-4.0-downmix-mono +fate-ac3-4.0-downmix-mono: CMD = pcm -request_channels 1 -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3 +fate-ac3-4.0-downmix-mono: CMP = oneoff +fate-ac3-4.0-downmix-mono: REF = $(SAMPLES)/ac3/millers_crossing_4.0_mono.pcm + +FATE_AC3 += fate-ac3-4.0-downmix-stereo +fate-ac3-4.0-downmix-stereo: CMD = pcm -request_channels 2 -i $(SAMPLES)/ac3/millers_crossing_4.0.ac3 +fate-ac3-4.0-downmix-stereo: CMP = oneoff +fate-ac3-4.0-downmix-stereo: REF = $(SAMPLES)/ac3/millers_crossing_4.0_stereo.pcm + FATE_AC3 += fate-ac3-5.1 fate-ac3-5.1: CMD = pcm -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 fate-ac3-5.1: CMP = oneoff fate-ac3-5.1: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small.pcm +FATE_AC3 += fate-ac3-5.1-downmix-mono +fate-ac3-5.1-downmix-mono: CMD = pcm -request_channels 1 -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 +fate-ac3-5.1-downmix-mono: CMP = oneoff +fate-ac3-5.1-downmix-mono: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_mono.pcm + +FATE_AC3 += fate-ac3-5.1-downmix-stereo +fate-ac3-5.1-downmix-stereo: CMD = pcm -request_channels 2 -i $(SAMPLES)/ac3/monsters_inc_5.1_448_small.ac3 +fate-ac3-5.1-downmix-stereo: CMP = oneoff +fate-ac3-5.1-downmix-stereo: REF = $(SAMPLES)/ac3/monsters_inc_5.1_448_small_stereo.pcm + FATE_AC3 += fate-eac3-1 fate-eac3-1: CMD = pcm -i $(SAMPLES)/eac3/csi_miami_5.1_256_spx_small.eac3 fate-eac3-1: CMP = oneoff From 1c56cdad337a39951f26b17bdc8068d75a19ffca Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Fri, 14 Sep 2012 14:10:50 +0000 Subject: [PATCH 6/6] riff: Add SVQ3 fourcc Signed-off-by: Derek Buitenhuis --- libavformat/riff.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/riff.c b/libavformat/riff.c index f96389099c..2539b23134 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -290,6 +290,7 @@ const AVCodecTag ff_codec_bmp_tags[] = { { AV_CODEC_ID_MTS2, MKTAG('M', 'T', 'S', '2') }, { AV_CODEC_ID_CLLC, MKTAG('C', 'L', 'L', 'C') }, { AV_CODEC_ID_MSS2, MKTAG('M', 'S', 'S', '2') }, + { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') }, { AV_CODEC_ID_NONE, 0 } };