On 04.12.2014 12:42, Clément Bœsch wrote:
On Thu, Dec 04, 2014 at 12:39:29AM +0100, Lukasz Marek wrote:
On 24.11.2014 01:17, Lukasz Marek wrote:
libxvidcore calculate number of threads basing on video height.
If height is small enough it allocates 0 bytes long memory and
writes to it.
Setting thread_count to 0 uses 1 thread and skips bugged code.
Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com>
---
libavcodec/libxvid.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 70d52b9..efe7b8a 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -471,6 +471,17 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
xvid_enc_create.num_zones = 0;
xvid_enc_create.num_threads = avctx->thread_count;
+ /* workaround for a bug in libxvidcore */
+ if (avctx->height < 18) {
+ if (avctx->thread_count < 2) {
+ xvid_enc_create.num_threads = 0;
+ } else {
+ av_log(avctx, AV_LOG_ERROR,
+ "Too small height for threads > 1.");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ }
xvid_enc_create.plugins = plugins;
xvid_enc_create.num_plugins = 0;
Please comment this patch. xvid accepted fix for it.
Can you add a version check, or at least a comment saying what versions
are affected by this?
Added a check. it was introduced in 1.3.0 and still present in 1.3.3.
Next should be fixed.
>From 1bfe00284fdb3dba072147df1efce03c7d29dd35 Mon Sep 17 00:00:00 2001
From: Lukasz Marek <lukasz.m.lu...@gmail.com>
Date: Mon, 24 Nov 2014 01:12:06 +0100
Subject: [PATCH] lavc/libxvid: workaround for bug in libxvidcore
libxvidcore calculate number of threads basing on video height.
If height is small enough it allocates 0 bytes long memory and
writes to it.
Setting thread_count to 0 uses 1 thread and skips bugged code.
Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com>
---
libavcodec/libxvid.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 046d2f7..64572da 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -471,6 +471,19 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
xvid_enc_create.num_zones = 0;
xvid_enc_create.num_threads = avctx->thread_count;
+#if (XVID_VERSION <= 0x010303) && (XVID_VERSION >= 0x010300)
+ /* workaround for a bug in libxvidcore */
+ if (avctx->height <= 16) {
+ if (avctx->thread_count < 2) {
+ xvid_enc_create.num_threads = 0;
+ } else {
+ av_log(avctx, AV_LOG_ERROR,
+ "Too small height for threads > 1.");
+ ret = AVERROR(EINVAL);
+ goto fail;
+ }
+ }
+#endif
xvid_enc_create.plugins = plugins;
xvid_enc_create.num_plugins = 0;
--
1.9.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel