UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

取消
显示结果 
搜索替代 
您的意思是: 
Xilinx Employee
Xilinx Employee
288 次查看
注册日期: ‎02-15-2012

【分享】 抽取和保存解码后的YUV帧


Xilinx MPSoC 集成了视频编解码器。有时候,需要检查解码后的YUV视频数据。但是YUV视频数据很大,很难全部保存。
一个解决办法时,只抽取需要关心的视频部分的一部分帧来保存,比如从1000帧开始,每10帧保存一帧。

在vcu-ctrl-sw\exe_decoder\Main.cpp里的函数Display::ProcessNotCompressedFrame()里,添加下列代码,可以实现这样的功能。

#if 1
iSkipFramesYUVOutput = 41000;
iSkipFramesRateYUVOutput = 10;
iFramesCountMaxYUVOutput = 100;

if( uFrameCount > iSkipFramesYUVOutput )
{
//cout<<"Prepare 2 to write No."<<uFrameCount<<" frame."<<endl;
if( 0 == (uFrameCount%iSkipFramesRateYUVOutput) )
{
//cout<<"Prepare 3 to write No."<<uFrameCount<<" frame."<<endl;
if( iFramesCountYUVOutput < iFramesCountMaxYUVOutput )
{
//cout<<"Prepare 4 to write No."<<uFrameCount<<" frame."<<endl;
auto uSize = GetPictureSizeInSamples(pYuvMeta) * iSizePix;
cout<<"Write No."<<uFrameCount<<" frame to YUV file, "<<uSize<<" bytes."<<endl;
YuvFile.write((const char*)AL_Buffer_GetData(YuvBuffer), uSize);
}
else
{
throw runtime_error("Exceed output frames limit.");
}
iFramesCountYUVOutput++;
}
}
#else
auto uSize = GetPictureSizeInSamples(pYuvMeta) * iSizePix;
cout<<"Write No."<<uFrameCount<<" frame to YUV file, "<<uSize<<" bytes."<<endl;
YuvFile.write((const char*)AL_Buffer_GetData(YuvBuffer), uSize);
#endif

0 项奖励
1 条回复1
Moderator
Moderator
253 次查看
注册日期: ‎05-27-2018

回复: 【分享】 抽取和保存解码后的YUV帧

谢谢Hank的分享!
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励