Example #1
0
static void 
dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t width, uint32_t height) 
{
	// YUV conversion works like this:
	//
	//		 We write the Y, U, and V planes separately into 3dfx YUV Planar memory
	//		 region.  The nice chip then takes these and packs them into the YUYV
	//		 format in the regular frame buffer, starting at yuvBaseAddr, page 2 here.
	//		 Then we tell the 3dfx to do a Screen to Screen Stretch BLT to copy all 
	//		 of the data on page 2 onto page 1, converting it to 16 bpp RGB as it goes.
	//		 The result is a nice image on page 1 ready for display. 

	uint32_t j;
	uint32_t y_imax, uv_imax, jmax;

	reg_YUV->yuvBaseAddr = to;
	reg_YUV->yuvStride = screenwidth*2;

	LOG("video_out_3dfx: starting planar dump\n");
	jmax = height>>1; // vidheight/2, height of U and V planes
	y_imax = width; // Y plane is twice as wide as U and V planes
	uv_imax = width>>1;  // vidwidth/2/4, width of U and V planes in 32-bit words

	for (j=0;j<jmax;j++) 
	{
		//XXX this should be hand-rolled 32 bit memcpy for safeness.
		fast_memcpy(fb_YUV->U + (uint32_t) VOODOO_YUV_STRIDE*  j       ,((uint8_t*) u) + uv_imax*  j       , uv_imax);
		fast_memcpy(fb_YUV->V + (uint32_t) VOODOO_YUV_STRIDE*  j       ,((uint8_t*) v) + uv_imax*  j       , uv_imax);
		fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE* (j<<1)   ,((uint8_t*) y) + y_imax * (j<<1)   , y_imax);
		fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE*((j<<1)+1),((uint8_t*) y) + y_imax *((j<<1)+1), y_imax);
	}
  LOG("video_out_3dfx: done planar dump\n");
}
Example #2
0
/***************************************************************************

  Game driver(s)

***************************************************************************/

ROM_START( kicker_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, 0x2598dfdd )
	ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, 0x0cf0351a )
	ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, 0x654037f8 )

	ROM_REGION_DISPOSE(0xc000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "kikra10.bin",  0x0000, 0x2000, 0x4d156afc )
	ROM_LOAD( "kikra11.bin",  0x2000, 0x2000, 0xff6ca5df )
	ROM_LOAD( "kikrh14.bin",  0x4000, 0x4000, 0xb94e645b )
	ROM_LOAD( "kikrh13.bin",  0x8000, 0x4000, 0x61bbf797 )

	ROM_REGION(0x0500)	/* color proms */
	ROM_LOAD( "kicker.a12",   0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */
	ROM_LOAD( "kicker.a13",   0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */
	ROM_LOAD( "kicker.a14",   0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */
	ROM_LOAD( "kicker.b8",    0x0300, 0x0100, 0xaa900724 ) /* character lookup table */
	ROM_LOAD( "kicker.f16",   0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */
ROM_END

ROM_START( shaolins_rom )
	ROM_REGION(0x10000)     /* 64k for code */
	ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, 0x2598dfdd )
	ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, 0x0cf0351a )
	ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, 0x654037f8 )

	ROM_REGION_DISPOSE(0xc000)	/* temporary space for graphics (disposed after conversion) */
	ROM_LOAD( "shaolins.6",   0x0000, 0x2000, 0xff18a7ed )
	ROM_LOAD( "shaolins.7",   0x2000, 0x2000, 0x5f53ae61 )
	ROM_LOAD( "kikrh14.bin",  0x4000, 0x4000, 0xb94e645b )
	ROM_LOAD( "kikrh13.bin",  0x8000, 0x4000, 0x61bbf797 )

	ROM_REGION(0x0500)	/* color proms */
	ROM_LOAD( "kicker.a12",   0x0000, 0x0100, 0xb09db4b4 ) /* palette red component */
	ROM_LOAD( "kicker.a13",   0x0100, 0x0100, 0x270a2bf3 ) /* palette green component */
	ROM_LOAD( "kicker.a14",   0x0200, 0x0100, 0x83e95ea8 ) /* palette blue component */
	ROM_LOAD( "kicker.b8",    0x0300, 0x0100, 0xaa900724 ) /* character lookup table */
	ROM_LOAD( "kicker.f16",   0x0400, 0x0100, 0x80009cf5 ) /* sprite lookup table */
ROM_END



static int hiload(void)
{
	unsigned char *RAM = Machine->memory_region[Machine->drv->cpu[0].memory_region];


	/* check if the hi score table has already been initialized */
	if (memcmp(&RAM[0x2b00],"\x1d\x2c\x1f\x01\x00",5) == 0)
	{
		void *f;


		if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_HIGHSCORE,0)) != 0)
		{
			osd_fread(f,&RAM[0x2b00],0x40);

			/* top score display */
			fast_memcpy(&RAM[0x2af0], &RAM[0x2b04], 4);

			/* 1p score display, which also displays the top score on startup */
			fast_memcpy(&RAM[0x2a81], &RAM[0x2b04], 4);

			osd_fclose(f);
		}

		return 1;
	}
	else return 0;	/* we can't load the hi scores yet */
}
void
svn_txdelta_apply_instructions(svn_txdelta_window_t *window,
                               const char *sbuf, char *tbuf,
                               apr_size_t *tlen)
{
  const svn_txdelta_op_t *op;
  apr_size_t tpos = 0;

  for (op = window->ops; op < window->ops + window->num_ops; op++)
    {
      const apr_size_t buf_len = (op->length < *tlen - tpos
                                  ? op->length : *tlen - tpos);

      /* Check some invariants common to all instructions.  */
      assert(tpos + op->length <= window->tview_len);

      switch (op->action_code)
        {
        case svn_txdelta_source:
          /* Copy from source area.  */
          assert(op->offset + op->length <= window->sview_len);
          fast_memcpy(tbuf + tpos, sbuf + op->offset, buf_len);
          break;

        case svn_txdelta_target:
          /* Copy from target area.  We can't use memcpy() or the like
           * since we need a specific semantics for overlapping copies:
           * they must result in repeating patterns.
           * Note that most copies won't have overlapping source and
           * target ranges (they are just a result of self-compressed
           * data) but a small percentage will.  */
          assert(op->offset < tpos);
          patterning_copy(tbuf + tpos, tbuf + op->offset, buf_len);
          break;

        case svn_txdelta_new:
          /* Copy from window new area.  */
          assert(op->offset + op->length <= window->new_data->len);
          fast_memcpy(tbuf + tpos,
                      window->new_data->data + op->offset,
                      buf_len);
          break;

        default:
          assert(!"Invalid delta instruction code");
        }

      tpos += op->length;
      if (tpos >= *tlen)
        return;                 /* The buffer is full. */
    }

  /* Check that we produced the right amount of data.  */
  assert(tpos == window->tview_len);
  *tlen = tpos;
}
Example #4
0
static int write_buffer(unsigned char* data,int len){
  int first_len = BUFFSIZE - write_pos;
  int free = buf_free();
  if (len > free) len = free;
  if (first_len > len) first_len = len;
  // till end of buffer
  fast_memcpy (&buffer[write_pos], data, first_len);
  if (len > first_len) { // we have to wrap around
    // remaining part from beginning of buffer
    fast_memcpy (buffer, &data[first_len], len - first_len);
  }
  write_pos = (write_pos + len) % BUFFSIZE;
  return len;
}
Example #5
0
TEST(Testfastmemcpy, General)
{
  char vardata[sizeof(refdata)];
  memset(vardata, 0, sizeof(vardata));
  EXPECT_NE(nullptr, fast_memcpy(vardata, refdata, sizeof(refdata)));
  EXPECT_EQ(0, memcmp(refdata, vardata, sizeof(refdata)));
}
Example #6
0
int appini_t::ini_open_memory (
                                ini_t * ini,
                                const char * content,
                                size_t content_len
                                )
{
    int r;

    memset ( ini, 0, sizeof ( ini_t ) );

    ini->len = content_len;
    ini->buf = ( char * ) calloc ( 1, content_len + 1 );
    if ( NULL == ini->buf )
    {
        return - 3;
    }

    fast_memcpy ( ini->buf, content, content_len );
    ini->buf[ content_len ] = '\0';

    r = ini_open2 ( ini );
    if ( 0 != r )
    {
        free ( ini->buf );
        ini->buf = NULL;
        return r;
    }

    return 0;
}
Example #7
0
/* JB 980920 update */
int osd_fread(void *file,void *buffer,int length)
{
	FakeFileHandle *f = (FakeFileHandle *)file;

	switch (f->type)
	{
		case kPlainFile:
			return fread(buffer,1,length,f->file);
			break;
		case kZippedFile:
		case kRAMFile:
			/* reading from the RAM image of a file */
			if (f->data)
			{
				if (length + f->offset > f->length)
					length = f->length - f->offset;
				fast_memcpy(buffer, f->offset + f->data, length);
				f->offset += length;
				return length;
			}
			break;
	}

	return 0;
}
Example #8
0
static void pngReadFN( png_structp pngstr,png_bytep buffer,png_size_t size )
{
 char * p = pngstr->io_ptr;
 if(size>pngLength-pngPointer && pngLength>=pngPointer) size=pngLength-pngPointer;
 fast_memcpy( buffer,(char *)&p[pngPointer],size );
 pngPointer+=size;
}
Example #9
0
int pia_startup (struct pia6821_interface *intf)
{
	int i;

	fast_memset (pia, 0, sizeof (pia));
	for (i = 0; i < intf->num; i++)
	{
		pia[i].in_a_func = intf->in_a_func[i];
		pia[i].in_ca1_func = intf->in_ca1_func[i];
		pia[i].in_ca2_func = intf->in_ca2_func[i];
		pia[i].out_a_func = intf->out_a_func[i];
		pia[i].out_ca2_func = intf->out_ca2_func[i];
		pia[i].irq_a_func = intf->irq_a_func[i];

		pia[i].in_b_func = intf->in_b_func[i];
		pia[i].in_cb1_func = intf->in_cb1_func[i];
		pia[i].in_cb2_func = intf->in_cb2_func[i];
		pia[i].out_b_func = intf->out_b_func[i];
		pia[i].out_cb2_func = intf->out_cb2_func[i];
		pia[i].irq_b_func = intf->irq_b_func[i];
	}
	fast_memcpy (pia_offsets, intf->offsets, sizeof (pia_offsets));

	return 1;
}
Example #10
0
TEST(Testfastmemcpy, General)
{
  char vardata[sizeof(refdata)];
  memset(vardata, 0, sizeof(vardata));
  EXPECT_TRUE(fast_memcpy(vardata, refdata, sizeof(refdata)));
  EXPECT_TRUE(!memcmp(refdata, vardata, sizeof(refdata)));
}
Example #11
0
static uint32_t draw_image(mp_image_t *mpi) {
	vo_zr2_priv_t *p = &priv;
	int size = (int)mpi->planes[1];
	if (size > (int)p->zrq.size) {
		ERROR("incoming JPEG image (size=%d) doesn't fit in buffer\n",
				size);
		return VO_FALSE;
	}

	/* looking for free buffer */
	if (p->queue - p->sync < (int)p->zrq.count) p->frame = p->queue;
	else {
		if (ioctl(p->vdes, MJPIOC_SYNC, &p->zs) < 0) {
			ERROR("error waiting for buffer to become free\n");
			return VO_FALSE;
		}
		p->frame = p->zs.frame;
		p->sync++;
	}

	/* copy the jpeg image to the buffer which we acquired */
	fast_memcpy(p->buf + p->zrq.size*p->frame, mpi->planes[0], size);

	return VO_TRUE;
}
Example #12
0
static void svga_clear_box(int x,int y,int w,int h){
uint8_t * rgbplane;
int i;

  if (mode_capabilities&CAP_ACCEL_CLEAR){
    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
      mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n",
             x,y,w,h);
    if(mode_capabilities&CAP_ACCEL_BACKGR)  
      vga_accel(ACCEL_SYNC);
    vga_accel(ACCEL_SETFGCOLOR,0);//black
    vga_accel(ACCEL_FILLBOX,x,y,w,h);
    return;
  }
  if (mode_capabilities & CAP_LINEAR){
    if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
      mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with memset\n",x,y,w,h);
    rgbplane=PageStore[0].vbase + (y*mode_stride) + (x*modeinfo->bytesperpixel);
    for(i=0;i<h;i++){
//i'm afraid that memcpy is better optimized than memset;)
      fast_memcpy(rgbplane,zerobuf,w*modeinfo->bytesperpixel);
//    memset(rgbplane,0,w*modeinfo->bytesperpixel);
      rgbplane+=mode_stride;
    }
    return;
  }
  //native
  if( mp_msg_test(MSGT_VO,MSGL_DBG3) )
    mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with native draw \n",x,y,w,h);
  if(modeinfo->bytesperpixel!=0) w*=modeinfo->bytesperpixel;
  for(i=0;i<h;i++){
    vga_drawscansegment(zerobuf,x,y+i,w);
  }
};
Example #13
0
void reorder_channel_copy_nch(void *src,
                              int src_layout,
                              void *dest,
                              int dest_layout,
                              int chnum,
                              int samples,
                              int samplesize)
{
    if (chnum < 5 || chnum == 7 || chnum > 8 ||
            src_layout < 0 || dest_layout < 0 ||
            src_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM ||
            dest_layout >= AF_CHANNEL_LAYOUT_SOURCE_NUM)
        fast_memcpy(dest, src, samples*samplesize);
    else if (chnum == 6)
        reorder_channel_copy(src, channel_layout_mapping_6ch[src_layout],
                             dest, channel_layout_mapping_6ch[dest_layout],
                             samples, samplesize);
    else if (chnum == 8)
        reorder_channel_copy(src, channel_layout_mapping_8ch[src_layout],
                             dest, channel_layout_mapping_8ch[dest_layout],
                             samples, samplesize);
    else
        reorder_channel_copy(src, channel_layout_mapping_5ch[src_layout],
                             dest, channel_layout_mapping_5ch[dest_layout],
                             samples, samplesize);
}
Example #14
0
static void toright(unsigned char *dst[3], unsigned char *src[3],
		    int dststride[3], int srcstride[3],
		    int w, int h, struct vf_priv_s* p)
{
	int k;

	for (k = 0; k < 3; k++) {
		unsigned char* fromL = src[k];
		unsigned char* fromR = src[k];
		unsigned char* to = dst[k];
		int src = srcstride[k];
                int dst = dststride[k];
		int ss;
		unsigned int dd;
		int i;

		if (k > 0) {
			i = h / 4 - p->skipline / 2;
			ss = src * (h / 4 + p->skipline / 2);
			dd = w / 4;
		} else {
			i = h / 2 - p->skipline;
                        ss = src * (h / 2 + p->skipline);
			dd = w / 2;
		}
		fromR += ss;
		for ( ; i > 0; i--) {
                        int j;
			unsigned char* t = to;
			unsigned char* sL = fromL;
			unsigned char* sR = fromR;

			if (p->scalew == 1) {
				for (j = dd; j > 0; j--) {
					*t++ = (sL[0] + sL[1]) / 2;
					sL+=2;
				}
				for (j = dd ; j > 0; j--) {
					*t++ = (sR[0] + sR[1]) / 2;
					sR+=2;
				}
			} else {
				for (j = dd * 2 ; j > 0; j--)
					*t++ = *sL++;
				for (j = dd * 2 ; j > 0; j--)
					*t++ = *sR++;
			}
			if (p->scaleh == 1) {
				fast_memcpy(to + dst, to, dst);
                                to += dst;
			}
			to += dst;
			fromL += src;
			fromR += src;
		}
		//printf("K %d  %d   %d   %d  %d \n", k, w, h,  src, dst);
	}
}
Example #15
0
DVDVideoPicture* CDVDCodecUtils::ConvertToNV12Picture(DVDVideoPicture *pSrc)
{
  // Clone a YV12 picture to new NV12 picture.
  DVDVideoPicture* pPicture = new DVDVideoPicture;
  if (pPicture)
  {
    *pPicture = *pSrc;

    int w = pPicture->iWidth / 2;
    int h = pPicture->iHeight / 2;
    int size = w * h;
    int totalsize = (pPicture->iWidth * pPicture->iHeight) + size * 2;
    BYTE* data = new BYTE[totalsize];
    if (data)
    {
      pPicture->data[0] = data;
      pPicture->data[1] = pPicture->data[0] + (pPicture->iWidth * pPicture->iHeight);
      pPicture->data[2] = NULL;
      pPicture->data[3] = NULL;
      pPicture->iLineSize[0] = pPicture->iWidth;
      pPicture->iLineSize[1] = pPicture->iWidth;
      pPicture->iLineSize[2] = 0;
      pPicture->iLineSize[3] = 0;
      pPicture->format = DVDVideoPicture::FMT_NV12;
      
      // copy luma
      uint8_t *s = pSrc->data[0];
      uint8_t *d = pPicture->data[0];
      for (int y = 0; y < (int)pSrc->iHeight; y++)
      {
        fast_memcpy(d, s, pSrc->iWidth);
        s += pSrc->iLineSize[0];
        d += pPicture->iLineSize[0];
      }

      //copy chroma
      uint8_t *s_u, *s_v, *d_uv;
      for (int y = 0; y < (int)pSrc->iHeight/2; y++) {
        s_u = pSrc->data[1] + (y * pSrc->iLineSize[1]);
        s_v = pSrc->data[2] + (y * pSrc->iLineSize[2]);
        d_uv = pPicture->data[1] + (y * pPicture->iLineSize[1]);
        for (int x = 0; x < (int)pSrc->iWidth/2; x++) {
          *d_uv++ = *s_u++;
          *d_uv++ = *s_v++;
        }
      }
      
    }
    else
    {
      CLog::Log(LOGFATAL, "CDVDCodecUtils::AllocateNV12Picture, unable to allocate new video picture, out of memory.");
      delete pPicture;
      pPicture = NULL;
    }
  }
  return pPicture;
}
Example #16
0
// our main method for processing images
// should  return a surface no matter what in the future
static PyObject* pygoom_process(PyObject *self, PyObject *args)
{
    if (init == 0) {
        if (data_import_init() == 0) {
            goomInfo = goom_init(width, height);
            init     = 1;
        }
        else {
            data_import_clean();
            return RAISE(PyExc_ValueError, "Error initializing mmap");
        }
    }

    if (mmap_area->count > counter || mmap_area->count < counter) {
        counter = mmap_area->count;

#ifdef USE_FASTMEMCPY
        fast_memcpy(data, mmap_area + sizeof(data_t), 2048);
#else
        memcpy(data, mmap_area + sizeof(data_t), 2048);
#endif
#ifdef VERBOSE
        printf ("goomInfo=%p, data=%p, FXMODE=%d, fps=%.1f, songtitle=%s, message=%s\n", 
            goomInfo, data, FXMODE, fps, songtitle, message);
#endif
        render_data = goom_update(goomInfo, data, FXMODE, fps, songtitle, message);

        if (!render_data) {
            data_import_clean();
            return RAISE(PyExc_ValueError, "Goom didn't give any result!");
        }

        if (!surf) {
            return RAISE(PyExc_ValueError, "Resolution not set");
        }

#ifdef USE_FASTMEMCPY
        fast_memcpy(surf->pixels, render_data, width * height * sizeof(uint32_t));
#else
        memcpy(surf->pixels, render_data, width * height * sizeof(uint32_t));
#endif
    }
    return Py_BuildValue("O", PySurface_New(surf));
}
static void do_plane(unsigned char *to, unsigned char *from,
		     int w, int h, int ts, int fs,
		     unsigned char **bufp, enum mode mode)
   {
   unsigned char *buf, *end;
   int top;

   if(!*bufp)
      {
      mode=PROGRESSIVE;
      if(!(*bufp=malloc(h*w))) return;
      }

   for(end=to+h*ts, buf=*bufp, top=1; to<end; from+=fs, to+=ts, buf+=w, top^=1)
      {
      fast_memcpy(to, mode==(top?BOTTOM_FIRST:TOP_FIRST)?buf:from, w);
      fast_memcpy(buf, from, w);
      }
   }
Example #18
0
LOCAL void set_pointer(int backstep)
{
//  if(backstep!=512 && backstep>fsizeold)
//    printf("\rWarning! backstep (%d>%d)                                         \n",backstep,fsizeold);
  wordpointer = bsbuf + ssize - backstep;
  if (backstep) fast_memcpy(wordpointer,bsbufold+fsizeold-backstep,backstep);
  bitindex = 0;
  bitsleft+=8*backstep;
//  printf("Backstep %d  (bitsleft=%d)\n",backstep,bitsleft);
}
Example #19
0
static void uiPlaybarDraw( void )
{
 int x;

 if ( !guiApp.subWindow.isFullScreen ) return;
 if ( !playbarVisible || !guiApp.playbarIsPresent ) return;

// guiApp.playbar.x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2;
 switch( guiApp.playbar.x )
  {
   case -1: x=( guiApp.subWindow.Width - guiApp.playbar.width ) / 2; break;
   case -2: x=( guiApp.subWindow.Width - guiApp.playbar.width ); break;
   default: x=guiApp.playbar.x;
  }

 switch ( uiPlaybarFade )
  {
   case 1: // fade in
        playbarLength--;
        if ( guiApp.subWindow.Height - guiApp.playbar.height >= playbarLength )
	 {
	  playbarLength=guiApp.subWindow.Height - guiApp.playbar.height;
	  uiPlaybarFade=0;
	  vo_mouse_autohide=0;
	 }
        wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength );
	break;
   case 2: // fade out
	playbarLength+=10;
	if ( playbarLength > guiApp.subWindow.Height )
	 {
	  playbarLength=guiApp.subWindow.Height;
	  uiPlaybarFade=playbarVisible=0;
          vo_mouse_autohide=1;
          wsVisibleWindow( &guiApp.playbarWindow,wsHideWindow );
	  return;
	 }
        wsMoveWindow( &guiApp.playbarWindow,True,x,playbarLength );
	break;
  }

// --- render
 if ( guiApp.playbarWindow.State == wsWindowExpose )
  {
   btnModify( evSetMoviePosition,guiInfo.Position );
   btnModify( evSetVolume,guiInfo.Volume );

   vo_mouse_autohide=0;

   fast_memcpy( playbarDrawBuffer,guiApp.playbar.Bitmap.Image,guiApp.playbar.Bitmap.ImageSize );
   RenderAll( &guiApp.playbarWindow,guiApp.playbarItems,guiApp.IndexOfPlaybarItems,playbarDrawBuffer );
   wsConvert( &guiApp.playbarWindow,playbarDrawBuffer );
  }
 wsPutImage( &guiApp.playbarWindow );
}
Example #20
0
bool CDVDCodecUtils::CopyNV12Picture(YV12Image* pImage, DVDVideoPicture *pSrc)
{
  BYTE *s = pSrc->data[0];
  BYTE *d = pImage->plane[0];
  int w = pSrc->iWidth;
  int h = pSrc->iHeight;
  // Copy Y
  if ((w == pSrc->iLineSize[0]) && ((unsigned int) pSrc->iLineSize[0] == pImage->stride[0]))
  {
    fast_memcpy(d, s, w*h);
  }
  else
  {
    for (int y = 0; y < h; y++)
    {
      fast_memcpy(d, s, w);
      s += pSrc->iLineSize[0];
      d += pImage->stride[0];
    }
  }
  
  s = pSrc->data[1];
  d = pImage->plane[1];
  w = pSrc->iWidth;
  h = pSrc->iHeight >> 1;
  // Copy packed UV (width is same as for Y as it's both U and V components)
  if ((w==pSrc->iLineSize[1]) && ((unsigned int) pSrc->iLineSize[1]==pImage->stride[1]))
  {
    fast_memcpy(d, s, w*h);
  }
  else
  {
    for (int y = 0; y < h; y++)
    {
      fast_memcpy(d, s, w);
      s += pSrc->iLineSize[1];
      d += pImage->stride[1];
    }
  }

  return true;
}
Example #21
0
static int read_buffer(unsigned char* data,int len){
  int first_len = BUFFSIZE - read_pos;
  int buffered = buf_used();
  if (len > buffered) len = buffered;
  if (first_len > len) first_len = len;
  // till end of buffer
#ifdef USE_SDL_INTERNAL_MIXER
  SDL_MixAudio (data, &buffer[read_pos], first_len, volume);
#else
  fast_memcpy (data, &buffer[read_pos], first_len);
#endif
  if (len > first_len) { // we have to wrap around
    // remaining part from beginning of buffer
#ifdef USE_SDL_INTERNAL_MIXER
    SDL_MixAudio (&data[first_len], buffer, len - first_len, volume);
#else
    fast_memcpy (&data[first_len], buffer, len - first_len);
#endif
  }
  read_pos = (read_pos + len) % BUFFSIZE;
  return len;
}
Example #22
0
static void flip_page(void)
{
#ifndef USE_CONVERT2FB
	int i, out_offset = 0, in_offset = 0;

	for (i = 0; i < in_height; i++) {
		fast_memcpy(center + out_offset, next_frame + in_offset,
				in_width * fb_pixel_size);
		out_offset += fb_line_len;
		in_offset += in_width * fb_pixel_size;
	}
#endif
}
Example #23
0
bool CDVDCodecUtils::CopyPicture(DVDVideoPicture* pDst, DVDVideoPicture* pSrc)
{
  BYTE *s, *d;
  int w = pSrc->iWidth;
  int h = pSrc->iHeight;

  s = pSrc->data[0];
  d = pDst->data[0];

  for (int y = 0; y < h; y++)
  {
    fast_memcpy(d, s, w);
    s += pSrc->iLineSize[0];
    d += pDst->iLineSize[0];
  }

  w >>= 1;
  h >>= 1;

  s = pSrc->data[1];
  d = pDst->data[1];
  for (int y = 0; y < h; y++)
  {
    fast_memcpy(d, s, w);
    s += pSrc->iLineSize[1];
    d += pDst->iLineSize[1];
  }

  s = pSrc->data[2];
  d = pDst->data[2];
  for (int y = 0; y < h; y++)
  {
    fast_memcpy(d, s, w);
    s += pSrc->iLineSize[2];
    d += pDst->iLineSize[2];
  }
  return true;
}
Example #24
0
static void flip_page (void) {
	int i;

	if (prevpts >= 0) for (i = 0; i < no_bl_files; i++)
		bl->write_frame(&bl_files[i], tmp, (vo_pts - prevpts)/90);
	fast_memcpy(tmp, image, bl->width*bl->height*bl->channels);
	prevpts = vo_pts;

	for (i = 0; i < no_bl_hosts; i++) bl->send_frame(&bl_hosts[i]);


	framenum++;
	return;
}
/**
 * \brief mpc_reader callback function for reading the header
 */
static mpc_int32_t cb_read(void *data, void *buf, mpc_int32_t size) {
  context_t *d = (context_t *)data;
  char *p = (char *)buf;
  int s = size;
  if (d->pos < d->header_len) {
    if (s > d->header_len - d->pos)
      s = d->header_len - d->pos;
    fast_memcpy(p, &d->header[d->pos], s);
  } else
    s = 0;
  memset(&p[s], 0, size - s);
  d->pos += size;
  return size;
}
Example #26
0
static int draw_slice(uint8_t *srcimg[], int stride[],
		int w, int h, int x, int y) {
	int i;
	uint8_t *dst = image + y * bl->width + x;
	uint8_t *src=srcimg[0];
	// copy Y:
	for (i = 0; i < h; i++) {
		fast_memcpy(dst,src,w);
		dst+=bl->width;
		src+=stride[0];

	}
 	return 0;
}
Example #27
0
void CRenderCaptureDX::SurfaceToBuffer()
{
  D3DLOCKED_RECT lockedRect;
  if (m_copySurface->LockRect(&lockedRect, NULL, D3DLOCK_READONLY) == D3D_OK)
  {
    //if pitch is same, do a direct copy, otherwise copy one line at a time
    if (lockedRect.Pitch == m_width * 4)
    {
      fast_memcpy(m_pixels, lockedRect.pBits, m_width * m_height * 4);
    }
    else
    {
      for (unsigned int y = 0; y < m_height; y++)
        fast_memcpy(m_pixels + y * m_width * 4, (uint8_t*)lockedRect.pBits + y * lockedRect.Pitch, m_width * 4);
    }
    m_copySurface->UnlockRect();
    SetState(CAPTURESTATE_DONE);
  }
  else
  {
    CLog::Log(LOGERROR, "CRenderCaptureDX::SurfaceToBuffer: locking m_copySurface failed");
    SetState(CAPTURESTATE_FAILED);
  }
}
bool CDVDCodecUtils::CopyPicture(YV12Image* pImage, const cedarv_picture_t *pSrc)
{
  BYTE *d = pImage->plane[0];
  int y_len = pSrc->size_y;
  int u_len = pSrc->size_u;
  int v_len = pSrc->size_v;

  int w = pImage->width * pImage->bpp;
  int h = pImage->height;

  CLog::Log(LOGDEBUG, "CopyPicture:w:%d -- h:%d - y:%d - u:%d- v:%d\n", w, h, y_len, u_len,v_len);
  fast_memcpy (d, pSrc->y, u_len);

  return true;
}
Example #29
0
bool CDVDCodecUtils::CopyYUV422PackedPicture(YV12Image* pImage, DVDVideoPicture *pSrc)
{
  BYTE *s = pSrc->data[0];
  BYTE *d = pImage->plane[0];
  int w = pSrc->iWidth;
  int h = pSrc->iHeight;

  // Copy YUYV
  if ((w * 2 == pSrc->iLineSize[0]) && ((unsigned int) pSrc->iLineSize[0] == pImage->stride[0]))
  {
    fast_memcpy(d, s, w*h*2);
  }
  else
  {
    for (int y = 0; y < h; y++)
    {
      fast_memcpy(d, s, w*2);
      s += pSrc->iLineSize[0];
      d += pImage->stride[0];
    }
  }
  
  return true;
}
Example #30
0
static int draw_slice(uint8_t *srcimg[], int stride[],
		int wf, int hf, int xf, int yf) {
	int i, w, h, x, y;
	uint8_t *dst;
	uint8_t *src=srcimg[0];
	w = wf; h = hf; x = xf; y = yf;
	dst=image; /* + zr->off_y + zr->image_width*(y/zr->vdec)+x;*/
	// copy Y:
	for (i = 0; i < h; i++) {
		fast_memcpy(dst,src,w);
		dst+=bl->width;
		src+=stride[0];

	}
 	return 0;
}