ffmpeg编译出现 Error: operand type mismatch for `shr‘

在执行脚本编译ffmpeg过程当中出现以下了错误:

D:\msys2\tmp\ccMavDjR.s: Assembler messages:
D:\msys2\tmp\ccMavDjR.s:345: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:410: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:470: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:645: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:713: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:781: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:866: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:951: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1036: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1133: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1405: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1514: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1638: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:1797: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:2137: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:2242: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:2368: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:2553: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccMavDjR.s:2703: Error: operand type mismatch for `shr'

 在反复检查脚本编写,以及文件路径都没有问题过后,通过网上相关论坛的得知这是通常与编译代码时使用了不匹配的操作数;类型有关,特别是在汇编语言或低级编程中可能会出现。

论坛网站:https://fftrac-bg.ffmpeg.org/ticket/10405

新版的ffmpeg当中修复了这个问题,新版对ffmpeg源码当中 libavcodec/x86/mathops.h 文件做了一些修改。新的文件做了如下的修改

static av_always_inline av_const int MULL(int a, int b, unsigned shift)
 {
     int rt, dummy;
    if (__builtin_constant_p(shift))
     __asm__ (
         "imull %3               \n\t"
         "shrdl %4, %%edx, %%eax \n\t"
         :"=a"(rt), "=d"(dummy)
        :"a"(a), "rm"(b), "ci"((uint8_t)shift)
        :"a"(a), "rm"(b), "i"(shift & 0x1F)
     );
    else
        __asm__ (
            "imull %3               \n\t"
            "shrdl %4, %%edx, %%eax \n\t"
            :"=a"(rt), "=d"(dummy)
            :"a"(a), "rm"(b), "c"((uint8_t)shift)
        );
     return rt;
 }
 

 #define NEG_SSR32 NEG_SSR32
 static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
    if (__builtin_constant_p(s))
     __asm__ ("sarl %1, %0\n\t"
          : "+r" (a)
         : "ic" ((uint8_t)(-s))
         : "i" (-s & 0x1F)
     );
    else
        __asm__ ("sarl %1, %0\n\t"
               : "+r" (a)
               : "c" ((uint8_t)(-s))
        );
     return a;
 }
 
 #define NEG_USR32 NEG_USR32
 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
    if (__builtin_constant_p(s))
     __asm__ ("shrl %1, %0\n\t"
          : "+r" (a)
         : "ic" ((uint8_t)(-s))
         : "i" (-s & 0x1F)
     );
    else
        __asm__ ("shrl %1, %0\n\t"
               : "+r" (a)
               : "c" ((uint8_t)(-s))
        );
     return a;
 }
 

将我们 libavcodec/x86/mathops.h文件当中的对应的函数修改之后完成了编译。

文件参考地址:https://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/x86/mathops.h;h=ca7e2dffc1076f82d2cabf55eae0681adbdcfb96;hb=effadce6c756247ea8bae32dc13bb3e6f464f0eb

以上就是我在编译ffmpeg过程当中遇到的问题。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值