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

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

?? mbcoding.c

?? 用MPEG-4對YUV視頻文件編碼壓縮成divx視頻文件
?? C
?? 第 1 頁 / 共 2 頁
字號:
 /******************************************************************************
  *                                                                            *
  *  This file is part of XviD, a free MPEG-4 video encoder/decoder            *
  *                                                                            *
  *  XviD is an implementation of a part of one or more MPEG-4 Video tools     *
  *  as specified in ISO/IEC 14496-2 standard.  Those intending to use this    *
  *  software module in hardware or software products are advised that its     *
  *  use may infringe existing patents or copyrights, and any such use         *
  *  would be at such party's own risk.  The original developer of this        *
  *  software module and his/her company, and subsequent editors and their     *
  *  companies, will have no liability for use of this software or             *
  *  modifications or derivatives thereof.                                     *
  *                                                                            *
  *  XviD is free software; you can redistribute it and/or modify it           *
  *  under the terms of the GNU General Public License as published by         *
  *  the Free Software Foundation; either version 2 of the License, or         *
  *  (at your option) any later version.                                       *
  *                                                                            *
  *  XviD is distributed in the hope that it will be useful, but               *
  *  WITHOUT ANY WARRANTY; without even the implied warranty of                *
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
  *  GNU General Public License for more details.                              *
  *                                                                            *
  *  You should have received a copy of the GNU General Public License         *
  *  along with this program; if not, write to the Free Software               *
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *
  *                                                                            *
  ******************************************************************************/

 /******************************************************************************
  *                                                                            *
  *  mbcoding.c                                                                *
  *                                                                            *
  *  Copyright (C) 2002 - Michael Militzer <isibaar@xvid.org>                  *
  *                                                                            *
  *  For more information visit the XviD homepage: http://www.xvid.org         *
  *                                                                            *
  ******************************************************************************/

 /******************************************************************************
  *																			   *	
  *  Revision history:                                                         *
  *                                                                            *
  *  28.06.2002 added check_resync_marker()                                    *
  *  14.04.2002 bframe encoding												   *
  *  08.03.2002 initial version; isibaar					                   *
  *																			   *
  ******************************************************************************/



#include <stdlib.h>
/*#include <malloc.h>*/
#include "../portab.h"
#include "bitstream.h"
#include "zigzag.h"
#include "vlc_codes.h"
#include "mbcoding.h"
#include "../utils/mbfunctions.h"

/* size=4095*64*2=524160,whq,2002.12-11 */
/* save intra,inter (run,level,last) pair */
VLC intra_table[524160]; 
VLC inter_table[524160];

/*!
 ************************************************************************
 * \replace goto using function run_level_code    
 * \brief
 *    get  vlc code for run-level pair 
 *
 * \author , whq
 ************************************************************************
 */
/*
void run_level_code(VLC **coeff_ptr,VLC *vlc[2],
					int32_t level,ptr_t run,int32_t intra);*/

static __inline
void run_level_code(VLC **coeff_ptr,	/*pointer to the suitable coeff table*/
					VLC *vlc[2],		/*pointer to the array for inter or intra table*/
					int32_t level,		/* level */
					ptr_t run,			/* run */
					int32_t intra)		/* intra or inter*/
{
			int32_t abs_level;
			if (level != 0) {
					abs_level = abs(level)-1;
					vlc[intra]->code =
						(vlc[intra]->
						 code << (coeff_ptr[run][abs_level ].len +
								  1)) | (coeff_ptr[run][abs_level ].code<<1);
												
					vlc[intra]->len =
						(coeff_ptr[run][abs_level ].len + 1) +
						vlc[intra]->len;

					if (level < 0)
						/*vlc[intra]->code += 1;*/
						vlc[intra]->code ++;
					}

				vlc[intra]++;
}


/*!
 ************************************************************************   
 * \brief
 *    init,get vlc code for all (last,run,level) pair 
 *
 * 
 ************************************************************************
 */
void
init_vlc_tables(void)
{

	int32_t k, l, i, intra, last;
/*	int32_t temp;*//*用于保存level,run值改變之前的值,用于后來恢復使用*/
	VLC *vlc[2];
	VLC **coeff_ptr;
	/* move variable out of loop */
	/* whq,2002.12.19,save array index */
	int32_t index;
	int8_t *max_level_ptr;
	int8_t *max_run_ptr;
	int32_t level,abs_level;
	uint32_t run;
	/* whq,2002.12.19 */

	vlc[0] = intra_table;
	vlc[1] = inter_table;
	/* generate encoding vlc lookup tables*/
	/* the lookup table idea is taken from the excellent fame project by Vivien Chapellier*/
	for (i = 0; i < 4; i++) {
		/* to be optimize */
		intra = i % 2;
		last = i / 2;
		index = last + 2 * intra;
		coeff_ptr = coeff_vlc[index];

		for (k = -2047; k < 2048; k++) {	/* level*/
			max_level_ptr = max_level[index];
			max_run_ptr = max_run[index];

			for (l = 0; l < 64; l++) {	/* run*/
				 level = k;
				 abs_level = abs(level);
				 run = l;

				if ((abs_level <= max_level_ptr[run]) && (run <= (uint32_t) max_run_ptr[abs_level])) {	/* level < max_level and run < max_run*/

					vlc[intra]->code = 0;
					vlc[intra]->len = 0;

			/*	if (level != 0) {
					vlc[intra]->code =
						(vlc[intra]->
						 code << (coeff_ptr[run][abs(level) - 1].len +
								  1)) | (coeff_ptr[run][abs(level) -
														1].code << 1);
					vlc[intra]->len =
						(coeff_ptr[run][abs(level) - 1].len + 1) +
						vlc[intra]->len;

					if (level < 0)
						vlc[intra]->code += 1;
				}

				vlc[intra]++;        */
				run_level_code(coeff_ptr,vlc,level,run,intra);
				continue;
					/*goto loop_end;*/
				} 
				else 
				{
					if (level > 0)	/* correct level*/
						level -= max_level_ptr[run];
					else
						level += max_level_ptr[run];
					abs_level = abs(level);
				
					if ((abs_level <= max_level_ptr[run]) &&
						(run <= (uint32_t) max_run_ptr[abs_level])) {

						vlc[intra]->code = 0x06;
						vlc[intra]->len = 8;
						
				/*	if (level != 0) {
					vlc[intra]->code =
						(vlc[intra]->
						 code << (coeff_ptr[run][abs(level) - 1].len +
								  1)) | (coeff_ptr[run][abs(level) -
														1].code << 1);
					vlc[intra]->len =
						(coeff_ptr[run][abs(level) - 1].len + 1) +
						vlc[intra]->len;

					if (level < 0)
						vlc[intra]->code += 1;
					}

				vlc[intra]++;*/
                run_level_code(coeff_ptr,vlc,level,run,intra);
						
				continue;
						/*goto loop_end;*/
				}
					/* restore level*/
				level=k;
				abs_level = abs(level);
				run -= max_run_ptr[abs_level] + 1;	/* and change run*/

				if ((abs_level <= max_level_ptr[run]) &&
					(run <= (uint32_t) max_run_ptr[abs_level])) {

					vlc[intra]->code = 0x0e;
					vlc[intra]->len = 9;


				/*	if (level != 0) {
					vlc[intra]->code =
						(vlc[intra]->
						 code << (coeff_ptr[run][abs(level) - 1].len +
								  1)) | (coeff_ptr[run][abs(level) -
														1].code << 1);
					vlc[intra]->len =
						(coeff_ptr[run][abs(level) - 1].len + 1) +
						vlc[intra]->len;

					if (level < 0)
						vlc[intra]->code += 1;
				}

				vlc[intra]++; */       

					run_level_code(coeff_ptr,vlc,level,run,intra);
					continue;
					/*	goto loop_end;*/
					}
					/*restore run*/
					/*run += max_run_ptr[abs(level)] + 1;*/
				run=l;
				}

				vlc[intra]->code =
					(uint32_t) ((l << 14) | (0x1e + last) << 20) | (1 << 13) |
					((k & 0xfff) << 1) | 1;

				vlc[intra]->len = 30;
				vlc[intra]++;
				continue;

	/*		  loop_end:
				if (level != 0) {
					vlc[intra]->code =
						(vlc[intra]->
						 code << (coeff_ptr[run][abs(level) - 1].len +
								  1)) | (coeff_ptr[run][abs(level) -
														1].code << 1);
					vlc[intra]->len =
						(coeff_ptr[run][abs(level) - 1].len + 1) +
						vlc[intra]->len;

					if (level < 0)
						vlc[intra]->code += 1;
				}

				vlc[intra]++;              */
			}
		}
	}
}

/*!
 ************************************************************************   
 * \brief
 *    get vlc code for motion vector
 *
 ************************************************************************
 */

static /*__inline*/ int16_t				/* ==> return the bits for vector */
CodeVector(Bitstream * bs,			/*<--> bitstream buffer */
		   int32_t value,           /*<--  vector value */
		   int32_t f_code,			/*<--  range of vector */
		   Statistics * pStat       /*<--> stat  vector count and value  */
		   )/*修改此函數使其返回運動向量占的位數 modify by lxq*/
{
	int16_t vector_length=0;	
	uint16_t code;
	const int scale_factor = 1 << (f_code - 1);
	const int cmp = scale_factor << 5;

    
	if (value < (-1 * cmp))
		/*value += 64 * scale_factor;*/
		value += scale_factor<<6;


	if (value > (cmp - 1))
		/*value -= 64 * scale_factor;*/
		value -= scale_factor<<6;


	pStat->iMvSum += value * value;
	pStat->iMvCount++;
	code =value + 32;
	BitstreamPutBits(bs, mb_motion_table[code].code,
						 mb_motion_table[code].len);
	vector_length+=mb_motion_table[code].len;

/*	if (value == 0) {
		BitstreamPutBits(bs, mb_motion_table[32].code,
						 mb_motion_table[32].len);
		vector_length+=mb_motion_table[32].len;
	} else {*/
			
/*		f_code--;
		sign = (value < 0);
*/
/*whq,2002,12,25*/
/*
		if (value >= length)*/
		/*	value -= 2 * length;*/
		/*	value -= length<<1;*/

/*		else if (value < -length)*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线看国产日韩| 亚洲欧洲精品一区二区三区不卡| 2020日本不卡一区二区视频| 国产精品久久久久久久久免费樱桃 | 成人免费视频播放| 9191国产精品| 中文字幕一区二区三| 久久精品国产亚洲5555| 色综合天天综合| 国产日韩v精品一区二区| 性久久久久久久| 91色乱码一区二区三区| 久久久久高清精品| 日韩精品色哟哟| 欧美亚洲另类激情小说| 国产精品成人免费在线| 精品一区二区综合| 日韩一区二区麻豆国产| 亚洲国产美女搞黄色| 波多野结衣视频一区| 国产欧美精品一区二区三区四区 | www.欧美日韩| 久久亚洲一区二区三区四区| 日韩av不卡一区二区| 欧美日韩在线三区| 亚洲综合久久av| 一本大道久久a久久综合| 中文字幕欧美区| 国产成人高清在线| 久久久不卡网国产精品一区| 经典三级在线一区| 日韩视频免费观看高清完整版| 亚洲午夜av在线| 欧美伊人久久久久久久久影院 | 六月丁香婷婷久久| 日韩欧美一区二区在线视频| 日本三级韩国三级欧美三级| 欧美一区二区精品久久911| 天堂成人国产精品一区| 在线91免费看| 精品一区二区在线视频| 久久蜜桃一区二区| 国产99久久久国产精品潘金 | 精品国免费一区二区三区| 奇米在线7777在线精品| 欧美电影免费观看高清完整版在| 免费av成人在线| 久久久久久久精| 成人一级黄色片| 亚洲码国产岛国毛片在线| 欧洲日韩一区二区三区| 婷婷一区二区三区| 欧美变态tickle挠乳网站| 国产精品一区二区黑丝| 国产精品色哟哟| 在线视频国内自拍亚洲视频| 丝袜美腿高跟呻吟高潮一区| 日韩精品一区二区三区视频播放 | 欧美一区二区三区爱爱| 国产麻豆成人传媒免费观看| 亚洲欧美综合在线精品| 欧美在线观看你懂的| 亚洲成人久久影院| 精品1区2区在线观看| eeuss国产一区二区三区| 亚洲激情图片小说视频| 欧美zozo另类异族| 色哟哟一区二区在线观看| 日本午夜一本久久久综合| 久久久久九九视频| 在线观看亚洲专区| 精品综合免费视频观看| 亚洲免费在线观看视频| 精品久久久久久久久久久院品网| 99国内精品久久| 久久精品国内一区二区三区| 亚洲欧洲www| 日韩欧美资源站| 色婷婷av一区二区| 国内成人免费视频| 亚洲尤物视频在线| 国产午夜精品美女毛片视频| 欧美狂野另类xxxxoooo| 成人免费视频视频| 免费在线欧美视频| 一区二区三区在线免费| 国产欧美日韩久久| 日韩三级中文字幕| 欧美色偷偷大香| bt欧美亚洲午夜电影天堂| 美女国产一区二区三区| 一区二区三区欧美| 国产精品久久毛片av大全日韩| 91麻豆精品国产91久久久资源速度| 成人综合在线网站| 国产在线精品免费av| 午夜久久电影网| 亚洲蜜桃精久久久久久久| 国产欧美一区二区精品性色| 日韩一区二区精品| 欧美精品国产精品| 日本高清无吗v一区| 成人黄页在线观看| 国产精品12区| 韩国欧美国产一区| 狠狠色丁香九九婷婷综合五月| 婷婷丁香久久五月婷婷| 亚洲国产日韩综合久久精品| 亚洲人成网站精品片在线观看 | 国产老女人精品毛片久久| 日韩av中文字幕一区二区| 亚洲一区国产视频| 亚洲欧美另类小说| 亚洲九九爱视频| 亚洲女人****多毛耸耸8| 国产精品福利在线播放| 中文字幕+乱码+中文字幕一区| 国产亚洲制服色| 国产日韩欧美a| 国产精品色婷婷久久58| 国产精品午夜电影| 国产精品超碰97尤物18| 亚洲乱码国产乱码精品精可以看| 最近中文字幕一区二区三区| 国产精品免费丝袜| 亚洲人成人一区二区在线观看| 1024成人网| 亚洲人成人一区二区在线观看 | 婷婷国产v国产偷v亚洲高清| 日韩在线卡一卡二| 另类小说综合欧美亚洲| 国产一区二区三区在线观看免费| 国产综合久久久久久久久久久久| 国产成人精品三级麻豆| jizz一区二区| 欧美日韩小视频| 日韩丝袜美女视频| 久久久综合视频| 亚洲欧洲一区二区三区| 亚洲一区中文日韩| 青娱乐精品在线视频| 国产精品伊人色| 色综合色综合色综合| 欧美日韩极品在线观看一区| 欧美xxxxxxxxx| 国产精品人妖ts系列视频| 亚洲美女免费视频| 蜜桃久久av一区| 99这里都是精品| 欧美老肥妇做.爰bbww| 久久久国产一区二区三区四区小说| 中文字幕一区二区5566日韩| 青青草97国产精品免费观看无弹窗版| 六月丁香婷婷久久| 91丨九色丨尤物| 91精品国产综合久久小美女| 久久精品夜色噜噜亚洲aⅴ| 亚洲激情五月婷婷| 国产真实乱对白精彩久久| 成人av在线观| 日韩午夜在线影院| 亚洲精品免费在线| 韩国欧美国产1区| 色哟哟在线观看一区二区三区| 日韩欧美中文字幕制服| 亚洲激情一二三区| 国产成人在线观看| 7777精品伊人久久久大香线蕉的| 久久久国产一区二区三区四区小说| 亚洲国产综合色| 粉嫩13p一区二区三区| 欧美一级免费大片| 中文字幕一区二区三区四区| 九九视频精品免费| 欧美色视频一区| 亚洲美女免费在线| 国产jizzjizz一区二区| 日韩欧美国产小视频| 亚洲成人动漫一区| av不卡免费在线观看| 久久精品欧美一区二区三区麻豆| 视频一区二区不卡| 欧美日韩综合在线免费观看| 国产精品免费网站在线观看| 狠狠色狠狠色综合日日91app| 欧美精品三级在线观看| 亚洲精品免费电影| caoporm超碰国产精品| 国产视频视频一区| 精品亚洲成av人在线观看| 7777精品伊人久久久大香线蕉的| 亚洲综合精品自拍| 在线欧美一区二区| 亚洲三级久久久| 成人免费视频网站在线观看| 久久久欧美精品sm网站| 国产九色sp调教91| 国产视频一区二区三区在线观看| 久久99久久久久久久久久久| 777欧美精品|