|
6#
楼主 |
发表于 2023-9-6 16:53:35
|
只看该作者
本帖最后由 雁南飞 于 2023-9-6 16:57 编辑
大神你好,我把解码后yuv的数据直接写文件是可以用工具播放出来,我把librga的库加了进去,经过rga拷贝后写文件就不行了,大概率流程是有问题的,我参考sample中rag_copy_demo.cpp,实现了以下代码,代码如下:
- 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, width*height*3);
-
- g_src_handle = importbuffer_virtualaddr((char*)mpp_buffer_get_ptr(buffer), width*height*3);
- g_dst_handle = importbuffer_virtualaddr(g_dst_buf, width*height*3);
- 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_RGB_888);
- g_dst_img = wrapbuffer_handle(g_dst_handle, width, height, RK_FORMAT_RGB_888);
- 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;
- }
- printf("dest handle:%d handle:%d fd:%d vir:%x phy:%x\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:%x phy:%x\n", g_src_handle, g_src_img.handle, g_src_img.fd, g_src_img.vir_addr, g_src_img.phy_addr);
- 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));
- }
- //这里对g_dst_buf进行操作,写文件之类
- //......
- if (g_src_handle)
- releasebuffer_handle(g_src_handle);
- if (g_dst_handle)
- releasebuffer_handle(g_dst_handle);
其中,printf打印的g_dst_handle、g_src_handle均为-1,fd,vir__addr, phy_addr这些值均为0,看着是不正常的。
|
|