本文整理汇总了C++中PVideoFrame::IsWritable方法的典型用法代码示例。如果您正苦于以下问题:C++ PVideoFrame::IsWritable方法的具体用法?C++ PVideoFrame::IsWritable怎么用?C++ PVideoFrame::IsWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVideoFrame
的用法示例。
在下文中一共展示了PVideoFrame::IsWritable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFrame
PVideoFrame __stdcall Null::GetFrame(int n, IScriptEnvironment* env)
{
PVideoFrame src = child->GetFrame(n, env);
BYTE * foo = new BYTE[256];
BYTE * bar = new BYTE[256];
MemDebug md;
md.randomFill(foo, 8, 8, 8);
BitBlt(bar, 8, foo, 8, 8, 8);
md.reset();
int i = md.randomCheck(bar, 9, 8, 8);
if (i)
env->ThrowError("bug found");
delete [] foo;
delete [] bar;
if (!lstrcmpi(copy, "makewritable"))
{
env->MakeWritable(&src);
return src;
}
// TODO: no support for planar formats!
if (!lstrcmpi(copy, "memcopy"))
{
PVideoFrame dst = env->NewVideoFrame(child->GetVideoInfo(), 16);
if (dst->IsWritable() == false)
env->ThrowError("new frame not writable"); // honestly don't know whether to expect this condition
memcpy( dst->GetWritePtr(), src->GetReadPtr(), src->GetPitch() * src->GetHeight() );
return dst;
}
if (!lstrcmpi(copy, "bitblt"))
{
PVideoFrame dst = env->NewVideoFrame(child->GetVideoInfo(), 16);
if (dst->IsWritable() == false)
env->ThrowError("new frame not writable"); // honestly don't know whether to expect this condition
BitBlt( dst->GetWritePtr(), src->GetPitch(), src->GetReadPtr(), src->GetPitch(),
src->GetRowSize(), src->GetHeight() );
return dst;
}
//if (!lstrcmpi(copy, "none"))
// do nothing
return src;
}
示例2: SafeNewVideoFrame
PVideoFrame SafeNewVideoFrame(IScriptEnvironment* env, const VideoInfo& vi, int align)
{
ensure_initialized();
{
CSLockAcquire lock(*_lock);
PVideoFrame frame = env->NewVideoFrame(vi, align);
assert(frame->IsWritable());
return frame;
}
}
示例3: GetFrame
PVideoFrame __stdcall MergeLuma::GetFrame(int n, IScriptEnvironment* env)
{
PVideoFrame src = child->GetFrame(n, env);
if (weight<0.0039f) return src;
PVideoFrame luma = clip->GetFrame(n, env);
if (vi.IsYUY2()) {
env->MakeWritable(&src);
BYTE* srcp = src->GetWritePtr();
const BYTE* lumap = luma->GetReadPtr();
int isrc_pitch = src->GetPitch();
int iluma_pitch = luma->GetPitch();
int h = src->GetHeight();
int w = src->GetRowSize();
if (weight<0.9961f)
{
if ((env->GetCPUFlags() & CPUF_SSE2) && IsPtrAligned(srcp, 16) && IsPtrAligned(lumap, 16))
{
weighted_merge_luma_yuy2_sse2(srcp, lumap, isrc_pitch, iluma_pitch, w, h, (int)(weight*32768.0f), 32768-(int)(weight*32768.0f));
}
else
#ifdef X86_32
if (env->GetCPUFlags() & CPUF_MMX)
{
weighted_merge_luma_yuy2_mmx(srcp, lumap, isrc_pitch, iluma_pitch, w, h, (int)(weight*32768.0f), 32768-(int)(weight*32768.0f));
}
else
#endif
{
weighted_merge_luma_yuy2_c(srcp, lumap, isrc_pitch, iluma_pitch, w, h, (int)(weight*32768.0f), 32768-(int)(weight*32768.0f));
}
}
else
{
if ((env->GetCPUFlags() & CPUF_SSE2) && IsPtrAligned(srcp, 16) && IsPtrAligned(lumap, 16))
{
replace_luma_yuy2_sse2(srcp,lumap,isrc_pitch,iluma_pitch,w,h);
}
else
#ifdef X86_32
if (env->GetCPUFlags() & CPUF_MMX)
{
replace_luma_yuy2_mmx(srcp,lumap,isrc_pitch,iluma_pitch,w,h);
}
else
#endif
{
replace_luma_yuy2_c(srcp,lumap,isrc_pitch,iluma_pitch,w,h);
}
}
return src;
} // Planar
if (weight>0.9961f) {
const VideoInfo& vi2 = clip->GetVideoInfo();
if (luma->IsWritable() && vi.IsSameColorspace(vi2)) {
if (luma->GetRowSize(PLANAR_U)) {
luma->GetWritePtr(PLANAR_Y); //Must be requested BUT only if we actually do something
env->BitBlt(luma->GetWritePtr(PLANAR_U),luma->GetPitch(PLANAR_U),src->GetReadPtr(PLANAR_U),src->GetPitch(PLANAR_U),src->GetRowSize(PLANAR_U),src->GetHeight(PLANAR_U));
env->BitBlt(luma->GetWritePtr(PLANAR_V),luma->GetPitch(PLANAR_V),src->GetReadPtr(PLANAR_V),src->GetPitch(PLANAR_V),src->GetRowSize(PLANAR_V),src->GetHeight(PLANAR_V));
}
return luma;
}
else { // avoid the cost of 2 chroma blits
PVideoFrame dst = env->NewVideoFrame(vi);
env->BitBlt(dst->GetWritePtr(PLANAR_Y),dst->GetPitch(PLANAR_Y),luma->GetReadPtr(PLANAR_Y),luma->GetPitch(PLANAR_Y),luma->GetRowSize(PLANAR_Y),luma->GetHeight(PLANAR_Y));
if (src->GetRowSize(PLANAR_U) && dst->GetRowSize(PLANAR_U)) {
env->BitBlt(dst->GetWritePtr(PLANAR_U),dst->GetPitch(PLANAR_U),src->GetReadPtr(PLANAR_U),src->GetPitch(PLANAR_U),src->GetRowSize(PLANAR_U),src->GetHeight(PLANAR_U));
env->BitBlt(dst->GetWritePtr(PLANAR_V),dst->GetPitch(PLANAR_V),src->GetReadPtr(PLANAR_V),src->GetPitch(PLANAR_V),src->GetRowSize(PLANAR_V),src->GetHeight(PLANAR_V));
}
return dst;
}
} else { // weight <= 0.9961f
env->MakeWritable(&src);
BYTE* srcpY = (BYTE*)src->GetWritePtr(PLANAR_Y);
BYTE* lumapY = (BYTE*)luma->GetReadPtr(PLANAR_Y);
int src_pitch = src->GetPitch(PLANAR_Y);
int luma_pitch = luma->GetPitch(PLANAR_Y);
int src_width = src->GetRowSize(PLANAR_Y);
int src_height = src->GetHeight(PLANAR_Y);
merge_plane(srcpY, lumapY, src_pitch, luma_pitch, src_width, src_height, weight, env);
}
return src;
}