工具/软件:Linux
您好!
我为我们的一位客户发布此帖子。
"
我正在从 AM5728的 VIP 端口捕获 YUYV 格式摄像机帧。 我将这些帧提交给 GC320、目的是将它们的格式转换为 RGBA 帧。 Galcore 驱动程序版本为5.0.11.33433。 我将 V4L2 DMABUF 直接传递到 GC320、为了进行调试、我将在 GC320呈现前后保存原始 YUV 文件。 输入帧为640x480 YUV、输出为640x480 RGBA。 我已附加以下图片。 左侧的图像是来自相机的 YUYV (由于 Ubuntu 的图像查看器而被编辑),右侧的图像是由 GC320转换的 RGBA 帧。 很明显、GC320的"种类"转换图像-上半部分看起来不错。 但是、图像的下半部分是某种伪影。 这让我相信我使用 GC320 API 进行转换的配置是错误的。 我在 Arago/Yocto ti-gc320-test 样片中研究了 GC320示例、并将我的 GC320转换代码放在下面-如果能帮助理解它的错误、我将不胜感激。
"
(将在单独的帖子中发送附件)
GC320格式函数:
/**
* gc320渲染格式转换 YUVtoRGBA()
*用途:执行渲染周期以将帧从 YUYV 转换为 RGBA
*
*@返回 bool 成功或失败
*
gctBOOL Gc320::渲染格式转换 YUVtoRGBA(){
gceSTATUS 状态;
//目标矩形
gcsRECT targetRect;
gcsRECT sourceRect;
//目标矩形
targetRect.Left = 0;
targetRect.top = 0;
targetRect.right = frame_width;//这些会影响输出图像(目标矩形)
targetRect.bottom = frame_height;//这些会影响输出图像(目标矩形)
//源矩形
sourceRect.left = 0;
sourceRect.top = 0;
sourceRect.right = frame_width;//这些会影响输入图像(源矩形)
sourceRect.bottom = frame_height;//这些会影响输入图像(源矩形)
QElapsedTimer 计时器;
timer.restart();
//为目标矩形设置剪切矩形
gcmONERROR (gco2D_SetClipping (m_Engine2d、&targetRect));
//设置内核大小
gcmONERROR (gco2D_SetKernelSize (m_Engine2d、1、1));
gcmONERROR (gco2D_FilterBlitEx2 (m_Engine2d、
(gctuint32_ptr)&m_SrcPhysAddr、1、
(gctuint32_ptr)&m_SrcStride、1、
gcvLINEAR、m_SrcFormat、gcvSURF_0_degree、
m_SrcWidth、m_SrcHeight、(gcsRECT_PTR)&sourceRect、
(gctuint32_ptr)&m_DstPhysAddr、1、(gctuint32_ptr)&m_DstStride、1、
gcvLINEAR、m_DstFormat、gcvSURF_0_degree、
m_DstWidth、m_DstHeight、(gcsRECT_PTR)&targetRect、
gcvNULL));
gcmONERROR (gcode_Flush (m_Engine2d));
//将当前命令缓冲区提交到硬件,并等待硬件完成
gcmONERROR (gcHAL_commit (m_hal、gcvTRUE));
qDebug()<<"Rendered:"<< timer.Elapsed();
#if 1.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//保存 RGB24
{
//转换-depth 8 -size 640x480+0 RGBA:gc320.RGB gc320.png;eog gc320.png
qDebug()<< QString ("将帧写入到/home/root/gc320.rgb);
QString fileName = QString ("/home/root/gc320.rgb);
QFile d (filename);
d. open (QFile::WriteOnly);
QDataStream DS (&d);
qDebug()<<"正在写入数据...";
ds.writeRawData (((const char*) m_DstVirtAddr、frame_width*frame_height*4);
D.flush();
D.Close();
SYNC();
qDebug()<<"Done writing";
}
睡眠(100);
#endif
返回 gcvTRUE;
onerror:
fprintf (stderr、"%s"(%d)失败:%s\n"、__function__、__line__、gcos_DebugStatus2Name (status);
返回 gcvFALSE;
}
Linux 内核版本:
uname -r
4.4.41.
GC320 Galcore 驱动程序版本:
CD /lib/modules/4.4.41/extra;insmod galcore.ko baseAddress=0x80000
000 physSize=0x80000000
[8014.626644] GC320 IRQ:304
[8014.629403] Galcore 版本5.0.11.33433
此致、
-Gunter