diff mbox

[FFmpeg-devel] mpegvideo_enc: disable optimized huffman coding with AMV or slice threads

Message ID 20170404095837.13142-1-atomnuker@gmail.com
State Accepted
Commit 03eb0515c12637dbd20c2e3ca8503d7b47cf583a
Headers show

Commit Message

Rostislav Pehlivanov April 4, 2017, 9:58 a.m. UTC
Doesn't work yet with slice threading and won't work with AMV.
---
 libavcodec/mpegvideo_enc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Tobias Rapp April 5, 2017, 8:51 a.m. UTC | #1
On 04.04.2017 11:58, Rostislav Pehlivanov wrote:
> Doesn't work yet with slice threading and won't work with AMV.
> ---
>  libavcodec/mpegvideo_enc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 71a858fc72..db241c82f0 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -399,6 +399,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          return AVERROR(EINVAL);
>      }
>
> +    if (avctx->codec_id == AV_CODEC_ID_AMV || (avctx->active_thread_type & FF_THREAD_SLICE))
> +        s->huffman = 0;
> +
>      if (s->intra_dc_precision > (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 3 : 0)) {
>          av_log(avctx, AV_LOG_ERROR, "intra dc precision too large\n");
>          return AVERROR(EINVAL);
>

In case this gets applied I think it should also be backported to 3.3.

Regards,
Tobias
Michael Niedermayer April 5, 2017, 4:52 p.m. UTC | #2
On Tue, Apr 04, 2017 at 10:58:37AM +0100, Rostislav Pehlivanov wrote:
> Doesn't work yet with slice threading and won't work with AMV.
> ---
>  libavcodec/mpegvideo_enc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 71a858fc72..db241c82f0 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -399,6 +399,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          return AVERROR(EINVAL);
>      }
>  
> +    if (avctx->codec_id == AV_CODEC_ID_AMV || (avctx->active_thread_type & FF_THREAD_SLICE))
> +        s->huffman = 0;

this should be under out_format == FMT_MJPEG or something like that

Currently all codecs which support huffman tables optims have an issue
with threads but that really is a limitation of the mjpeg implemantation

[...]
diff mbox

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 71a858fc72..db241c82f0 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -399,6 +399,9 @@  FF_ENABLE_DEPRECATION_WARNINGS
         return AVERROR(EINVAL);
     }
 
+    if (avctx->codec_id == AV_CODEC_ID_AMV || (avctx->active_thread_type & FF_THREAD_SLICE))
+        s->huffman = 0;
+
     if (s->intra_dc_precision > (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO ? 3 : 0)) {
         av_log(avctx, AV_LOG_ERROR, "intra dc precision too large\n");
         return AVERROR(EINVAL);