本文整理汇总了C++中VideoFrame::toRgb方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoFrame::toRgb方法的具体用法?C++ VideoFrame::toRgb怎么用?C++ VideoFrame::toRgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoFrame
的用法示例。
在下文中一共展示了VideoFrame::toRgb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equal
// ######################################################################
bool operator==(const GenericFrame& f1, const GenericFrame& f2)
{
if (f1.nativeType() == f2.nativeType())
{
switch (f1.nativeType())
{
case GenericFrame::NONE: return true;
case GenericFrame::RGB_U8: return f1.asRgbU8() == f2.asRgbU8();
case GenericFrame::RGBD: return ((f1.asRgbU8() == f2.asRgbU8()) && (f1.asGrayU16() == f2.asGrayU16()));
case GenericFrame::RGB_F32: return f1.asRgbF32() == f2.asRgbF32();
case GenericFrame::GRAY_U8: return f1.asGrayU8() == f2.asGrayU8();
case GenericFrame::GRAY_F32: return f1.asGrayF32() == f2.asGrayF32();
case GenericFrame::VIDEO:
{
const VideoFrame v1 = f1.asVideo();
const VideoFrame v2 = f2.asVideo();
if (v1.getMode() == v2.getMode())
return std::equal(v1.getBuffer(),
v1.getBuffer() + v1.getBufSize(),
v2.getBuffer());
else
return v1.toRgb() == v2.toRgb();
}
case GenericFrame::RGB_U16: return f1.asRgbU16() == f2.asRgbU16();
case GenericFrame::GRAY_U16: return f1.asGrayU16() == f2.asGrayU16();
}
}
return f1.asRgbF32() == f2.asRgbF32();
}
示例2: writeVideoFrame
void FfmpegEncoder::writeVideoFrame(const VideoFrame& frame)
{
GVX_TRACE(__PRETTY_FUNCTION__);
if (frame.getDims().w() != itsContext.width ||
frame.getDims().h() != itsContext.height)
{
LFATAL("wrong size mpeg output frame "
"(expected %dx%d, got %dx%d)",
itsContext.width, itsContext.height,
frame.getDims().w(), frame.getDims().h());
}
AVFrame picture;
#if defined(INVT_FFMPEG_HAS_DEFAULTS_FUNCTIONS)
avcodec_get_frame_defaults(&picture);
#else
{
AVFrame* tmp = avcodec_alloc_frame();
memcpy(&picture, tmp, sizeof(AVFrame));
free(tmp);
}
#endif
if (convertVideoFrameToAVFrame(frame,
itsContext.pix_fmt,
&picture))
{
this->writeRawFrame(&picture);
}
else
{
// OK, we couldn't do a direct conversion from
// VideoFrame->AVFrame (probably the pixel formats didn't
// match), so let's just fall back to RGB instead:
this->writeRGB(frame.toRgb());
}
}