亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? refbuf.c

?? Mobile IP VCEG的信道模擬程序
?? C
字號:
// Refbuf.c		Declarations of teh reference frame buffer types and functions

#define HACK


#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <assert.h>

#include "refbuf.h"
#include "global.h"

#define CACHELINESIZE	32

#ifdef HACK


// Reference buffer write routines
//
//

void PutPel_14 (pel_t **Pic, int y, int x, pel_t val) {
	Pic [y][x] = val;
}

void PutPel_11 (pel_t *Pic, int y, int x, pel_t val) {
	Pic [y*img->width+x] = val;
}


// Reference buffer read, Full pel
//
pel_t	FastPelY_11 (pel_t *Pic, int y, int x) {

	return Pic [y*img->width+x];
}


pel_t	*FastLine16Y_11 (pel_t *Pic, int y, int x) {
	return &Pic [y*img->width+x];
}

pel_t	UMVPelY_11 (pel_t *Pic, int y, int x) {
	if (x < 0) {										
		if (y < 0)
			return Pic [0];
		if (y >= img->height)
			return Pic [(img->height-1) * img->width];
		return Pic [y*img->width];
	}

	if (x >= img->width) {
		if (y < 0)
			return Pic [img->width-1];
		if (y >= img->height)
			return Pic [img->height * img->width -1];
		return Pic [(y+1)*img->width -1 ];
	}

	if (y < 0)		// note: corner pixels were already processed
		return Pic [x];
	if (y >= img->height)
		return Pic [(img->height-1)*img->width+x];

	return Pic [y*img->width+x];
}

// Note: the follonwing function is NOT reentrant!  Use a buffer 
// provided by the caller to change that (but it costs a memcpy()...

static pel_t line[16];
pel_t	*UMVLine16Y_11 (pel_t *Pic, int y, int x) {
	int i;

	for (i=0; i<16; i++)
		line[i] = UMVPelY_11 (Pic, y, x+i);
	return line;
}


// Reference buffer read, 1/2 pel
//
pel_t	FastPelY_12 (pel_t **Pic, int y, int x) {
	return Pic [y<<1][x<<1];
}


pel_t	UMVPelY_12 (pel_t **Pic, int y, int x) {
	return UMVPelY_14 (Pic, y*2, x*2);
}


// Reference buffer, 1/4 pel
//
pel_t	UMVPelY_14 (pel_t **Pic, int y, int x) {

	int width4	= (img->width<<2)-1;
	int height4 = (img->height<<2)-1;
	
	if (x < 0) {
		if (y < 0)
			return Pic [0][0];
		if (y > height4)
			return Pic [height4][0];
		return Pic [y][0];
	}

	if (x > width4) {
		if (y < 0)
			return Pic [0][width4];
		if (y > height4)
			return Pic [height4][width4];
		return Pic [y][width4];
	}

	if (y < 0)		// note: corner pixels were already processed
		return Pic [0][x];
	if (y > height4)
		return Pic [height4][x];


	return Pic [y][x];
}

pel_t	FastPelY_14 (pel_t**Pic, int y, int x) {
	return Pic [y][x];
}


// reference buffer, 1/8th pel
	
pel_t	UMVPelY_18_old (pel_t **Pic, int y, int x)
{
	byte out;
	int yfloor, xfloor, x_max, y_max;

	x = max (0, min (x, (img->width *8-2)));
	y = max (0, min (y, (img->height*8-2)));

	xfloor=x/2;
	yfloor=y/2;


	x_max=img->width *4-1;
	y_max=img->height*4-1;

	if(xfloor<0 || xfloor > x_max)
	  {
	    printf("\n WARNING(get_eigthpix_pel): xfloor = %d is out of range",xfloor);
	    xfloor=min(x_max,max(0,xfloor));
	    printf(", set to %d\n",xfloor);
	  }

	if(yfloor<0 || yfloor > y_max)
	  {
	    printf("\n WARNING(get_eigthpix_pel): yfloor = %d is out of range",yfloor);
	    yfloor=min(y_max,max(0,yfloor));
	    printf(", set to %d\n",yfloor);

	  }


	if( y == img->height*8-1 )
	  {
	    if (x%2 && x != img->width*8-1)
	      {
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor  ][xfloor+1] + 1 ) / 2;
	      }
	    else
	      out=  Pic[yfloor  ][xfloor  ];
	      
	  }
	else 	if( x == img->width*8-1 )
	  {
	    if (y%2)
	      {
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor+1][xfloor  ] + 1 ) / 2;
	      }
	    else
	      out=  Pic[yfloor  ][xfloor  ];
	      
	  }
	else if( x%2 && y%2 )
	  {
	    out=( Pic[yfloor  ][xfloor  ] +
		  Pic[yfloor+1][xfloor  ] +
		  Pic[yfloor  ][xfloor+1] +
		  Pic[yfloor+1][xfloor+1] + 2 ) / 4;
	  }
	else if (x%2)
	  {
	    out=( Pic[yfloor  ][xfloor  ] +
		  Pic[yfloor  ][xfloor+1] + 1 ) / 2;
	  }
	else if (y%2)
	  {
	    out=( Pic[yfloor  ][xfloor  ] +
		  Pic[yfloor+1][xfloor  ] + 1 ) / 2;
	  }
	else
	  out=  Pic[yfloor  ][xfloor  ];
	
	return(out);

}

pel_t	UMVPelY_18 (pel_t **Pic, int y, int x) {
	
	byte out;
	int yfloor, xfloor;
	
	int width8  = (img->width<<3) - 2;		// Width and Height of the 1/4 buffer, measure in 1/8 pel
	int height8 = (img->height<<3) -2;		// the -2 is for the bound checking, since arrays start at 0
	

	// The following two are macros and not variables, because they need to be calculated only
	// rarely, and hence variables that are always evaluated would be inappropriate.  The macros
	// are more easily readable.

#define	width4	((img->width<<2)-1)
#define height4	((img->height<<2)-1)

	if (x < 0) {
		if (y < 0)
			return Pic [0][0];
		if (y > height8)
			return Pic [height4][0];
		x=0;
	}

	if (x > width8) {
		if (y < 0)
			return Pic [0][width4];
		if (y > height8)
			return Pic [height4][width4];
		x=width8;
	}

	if (y < 0)		// note: corner pixels were already processed
		y=0;
	if (y > height8)
		y=height8;

#undef width4
#undef height4


	xfloor=x>>1;
	yfloor=y>>1;

	if( x%2 && y%2 )
	{
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor+1][xfloor  ] +
			  Pic[yfloor  ][xfloor+1] +
			  Pic[yfloor+1][xfloor+1] + 2 ) / 4;
	}
	else if (x%2)
	{
		out=( Pic[yfloor  ][xfloor  ] +
			  Pic[yfloor  ][xfloor+1] + 1 ) / 2;
	}
	else if (y%2)
	{
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor+1][xfloor  ] + 1 ) / 2;
	}
	else
		out=  Pic[yfloor  ][xfloor  ];

	return(out);

}

pel_t	FastPelY_18 (pel_t **Pic, int y, int x) {
	
	byte out;
	int yfloor, xfloor;

	//int width8  = (img->width<<3) - 2;		// Width and Height of the 1/4 buffer, measure in 1/8 pel
	//int height8 = (img->height<<3) -2;		// the -2 is for the bound checking, since arrays start at 0

	xfloor=x>>1;
	yfloor=y>>1;

	if( x%2 && y%2 )
	{
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor+1][xfloor  ] +
			  Pic[yfloor  ][xfloor+1] +
			  Pic[yfloor+1][xfloor+1] + 2 ) / 4;
	}
	else if (x%2)
	{
		out=( Pic[yfloor  ][xfloor  ] +
			  Pic[yfloor  ][xfloor+1] + 1 ) / 2;
	}
	else if (y%2)
	{
		out=( Pic[yfloor  ][xfloor  ] +
		      Pic[yfloor+1][xfloor  ] + 1 ) / 2;
	}
	else
		out=  Pic[yfloor  ][xfloor  ];

	return(out);

}

void InitRefbuf () {
	int width  = img->width;
	int height = img->height;
	int num_frames = img->buf_cycle;
	int i;

	if (NULL == (Refbuf11_P = malloc ((width * height + 4711) * sizeof (pel_t))))
		perror ("InitRefbuf: cannot allocate memory");
	if (NULL == (Refbuf11 = malloc (num_frames * sizeof (pel_t *))))
		perror ("InitRefbuf, cannot allocate memory\n");
	for (i=0; i<num_frames; i++)
		if (NULL == (Refbuf11[i] = malloc ((width * height + 4711) * sizeof (pel_t))))
			perror ("InitRefbuf: cannot allocate memory");

}



/************************************************************************
*  Name :    copy2mref()
*
*  Description: Substitutes function oneforthpix_2. It should be worked 
*								out how this copy procedure can be avoided.
*
************************************************************************/
void copy2mref()
{
	int j, uv;

	img->frame_cycle=img->number % img->buf_cycle;  /*GH img->no_multpred used insteadof MAX_MULT_PRED
		                                                frame buffer size = img->no_multpred+1*/
//	printf ("Copy2MRef: copying mref-P to ref buffer %d\n", img->frame_cycle);
	/* Luma */
	for (j=0; j < img->height*4; j++)
		memcpy(mref[img->frame_cycle][j],mref_P[j], img->width*4);


	/*  Chroma: */
	for (uv=0; uv < 2; uv++)
		for (j=0; j < img->height_cr; j++)
				memcpy(mcef[img->frame_cycle][uv][j],mcef_P[uv][j],img->width_cr);

	// Full pel represnetation for MV search

	memcpy (Refbuf11[img->frame_cycle], Refbuf11_P, (img->width*img->height));
}






#endif


#ifndef HACK
// Alloc and free for reference buffers

refpic_t *AllocRefPic (int Id, 
					  int NumCols, 
					  int NumRows,
					  int MaxMotionVectorX,		// MV Size may be used to allocate additional
					  int MaxMotionVectorY) {	// memory around boundaries fro UMV search

	refpic_t *pic;
	int xs, ys;
	
	if (NULL == (pic = malloc (sizeof (refpic_t)))) {
		perror ("Malloc (sizeof (refpic_t)) in AllocRefPic, exiting\n");
	}
	
	if (NumCols %2 != 0)
		perror ("AllocRefPic: Number of columns must be divisible by two, exiting\n");
	if (NumRows %2 != 0)
		perror ("AllocRefPic: Number of rows must be divisible by two, exiting\n");

	pic->Id = Id;
	xs = NumCols + MaxMotionVectorX + MaxMotionVectorX;
	if (xs % (CACHELINESIZE/sizeof (pel_t)) != 0)
		xs = ((xs / (CACHELINESIZE/sizeof (pel_t)))+1) * (CACHELINESIZE/sizeof (pel_t));
	ys = NumRows + MaxMotionVectorY + MaxMotionVectorY;
	pic->x_ysize = xs * 4;
	pic->y_ysize = (NumRows + MaxMotionVectorY + MaxMotionVectorY) * 4;

	pic->x_yfirst	= MaxMotionVectorX * 4;
	pic->x_ylast	= (NumCols + MaxMotionVectorX) * 4;
	pic->y_yfirst	= MaxMotionVectorY * 4;
	pic->x_ylast	= (NumRows + MaxMotionVectorY) * 4;

	pic->x_uvsize	= xs/2;
	pic->y_uvsize	= ys/2;

	pic->x_uvfirst	= MaxMotionVectorX/2;
	pic->x_uvlast	= (NumCols + MaxMotionVectorX)/2;
	pic->y_uvfirst	= MaxMotionVectorY/2;
	pic->y_uvlast	= (NumRows + MaxMotionVectorY)/2;

	if (NULL == (pic->y = malloc (16 * sizeof (pel_t)* xs * ys)))
		perror ("AllocRefPic: cannot alloc memory for Y-plane, exiting");
	if (NULL == (pic->u = malloc (sizeof (pel_t) * (xs/2) * (ys/2))))
		perror ("AllocRefPic: cannot alloc memory for U-plane, exiting");
	if (NULL == (pic->v = malloc (sizeof (pel_t) * (xs/2) * (ys/2))))
		perror ("AllocRefPic: cannot alloc memory for V-plane, exiting");

	return pic;
}


int FreeRefPic (refpic_t *Pic) {
	if (Pic == NULL)
		return 0;
	if (Pic->y != NULL)
		free (Pic->y);
	if (Pic->u != NULL)
		free (Pic->u);
	if (Pic->v != NULL)
		free (Pic->v);
	free (Pic);
	return (0);
}






// Access functions for full pel (1/1 pel)

pel_t	PelY_11 (refpic_t *Pic, int x, int y) {
	register int pos;

	pos = x<<2+Pic->x_yfirst;		// Y Structures are 1/4 pel, hence *4
	pos += (Pic->x_ysize * (Pic->y_yfirst + y<<2));

	return Pic->y[pos];
}


pel_t	PelU_11 (refpic_t *Pic, int x, int y) {
	register int pos;

	pos = x+Pic->x_uvfirst;		// UV Structures are 1/1 pel
	pos += Pic->x_uvsize * (Pic->y_uvfirst + y);

	return Pic->u[pos];
}

pel_t	PelV_11 (refpic_t *Pic, int x, int y) {
	register int pos;

	pos = x+Pic->x_uvfirst;		// UV Structures are 1/1 pel
	pos += Pic->x_uvsize * (Pic->y_uvfirst + y);

	return Pic->v[pos];
}


pel_t	*MBLineY_11 (refpic_t *Pic, int x, int y) {
	perror ("MBLine_11: net yet implemented, exit");
}


// Access functions for half pel (1/2 pel)

pel_t	PelY_12 (refpic_t *Pic, int x, int y) {
	register int pos;
	
	pos = (x<<1+Pic->x_yfirst);		// Structures are 1/4 pel, hence *4
	pos += (Pic->x_ysize * (Pic->y_yfirst + y<<1));

	return (Pic->v[pos]);
};


// Access functions for quater pel (1/4 pel)

pel_t	PelY_14 (refpic_t *Pic, int x, int y) {
	return (Pic->y[ (Pic->y_yfirst+y)*Pic->x_ysize  + x + Pic->x_yfirst]);
}


// Access functions for one-eigths pel (1/8 pel)

pel_t	PelY_18 (refpic_t *Pic, int x, int y) {
	perror ("No 1/8th pel support yet");
}

#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区高清视频在线观看| 国产成人av一区二区三区在线 | 日韩一级视频免费观看在线| 久久精品人人做人人综合 | 亚洲欧美电影院| 国产在线播精品第三| 精品视频999| 国产精品美日韩| 国产老肥熟一区二区三区| 欧美性猛交xxxxxx富婆| 成人欧美一区二区三区在线播放| 日本成人中文字幕在线视频 | 精品国产亚洲一区二区三区在线观看 | 国产精品亚洲第一 | 91福利区一区二区三区| 中文欧美字幕免费| 国产裸体歌舞团一区二区| 欧美日韩国产色站一区二区三区| 国产精品国产三级国产aⅴ入口 | 久久先锋影音av| 九九九精品视频| 欧美成人a视频| 日韩高清在线观看| 欧美区在线观看| 亚洲6080在线| 欧美精选一区二区| 五月综合激情网| 91精品国产麻豆| 视频一区中文字幕| 日韩一区二区三区观看| 日韩成人一区二区三区在线观看| 欧美日韩久久一区二区| 视频一区国产视频| 欧美一区二区三区视频在线观看| 日韩高清电影一区| 欧美变态tickle挠乳网站| 美女视频网站黄色亚洲| 欧美v亚洲v综合ⅴ国产v| 国内外成人在线| 国产偷v国产偷v亚洲高清| 不卡一区二区中文字幕| 亚洲精品高清在线| 欧美视频三区在线播放| 蜜臀精品一区二区三区在线观看| 欧美一级二级三级蜜桃| 国产精品456| 日韩毛片在线免费观看| 欧美日韩国产一级片| 免费成人av在线播放| 久久精品一区四区| 色综合色狠狠天天综合色| 午夜欧美电影在线观看| 亚洲精品在线三区| 99re视频精品| 免费人成黄页网站在线一区二区 | 亚洲自拍欧美精品| 91精品国产综合久久福利| 国产麻豆精品久久一二三| 日韩一区日韩二区| 日韩欧美国产系列| 成人app网站| 日韩国产欧美在线播放| 久久久国产综合精品女国产盗摄| 色综合色综合色综合色综合色综合| 亚洲国产aⅴ成人精品无吗| 久久一日本道色综合| 在线一区二区观看| 国产一区二区三区| 一级日本不卡的影视| 亚洲精品一线二线三线无人区| 99久久er热在这里只有精品15| 日日夜夜免费精品| 国产精品久久久久影院亚瑟| 91精品国产一区二区三区| 97精品电影院| 韩国三级在线一区| 亚洲国产精品久久艾草纯爱| 国产日韩亚洲欧美综合| 69久久99精品久久久久婷婷| 99综合电影在线视频| 久久99精品久久久久久国产越南 | 久久久久国产精品麻豆| 欧美亚洲国产一区在线观看网站 | 久久福利资源站| 亚洲一区二区影院| 国产精品麻豆欧美日韩ww| 日韩精品一区二区在线| 欧美日韩激情一区二区三区| 91香蕉国产在线观看软件| 国产成人精品亚洲777人妖| 日日欢夜夜爽一区| 亚洲福利电影网| 亚洲猫色日本管| 国产精品无人区| 久久久蜜臀国产一区二区| 日韩一二三区不卡| 欧美美女激情18p| 欧美少妇一区二区| 91黄视频在线观看| 色综合中文综合网| 欧美在线看片a免费观看| 波多野结衣亚洲| 成人午夜又粗又硬又大| 国产福利精品一区| 韩国女主播成人在线观看| 免费在线观看视频一区| 日韩高清欧美激情| 日本三级亚洲精品| 久久精品999| 精品综合久久久久久8888| 久久精品久久精品| 国产又黄又大久久| 国产一区二区电影| 国产二区国产一区在线观看| 国产精品自拍一区| 丰满亚洲少妇av| 成人av集中营| 91日韩在线专区| 91国偷自产一区二区三区观看| 91美女片黄在线观看| 91美女在线看| 欧美三日本三级三级在线播放| 91高清视频免费看| 欧美久久一二区| 精品久久五月天| 国产日韩欧美高清在线| 亚洲欧洲三级电影| 亚洲午夜视频在线观看| 日本在线不卡视频一二三区| 精品一二线国产| 成人av网站免费| 欧美怡红院视频| 精品福利视频一区二区三区| 日本一区二区三区四区| 亚洲在线观看免费| 美女视频黄免费的久久| 国产精品69久久久久水密桃| 一本到三区不卡视频| 欧美精品日韩一区| www国产精品av| 一区二区三区四区在线| 免费日本视频一区| 91网站最新网址| 日韩一二三区不卡| 成人欧美一区二区三区视频网页| 亚洲电影激情视频网站| 国产乱人伦偷精品视频免下载| 一本色道久久综合精品竹菊| 日韩欧美一级在线播放| 亚洲欧美偷拍三级| 加勒比av一区二区| 欧美伊人久久大香线蕉综合69| 精品国产91乱码一区二区三区 | 成人精品鲁一区一区二区| 欧美亚洲一区三区| 国产视频一区在线播放| 五月激情综合色| 97精品国产露脸对白| 久久综合久久综合亚洲| 亚洲综合av网| 99久久国产综合精品麻豆| 精品av综合导航| 午夜精品久久久| 91美女福利视频| 国产日韩精品一区| 麻豆成人久久精品二区三区红 | 欧美激情综合五月色丁香| 天堂影院一区二区| 色综合天天在线| 国产三级欧美三级| 蜜臀va亚洲va欧美va天堂| 91久久人澡人人添人人爽欧美| xvideos.蜜桃一区二区| 免费观看日韩电影| 欧美日韩免费电影| 樱花草国产18久久久久| 国产精品影视在线| 欧美精品一区二区久久久| 亚洲成人激情综合网| 色综合久久久久久久久| 国产精品久久久久久久久久免费看| 久久精品噜噜噜成人88aⅴ | 国产一区二区不卡| 欧美精品久久久久久久多人混战 | 精品少妇一区二区三区免费观看 | 成人av在线资源| 国产日韩影视精品| 国产一区二区精品久久91| 欧美一级免费大片| 麻豆国产一区二区| 日韩视频一区二区在线观看| 午夜伦欧美伦电影理论片| 欧美三级中文字幕| 怡红院av一区二区三区| 在线区一区二视频| 亚洲一区二区欧美日韩| 欧美三级日韩在线| 免费观看一级特黄欧美大片| 欧美电影精品一区二区| 激情深爱一区二区|