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

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

?? uvlc.c

?? Mobile IP VCEG的信道模擬程序
?? C
字號:
/*!
 * \file
 *			uvlc.c	
 *	\brief	
 *			UVLC support functions
 *	\author
 *			Main contributors (see contributors.h for copyright, address and affiliation details)
 *			Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com>
 *      Detlev Marpe                    <marpe@hhi.de>
 *      Gabi Blaettermann               <blaetter@hhi.de>
 */
#include "contributors.h"

#include <math.h>
#include <memory.h>
#include "global.h"
#include "uvlc.h"
#include "elements.h"
#include "bitsbuf.h"
#include "header.h"


// A little trick to avoid those horrible #if TRACE all over the source code
#if TRACE
#define SYMTRACESTRING(s) strcpy(sym.tracestring,s)
#else
#define SYMTRACESTRING(s)	/* to nothing */
#endif

extern void tracebits(const char *trace_str,	int len,	int info,int value1,
    int value2)	;

/************************************************************************
*
*  Routine      linfo
*
*  Description:   
*               Input: lenght and info
*               Output: number in the code table
*                    
************************************************************************/
void linfo(int len,	int info, int *value1, int *dummy) 
{
	*value1 = (int)pow(2,(len/2))+info-1; // *value1 = (int)(2<<(len>>1))+info-1;
}

/************************************************************************
*
*  Routine      linfo_mvd
*
*  Description:   
*               Input: lenght and info
*               Output: signed mvd
*                    
************************************************************************/
void linfo_mvd(int len,	int info, int *signed_mvd, int *dummy)  
{
	int n;
	n = (int)pow(2,(len/2))+info-1;
	*signed_mvd = (n+1)/2;
	if((n & 0x01)==0)                           /* lsb is signed bit */
		*signed_mvd = -*signed_mvd;
}

/************************************************************************
*
*  Routine      linfo_cbp_intra
*
*  Description:   
*               Input: lenght and info
*               Output: cbp (intra)
*                    
************************************************************************/
void linfo_cbp_intra(int len,int info,int *cbp, int *dummy)
{
	extern const byte NCBP[48][2];
    int cbp_idx;
	linfo(len,info,&cbp_idx,dummy);
    *cbp=NCBP[cbp_idx][0];
}

/************************************************************************
*
*  Routine      linfo_cbp_inter
*
*  Description:   
*               Input: lenght and info
*               Output: cbp (inter)
*                    
************************************************************************/
void linfo_cbp_inter(int len,int info,int *cbp, int *dummy)
{
	extern const byte NCBP[48][2];
	int cbp_idx;
	linfo(len,info,&cbp_idx,dummy);
    *cbp=NCBP[cbp_idx][1];
}
/************************************************************************
*
*  Routine      linfo_levrun_inter
*
*  Description:   
*               Input: lenght and info
*               Output: level, run
*                    
************************************************************************/
void linfo_levrun_inter(int len, int info, int *level, int *irun)	
{
	int l2;
	int inf;
	if (len<=9)
	{
		l2=mmax(0,len/2-1);
		inf=info/2;
		*level=NTAB1[l2][inf][0];
		*irun=NTAB1[l2][inf][1];
		if ((info&0x01)==1)
			*level=-*level;                   /* make sign */
	}
	else                                  /* if len > 9, skip using the array */
	{
		*irun=(info&0x1e)>>1;
		*level = LEVRUN1[*irun] + info/32 + (int)pow(2,len/2 - 5);
		if ((info&0x01)==1)
			*level=-*level;
	}
    /* GB */
    if (len == 1) /* EOB */
        *level = 0;
}

/************************************************************************
*
*  Routine      linfo_levrun_intra
*
*  Description:   
*               Input: lenght and info
*               Output: level, run
*                    
************************************************************************/
void linfo_levrun_intra(int len, int info, int *level,	int *irun)	
{
	int l2;
	int inf;

	if (len<=9)
	{
		l2=mmax(0,len/2-1);
		inf=info/2;
		*level=NTAB2[l2][inf][0];
		*irun=NTAB2[l2][inf][1];
		if ((info&0x01)==1)
			*level=-*level;                 /* make sign */
	}
	else                                  /* if len > 9, skip using the array */
	{
		*irun=(info&0x0e)>>1;
		*level = LEVRUN2[*irun] + info/16 + (int)pow(2,len/2-4) -1;
		if ((info&0x01)==1)
			*level=-*level;
	}
     /* GB */
    if (len == 1) /* EOB */
        *level = 0;
}


/************************************************************************
*
*  Routine      linfo_levrun_c2x2
*
*  Description:   
*               Input: lenght and info
*               Output: level, run
*                    
************************************************************************/
void linfo_levrun_c2x2(int len, int info, int *level, int *irun)
{
	int l2;
	int inf;

	if (len<=5)
	{
		l2=mmax(0,len/2-1);
		inf=info/2;
		*level=NTAB3[l2][inf][0];
		*irun=NTAB3[l2][inf][1];
		if ((info&0x01)==1)
			*level=-*level;                 /* make sign */
	}
	else                                  /* if len > 5, skip using the array */
	{
		*irun=(info&0x06)>>1;
		*level = LEVRUN3[*irun] + info/8 + (int)pow(2,len/2 - 3);
		if ((info&0x01)==1)
			*level=-*level;
	}
     /* GB */
    if (len == 1) /* EOB */
        *level = 0;
}




//  readSliceUVLC for new Pictureheader according VCEG-M79 

// Slice Headers can start on every byte aligned position, provided zero-stuffing.
// This is implemented here in such a way that a slice header can be trailed by 
// any number of 0 bits.
//
// readSliceUVLC returns -1 in case of problems, or oen of SOP, SOS, EOS in case of success

int readSliceUVLC(struct img_par *img, struct inp_par *inp)
{
    Slice *currSlice = img->currentSlice;
	DataPartition *dP;
	Bitstream *currStream = currSlice->partArr[0].bitstream;
	int *partMap = assignSE2partition[inp->partition_mode];
	int frame_bitoffset = currStream->frame_bitoffset = 0;
    SyntaxElement sym;
	int dummy;
	byte *buf = currStream->streamBuffer;
	//	static int first=TRUE;

	int code_word_ctr=0;
	int len, info;
    
	memset (buf, 0xff, MAX_CODED_FRAME_SIZE);		// this prevents a buffer full with zeros
	currStream->bitstram_length = GetOneSliceIntoSourceBitBuffer(buf);
	if (currStream->bitstram_length > 4)  // More than just a start code
	{		
		sym.type = SE_HEADER;
#if TRACE
	strcpy(sym.tracestring, "\nHeaderinfo");
#endif
		dP = &(currSlice->partArr[partMap[sym.type]]);
		len =  GetVLCSymbol (buf, frame_bitoffset, &info, currStream->bitstram_length); 
		currStream->frame_bitoffset +=len;
		switch (info)
		{
		case 0: 
			/* read PICTURE HEADER */
			dummy = PictureHeader(img,inp);
			return SOP;
		case 1:
			/* read SLICE HEADER */
			dummy = SliceHeader(img,inp);
			return SOS;
		default:
			set_ec_flag(SE_HEADER);				/* conceal current frame/slice */
			break;
		}
	} 
	else 		// less than four bytes in file -> cannot be a slice
		return EOS;    
	return 0;
}


/************************************************************************
*
*  Routine      readSyntaxElement_UVLC
*
*  Description: read next UVLC codeword from UVLC-partition and
*               map it to the corresponding syntax element
*
************************************************************************/
int readSyntaxElement_UVLC(SyntaxElement *sym, struct img_par *img, struct inp_par *inp, struct datapartition *dP)
{
    Bitstream   *currStream = dP->bitstream;
	int frame_bitoffset = currStream->frame_bitoffset;
	byte *buf = currStream->streamBuffer; 
	int BitstreamLengthInBytes = currStream->bitstram_length; 
	
	sym->len =  GetVLCSymbol (buf, frame_bitoffset, &(sym->inf), BitstreamLengthInBytes);
	if (sym->len == -1)
		return -1;
	currStream->frame_bitoffset += sym->len; 
	sym->mapping(sym->len,sym->inf,&(sym->value1),&(sym->value2));

#if TRACE
	tracebits(sym->tracestring, sym->len, sym->inf, sym->value1, sym->value2);
#endif
   
    return 1;
}

/************************************************************************
*
*  Routine      uvlc_startcode_follows
*
*  Description: Check if there are symbols for the next MB
*               
*
************************************************************************/

int uvlc_startcode_follows(struct img_par *img, struct inp_par *inp)
{
	Slice *currSlice = img->currentSlice;
	int dp_Nr = assignSE2partition[inp->partition_mode][SE_MBTYPE];
	DataPartition *dP = &(currSlice->partArr[dp_Nr]);
	Bitstream   *currStream = dP->bitstream;
	byte *buf = currStream->streamBuffer; 
	int frame_bitoffset = currStream->frame_bitoffset;
	int info;
	
	if (-1 == GetVLCSymbol (buf, frame_bitoffset, &info, currStream->bitstram_length)) 
		return TRUE;
	else
		return FALSE;
}


/*!
 *	\fn	GetVLCSymbol is the old findinfo();
 *	\brief	Moves the read pointer of the partition forward by one symbol
 *
 *	\param	byte buffer[]		containing VLC-coded data bits)
 *	\param	int totbitoffset	bit offset from start of partition
 *	\param	int type			expected data type (Partiotion ID)
 *	\return	int info, len		Length and Value of the next symbol
 *
 *	\note	As in both nal_bits.c and nal_part.c all data of one partition, slice,
 *			picture was already read into a buffer, there is no need to read any data
 *			here again.
 *		\par
 *			GetVLCInfo was extracted because there should be only one place in the
 *			source code that has knowledge about symbol extraction, regardless of
 *			the number of different NALs.
 *		\par
 *			This function could (and should) be optimized considerably
 *		\par
 *			If it is ever decided to have different VLC tables for different symbol
 *			types, then this would be the place for the implementation
 */

int GetVLCSymbol (byte buffer[],int totbitoffset,int *info, int bytecount) 
{

	register int inf;
	long byteoffset;			// byte from start of frame
	int bitoffset;			// bit from start of byte
	int ctr_bit=0;			// control bit for current bit posision
	int bitcounter=1;

	byteoffset= totbitoffset/8;
	bitoffset= 7-(totbitoffset%8);
	ctr_bit = (buffer[byteoffset] & (0x01<<bitoffset));		// set up control bit

	inf=0;													// shortest possible code is 1, then info is always 0

	while (ctr_bit==0)
	{									// repeate until next 0, ref. VLC
		bitoffset-=2;						// from MSB to LSB
		if (bitoffset<0)
		{									// finish with current byte ?
			bitoffset=bitoffset+8;
			byteoffset++;
		}

		ctr_bit=buffer[byteoffset] & (0x01<<(bitoffset));

		// make infoword

		if(bitoffset>=7)									// first bit in new byte
			if (buffer[byteoffset-1] & (0x01))				// check last (info)bit of last byte
				inf = ((inf << 1) | 0x01);					// multiply with 2 and add 1, ref VLC
			else
				inf = (inf << 1);							// multiply with 2

		else
			if (buffer[byteoffset] & (0x01<<(bitoffset+1)))	// check infobit
				inf = ((inf << 1) | 0x01);
			else
				inf = (inf << 1);
		bitcounter+=2;
		if (byteoffset > bytecount)
			return -1;
	}
	*info = inf;
	return bitcounter;           /* return absolute offset in bit from start of frame */
}





?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲美州欧州综合国| 爽爽淫人综合网网站| 舔着乳尖日韩一区| 国产精品中文字幕欧美| 欧美日本在线视频| 亚洲猫色日本管| 成人一道本在线| 精品国产sm最大网站| 亚洲成人av中文| 欧洲精品视频在线观看| 国产精品视频九色porn| 黑人巨大精品欧美一区| 欧美精品在线一区二区三区| 亚洲视频在线观看三级| 成人免费视频免费观看| 国产亚洲人成网站| 毛片不卡一区二区| 88在线观看91蜜桃国自产| 一区二区三区视频在线看| 本田岬高潮一区二区三区| 久久伊人蜜桃av一区二区| 久久国产人妖系列| 欧美一区二区女人| 日韩av电影一区| 91精品免费观看| 日韩福利视频网| 欧美一级爆毛片| 激情六月婷婷久久| 精品剧情v国产在线观看在线| 美女视频网站黄色亚洲| 日韩一区二区在线观看视频| 秋霞国产午夜精品免费视频| 日韩午夜精品视频| 美女爽到高潮91| 久久亚洲二区三区| 成人精品视频一区二区三区 | 亚洲五月六月丁香激情| 色综合天天综合色综合av| 亚洲人成网站精品片在线观看| 91尤物视频在线观看| 亚洲欧美经典视频| 色www精品视频在线观看| 亚洲在线视频一区| 91精品久久久久久久99蜜桃| 激情六月婷婷综合| 国产精品天干天干在观线| 色婷婷综合激情| ...中文天堂在线一区| 99热99精品| 亚洲国产成人高清精品| 日韩一二三四区| 成人午夜电影久久影院| 亚洲美女偷拍久久| 日韩区在线观看| 成人激情电影免费在线观看| 一区二区三区久久| 欧美变态tickling挠脚心| 国产成人av一区二区| 亚洲精品你懂的| 日韩欧美国产精品| 9i看片成人免费高清| 天天色天天爱天天射综合| 久久你懂得1024| 色94色欧美sute亚洲线路二| 免费在线视频一区| 国产精品乱人伦| 91精品国产黑色紧身裤美女| 成人免费高清视频| 日本中文字幕一区| 亚洲欧美日韩精品久久久久| 欧美一区二区三区思思人| 国产精华液一区二区三区| 亚洲最大的成人av| 国产欧美日韩精品在线| 777a∨成人精品桃花网| 成人h动漫精品一区二区| 日韩精品一级中文字幕精品视频免费观看 | 国产一区在线视频| 亚洲日本乱码在线观看| 欧美电影免费观看高清完整版在| 99视频精品全部免费在线| 久久狠狠亚洲综合| 一区二区三区欧美视频| 欧美极品另类videosde| 欧美一区二区福利视频| 在线精品视频小说1| 懂色一区二区三区免费观看| 美脚の诱脚舐め脚责91| 亚洲国产精品嫩草影院| 国产精品不卡在线| 久久精品一区二区三区四区| 日韩三区在线观看| 欧美视频日韩视频| 色噜噜夜夜夜综合网| 成人免费观看男女羞羞视频| 国产在线播放一区| 免费成人在线影院| 日本午夜精品视频在线观看| 亚洲国产日产av| 亚洲国产综合视频在线观看| 亚洲男帅同性gay1069| 亚洲人成网站影音先锋播放| 日本一区二区不卡视频| 久久精品一二三| 欧美精品一区二区精品网| 日韩精品自拍偷拍| 欧美第一区第二区| 精品福利一二区| 精品三级av在线| 久久蜜桃一区二区| 欧美国产精品一区| 国产情人综合久久777777| 久久久午夜精品| 久久久.com| 国产午夜亚洲精品不卡| 国产欧美一区在线| 亚洲欧洲国产专区| 亚洲欧美日韩国产另类专区| 亚洲女与黑人做爰| 亚洲国产一区二区在线播放| 亚洲午夜激情av| 蜜桃视频在线一区| 国内精品国产三级国产a久久| 国内精品写真在线观看| 国产精品亚洲综合一区在线观看| 国产黄色精品网站| 97se亚洲国产综合自在线| 色综合色综合色综合色综合色综合| 91网站视频在线观看| 欧美三级午夜理伦三级中视频| 欧美精品日韩一区| 精品国免费一区二区三区| 中文成人综合网| 亚洲午夜久久久久久久久久久| 日本成人在线一区| 国产高清不卡一区二区| 色先锋资源久久综合| 欧美日本韩国一区二区三区视频| 日韩三级视频中文字幕| 日本一区二区三区免费乱视频 | 一本色道久久加勒比精品| 欧美性xxxxx极品少妇| 日韩欧美一级二级三级| 中文字幕乱码久久午夜不卡| 亚洲自拍都市欧美小说| 精品一区二区在线免费观看| 成人av免费在线| 欧美日韩一区二区三区在线看| 亚洲精品在线免费播放| 成人欧美一区二区三区小说| 亚洲va欧美va人人爽| 国产福利一区二区| 欧美日韩国产精选| 国产精品免费人成网站| 日韩国产欧美在线播放| 成av人片一区二区| 欧美电视剧在线观看完整版| 亚洲欧美日韩精品久久久久| 久久精品国产久精国产| 色系网站成人免费| 久久理论电影网| 丝瓜av网站精品一区二区| 不卡一二三区首页| 日韩欧美精品三级| 亚洲精品乱码久久久久久久久 | 一区二区三区四区五区视频在线观看| 日韩av电影天堂| 一本高清dvd不卡在线观看| 精品国精品国产尤物美女| 亚洲一区二区三区四区五区中文| 国产精品一二三区在线| 欧美美女视频在线观看| 亚洲免费在线视频一区 二区| 国产一区二区三区久久悠悠色av| 欧美日韩国产成人在线91| 成人欧美一区二区三区1314| 国产资源在线一区| 日韩欧美亚洲国产另类| 亚洲一二三四在线观看| 99久免费精品视频在线观看| 欧美www视频| 免费在线一区观看| 91精品国产色综合久久| 一二三区精品视频| 欧美在线影院一区二区| 亚洲精品欧美在线| 色国产精品一区在线观看| **网站欧美大片在线观看| 波多野洁衣一区| 国产精品乱人伦一区二区| 成人午夜在线视频| 国产精品美女视频| 成人午夜av在线| 中文字幕制服丝袜成人av| a亚洲天堂av| 综合精品久久久| 色婷婷av一区二区三区gif| 一区二区激情视频| 欧美色综合网站| 香蕉成人啪国产精品视频综合网|