[FFmpeg-devel,v2,3/3] lavc/libdavs2: add disable_avx into decoder parameter

Submitted by hwrenx on Nov. 18, 2018, 7:19 a.m.

Details

Message ID 1542525544-8034-3-git-send-email-hwrenx@qq.com
State New
Headers show

Commit Message

hwrenx Nov. 18, 2018, 7:19 a.m.
From: hwrenx <hwrenx@126.com>

Signed-off-by: hwrenx <hwrenx@126.com>
---
 libavcodec/libdavs2.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Carl Eugen Hoyos Nov. 19, 2018, 5:18 p.m.
2018-11-18 8:19 GMT+01:00, hwrenx <hwrenx@qq.com>:
> From: hwrenx <hwrenx@126.com>
>
> Signed-off-by: hwrenx <hwrenx@126.com>
> ---
>  libavcodec/libdavs2.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
> index cadf995..8cef49d 100644
> --- a/libavcodec/libdavs2.c
> +++ b/libavcodec/libdavs2.c
> @@ -42,11 +42,14 @@ typedef struct DAVS2Context {
>  static av_cold int davs2_init(AVCodecContext *avctx)
>  {
>      DAVS2Context *cad = avctx->priv_data;
> +    int cpu_flags = av_get_cpu_flags();
>
>      /* init the decoder */
>      cad->param.threads      = avctx->thread_count;
>      cad->param.info_level   = 0;
>      cad->decoder            = davs2_decoder_open(&cad->param);
> +    cad->param.disable_avx  = !(cpu_flags & AV_CPU_FLAG_AVX &&
> +                                cpu_flags & AV_CPU_FLAG_AVX2);

Please merge this with the patch changing minimal version in configure.

Carl Eugen

Patch hide | download patch | download mbox

diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
index cadf995..8cef49d 100644
--- a/libavcodec/libdavs2.c
+++ b/libavcodec/libdavs2.c
@@ -42,11 +42,14 @@  typedef struct DAVS2Context {
 static av_cold int davs2_init(AVCodecContext *avctx)
 {
     DAVS2Context *cad = avctx->priv_data;
+    int cpu_flags = av_get_cpu_flags();
 
     /* init the decoder */
     cad->param.threads      = avctx->thread_count;
     cad->param.info_level   = 0;
     cad->decoder            = davs2_decoder_open(&cad->param);
+    cad->param.disable_avx  = !(cpu_flags & AV_CPU_FLAG_AVX &&
+                                cpu_flags & AV_CPU_FLAG_AVX2);
 
     if (!cad->decoder) {
         av_log(avctx, AV_LOG_ERROR, "decoder created error.");