From 2c9639227766fea9a8109f82378b312a8d32a1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 6 Dec 2012 23:42:36 +0200 Subject: [PATCH 1/5] avpicture: Don't assume a valid pix fmt in avpicture_get_size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When called from the v4l2 input device, pix_fmt can be AV_PIX_FMT_NONE (for jpeg formats). Before 50ba57e0, this wasn't an issue for avpicture_get_size, but after that commit, this lead to crashes. Signed-off-by: Martin Storsjö --- libavcodec/avpicture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/avpicture.c b/libavcodec/avpicture.c index ec4e748ac8..259fd8e690 100644 --- a/libavcodec/avpicture.c +++ b/libavcodec/avpicture.c @@ -88,6 +88,8 @@ int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height) AVPicture dummy_pict; int ret; + if (!desc) + return AVERROR(EINVAL); if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) return ret; if (desc->flags & PIX_FMT_PSEUDOPAL) From 92dad6687f59a6e599834218626e524eb8a5bdae Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 6 Dec 2012 23:51:01 +0000 Subject: [PATCH 2/5] arm: fix use of uninitialised value in ff_fft_fixed_init_arm() When initialising an FFTContext for a plain FFT, mdct_bits is not set and can contain a garbage value. Since nbits is always valid and for MDCT operation is mdct_bits - 2 checking this instead avoids using an uninitialised value while having the same effect. Signed-off-by: Mans Rullgard --- libavcodec/arm/fft_fixed_init_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/arm/fft_fixed_init_arm.c b/libavcodec/arm/fft_fixed_init_arm.c index 5601ba1a5c..50532f2573 100644 --- a/libavcodec/arm/fft_fixed_init_arm.c +++ b/libavcodec/arm/fft_fixed_init_arm.c @@ -36,7 +36,7 @@ av_cold void ff_fft_fixed_init_arm(FFTContext *s) s->fft_calc = ff_fft_fixed_calc_neon; #if CONFIG_MDCT - if (!s->inverse && s->mdct_bits >= 5) { + if (!s->inverse && s->nbits >= 3) { s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; s->mdct_calc = ff_mdct_fixed_calc_neon; s->mdct_calcw = ff_mdct_fixed_calcw_neon; From 380232fac3a6ca6f661f3d14e31308d3059c5c72 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 5 Dec 2012 06:34:02 +0100 Subject: [PATCH 3/5] snow: fix build after 594d4d5df3c70404168701dd5c90b7e6e5587793 --- libavcodec/snow.c | 5 +++-- libavcodec/snowenc.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index fce45621c6..b9dab45c5f 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -24,6 +24,7 @@ #include "avcodec.h" #include "dsputil.h" #include "dwt.h" +#include "internal.h" #include "snow.h" #include "snowdata.h" @@ -458,7 +459,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ for(j=0; jff_get_buffer(s->avctx, &s->mconly_picture)) < 0) { + if ((ret = ff_get_buffer(s->avctx, &s->mconly_picture)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -623,7 +624,7 @@ int ff_snow_frame_start(SnowContext *s){ } s->current_picture.reference= 1; - if(s->ff_get_buffer(s->avctx, &s->current_picture) < 0){ + if(ff_get_buffer(s->avctx, &s->current_picture) < 0){ av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index e60cb65297..f93c53f145 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -23,6 +23,7 @@ #include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" +#include "internal.h" #include "dwt.h" #include "snow.h" @@ -239,7 +240,7 @@ static av_cold int encode_init(AVCodecContext *avctx) ff_set_cmp(&s->dsp, s->dsp.me_cmp, s->avctx->me_cmp); ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp); - s->ff_get_buffer(s->avctx, &s->input_picture); + ff_get_buffer(s->avctx, &s->input_picture); if(s->avctx->me_method == ME_ITER){ int i; From c29d49c1b3c8ad15955bf0638b51ea752df5ea37 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 1 Dec 2012 23:08:41 +0000 Subject: [PATCH 4/5] dct-test: arm: indicate required cpu features for optimised funcs Signed-off-by: Mans Rullgard --- libavcodec/dct-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c index c480aeccf1..3ce0270006 100644 --- a/libavcodec/dct-test.c +++ b/libavcodec/dct-test.c @@ -120,13 +120,13 @@ static const struct algo idct_tab[] = { { "INT-ARM", ff_j_rev_dct_arm, MMX_PERM }, #endif #if HAVE_ARMV5TE - { "SIMPLE-ARMV5TE", ff_simple_idct_armv5te,NO_PERM }, + { "SIMPLE-ARMV5TE", ff_simple_idct_armv5te,NO_PERM, AV_CPU_FLAG_ARMV5TE }, #endif #if HAVE_ARMV6 - { "SIMPLE-ARMV6", ff_simple_idct_armv6, MMX_PERM }, + { "SIMPLE-ARMV6", ff_simple_idct_armv6, MMX_PERM, AV_CPU_FLAG_ARMV6 }, #endif #if HAVE_NEON - { "SIMPLE-NEON", ff_simple_idct_neon, PARTTRANS_PERM }, + { "SIMPLE-NEON", ff_simple_idct_neon, PARTTRANS_PERM, AV_CPU_FLAG_NEON }, #endif #if ARCH_ALPHA From 9ebd45c2d58ad9241ad09718679f0cf7fb57da52 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Mon, 3 Dec 2012 19:21:42 +0000 Subject: [PATCH 5/5] configure: do not bypass cpuflags section if --cpu not given This will allow arch-specific ways of determining the target variant when none is specified on the command line. Signed-off-by: Mans Rullgard --- configure | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/configure b/configure index fbfafe032b..0c13619885 100755 --- a/configure +++ b/configure @@ -2524,10 +2524,7 @@ is_in $arch $ARCH_LIST || warn "unknown architecture $arch" enable $arch # Add processor-specific flags -if test "$cpu" = generic; then - : do nothing - -elif enabled aarch64; then +if enabled aarch64; then case $cpu in armv*) @@ -2680,8 +2677,10 @@ elif enabled x86; then fi -add_cflags $cpuflags -add_asflags $cpuflags +if [ "$cpu" != generic ]; then + add_cflags $cpuflags + add_asflags $cpuflags +fi # compiler sanity check check_exec <