|
在rk3588正常启用librga库,感觉CPU还是蛮高(18%左右),请问流程哪里不对吗?代码如下:- //初始化
- char *outBuff = new char[1024*1024*12];
- char *g_dst_buf = new char[1024*1024*12];
- rga_buffer_t g_src_img;
- rga_buffer_t g_dst_img;
- rga_buffer_handle_t g_src_handle;
- rga_buffer_handle_t g_dst_handle;
- //每一帧的处理
- g_src_handle = 0;
- g_dst_handle = 0;
- memset(&g_src_img, 0, sizeof(g_src_img));
- memset(&g_dst_img, 0, sizeof(g_dst_img));
- memset(g_dst_buf, 0x80, 1024*1024*12);
- //frame为解码后的yuv 帧数据 MppFrame frame
- RK_U32 width = mpp_frame_get_width(frame);
- RK_U32 height = mpp_frame_get_height(frame);
- RK_U32 h_stride = mpp_frame_get_hor_stride(frame);
- RK_U32 v_stride = mpp_frame_get_ver_stride(frame);
- MppBuffer buffer = mpp_frame_get_buffer(frame);
- int size = mpp_frame_get_buf_size(frame);
- RK_U8 *base = NULL;
- //handle值正常
- g_src_handle = importbuffer_virtualaddr((char*)mpp_buffer_get_ptr(buffer), size);
- g_dst_handle = importbuffer_virtualaddr(g_dst_buf, 1024*1024*12);
- if (g_src_handle == 0 || g_dst_handle == 0)
- {
- printf("importbuffer failed!\n");
- return ;
- }
- g_src_img = wrapbuffer_handle(g_src_handle, width, height, RK_FORMAT_YCbCr_420_SP);
- g_dst_img = wrapbuffer_handle(g_dst_handle, width, height, RK_FORMAT_YCbCr_420_SP);
- printf("dest handle:%d handle:%d fd:%d vir:%p phy:%p\n", g_dst_handle, g_dst_img.handle, g_dst_img.fd, g_dst_img.vir_addr, g_dst_img.phy_addr);
- printf("src handle:%d handle:%d fd:%d vir:%p phy:%p\n", g_src_handle, g_src_img.handle, g_src_img.fd, g_src_img.vir_addr, g_src_img.phy_addr);
-
- IM_STATUS checkRet = imcheck(g_src_img, g_dst_img, {}, {});
- if (IM_STATUS_NOERROR != checkRet)
- {
- printf("%d, check error! %s", __LINE__, imStrError((IM_STATUS)checkRet));
- return;
- }
- //执行成功
- IM_STATUS retStatus = imcopy(g_src_img, g_dst_img);
- if (retStatus == IM_STATUS_SUCCESS) {
- printf("imcopy running success!\n");
- } else {
- printf("imcopy running failed, %s\n", imStrError((IM_STATUS)retStatus));
- }
- //将yuv数据拷贝到目的地址
- memcpy(outBuff, g_dst_buf, size);
- if (g_src_handle)
- releasebuffer_handle(g_src_handle);
- if (g_dst_handle)
- releasebuffer_handle(g_dst_handle);
- //结束一帧YUV的数据处理
板子的CPU信息如下:- Architecture: aarch64
- CPU op-mode(s): 32-bit, 64-bit
- Byte Order: Little Endian
- CPU(s): 8
- On-line CPU(s) list: 0-7
- Thread(s) per core: 1
- Core(s) per socket: 2
- Socket(s): 3
- Vendor ID: ARM
- Model: 0
- Model name: Cortex-A55
- Stepping: r2p0
- CPU max MHz: 2304.0000
- CPU min MHz: 408.0000
|
|