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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? filehandle.c

?? Mobile IP VCEG的信道模擬程序
?? C
字號:
/**************************************************************************************
**************************************************************************************
* Filehandle.c	 Handles the operations how to write
*								 the generated symbols on the interim file format or some
*								 other specified output formats
*
* Main contributors (see contributors.h for copyright, address and affiliation details)
*
* Thomas Stockhammer			<stockhammer@ei.tum.de>
* Detlev Marpe                  <marpe@hhi.de>
***************************************************************************************
***************************************************************************************/

#include "contributors.h"

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <sys/timeb.h>
#include <stdlib.h>
#include <assert.h>
#include "string.h"

#include "defines.h"
#include "global.h"
#include "header.h"


// Global Varibales

static FILE *out;		// output file
//static int bytepos;		// byte position in output file
//static int bitpos;		// bit position in output file

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

The implemented solution for a unified picture header 

*/
/************************************************************************
*
*  Routine      void error(char *text)
*
*  Description: Error Handling Procedure
*
************************************************************************/

void error(char *text)
{
	fprintf(stderr, "%s\n", errortext);
	exit(1);
}


/************************************************************************
*
*  Routine      int start_sequence()
*
*  Description: This function opens the output files and generates the 
*								appropriate sequence header
*
************************************************************************/

int start_sequence()
{	

	switch(input->of_mode)
	{
		case PAR_OF_26L:
			if ((out=fopen(input->outfile,"wb"))==NULL) {
					sprintf(errortext, "Error open file %s  \n",input->outfile);
					error(errortext);
			}
			SequenceHeader(out);
			return 0;
		default: 
			sprintf(errortext, "Output File Mode %d not supported", input->of_mode);
			error(errortext);
			return 1;
	}				
}

/************************************************************************
*
*  Routine      int terminate_sequence()
*
*  Description: This function terminates the sequence and closes the 
*								output files
*
************************************************************************/

int terminate_sequence()
{
	Bitstream *currStream;
	//int stuffing=0xff;


	/* Mainly flushing of everything */
	/* Add termination symbol, etc.  */

	switch(input->of_mode)
	{
		case PAR_OF_26L:
			currStream = ((img->currentSlice)->partArr[0]).bitstream;
			if (input->symbol_mode == UVLC)
			{ 

				/* Current TML File Format */
				/* Get the trailing bits of the last slice */
				currStream->bits_to_go	= currStream->stored_bits_to_go;
				currStream->byte_pos		= currStream->stored_byte_pos;
				currStream->byte_buf		= currStream->stored_byte_buf;

				if (currStream->bits_to_go < 8)		// there are bits left in the last byte
					currStream->streamBuffer[currStream->byte_pos++] = currStream->byte_buf;
				/* Write all remaining bits to output bitstream file */
				fwrite (currStream->streamBuffer, 1, currStream->byte_pos, out);
				fclose(out);
			}
			else
			{
				/* CABAC File Format */
				fclose(out);
			}
			return 0;
		default: 
			sprintf(errortext, "Output File Mode %d not supported", input->of_mode);
			error(errortext);
			return 1;
	}						
}





/*!
 *	\fn		start_slice()
 *
 *	\return	number of bits used for the picture header, including the PSC.
 
 *	\note
 *
 *	-Side effects:
 *			Adds picture header symbols to the symbol buffer
 *  -Remarks:
 *			THIS IS AN INTERIM SOLUTION FOR A PICTURE HEADER, see VCEG-M79
 *
 *			Generates the Picture Header out of the information in img_par and inp-par,
 *			and writes it to the symbol buffer.  The structure of the Picture Header
 *			is discussed in VCEG-M79.  It is implemented as discussed there.  In addition,
 *			it is preceeded by a picture start code, a UVLC-codeword of LEN=31 and INFO = 0.
 *          It would have been possible to put information into this codeword, similar
 *			to designs earlier than TML 5.9.  But it is deemed that the waste of 15
 *			data bits is acceptable considering the advantages of being able to search
 *			for a picture header quickly and easily, by looking for 30 consecutive, byte-
 *			aligned zero bits.
 *
 *			The accounting of the header length (variable len) relies on the side effect
 *			of writeUVLCSymbol() that sets len and info in the symbol variable parameter
*/





/************************************************************************
*
*  Routine      int start_slice()
*
*  Description: This function generates the appropriate slice
*								header
*
************************************************************************/



int start_slice(SyntaxElement *sym)
{
	EncodingEnvironmentPtr eep;
	Slice *currSlice = img->currentSlice;
	Bitstream *currStream; 
	int header_len;

	switch(input->of_mode)
	{
		case PAR_OF_26L:
			if (input->symbol_mode == UVLC) {
				currStream = (currSlice->partArr[0]).bitstream;
				if (img->current_mb_nr == 0) {
					header_len = PictureHeader();		// Picture Header
					header_len += SliceHeader (0);	// Slice Header without Start Code
				} else {
					header_len = SliceHeader (1);	// Slice Header with Start Code
				}
				
				return header_len;
			}
			  else {										// H.26: CABAC File Format
				eep = &((currSlice->partArr[0]).ee_cabac);
				currStream = (currSlice->partArr[0]).bitstream;

				assert (currStream->bits_to_go == 8);
				assert (currStream->byte_buf == 0);
				assert (currStream->byte_pos == 0);
				memset(currStream->streamBuffer, 0, 12);		// fill first 12 bytes with zeros (debug only)

				if (img->current_mb_nr == 0) {
					header_len = PictureHeader();		// Picture Header
					header_len += SliceHeader (0);	// Slice Header without Start Code
				} else {
					header_len = SliceHeader (1);	// Slice Header with Start Code
				}
				
				// Note that PictureHeader() and SLiceHeader() set the buffer pointers as a side effect
				// Hence no need for adjusting it manually (and preserving space to be patched later
				
				//reserve bits for d_MB_Nr 
				currStream->header_len = header_len;
				currStream->header_byte_buffer = currStream->byte_buf;
				
				currStream->byte_pos += ((31-currStream->bits_to_go)/8);
				if ((31-currStream->bits_to_go)%8 != 0)
					currStream->byte_pos++;
				currStream->bits_to_go = 8;
				currStream->byte_pos++;

				// If there is an absolute need to communicate the partition size, this would be
				// the space to insert it
				arienco_start_encoding(eep, currStream->streamBuffer, &(currStream->byte_pos));
				/* initialize context models */
				init_contexts_MotionInfo(currSlice->mot_ctx, 1);	
				init_contexts_TextureInfo(currSlice->tex_ctx, 1);

				return header_len;

			}
		default: 
			sprintf(errortext, "Output File Mode %d not supported", input->of_mode);
			error(errortext);
			return 1;
	}							
}






/************************************************************************
*
*  Routine      int terminate_slice()
*
*  Description: This function terminates a slice
*
************************************************************************/

int terminate_slice()
{
	int bytes_written;
	Bitstream *currStream;
	Slice *currSlice = img->currentSlice;
	EncodingEnvironmentPtr eep;
	int byte_pos, bits_to_go, start_data;
	byte buffer;

int null = 0;

	/* Mainly flushing of everything */
	/* Add termination symbol, etc.  */
	switch(input->of_mode)
	{
		case PAR_OF_26L:

			
			if (input->symbol_mode == UVLC)
			{ 
				// Current TML File Format 
				// Enforce byte alignment of next header: zero bit stuffing
				currStream = (currSlice->partArr[0]).bitstream;
				
				if (currStream->bits_to_go < 8) { // trailing bits to process 
					currStream->byte_buf <<= currStream->bits_to_go;
					currStream->streamBuffer[currStream->byte_pos++]=currStream->byte_buf;
					currStream->bits_to_go = 8;
				}
				
				bytes_written = currStream->byte_pos;
				fwrite (currStream->streamBuffer, 1, bytes_written, out);

				currStream->stored_bits_to_go = 8; // store bits_to_go
				currStream->stored_byte_buf		= currStream->byte_buf;		// store current byte 
				currStream->stored_byte_pos		= 0; // reset byte position 

			}
			else
			{

				/* CABAC File Format */
				eep = &((currSlice->partArr[0]).ee_cabac);
				currStream = (currSlice->partArr[0]).bitstream;

				/* terminate the arithmetic code */
				arienco_done_encoding(eep);
				
				//Add Number of MBs of this slice to the header
				//Save current state of Bitstream
				currStream = (currSlice->partArr[0]).bitstream;
				byte_pos = currStream->byte_pos;
				bits_to_go = currStream->bits_to_go;
				buffer = currStream->byte_buf; 
				
				//Go to the reserved bits
				currStream->byte_pos = (currStream->header_len)/8;
				currStream->bits_to_go = 8-(currStream->header_len)%8;
				currStream->byte_buf = currStream->header_byte_buffer;
				
				//Add Info about last MB
				LastMBInSlice();
				
				//And write the header to the output
				bytes_written = currStream->byte_pos;
				if (currStream->bits_to_go < 8) // trailing bits to process 
				{ 
						currStream->byte_buf <<= currStream->bits_to_go;
						currStream->streamBuffer[currStream->byte_pos++]=currStream->byte_buf;
						bytes_written++;
						currStream->bits_to_go = 8;
				}
				fwrite (currStream->streamBuffer, 1, bytes_written, out);
				stat->bit_ctr += 8*bytes_written;
				
				//Go back to the end of the stream
				currStream->byte_pos = byte_pos; 
				currStream->bits_to_go = bits_to_go;
				currStream->byte_buf = buffer;


				//Find start position of data bitstream
				start_data = (currStream->header_len+31)/8;
				if ((currStream->header_len+31)%8 != 0)
					start_data++;
				bytes_written = currStream->byte_pos - start_data; // number of written bytes

				stat->bit_ctr += 8*bytes_written;			/* actually written bits */

				
				fwrite ((currStream->streamBuffer+start_data), 1, bytes_written, out);

			}
			return 0;
		default: 
			sprintf(errortext, "Output File Mode %d not supported", input->of_mode);
			error(errortext);
			return 1;
	}									
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合在线观看色| 日韩手机在线导航| 国产精品卡一卡二| 成人免费观看av| 欧美高清在线一区| 97se狠狠狠综合亚洲狠狠| 最新日韩av在线| 色丁香久综合在线久综合在线观看| 1024成人网| 欧美精品乱码久久久久久| 日本不卡一区二区| 久久奇米777| 99精品国产99久久久久久白柏| 亚洲欧洲成人自拍| 欧美色倩网站大全免费| 美女www一区二区| 欧美激情一区二区三区| 91网站在线播放| 日韩成人伦理电影在线观看| 久久久久久久久免费| 91麻豆自制传媒国产之光| 午夜精品久久久久久久久久久| 精品国产91九色蝌蚪| aaa亚洲精品| 日韩电影在线一区二区三区| 久久天天做天天爱综合色| 99久久免费国产| 日韩国产一区二| 国产免费久久精品| 欧美三级电影网| 国产成人综合在线播放| 亚洲宅男天堂在线观看无病毒| 日韩你懂的电影在线观看| 91在线观看成人| 美女视频黄 久久| 亚洲欧美在线观看| 欧美成人猛片aaaaaaa| 色婷婷国产精品| 国模娜娜一区二区三区| 亚洲制服欧美中文字幕中文字幕| 精品国产3级a| 欧美精品一级二级三级| 成人理论电影网| 麻豆成人久久精品二区三区红| 中文字幕在线一区二区三区| 日韩欧美在线1卡| 91福利视频网站| 成人免费视频app| 日韩精品亚洲一区| 亚洲欧美视频一区| 久久久www成人免费无遮挡大片| 一本到不卡免费一区二区| 国产馆精品极品| 精品中文字幕一区二区小辣椒| 亚洲另类色综合网站| 国产日本欧洲亚洲| 欧美一二三在线| 欧美怡红院视频| 99视频国产精品| 国产成人综合亚洲网站| 韩国三级在线一区| 日韩电影在线看| 亚洲成人综合在线| 亚洲桃色在线一区| 亚洲天天做日日做天天谢日日欢 | 精品少妇一区二区| 欧美吞精做爰啪啪高潮| 99久久久免费精品国产一区二区| 国产成人综合精品三级| 精品一区二区免费看| 蜜臀久久99精品久久久久久9| 亚洲一区二区三区中文字幕在线| 日韩毛片一二三区| 亚洲品质自拍视频| 亚洲女人的天堂| 亚洲欧美日韩综合aⅴ视频| 中文字幕日韩av资源站| 国产精品久久精品日日| 中文欧美字幕免费| 国产精品视频在线看| 中文字幕乱码日本亚洲一区二区| 国产日产亚洲精品系列| 国产精品色哟哟网站| 国产精品久久久久久久久久免费看 | 天堂一区二区在线免费观看| 亚洲国产一区二区在线播放| 亚洲一区二区美女| 视频在线在亚洲| 日韩黄色小视频| 麻豆91免费看| 国产专区综合网| 粉嫩一区二区三区在线看| 豆国产96在线|亚洲| www.亚洲人| 欧美在线三级电影| 在线成人av网站| 精品区一区二区| 中文一区二区完整视频在线观看 | 一区二区三区免费在线观看| 亚洲午夜在线观看视频在线| 天堂成人免费av电影一区| 日本怡春院一区二区| 黄网站免费久久| 国产成人在线视频免费播放| 国产成人福利片| 91国模大尺度私拍在线视频| 欧美精品1区2区| 欧美精品一区男女天堂| 国产精品黄色在线观看| 一区二区欧美精品| 久草中文综合在线| 成人av电影在线网| 欧美人妇做爰xxxⅹ性高电影| 日韩精品一区在线| 中文字幕日韩一区| 免费的成人av| 色综合天天综合狠狠| 91精品国产高清一区二区三区| 久久精品在这里| 亚洲一区二区三区影院| 精品亚洲国产成人av制服丝袜| 不卡av在线网| 欧美一区二区福利在线| 亚洲视频小说图片| 韩国女主播成人在线| 色综合久久88色综合天天免费| 欧美电影免费观看完整版| 亚洲精选视频免费看| 国产在线精品国自产拍免费| 91小视频在线| 国产午夜精品久久| 日韩不卡在线观看日韩不卡视频| 高清视频一区二区| 日韩精品在线网站| 亚洲成人动漫一区| 91麻豆免费看片| 久久久久久久久久久久久夜| 午夜精品久久久久久久久久| 91伊人久久大香线蕉| 2021中文字幕一区亚洲| 日韩电影在线免费观看| 91国偷自产一区二区开放时间| 欧美激情一区三区| 国产在线精品免费av| 制服视频三区第一页精品| 亚洲美女免费在线| 成人免费观看视频| 国产亚洲婷婷免费| 精品制服美女久久| 欧美精品xxxxbbbb| 亚洲国产一区二区视频| 91免费版在线| 国产精品不卡一区| 成人不卡免费av| 久久九九影视网| 久久精品国产**网站演员| 欧美日韩在线播放三区| 亚洲精品视频在线| 99久久夜色精品国产网站| 国产精品女主播av| 国产成人免费视频网站高清观看视频| 欧美mv日韩mv国产| 美脚の诱脚舐め脚责91| 欧美一区二区福利在线| 青青草成人在线观看| 欧美一区二区三区四区在线观看| 天堂av在线一区| 欧美日韩卡一卡二| 天涯成人国产亚洲精品一区av| 色哟哟一区二区在线观看| 亚洲视频在线一区观看| 91看片淫黄大片一级| 一区二区三区欧美| 欧美三级视频在线| 丝袜亚洲精品中文字幕一区| 911精品国产一区二区在线| 视频一区二区三区中文字幕| 欧美疯狂做受xxxx富婆| 日韩不卡一区二区三区| 精品91自产拍在线观看一区| 国产在线日韩欧美| 国产人伦精品一区二区| 成人黄色小视频在线观看| 亚洲天堂av一区| 欧美日韩精品欧美日韩精品一综合| 亚洲一二三级电影| 欧美一区二区三区免费在线看| 蜜桃传媒麻豆第一区在线观看| 久久欧美中文字幕| 91色porny| 性做久久久久久免费观看| 日韩免费看网站| 豆国产96在线|亚洲| 一区二区日韩av| 欧美大黄免费观看| 成人理论电影网| 五月天激情综合网| 久久久激情视频| 欧美这里有精品| 激情偷乱视频一区二区三区|