neon内嵌汇编实现一个yuv转rgb的功能stopped原因

#include "opencv2/core/core.hpp"#include "opencv2/highgui/highgui.hpp"#include #include #include "opencv2/imgproc/imgproc.hpp"using namespace cv;using namespace std;struct YUVBuf
摘要由CSDN通过智能技术生成

我在C语言里面调用内嵌的neon汇编的时候,算法运行两次后发生stopped错误,最后发现是内嵌的参数属性错误,于是我调换了参数的位置和某个参数的读写属性

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <chrono>
#include <arm_neon.h>
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;
using namespace std;

struct YUVBufferAddr{
unsigned char* Yaddr;
unsigned char* Uaddr;
unsigned char* Vaddr;
};

class q_timer { 
public: 
void start()
{
m_start = std::chrono::steady_clock::now();
}
double stop()
{
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
return  std::chrono::duration_cast<std::chrono::duration<double> >(end - m_start).count();
}
void time_display(const char *disp = "", int nr_frame = 1)
{
printf("Running time (%s) is: %5.5f Seconds.\n", disp, stop() / nr_frame);
}
void fps_display(const char *disp = "", int nr_frame = 1)
{
printf("Running time (%s) is: %5.5f frame per second.\n", disp, (double)nr_frame / stop());
}
private: 
std::chrono::steady_clock::time_point m_start;
 };


void ImgYUV2RGB24_neon(unsigned char *pu8RgbBuffer, 
unsigned char *pu8SrcYUV, 
int l32Width, 
int l32Height, 
unsigned char* u ,
unsigned char* v)
{
  asm volatile (
   "add             r4,  %2, %2 , lsl #1     \n"
   "mul             r5, r4, %3               \n"
   "sub             r5, r5, r4               \n"
   "mul             r5, %2, %3               \n"     
   "add             %4, %1, r5               \n"
   "add             %5, %4, r5, lsr #2       \n"
   "mov             r8, %2, lsr #3           \n"
   "mov             r11, %3, lsr #1          \n"
   "add             %3, %1, %2               \n"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值