本文整理汇总了C++中PVideoFrame::GetWritePtr方法的典型用法代码示例。如果您正苦于以下问题:C++ PVideoFrame::GetWritePtr方法的具体用法?C++ PVideoFrame::GetWritePtr怎么用?C++ PVideoFrame::GetWritePtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVideoFrame
的用法示例。
在下文中一共展示了PVideoFrame::GetWritePtr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFrame
PVideoFrame __stdcall MergeAll::GetFrame(int n, IScriptEnvironment* env)
{
if (weight<0.0039f) return child->GetFrame(n, env);
if (weight>0.9961f) return clip->GetFrame(n, env);
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame src2 = clip->GetFrame(n, env);
env->MakeWritable(&src);
BYTE* srcp = src->GetWritePtr();
const BYTE* srcp2 = src2->GetReadPtr();
const int src_pitch = src->GetPitch();
const int src_rowsize = src->GetRowSize();
merge_plane(srcp, srcp2, src_pitch, src2->GetPitch(), src_rowsize, src->GetHeight(), weight, env);
if (vi.IsPlanar()) {
BYTE* srcpU = (BYTE*)src->GetWritePtr(PLANAR_U);
BYTE* srcpV = (BYTE*)src->GetWritePtr(PLANAR_V);
BYTE* srcp2U = (BYTE*)src2->GetReadPtr(PLANAR_U);
BYTE* srcp2V = (BYTE*)src2->GetReadPtr(PLANAR_V);
int src_rowsize = src->GetRowSize(PLANAR_U);
merge_plane(srcpU, srcp2U, src->GetPitch(PLANAR_U), src2->GetPitch(PLANAR_U), src_rowsize, src->GetHeight(PLANAR_U), weight, env);
merge_plane(srcpV, srcp2V, src->GetPitch(PLANAR_V), src2->GetPitch(PLANAR_V), src_rowsize, src->GetHeight(PLANAR_V), weight, env);
}
return src;
}
示例2: memset
static void make_black_background_planar_yuv
(
PVideoFrame &frame,
int bitdepth_minus_8
)
{
memset( frame->GetWritePtr( PLANAR_Y ), 0x00, frame->GetPitch( PLANAR_Y ) * frame->GetHeight( PLANAR_Y ) );
memset( frame->GetWritePtr( PLANAR_U ), 0x80, frame->GetPitch( PLANAR_U ) * frame->GetHeight( PLANAR_U ) );
memset( frame->GetWritePtr( PLANAR_V ), 0x80, frame->GetPitch( PLANAR_V ) * frame->GetHeight( PLANAR_V ) );
}
示例3: GetFrame
PVideoFrame TMaskCleaner::GetFrame(int n, IScriptEnvironment* env) {
PVideoFrame src = child->GetFrame(n,env);
PVideoFrame dst = env->NewVideoFrame(child->GetVideoInfo());
memset(dst->GetWritePtr(PLANAR_Y), 0, dst->GetPitch(PLANAR_Y) * dst->GetHeight(PLANAR_Y));
memset(lookup, 0, child->GetVideoInfo().height * child->GetVideoInfo().width / 8);
ClearMask(dst->GetWritePtr(PLANAR_Y), src->GetReadPtr(PLANAR_Y), dst->GetRowSize(PLANAR_Y), dst->GetHeight(PLANAR_Y),src->GetPitch(PLANAR_Y), dst->GetPitch(PLANAR_Y));
return dst;
}
示例4: OutputFrame
void AvisynthVideoSource::OutputFrame(const FFMS_Frame *Frame, PVideoFrame &Dst, IScriptEnvironment *Env) {
if (VI.pixel_type == VideoInfo::CS_I420) {
Env->BitBlt(Dst->GetWritePtr(PLANAR_Y), Dst->GetPitch(PLANAR_Y), Frame->Data[0], Frame->Linesize[0], Dst->GetRowSize(PLANAR_Y), Dst->GetHeight(PLANAR_Y));
Env->BitBlt(Dst->GetWritePtr(PLANAR_U), Dst->GetPitch(PLANAR_U), Frame->Data[1], Frame->Linesize[1], Dst->GetRowSize(PLANAR_U), Dst->GetHeight(PLANAR_U));
Env->BitBlt(Dst->GetWritePtr(PLANAR_V), Dst->GetPitch(PLANAR_V), Frame->Data[2], Frame->Linesize[2], Dst->GetRowSize(PLANAR_V), Dst->GetHeight(PLANAR_V));
} else if (VI.IsYUY2()) {
Env->BitBlt(Dst->GetWritePtr(), Dst->GetPitch(), Frame->Data[0], Frame->Linesize[0], Dst->GetRowSize(), Dst->GetHeight());
} else { // RGB
Env->BitBlt(Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1), -Dst->GetPitch(), Frame->Data[0], Frame->Linesize[0], Dst->GetRowSize(), Dst->GetHeight());
}
}
示例5: 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;
}
示例6:
static inline void as_assign_planar_yuv
(
PVideoFrame &as_frame,
as_picture_t *as_picture
)
{
as_picture->data [0] = as_frame->GetWritePtr( PLANAR_Y );
as_picture->data [1] = as_frame->GetWritePtr( PLANAR_U );
as_picture->data [2] = as_frame->GetWritePtr( PLANAR_V );
as_picture->linesize[0] = as_frame->GetPitch ( PLANAR_Y );
as_picture->linesize[1] = as_frame->GetPitch ( PLANAR_U );
as_picture->linesize[2] = as_frame->GetPitch ( PLANAR_V );
}
示例7: GetFrame
PVideoFrame __stdcall TEMmod::GetFrame(int n, IScriptEnvironment* env)
{
const int planes[3] = {PLANAR_Y, PLANAR_U, PLANAR_V};
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame dst = env->NewVideoFrame(vi);
for (int i = 0; i < 3; i++) {
if (process[i] == 0) {
break;
}
int p = planes[i];
int dst_pitch = dst->GetPitch(p);
uint8_t* dstp = dst->GetWritePtr(p);
int height = src->GetHeight(p);
if (process[i] == 2) {
memset(dstp, 0, dst_pitch * height);
continue;
}
int src_pitch = src->GetPitch(p);
int width = src->GetRowSize(p);
const uint8_t* srcp = src->GetReadPtr(p);
if (((intptr_t)srcp & 15) && type > 2) {
env->ThrowError("TEMmod: invalid memory alignment found!");
}
calc_map(srcp, dstp, buff, src_pitch, dst_pitch, buff_pitch,
width, height, threshold[i], scale);
}
if (link > 0) {
link_planes(dst);
}
if (!invert) {
return dst;
}
for (int i = 0; i < 3; i++) {
if (process[i] == 0) {
break;
}
invert_plane(dst->GetWritePtr(planes[i]), dst->GetPitch(planes[i]),
dst->GetHeight(planes[i]));
}
return dst;
}
示例8: OutputField
void AvisynthVideoSource::OutputField(const FFMS_Frame *Frame, PVideoFrame &Dst, int Field, IScriptEnvironment *Env) {
const FFMS_Frame *SrcPicture = (Frame);
if (VI.pixel_type == VideoInfo::CS_I420) {
if (Field) {
Env->BitBlt(Dst->GetWritePtr(PLANAR_Y), Dst->GetPitch(PLANAR_Y) * 2, SrcPicture->Data[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(PLANAR_Y), Dst->GetHeight(PLANAR_Y) / 2);
Env->BitBlt(Dst->GetWritePtr(PLANAR_U), Dst->GetPitch(PLANAR_U) * 2, SrcPicture->Data[1], SrcPicture->Linesize[1] * 2, Dst->GetRowSize(PLANAR_U), Dst->GetHeight(PLANAR_U) / 2);
Env->BitBlt(Dst->GetWritePtr(PLANAR_V), Dst->GetPitch(PLANAR_V) * 2, SrcPicture->Data[2], SrcPicture->Linesize[2] * 2, Dst->GetRowSize(PLANAR_V), Dst->GetHeight(PLANAR_V) / 2);
} else {
Env->BitBlt(Dst->GetWritePtr(PLANAR_Y) + Dst->GetPitch(PLANAR_Y), Dst->GetPitch(PLANAR_Y) * 2, SrcPicture->Data[0] + SrcPicture->Linesize[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(PLANAR_Y), Dst->GetHeight(PLANAR_Y) / 2);
Env->BitBlt(Dst->GetWritePtr(PLANAR_U) + Dst->GetPitch(PLANAR_U), Dst->GetPitch(PLANAR_U) * 2, SrcPicture->Data[1] + SrcPicture->Linesize[1], SrcPicture->Linesize[1] * 2, Dst->GetRowSize(PLANAR_U), Dst->GetHeight(PLANAR_U) / 2);
Env->BitBlt(Dst->GetWritePtr(PLANAR_V) + Dst->GetPitch(PLANAR_V), Dst->GetPitch(PLANAR_V) * 2, SrcPicture->Data[2] + SrcPicture->Linesize[2], SrcPicture->Linesize[2] * 2, Dst->GetRowSize(PLANAR_V), Dst->GetHeight(PLANAR_V) / 2);
}
} else if (VI.IsYUY2()) {
if (Field)
Env->BitBlt(Dst->GetWritePtr(), Dst->GetPitch() * 2, SrcPicture->Data[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(), Dst->GetHeight() / 2);
else
Env->BitBlt(Dst->GetWritePtr() + Dst->GetPitch(), Dst->GetPitch() * 2, SrcPicture->Data[0] + SrcPicture->Linesize[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(), Dst->GetHeight() / 2);
} else { // RGB
if (Field)
Env->BitBlt(Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1), -Dst->GetPitch() * 2, SrcPicture->Data[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(), Dst->GetHeight() / 2);
else
Env->BitBlt(Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 2), -Dst->GetPitch() * 2, SrcPicture->Data[0] + SrcPicture->Linesize[0], SrcPicture->Linesize[0] * 2, Dst->GetRowSize(), Dst->GetHeight() / 2);
}
}
示例9:
PVideoFrame VerticalReduceBy2::GetFrame(int n, IScriptEnvironment* env) {
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame dst = env->NewVideoFrame(vi);
int src_pitch = src->GetPitch();
int dst_pitch = dst->GetPitch();
int row_size = src->GetRowSize();
BYTE* dstp = dst->GetWritePtr();
const BYTE* srcp = src->GetReadPtr();
if (vi.IsPlanar()) {
mmx_process(srcp,src_pitch, row_size, dstp,dst_pitch,dst->GetHeight(PLANAR_Y));
if (src->GetRowSize(PLANAR_V)) {
src_pitch = src->GetPitch(PLANAR_V);
dst_pitch = dst->GetPitch(PLANAR_V);
row_size = src->GetRowSize(PLANAR_V_ALIGNED);
dstp = dst->GetWritePtr(PLANAR_V);
srcp = src->GetReadPtr(PLANAR_V);
mmx_process(srcp,src_pitch, row_size, dstp,dst_pitch,dst->GetHeight(PLANAR_V));
src_pitch = src->GetPitch(PLANAR_U);
dst_pitch = dst->GetPitch(PLANAR_U);
row_size = src->GetRowSize(PLANAR_U_ALIGNED);
dstp = dst->GetWritePtr(PLANAR_U);
srcp = src->GetReadPtr(PLANAR_U);
mmx_process(srcp,src_pitch, row_size, dstp,dst_pitch,dst->GetHeight(PLANAR_U));
}
return dst;
}
//if ((env->GetCPUFlags() & CPUF_MMX)) {
if ((row_size&3)==0) { // row width divideable with 4 (one dword per loop)
mmx_process(srcp,src_pitch, row_size, dstp,dst_pitch,vi.height);
return dst;
}
//}
for (int y=0; y<vi.height; ++y) {
const BYTE* line0 = src->GetReadPtr() + (y*2)*src_pitch;
const BYTE* line1 = line0 + src_pitch;
const BYTE* line2 = (y*2 < original_height-2) ? (line1 + src_pitch) : line0;
for (int x=0; x<row_size; ++x)
dstp[x] = (line0[x] + 2*line1[x] + line2[x] + 2) >> 2;
dstp += dst_pitch;
}
return dst;
}
示例10: GetFrame
PVideoFrame SkewRows::GetFrame(int n, IScriptEnvironment* env) {
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame dst = env->NewVideoFrame(vi);
const int srowsize = src->GetRowSize();
const int spitch = src->GetPitch();
const BYTE *sptr = src->GetReadPtr();
const int drowsize = dst->GetRowSize();
const int dpitch = dst->GetPitch();
BYTE *dptr = dst->GetWritePtr();
const int ssize = src->GetHeight()*srowsize;
int s=0, d=0;
for (int i=0; i < ssize; i++) {
if (s >= srowsize) {
s = 0;
sptr += spitch;
}
if (d >= drowsize) {
d = 0;
dptr += dpitch;
}
dptr[d++] = sptr[s++];
}
while (d < drowsize)
dptr[d++] = 128;
return dst;
}
示例11: GetFrame
PVideoFrame __stdcall Padding::GetFrame(int n, IScriptEnvironment *env)
{
PVideoFrame src = child->GetFrame(n, env);
PVideoFrame dst = env->NewVideoFrame(vi);
// convert to frames
unsigned char const *pSrc[3];
unsigned char *pDst[3];
int nDstPitches[3], nSrcPitches[3];
SrcPlanes->ConvertVideoFrameToPlanes(&src, pSrc, nSrcPitches);
DstPlanes->ConvertVideoFrameToPlanes(&dst, pDst, nDstPitches);
int yRatioUV = (vi.IsYV12()) ? 2 : 1;
PlaneCopy(pDst[0] + horizontalPadding + verticalPadding * nDstPitches[0], nDstPitches[0],
pSrc[0], nSrcPitches[0], width, height, isse);
PadReferenceFrame(pDst[0], nDstPitches[0], horizontalPadding, verticalPadding, width, height);
PlaneCopy(pDst[1] + horizontalPadding/2 + verticalPadding/yRatioUV * nDstPitches[1],
nDstPitches[1], pSrc[1], nSrcPitches[1], width/2, height/yRatioUV, isse);
PadReferenceFrame(pDst[1], nDstPitches[1], horizontalPadding/2, verticalPadding/yRatioUV, width/2, height/yRatioUV);
PlaneCopy(pDst[2] + horizontalPadding/2 + verticalPadding/yRatioUV * nDstPitches[2],
nDstPitches[2], pSrc[2], nSrcPitches[2], width/2, height/yRatioUV, isse);
PadReferenceFrame(pDst[2], nDstPitches[2], horizontalPadding/2, verticalPadding/yRatioUV, width/2, height/yRatioUV);
// convert back from planes
unsigned char *pDstYUY2 = dst->GetWritePtr();
int nDstPitchYUY2 = dst->GetPitch();
DstPlanes->YUY2FromPlanes(pDstYUY2, nDstPitchYUY2);
return dst;
}
示例12: BlitField
static void BlitField(const FFMS_Frame *Frame, PVideoFrame &Dst, IScriptEnvironment *Env, int Plane, int Field) {
int PlaneId = 1 << Plane;
Env->BitBlt(
Dst->GetWritePtr(PlaneId) + Dst->GetPitch(PlaneId) * Field, Dst->GetPitch(PlaneId) * 2,
Frame->Data[Plane] + Frame->Linesize[Plane] * Field, Frame->Linesize[Plane] * 2,
Dst->GetRowSize(PlaneId), Dst->GetHeight(PlaneId) / 2);
}
示例13: GetFrame
PVideoFrame PeculiarBlend::GetFrame(int n, IScriptEnvironment* env) {
PVideoFrame a = child->GetFrame(n, env);
PVideoFrame b = child->GetFrame(n+1, env);
env->MakeWritable(&a);
BYTE* main = a->GetWritePtr();
const BYTE* other = b->GetReadPtr();
const int main_pitch = a->GetPitch();
const int other_pitch = b->GetPitch();
const int row_size = a->GetRowSize();
if (cutoff-31 > 0) {
int copy_top = min(cutoff-31, vi.height);
BitBlt(main, main_pitch, other, other_pitch, row_size, copy_top);
main += main_pitch * copy_top;
other += other_pitch * copy_top;
}
for (int y = max(0, cutoff-31); y < min(cutoff, vi.height-1); ++y) {
int scale = cutoff - y;
for (int x = 0; x < row_size; ++x)
main[x] += ((other[x] - main[x]) * scale + 16) >> 5;
main += main_pitch;
other += other_pitch;
}
return a;
}
示例14: GetFrame
PVideoFrame WeaveRows::GetFrame(int n, IScriptEnvironment* env)
{
const int b = n * period;
const int e = b + period;
PVideoFrame dst = env->NewVideoFrame(vi);
BYTE *dstp = dst->GetWritePtr();
const int dstpitch = dst->GetPitch();
if (vi.IsRGB()) { // RGB upsidedown
dstp += dstpitch * period;
for (int i=b; i<e; i++) {
dstp -= dstpitch;
const int j = i < inframes ? i : inframes-1;
PVideoFrame src = child->GetFrame(j, env);
BitBlt( dstp, dstpitch * period,
src->GetReadPtr(), src->GetPitch(),
src->GetRowSize(), src->GetHeight() );
}
}
else {
BYTE *dstpU = dst->GetWritePtr(PLANAR_U);
BYTE *dstpV = dst->GetWritePtr(PLANAR_V);
const int dstpitchUV = dst->GetPitch(PLANAR_U);
for (int i=b; i<e; i++) {
const int j = i < inframes ? i : inframes-1;
PVideoFrame src = child->GetFrame(j, env);
BitBlt( dstp, dstpitch * period,
src->GetReadPtr(), src->GetPitch(),
src->GetRowSize(), src->GetHeight() );
dstp += dstpitch;
if (dstpitchUV) {
BitBlt( dstpU, dstpitchUV * period,
src->GetReadPtr(PLANAR_U), src->GetPitch(PLANAR_U),
src->GetRowSize(PLANAR_U), src->GetHeight(PLANAR_U) );
BitBlt( dstpV, dstpitchUV * period,
src->GetReadPtr(PLANAR_V), src->GetPitch(PLANAR_V),
src->GetRowSize(PLANAR_V), src->GetHeight(PLANAR_V) );
dstpU += dstpitchUV;
dstpV += dstpitchUV;
}
}
}
return dst;
}
示例15: GetFrame
PVideoFrame __stdcall AlignPlanar::GetFrame(int n, IScriptEnvironment* env) {
int plane = (env->PlanarChromaAlignment(IScriptEnvironment::PlanarChromaAlignmentTest)) ? PLANAR_U_ALIGNED : PLANAR_Y_ALIGNED;
PVideoFrame src = child->GetFrame(n, env);
if (!(src->GetRowSize(plane)&(FRAME_ALIGN-1)))
return src;
PVideoFrame dst = env->NewVideoFrame(vi);
if ((dst->GetRowSize(PLANAR_Y_ALIGNED)&(FRAME_ALIGN-1)))
env->ThrowError("AlignPlanar: [internal error] Returned frame was not aligned!");
env->BitBlt(dst->GetWritePtr(), dst->GetPitch(), src->GetReadPtr(), src->GetPitch(), src->GetRowSize(), src->GetHeight());
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));
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));
return dst;
}