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


C++ PVideoFrame::GetReadPtr方法代码示例

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


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

示例1: MultiFrameCopy

void deathray::MultiFrameCopy(const int &n) {
	result status = FILTER_OK;

	int frame_number;
	if (temporal_radius_Y_ > 0 && h_Y_ > 0.f) {
		MultiFrameRequest frames_Y;
		g_MultiFrame_Y.SupplyFrameNumbers(n, &frames_Y);
		while (frames_Y.GetFrameNumber(&frame_number)) {
			PVideoFrame Y = child->GetFrame(frame_number, env_);
			const unsigned char* ptr_Y = Y->GetReadPtr(PLANAR_Y);
			frames_Y.Supply(frame_number, ptr_Y);
		}
		status = g_MultiFrame_Y.CopyTo(&frames_Y);
		if (status != FILTER_OK ) env_->ThrowError("Deathray: Copy Y to device, status=%d and OpenCL status=%d", status, g_last_cl_error);
	}

	if (temporal_radius_UV_ > 0 && h_UV_ > 0.f) {
		MultiFrameRequest frames_U;
		MultiFrameRequest frames_V;
		g_MultiFrame_U.SupplyFrameNumbers(n, &frames_U);
		g_MultiFrame_V.SupplyFrameNumbers(n, &frames_V);
		while (frames_U.GetFrameNumber(&frame_number)) {
			PVideoFrame UV = child->GetFrame(frame_number, env_);
			const unsigned char* ptr_U = UV->GetReadPtr(PLANAR_U);
			const unsigned char* ptr_V = UV->GetReadPtr(PLANAR_V);
			frames_U.Supply(frame_number, ptr_U);
			frames_V.Supply(frame_number, ptr_V);
		}
		status = g_MultiFrame_U.CopyTo(&frames_U);
		if (status != FILTER_OK ) env_->ThrowError("Deathray: Copy U to device, status=%d and OpenCL status=%d", status, g_last_cl_error);
		status = g_MultiFrame_V.CopyTo(&frames_V);
		if (status != FILTER_OK ) env_->ThrowError("Deathray: Copy V to device, status=%d and OpenCL status=%d", status, g_last_cl_error);
	}
}
开发者ID:chappjc,项目名称:Deathray,代码行数:34,代码来源:deathray.cpp

示例2: GetFrame

PVideoFrame __stdcall TurnsTile::GetFrame(int n, IScriptEnvironment* env)
{

  PVideoFrame
    src = child->GetFrame(n, env),
    sht = 0,
    dst = env->NewVideoFrame(vi);

  const unsigned char
    * srcY = src->GetReadPtr(PLANAR_Y),
    * srcU = src->GetReadPtr(PLANAR_U),
    * srcV = src->GetReadPtr(PLANAR_V),
    * shtY = 0,
    * shtU = 0,
    * shtV = 0;

  unsigned char
    * dstY = dst->GetWritePtr(PLANAR_Y),
    * dstU = dst->GetWritePtr(PLANAR_U),
    * dstV = dst->GetWritePtr(PLANAR_V);

  int
    SRC_PITCH_SAMPLES_Y = src->GetPitch(PLANAR_Y),
    SRC_PITCH_SAMPLES_U = src->GetPitch(PLANAR_U),
    SHT_PITCH_SAMPLES_Y = 0,
    SHT_PITCH_SAMPLES_U = 0,
    DST_PITCH_SAMPLES_Y = dst->GetPitch(PLANAR_Y),
    DST_PITCH_SAMPLES_U = dst->GetPitch(PLANAR_U);

  if (tilesheet) {

    sht = tilesheet->GetFrame(n, env);

    shtY = sht->GetReadPtr(PLANAR_Y);
    shtU = sht->GetReadPtr(PLANAR_U);
    shtV = sht->GetReadPtr(PLANAR_V);

    SHT_PITCH_SAMPLES_Y = sht->GetPitch(PLANAR_Y);
    SHT_PITCH_SAMPLES_U = sht->GetPitch(PLANAR_U);

  }

  if (PLANAR)
    processFramePlanar(
      srcY, srcU, srcV,
      shtY, shtU, shtV,
      dstY, dstU, dstV,
      SRC_PITCH_SAMPLES_Y, SRC_PITCH_SAMPLES_U,
      SHT_PITCH_SAMPLES_Y, SHT_PITCH_SAMPLES_U,
      DST_PITCH_SAMPLES_Y, DST_PITCH_SAMPLES_U,
      env);
  else
    processFramePacked(
      srcY, shtY, dstY,
      SRC_PITCH_SAMPLES_Y, SHT_PITCH_SAMPLES_Y, DST_PITCH_SAMPLES_Y,
      env);

  return dst;

}
开发者ID:ItEndsWithTens,项目名称:TurnsTile,代码行数:60,代码来源:TurnsTile.cpp

示例3: 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;
}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:52,代码来源:debug.cpp

示例4:

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;
}
开发者ID:Dias19,项目名称:avisynth64,代码行数:49,代码来源:resize.cpp

示例5: GetFrame

PVideoFrame __stdcall ShapeMask::GetFrame(int n, IScriptEnvironment* env) {
	int colorspace;

	if (vi.IsRGB24())      colorspace = RGB24;
	else if (vi.IsRGB32()) colorspace = RGB32;
	else if (vi.IsYUY2())  colorspace = YUV2;
	else if (vi.IsYV12())  colorspace = YV12;
	else raiseError(env, "Unsupported color space, must be one of RGB24, RGB32, YUV2 or YV12");

	PClip srcClip = toGrayScale(env, child);
	PVideoFrame src = srcClip->GetFrame(n, env);
	PVideoFrame dst = env->NewVideoFrame(vi);

	const uchar* srcp = src->GetReadPtr();
	const int src_pitch = src->GetPitch();
	const int bpp = vi.BitsPerPixel();

	uchar* retp;

	// No change to the source pixels in the process steps, so ok to cast to non-const
	// returns a 1 channel gray scale image which needs to be converted to whatever format the source clip is in.
	retp = process_frame((uchar*)srcp, vi.width, vi.height, src_pitch, colorspace, threshold, minarea, rectonly);

	if (vi.IsPlanar()) copyPlanar(retp, dst, bpp);
	else if (vi.IsYUY2()) copyYUY2(retp, dst);
	else copyRGB(retp, dst, bpp);

	delete retp;
	return dst;
}
开发者ID:jojje,项目名称:shapemask,代码行数:30,代码来源:shapemask.cpp

示例6: 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;

}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:34,代码来源:misc.cpp

示例7: 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;
}
开发者ID:Dias19,项目名称:avisynth64,代码行数:26,代码来源:misc.cpp

示例8: 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;
}
开发者ID:1974kpkpkp,项目名称:AviSynthPlus,代码行数:45,代码来源:field.cpp

示例9: 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;
}
开发者ID:hetarenaossan,项目名称:tmaskcleaner,代码行数:10,代码来源:tmaskcleaner.cpp

示例10: 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;
}
开发者ID:GDXN,项目名称:avxsynth,代码行数:19,代码来源:alignplanar.cpp

示例11: if

extern "C" HRESULT __stdcall read_data(VF_FileHandle in, DWORD stream, void *out)
{
	if (stream == VF_STREAM_VIDEO)
	{
		LPVF_ReadData_Video data = (LPVF_ReadData_Video)out;
		unsigned char *dst = (unsigned char *)data->lpData;

		if (data == NULL)
			return VF_ERROR;
		
		if (data->dwSize != sizeof(VF_ReadData_Video))
			return VF_ERROR;

		vfMI *i = (vfMI*)in;

		if (i->type == D2V_TYPE)
		{
			unsigned char *src = i->getRGBFrameMI(data->dwFrameNumberL, i->ident);
			int y, height = i->vi->height;
			for (y = 0; y < height; y++)
				memcpy(dst+y*data->lPitch, src+y*i->vi->width*3, i->vi->width*3);
		}
		else
		{
			PVideoFrame src = (*i->clip)->GetFrame(data->dwFrameNumberL, i->avsEnv);
			i->avsEnv->BitBlt(dst, data->lPitch, src->GetReadPtr(), src->GetPitch(),
				src->GetRowSize(), src->GetHeight());
		}
	}
	else if (stream == VF_STREAM_AUDIO)
	{
		LPVF_ReadData_Audio data = (LPVF_ReadData_Audio)out;

		if (data == NULL)
			return VF_ERROR;
		
		if (data->dwSize != sizeof(VF_ReadData_Audio))
			return VF_ERROR;

		vfMI *i = (vfMI*)in;

		if (i->type == D2V_TYPE)
			return VF_ERROR;
		else
		{
			if (!(*i->clip)->GetVideoInfo().HasAudio()) return VF_ERROR;
			(*i->clip)->GetAudio(data->lpBuf, data->dwSamplePosL, data->dwSampleCount, i->avsEnv);
			data->dwReadedSampleCount = (unsigned long) min(data->dwSampleCount,
				max((*i->clip)->GetVideoInfo().num_audio_samples-data->dwSamplePosL,0));
		}
	}
	else return VF_ERROR;

	return VF_OK;
}
开发者ID:ScandalCorp,项目名称:DGMPGDec,代码行数:55,代码来源:vfapi.cpp

示例12: GetFrame

PVideoFrame __stdcall Turn::GetFrame(int n, IScriptEnvironment* env) {

	PVideoFrame src = child->GetFrame(n, env);

    PVideoFrame dst = env->NewVideoFrame(vi);

	if (vi.IsPlanar())
		TurnPlanFunc(src->GetReadPtr(PLANAR_Y), dst->GetWritePtr(PLANAR_Y),
					 src->GetReadPtr(PLANAR_U), dst->GetWritePtr(PLANAR_U),
					 src->GetReadPtr(PLANAR_V), dst->GetWritePtr(PLANAR_V),
					 src->GetRowSize(PLANAR_Y), src->GetHeight(PLANAR_Y),
					 src->GetRowSize(PLANAR_U), src->GetHeight(PLANAR_U),
					 src->GetPitch(PLANAR_Y), dst->GetPitch(PLANAR_Y),
					 src->GetPitch(PLANAR_U), dst->GetPitch(PLANAR_U),
					 src->GetPitch(PLANAR_V), direction);
	else
		TurnFunc(src->GetReadPtr(),dst->GetWritePtr(),src->GetRowSize(),
				 src->GetHeight(),src->GetPitch(),dst->GetPitch(),direction);
    return dst;
}
开发者ID:Dias19,项目名称:avisynth64,代码行数:20,代码来源:turn.cpp

示例13: GetFrame

PVideoFrame __stdcall AutoTraceFilter::GetFrame(int n, IScriptEnvironment* env) {
	// Grab the child frame
	PVideoFrame childFrame = child->GetFrame(n, env);
	// Create the bitmap - AutoTrace always wants a 24-bpp bitmap for some dumb reason
	at_bitmap_type *bitmap;
	bitmap = at_bitmap_new(srcWidth, srcHeight, 3);
	size_t bitmap_size = srcWidth * srcHeight * 3;
	// Pull the bitmap data
	// We can just blt lines
	const BYTE* srcBitmap = childFrame->GetReadPtr();
	int pitch = childFrame->GetPitch();
	int rowSize = childFrame->GetRowSize();
	for (int y = 0; y < srcHeight; y++) {
		// Note that R and B are swapped in this. It doesn't really matter.
		memcpy_s(bitmap->bitmap + ((srcHeight - y - 1) * rowSize), bitmap_size, srcBitmap + (y * pitch), rowSize);
	}
	// This does the actual tracing:
	at_splines_type* splines = at_splines_new(bitmap, fitting_opts, exception_handler, NULL);
	// Now create the new frame. First, blank out the old frame
	graphics->Clear(*backgroundColor);
	at_real tx = ((at_real)destWidth) / ((at_real)srcWidth);
	at_real ty = ((at_real)destHeight) / ((at_real)srcHeight);
	for (unsigned int i = 0; i < splines->length; i++) {
		at_spline_list_type spline_list = splines->data[i];
		Gdiplus::GraphicsPath path;
		for (unsigned int j = 0; j < spline_list.length; j++) {
			at_spline_type* spline = &(spline_list.data[j]);
			if (spline->degree == AT_LINEARTYPE) {
				path.AddLine((Gdiplus::REAL)(spline->v[0].x * tx), (Gdiplus::REAL)(spline->v[0].y * ty),
					(Gdiplus::REAL)(spline->v[3].x * tx), (Gdiplus::REAL)(spline->v[3].y * ty));
			} else {
				path.AddBezier(
					(Gdiplus::REAL)(spline->v[0].x * tx), (Gdiplus::REAL)(spline->v[0].y * ty),
					(Gdiplus::REAL)(spline->v[1].x * tx), (Gdiplus::REAL)(spline->v[1].y * ty),
					(Gdiplus::REAL)(spline->v[2].x * tx), (Gdiplus::REAL)(spline->v[2].y * ty),
					(Gdiplus::REAL)(spline->v[3].x * tx), (Gdiplus::REAL)(spline->v[3].y * ty));
			}
		}
		path.CloseFigure();
		// Red and blue are swapped here, so swap them back.
		Gdiplus::Color color(spline_list.color.b, spline_list.color.g, spline_list.color.r);
		Gdiplus::SolidBrush brush(color);
		graphics->FillPath(&brush, &path);
	}
	at_splines_free(splines);
	at_bitmap_free(bitmap);
	// Now we need to create our result frame
	PVideoFrame outputFrame = env->NewVideoFrame(vi);
	BYTE* outputData = outputFrame->GetWritePtr();
	env->BitBlt(outputData, outputFrame->GetPitch(), renderedFrameData, renderedFramePitch, destWidth*4, destHeight);
	return outputFrame;
}
开发者ID:Xenoveritas,项目名称:AviSynth-Stuff,代码行数:52,代码来源:AutoTraceFilter.cpp

示例14: 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;
}
开发者ID:chikuzen,项目名称:TEMmod,代码行数:51,代码来源:temmod.cpp

示例15: 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


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