From bf20cdbd86b13d474babecfea13682cc7c9ff2c7 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Tue, 21 May 2013 10:40:01 +0200 Subject: [PATCH 1/2] mpeg12: skip frames consistently The decoder did not start predicted frames with missing references but called the end of frame handling on them anyway. This caused an assertion in the VA API HW accelorator since it tried to render a picture with uninitialized buffers. --- libavcodec/mpeg12dec.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 67518640b0..d7d893b10a 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2059,14 +2059,14 @@ static int decode_chunks(AVCodecContext *avctx, const uint8_t *buf_ptr = buf; const uint8_t *buf_end = buf + buf_size; int ret, input_size; - int last_code = 0; + int last_code = 0, skip_frame = 0; for (;;) { /* find next start code */ uint32_t start_code = -1; buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &start_code); if (start_code > 0x1ff) { - if (s2->pict_type != AV_PICTURE_TYPE_B || avctx->skip_frame <= AVDISCARD_DEFAULT) { + if (!skip_frame) { if (HAVE_THREADS && (avctx->active_thread_type & FF_THREAD_SLICE)) { int i; @@ -2210,20 +2210,27 @@ static int decode_chunks(AVCodecContext *avctx, if (s2->last_picture_ptr == NULL) { /* Skip B-frames if we do not have reference frames and gop is not closed */ if (s2->pict_type == AV_PICTURE_TYPE_B) { - if (!s->closed_gop) + if (!s->closed_gop) { + skip_frame = 1; break; + } } } if (s2->pict_type == AV_PICTURE_TYPE_I) s->sync=1; if (s2->next_picture_ptr == NULL) { /* Skip P-frames if we do not have a reference frame or we have an invalid header. */ - if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) break; + if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { + skip_frame = 1; + break; + } } if ((avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type != AV_PICTURE_TYPE_I) || - avctx->skip_frame >= AVDISCARD_ALL) + avctx->skip_frame >= AVDISCARD_ALL) { + skip_frame = 1; break; + } if (!s->mpeg_enc_ctx_allocated) break; @@ -2241,6 +2248,7 @@ static int decode_chunks(AVCodecContext *avctx, } if (s2->first_slice) { + skip_frame = 0; s2->first_slice = 0; if (mpeg_field_start(s2, buf, buf_size) < 0) return -1; From 9f30fb5a773d59298d8d45c741b3fd971d84c97b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 28 May 2013 23:39:21 +0300 Subject: [PATCH 2/2] configure: Don't pass -mthumb or -march= to MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The modern MSVC for ARM always builds for thumb, and it can't be disabled. Also just use the default arch instead of trying to map the -march parameter to MSVC's -arch parameter (which only takes the values ARMv7VE and VFPv4). Signed-off-by: Martin Storsjö --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index e890c155e9..48b405f015 100755 --- a/configure +++ b/configure @@ -2354,6 +2354,8 @@ msvc_flags(){ -fno-common) ;; -fno-signed-zeros) ;; -fPIC) ;; + -mthumb) ;; + -march=*) ;; -lz) echo zlib.lib ;; -lavifil32) echo vfw32.lib ;; -lavicap32) echo vfw32.lib user32.lib ;;