在执行脚本编译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文件当中的对应的函数修改之后完成了编译。
以上就是我在编译ffmpeg过程当中遇到的问题。