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

错误如下:

C 复制代码
D:\msys2\tmp\ccUxvBjQ.s: Assembler messages:
D:\msys2\tmp\ccUxvBjQ.s:345: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:410: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:470: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:645: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:713: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:781: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:866: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:951: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1036: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1133: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1405: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1514: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1638: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:1797: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:2137: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:2242: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:2368: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:2553: Error: operand type mismatch for `shr'
D:\msys2\tmp\ccUxvBjQ.s:2703: Error: operand type mismatch for `shr'
make: *** [ffbuild/common.mak:60: libavformat/adtsenc.o] Error 1
make 编译过程中的出现上面错误

分析:

这些错误是由于汇编代码中存在类型不匹配的错误,导致无法通过汇编阶段编译。

具体是因为什么我也不是太清楚,我是在Windows下的MSYS2中make编译,我猜测是gcc版本的问题,我的ffmpeg源码比较老,是2018年的,我通过MSYS2下载了 mingw64 编译工具链,其中的gcc版本为:13.2.0

解决:

将ffmpeg源码中 mathops.h 中的如下代码做一个修改。

cpp 复制代码
#define MULL MULL
static av_always_inline av_const int MULL(int a, int b, unsigned shift)
{
    int rt, dummy;
    __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)
    );
    return rt;
}
cpp 复制代码
#define NEG_SSR32 NEG_SSR32
static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
    __asm__ ("sarl %1, %0\n\t"
         : "+r" (a)
        //  : "ic" ((uint8_t)(-s))
         : "i" (-s & 0x1F)
    );
    return a;
}

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

参考链接:https://fftrac-bg.ffmpeg.org/ticket/10405

相关推荐
aqi002 小时前
FFmpeg开发笔记(七十二)Linux给FFmpeg集成MPEG-5视频编解码器EVC
android·ffmpeg·音视频·流媒体
不太会编程的IT男21 小时前
在 Jetson Orin 开发套件上使用 Hardware Encoder / Decoder 构建 FFmpeg
ffmpeg·视频编解码·h.264
m0_687399841 天前
写一个Ununtu C++ 程序,调用ffmpeg API, 来判断一个数字电影的视频文件mxf 是不是Jpeg2000?
开发语言·c++·ffmpeg
aqi001 天前
FFmpeg开发笔记(七十一)使用国产的QPlayer2实现双播放器观看视频
android·ffmpeg·音视频·流媒体
Java患者·1 天前
【小白】linux安装ffmpeg | java转码 【超详细】
ffmpeg
suifen_1 天前
RK平台ffmpeg支持硬件编解码
ffmpeg
feiyangqingyun1 天前
全网唯一/Qt结合ffmpeg实现手机端采集摄像头推流到rtsp或rtmp/可切换前置后置摄像头/指定分辨率帧率
qt·智能手机·ffmpeg
melonbo2 天前
使用FFmpeg将H.264码流封装为MP4
ffmpeg·音视频·h.264
aqi002 天前
FFmpeg开发笔记(七十七)Android的开源音视频剪辑框架RxFFmpeg
android·ffmpeg·音视频·流媒体
慢行的骑兵2 天前
Android音视频探索之旅 | CMake基础语法 && 创建支持Ffmpeg的Android项目
ffmpeg·音视频