当前位置: 首页>>代码示例>>C++>>正文


C++ PVideoFrame类代码示例

本文整理汇总了C++中PVideoFrame的典型用法代码示例。如果您正苦于以下问题:C++ PVideoFrame类的具体用法?C++ PVideoFrame怎么用?C++ PVideoFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PVideoFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copyPlanar

void copyPlanar(const uchar* srcp, PVideoFrame &dst, int bpp) {
	const int bytes_per_pixel = bpp / 8;
	const int cols = dst->GetRowSize();
	const int rows = dst->GetHeight();
	const int dst_pitch = dst->GetPitch();
	const int src_pitch = cols / bytes_per_pixel;
	uchar* dstp = dst->GetWritePtr();
	int y, x;

	const int dst_pitchUV = dst->GetPitch(PLANAR_U);
	const int dst_widthUV = dst->GetRowSize(PLANAR_U);
	const int dst_heightUV = dst->GetHeight(PLANAR_U);

	for (y = 0; y < rows; y++) {                 // copy mask to Y plane
		for (x = 0; x < cols; x++) {
			dstp[x] = srcp[x / bytes_per_pixel];
		}
		srcp += src_pitch;
		dstp += dst_pitch;
	}

	dstp = dst->GetWritePtr(PLANAR_U);           // set U plane to no color

	for (y = 0; y < dst_heightUV; y++) {
		for (x = 0; x < dst_widthUV; x++) {
			dstp[x] = 128;                       // set chroma to none
		}
		dstp += dst_pitchUV;
	}

	// set V plane to no color
	dstp = dst->GetWritePtr(PLANAR_V);

	for (y = 0; y < dst_heightUV; y++) {
		for (x = 0; x < dst_widthUV; x++) {
			dstp[x] = 128;                       // set chroma to none
		}
		dstp += dst_pitchUV;
	}
}
开发者ID:jojje,项目名称:shapemask,代码行数:40,代码来源:shapemask.cpp

示例2: Update

//void MVClip::Update(int n, IScriptEnvironment *env)
void MVClip::Update(PVideoFrame &fn, IScriptEnvironment *env)

{
    //    PVideoFrame fn = child->GetFrame(n, env);
    const int *pMv = reinterpret_cast<const int*>(fn->GetReadPtr());
    int _headerSize = pMv[0];
    int nMagicKey1 = pMv[1];
    if (nMagicKey1 != MOTION_MAGIC_KEY)
        env->ThrowError("MVTools: invalid vectors stream");
    int nVersion1 = pMv[2];
    if (nVersion1 != MVANALYSIS_DATA_VERSION)
        env->ThrowError("MVTools: incompatible version of vectors stream");
    pMv += _headerSize/sizeof(int); // go to data - v1.8.1
    //   FakeGroupOfPlanes::Update(reinterpret_cast<const int*>(fn->GetReadPtr()));// fixed a bug with lost frames
    FakeGroupOfPlanes::Update(pMv);// fixed a bug with lost frames
}
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:17,代码来源:MVClip.cpp

示例3: GetFrame

PVideoFrame FTurn::GetFrame(int n, IScriptEnvironment* env) {
    PVideoFrame src = child->GetFrame(n,env);
    auto dst = env->NewVideoFrame(vi);
    auto pSrcY = src->GetReadPtr(PLANAR_Y);
    auto pDstY = dst->GetWritePtr(PLANAR_Y);
    int srcPitchY = src->GetPitch(PLANAR_Y);
    int dstPitchY = dst->GetPitch(PLANAR_Y);
    int srcWidthY = src->GetRowSize(PLANAR_Y);
    int srcHeightY = src->GetHeight(PLANAR_Y);

    if (!(chroma_ && hasChroma(vi.pixel_type))) {
        turnFunction_(pDstY, pSrcY, srcWidthY, srcHeightY, dstPitchY, srcPitchY);
    } else {
        auto pDstU = dst->GetWritePtr(PLANAR_U);
        auto pDstV = dst->GetWritePtr(PLANAR_V);
        auto pSrcU = src->GetReadPtr(PLANAR_U);
        auto pSrcV = src->GetReadPtr(PLANAR_V);
        int srcPitchUV = src->GetPitch(PLANAR_U);
        int dstPitchUV = dst->GetPitch(PLANAR_U);
        int srcWidthUV = src->GetRowSize(PLANAR_U);
        int srcHeightUV = src->GetHeight(PLANAR_V);
        
        if (mt_) {
            auto thread2 = std::async(launch::async, [=] { 
                turnFunction_(pDstU, pSrcU, srcWidthUV, srcHeightUV, dstPitchUV, srcPitchUV);
                turnFunction_(pDstV, pSrcV, srcWidthUV, srcHeightUV, dstPitchUV, srcPitchUV);
            });
            turnFunction_(pDstY, pSrcY, srcWidthY, srcHeightY, dstPitchY, srcPitchY);
            thread2.wait();
        } else {
            turnFunction_(pDstU, pSrcU, srcWidthUV, srcHeightUV, dstPitchUV, srcPitchUV);
            turnFunction_(pDstV, pSrcV, srcWidthUV, srcHeightUV, dstPitchUV, srcPitchUV);
            turnFunction_(pDstY, pSrcY, srcWidthY, srcHeightY, dstPitchY, srcPitchY);
        }
    }
    return dst;
}
开发者ID:tp7,项目名称:fturn,代码行数:37,代码来源:fturn.cpp

示例4: OutputFrame

void AvisynthVideoSource::OutputFrame(const FFMS_Frame *Frame, PVideoFrame &Dst, IScriptEnvironment *Env) {
	if (VI.pixel_type == VideoInfo::CS_I420) {
		BlitPlane(Frame, Dst, Env, 0);
		BlitPlane(Frame, Dst, Env, 1);
		BlitPlane(Frame, Dst, Env, 2);
	} else if (VI.IsYUY2()) {
		BlitPlane(Frame, Dst, Env, 0);
	} else { // RGB
		Env->BitBlt(
			Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1), -Dst->GetPitch(),
			Frame->Data[0], Frame->Linesize[0],
			Dst->GetRowSize(), Dst->GetHeight());
	}
}
开发者ID:GDXN,项目名称:avxsynth,代码行数:14,代码来源:avssources.cpp

示例5: GetFrame

PVideoFrame AreaResize::GetFrame(int n, IScriptEnvironment* env)
{
    PVideoFrame src = child->GetFrame(n, env);
    if (params[0].src_width == params[0].target_width &&
            params[0].src_height == params[0].target_height) {
        return src;
    }

    PVideoFrame dst = env->NewVideoFrame(vi);

    int plane[] = {PLANAR_Y, PLANAR_U, PLANAR_V};
    for (int i = 0, time = vi.IsInterleaved() ? 1 : 3; i < time; i++) {
        const BYTE* srcp = src->GetReadPtr(plane[i]);
        int src_pitch = src->GetPitch(plane[i]);

        const BYTE* resized_h;
        if (params[i].src_width == params[i].target_width) {
            resized_h = srcp;
        } else {
            if (!ResizeHorizontal(buff, srcp, src_pitch, &params[i])) {
                return dst;
            }
            resized_h = buff;
            src_pitch = dst->GetRowSize(plane[i]);
        }

        BYTE* dstp = dst->GetWritePtr(plane[i]);
        int dst_pitch = dst->GetPitch(plane[i]);
        if (params[i].src_height == params[i].target_height) {
            env->BitBlt(dstp, dst_pitch, resized_h, src_pitch, dst->GetRowSize(plane[i]), dst->GetHeight(plane[i]));
            continue;
        }

        if (!ResizeVertical(dstp, dst_pitch, resized_h, src_pitch, &params[i])) {
            return dst;
        }
    }

    return dst;
}
开发者ID:chikuzen,项目名称:AreaResize,代码行数:40,代码来源:AreaResize.cpp

示例6: copyplane

	void copyplane(PVideoFrame &result, const PVideoFrame &source, int plane, IScriptEnvironment *env)
	{
	//  void __stdcall IScriptEnvironment::BitBlt
		//(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height) = 0

		unsigned char *resultpointer = result->GetWritePtr(plane);
		const unsigned char *sourcepointer = source->GetReadPtr(plane);

		const int width = source->GetRowSize(plane);
		const int height = source->GetHeight(plane);
		const int sourcepitch = source->GetPitch(plane);
		const int resultpitch = result->GetPitch(plane);

		env->BitBlt(resultpointer, resultpitch, sourcepointer, sourcepitch, width, height);
	}
开发者ID:alexeiemam,项目名称:avsScripts,代码行数:15,代码来源:PlanarChroma.cpp

示例7: 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) {
		BlitField(Frame, Dst, Env, 0, Field);
		BlitField(Frame, Dst, Env, 1, Field);
		BlitField(Frame, Dst, Env, 2, Field);
	} else if (VI.IsYUY2()) {
		BlitField(Frame, Dst, Env, 0, Field);
	} else { // RGB
        Env->BitBlt(
			Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1 - Field), -Dst->GetPitch() * 2,
			SrcPicture->Data[0] + SrcPicture->Linesize[0] * Field, SrcPicture->Linesize[0] * 2,
			Dst->GetRowSize(), Dst->GetHeight() / 2);
	}
}
开发者ID:GDXN,项目名称:avxsynth,代码行数:16,代码来源:avssources.cpp

示例8: GetFrame

PVideoFrame __stdcall MergeChroma::GetFrame(int n, IScriptEnvironment* env)
{
  PVideoFrame src = child->GetFrame(n, env);

  if (weight<0.0001f) return src;

  PVideoFrame chroma = clip->GetFrame(n, env);

  const int h = src->GetHeight();
  const int w = src->GetRowSize()>>1; // width in pixels

  if (weight<0.9999f) {
    if (vi.IsYUY2()) {
      env->MakeWritable(&src);
      unsigned int* srcp = (unsigned int*)src->GetWritePtr();
      unsigned int* chromap = (unsigned int*)chroma->GetReadPtr();

      const int isrc_pitch = (src->GetPitch())>>2;  // int pitch (one pitch=two pixels)
      const int ichroma_pitch = (chroma->GetPitch())>>2;  // Ints

      ((TEST(4, 8) (env->GetCPUFlags() & CPUF_MMX)) ? mmx_weigh_chroma : weigh_chroma)
        (srcp,chromap,isrc_pitch,ichroma_pitch,w,h,(int)(weight*32768.0f),32768-(int)(weight*32768.0f));
    } else {  // Planar
开发者ID:XhmikosR,项目名称:avisynth-mt,代码行数:23,代码来源:merge.cpp

示例9: memset

static void make_black_background_planar_yuv_interleaved
(
    PVideoFrame &frame,
    int          bitdepth_minus_8
)
{
    memset( frame->GetWritePtr( PLANAR_Y ), 0x00, frame->GetPitch( PLANAR_Y ) * frame->GetHeight( PLANAR_Y ) );
    uint8_t msb  = (uint8_t)((0x80U << bitdepth_minus_8) >> 8);
    int     size = frame->GetPitch( PLANAR_U ) * frame->GetHeight( PLANAR_U );
    for( int i = 0; i < size; i++ )
        if( i & 1 )
        {
            *(frame->GetWritePtr( PLANAR_U ) + i) = msb;
            *(frame->GetWritePtr( PLANAR_V ) + i) = msb;
        }
        else
        {
            *(frame->GetWritePtr( PLANAR_U ) + i) = 0x00;
            *(frame->GetWritePtr( PLANAR_V ) + i) = 0x00;
        }
}
开发者ID:Freecom,项目名称:L-SMASH-Works,代码行数:21,代码来源:video_output.cpp

示例10: GetFrame

PVideoFrame __stdcall VNoise :: GetFrame(int n, IScriptEnvironment* env) {
	// Destination
	PVideoFrame dest = env->NewVideoFrame(this->clipInfo);
	unsigned char* destPtr = dest->GetWritePtr();
	int destPitch = dest->GetPitch();

	// Get main source
	PVideoFrame sourceMain = this->clip->GetFrame(n, env);
	const unsigned char* sourceMainPtr = sourceMain->GetReadPtr();
	int sourceMainPitch = sourceMain->GetPitch();
	int rgba[4];

	// Loop values
	int x, y, j;
	int width = this->clipInfo.width;
	int height = this->clipInfo.height;
	int rowSize = width * this->components;

	// Copy from main source
	for (y = 0; y < height; ++y) {
		// Loop over line
		for (x = 0; x < rowSize; x += this->components) {
			// Get old
			for (j = 0; j < this->components; ++j) {
				rgba[j] = *(sourceMainPtr + x + j);
			}

			// Modify
			this->randomChange(rgba);

			// Set new
			for (j = 0; j < this->components; ++j) {
				*(destPtr + x + j) = rgba[j];
			}
		}

		// Next line
		sourceMainPtr += sourceMainPitch;
		destPtr += destPitch;
	}

	// Done
	return dest;
}
开发者ID:nutbread,项目名称:ave,代码行数:44,代码来源:VNoise.cpp

示例11: switch

void f3kdb_avisynth::process_plane(int n, PVideoFrame src, PVideoFrame dst, unsigned char *dstp, int plane, IScriptEnvironment* env)
{
    int f3kdb_plane;
    switch (plane & 7)
    {
    case PLANAR_Y:
        f3kdb_plane = PLANE_Y;
        break;
    case PLANAR_U:
        f3kdb_plane = PLANE_CB;
        break;
    case PLANAR_V:
        f3kdb_plane = PLANE_CR;
        break;
    default:
        assert(false);
        env->ThrowError("f3kdb: Invalid plane");
    }
    int result = f3kdb_process_plane(_core, n, f3kdb_plane, dstp, dst->GetPitch(plane), src->GetReadPtr(plane), src->GetPitch(plane));
    if (result != F3KDB_SUCCESS)
    {
        env->ThrowError("f3kdb: Unknown error, code = %d", result);
    }
}
开发者ID:SAPikachu,项目名称:flash3kyuu_deband,代码行数:24,代码来源:filter_impl.hpp

示例12: GetFrame

PVideoFrame __stdcall MVMultiExtract::GetFrame(int n, IScriptEnvironment* env)
{
    //	DebugPrintf("MVAnalyse: Get src frame %d",n);
    PVideoFrame src = child->GetFrame(n, env);
    const BYTE* srcPtr=src->GetReadPtr();
    int SrcPitch=src->GetPitch();
    
    PVideoFrame dst = env->NewVideoFrame(vi);
    unsigned char *pDst = dst->GetWritePtr();
    int DstPitch = dst->GetPitch();

    // extract the appropriate rows out of the frame RGB32 is 4 bytes per pixel
    for(int IndexNum=0; IndexNum<NumIndices; ++IndexNum) {
        memcpy(reinterpret_cast<void*>(pDst+DstPitch*IndexNum), 
               reinterpret_cast<void const*>(srcPtr+SrcPitch*Index[IndexNum]), vi.width*4);
    }

    return dst;
}
开发者ID:mdaughtrey,项目名称:personal-projects,代码行数:19,代码来源:MVMultiExtract.cpp

示例13: OutputFrame

void AvisynthVideoSource::OutputFrame(const FFMS_Frame *Frame, PVideoFrame &Dst, IScriptEnvironment *Env) {
	if (VI.IsPlanar()) {
		BlitPlane(Frame, Dst, Env, 0, VI.IsRGB() ? PLANAR_G : PLANAR_Y);
        if (HighBitDepth ? !VI.IsY() : !VI.IsY8()) {
            BlitPlane(Frame, Dst, Env, 1, VI.IsRGB() ? PLANAR_B : PLANAR_U);
            BlitPlane(Frame, Dst, Env, 2, VI.IsRGB() ? PLANAR_R : PLANAR_V);
        }
        if (VI.IsYUVA() || VI.IsPlanarRGBA())
            BlitPlane(Frame, Dst, Env, 3, PLANAR_A);
	} else if (VI.IsYUY2()) {
		BlitPlane(Frame, Dst, Env, 0, 0);
    } else if (VI.IsRGB24() || VI.IsRGB32()) {
		Env->BitBlt(
			Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1), -Dst->GetPitch(),
			Frame->Data[0], Frame->Linesize[0],
			Dst->GetRowSize(), Dst->GetHeight());
    } else {
        assert(false);
    }
}
开发者ID:jeeb,项目名称:ffms2,代码行数:20,代码来源:avssources.cpp

示例14: GetFrame

PVideoFrame __stdcall CSRIAviSynth::GetFrame(int n, IScriptEnvironment *env)
{
	PVideoFrame avsframe = child->GetFrame(n, env);
	struct csri_frame frame;

	env->MakeWritable(&avsframe);

	frame.pixfmt = GetPixfmt();
	frame.planes[0] = avsframe->GetWritePtr();
	frame.strides[0] = avsframe->GetPitch();
	if (csri_is_yuv_planar(frame.pixfmt)) {
		frame.planes[1] = avsframe->GetWritePtr(PLANAR_U);
		frame.strides[1] = avsframe->GetPitch(PLANAR_U);
		frame.planes[2] = avsframe->GetWritePtr(PLANAR_V);
		frame.strides[2] = avsframe->GetPitch(PLANAR_V);
	}
	if (csri_is_rgb(frame.pixfmt)) {
		frame.planes[0] += (vi.height - 1) * frame.strides[0];
		frame.strides[0] = -frame.strides[0];
	}

	csri_render(inst, &frame, n * spf);
	return avsframe;
}
开发者ID:Aegisub,项目名称:Aegisub,代码行数:24,代码来源:avisynth.cpp

示例15: OutputField

void AvisynthVideoSource::OutputField(const FFMS_Frame *Frame, PVideoFrame &Dst, int Field, IScriptEnvironment *Env) {
	const FFMS_Frame *SrcPicture = Frame;
	if (VI.IsPlanar()) {
		BlitField(Frame, Dst, Env, 0, VI.IsRGB() ? PLANAR_G : PLANAR_Y, Field);
        if (HighBitDepth ? !VI.IsY() : !VI.IsY8()) {
            BlitField(Frame, Dst, Env, 1, VI.IsRGB() ? PLANAR_B : PLANAR_U, Field);
            BlitField(Frame, Dst, Env, 2, VI.IsRGB() ? PLANAR_R : PLANAR_V, Field);
        }
        if (VI.IsYUVA() || VI.IsPlanarRGBA())
            BlitField(Frame, Dst, Env, 3, PLANAR_A, Field);
	} else if (VI.IsYUY2()) {
		BlitField(Frame, Dst, Env, 0, 0, Field);
	} else if (VI.IsRGB24() || VI.IsRGB32()) {
		Env->BitBlt(
			Dst->GetWritePtr() + Dst->GetPitch() * (Dst->GetHeight() - 1 - Field), -Dst->GetPitch() * 2,
			SrcPicture->Data[0] + SrcPicture->Linesize[0] * Field, SrcPicture->Linesize[0] * 2,
			Dst->GetRowSize(), Dst->GetHeight() / 2);
    } else {
        assert(false);
    }
}
开发者ID:jeeb,项目名称:ffms2,代码行数:21,代码来源:avssources.cpp


注:本文中的PVideoFrame类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。