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

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

?? jcarith.c

?? 常好且全面的jpeg圖像壓縮算法
?? C
字號:
/* This programe is reedited by Fujian Shi(fieagle@yahoo.com.cn) *from the code programmed by  Guido Vollbeding <guivol@esc.de>. * jcarith.c * * It can only acomplesh simple arithmetic coding. */#include "commondecls.h"#define RIGHT_SHIFT(x,shft) x>=0 ? x>>shft : -((-x)>>shft)/* We use a compact representation with 1 byte per statistics bin, * thus the numbers directly represent byte sizes. * This 1 byte per statistics bin contains the meaning of the MPS * (more probable symbol) in the highest bit (mask 0x80), and the * index into the probability estimation state machine table * in the lower bits (mask 0x7F). *//* NOTE: Uncomment the following #define if you want to use the * given formula for calculating the AC conditioning parameter Kx * for spectral selection progressive coding in section G.1.3.2 * of the spec (Kx = Kmin + SRL (8 + Se - Kmin) 4). * Although the spec and P&M authors claim that this "has proven * to give good results for 8 bit precision samples", I'm not * convinced yet that this is really beneficial. * Early tests gave only very marginal compression enhancements * (a few - around 5 or so - bytes even for very large files), * which would turn out rather negative if we'd suppress the * DAC (Define Arithmetic Conditioning) marker segments for * the default parameters in the future. * Note that currently the marker writing module emits 12-byte * DAC segments for a full-component scan in a color image. * This is not worth worrying about IMHO. However, since the * spec defines the default values to be used if the tables * are omitted (unlike Huffman tables, which are required * anyway), one might optimize this behaviour in the future, * and then it would be disadvantageous to use custom tables if * they don't provide sufficient gain to exceed the DAC size. * * On the other hand, I'd consider it as a reasonable result * that the conditioning has no significant influence on the * compression performance. This means that the basic * statistical model is already rather stable. * * Thus, at the moment, we use the default conditioning values * anyway, and do not use the custom formula. * * IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. * We assume that int right shift is unsigned if INT32 right shift is, * which should be safe. *//* * Finish up at the end of an arithmetic-compressed scan. */voidflush_bits (j_compress_ptr cinfo){  arith_entropy_ptr e = (arith_entropy_ptr) cinfo->entropy;  INT32 temp;  /* Section D.1.8: Termination of encoding */  /* Find the e->c in the coding interval with the largest   * number of trailing zero bits */  if ((temp = (e->a - 1 + e->c) & 0xFFFF0000L) < e->c)    e->c = temp + 0x8000L;  else    e->c = temp;  /* Send remaining bytes to output */  e->c <<= e->ct;  if (e->c & 0xF8000000L) {    /* One final overflow has to be handled */    if (e->buffer >= 0) {      if (e->zc)	do emit_byte(cinfo,0x00);	while (--e->zc);      emit_byte(cinfo,e->buffer + 1);      if (e->buffer + 1 == 0xFF)	emit_byte(cinfo,0x00);    }    e->zc += e->sc;  /* carry-over converts stacked 0xFF bytes to 0x00 */    e->sc = 0;  } else {    if (e->buffer == 0)      ++e->zc;    else if (e->buffer >= 0) {      if (e->zc)	do emit_byte(cinfo,0x00);	while (--e->zc);      emit_byte(cinfo,e->buffer);    }    if (e->sc) {      if (e->zc)	do emit_byte(cinfo,0x00);	while (--e->zc);      do {	emit_byte(cinfo,0xFF);	emit_byte(cinfo,0x00);      } while (--e->sc);    }  }  /* Output final bytes only if they are not 0x00 */  if (e->c & 0x7FFF800L) {    if (e->zc)  /* output final pending zero bytes */      do emit_byte(cinfo,0x00);      while (--e->zc);    emit_byte(cinfo,(e->c >> 19) & 0xFF);    if (((e->c >> 19) & 0xFF) == 0xFF)      emit_byte(cinfo,0x00);    if (e->c & 0x7F800L) {      emit_byte(cinfo,(e->c >> 11) & 0xFF);      if (((e->c >> 11) & 0xFF) == 0xFF)	emit_byte(cinfo,0x00);    }  }}/* * The core arithmetic encoding routine (common in JPEG and JBIG). * This needs to go as fast as possible. * Machine-dependent optimization facilities * are not utilized in this portable implementation. * However, this code should be fairly efficient and * may be a good base for further optimizations anyway. * * Parameter 'val' to be encoded may be 0 or 1 (binary decision). * * Note: I've added full "Pacman" termination support to the * byte output routines, which is equivalent to the optional * Discard_final_zeros procedure (Figure D.15) in the spec. * Thus, we always produce the shortest possible output * stream compliant to the spec (no trailing zero bytes, * except for FF stuffing). * * I've also introduced a new scheme for accessing * the probability estimation state machine table, * derived from Markus Kuhn's JBIG implementation. */voidarith_encode (j_compress_ptr cinfo, unsigned char *st, int val) {  extern const INT32 jaritab[];  register arith_entropy_ptr e = cinfo->entropy;  register unsigned char nl, nm;  register INT32 qe, temp;  register int sv;  /* Fetch values from our compact representation of Table D.2:   * Qe values and probability estimation state machine   */  sv = *st;  qe = jaritab[sv & 0x7F];	/* => Qe_Value */  nl = qe & 0xFF; qe >>= 8;	/* Next_Index_LPS + Switch_MPS */  nm = qe & 0xFF; qe >>= 8;	/* Next_Index_MPS */  /* Encode & estimation procedures per sections D.1.4 & D.1.5 */  e->a -= qe;  if (val != ((sv >> 7) & (0x00000001))) {    /* Encode the less probable symbol */    if (e->a >= qe) {      /* If the interval size (qe) for the less probable symbol (LPS)       * is larger than the interval size for the MPS, then exchange       * the two symbols for coding efficiency, otherwise code the LPS       * as usual: */      e->c += e->a;      e->a = qe;    }    *st = (sv & 0x80) ^ nl;	/* Estimate_after_LPS */  } else {    /* Encode the more probable symbol */    if (e->a >= 0x8000L)      return;  /* A >= 0x8000 -> ready, no renormalization required */    if (e->a < qe) {      /* If the interval size (qe) for the less probable symbol (LPS)       * is larger than the interval size for the MPS, then exchange       * the two symbols for coding efficiency: ,it is equal to code        * the LPS.*/      e->c += e->a;      e->a = qe;    }    *st = (sv & 0x80) ^ nm ;	/* Estimate_after_MPS ,no change of the sense of the MPS*/  }  /* Renormalization & data output per section D.1.6 */  do {    e->a <<= 1;    e->c <<= 1;    if (--e->ct == 0) {      /* The followning is the byte_out programe.*/      /* Another byte is ready for output */      temp = e->c >> 19;      if (temp > 0xFF) {	/*Handle overflow over all stacked 0xFF bytes */	if (e->buffer >= 0) {	  	   emit_byte(cinfo,e->buffer + 1);	  if (e->buffer + 1 == 0xFF)	  emit_byte(cinfo,0x00); 	}	/*e->zc += e->sc;*/  /* carry-over converts stacked 0xFF bytes to 0x00 and output them*/	while(e->sc-->0)	  emit_byte(cinfo,0X00);	e->sc = 0;	/* Note: The 3 spacer bits in the C register guarantee	 * that the new buffer byte can't be 0xFF here	 * (see page 160 in the P&M JPEG book). */	e->buffer = temp & 0xFF;  /* new output byte, might overflow later */      } else if (temp == 0xFF) {	++e->sc;  /* stack 0xFF byte (which might overflow later) */      } else {	/* Output all stacked 0xFF bytes, they will not overflow any more */	         if (e->buffer >= 0) {           emit_byte(cinfo,e->buffer);	   if (e->sc) {	     while (e->sc--) {	       emit_byte(cinfo,0xFF);	       emit_byte(cinfo,0x00);	     } 	    e->sc=0;	    }	           }         e->buffer = temp & 0xFF;  /* new output byte (can still overflow) */      }      e->c &= 0x7FFFFL;      e->ct = 8;    }  } while (e->a < 0x8000L);  }/* * Encode and output one MCU's worth of arithmetic-compressed coefficients. */voidencode_row (j_compress_ptr cinfo,JSAMPROW row,int i){  arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;  unsigned char * st;  unsigned char context_a=0;  int num,ci, tbl, k, ke;  int v, v2, m,last_val=0,Rc=0,predic_val;  entropy->context=0;  /* Encode the MCU data blocks */  for (num = 0; num < cinfo->image_width; num++) {        /* Sections F.1.4.1 & F.1.4.4.1: Encoding of DC coefficients */    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */    st =entropy->dc_stats + entropy->context*5+entropy->context_b[num];    /*predic_val=last_val+((entropy->val_b[num]-Rc)>>1);*/    /*predic_val=RIGHT_SHIFT(last_val+entropy->val_b[num],1);*/    v=get_errval(cinfo,last_val,entropy->val_b[num],Rc,entropy->val_b[num+1],row+num);    /* if (i==0)       printf("row[%d]:%x  v=%d\n",num,row[num],v);*/    /*v=row[num]-predic_val;*/    /* Figure F.4: Encode_DC_DIFF */    if ((v ) == 0) {      arith_encode(cinfo, st, 0);      entropy->context = 0;	                /* zero diff category */          } else {            arith_encode(cinfo, st, 1);      /* Figure F.6: Encoding nonzero value v */      /* Figure F.7: Encoding the sign of v */      if (v > 0) {	st +=1;	arith_encode(cinfo, st, 0);	/* Table F.4: SS = S0 + 1 */	st += 1;			/* Table F.4: SP = S0 + 2 */	entropy->context = 4;	                /* small positive diff category */      } else {	st +=1;	v = -v;	arith_encode(cinfo, st, 1);	/* Table F.4: SS = S0 + 1 */	st += 2;			/* Table F.4: SN = S0 + 3 */	entropy->context = 8;	                /* small negative diff category */      }      /* Figure F.8: Encoding the magnitude category of v */      m = 0;      if (v -= 1) {        arith_encode(cinfo, st, 1);        m = 1;        v2 = v;        if ( entropy->context_b[num]>8 )	  st=entropy->dc_stats+129;	else	  st = entropy->dc_stats + 100; /* Table H.3: X1 = X1_context(Db)*/	    /*st=entropy->dc_stats+20;*/	 while (v2 >>= 1) {	   arith_encode(cinfo, st, 1);	   m <<= 1;	   st += 1;	}      }      arith_encode(cinfo, st, 0);            /* v -=1;       *m=1;       *if (v>m){       *arith_encode(cinfo,st,1);       *if ( entropy->context_b[num]>8 )       *  st=entropy->dc_stats+129;       * else       *  st = entropy->dc_stats + 100; * Table H.3: X1 = X1_context(Db)*       *m=2;       * while (v>=m){	*  arith_encode (cinfo,st,1);	 * m <<=1;	  *st +=1;	*}      *}      *arith_encode (cinfo,st,0);*/            /* Section F.1.4.4.1.2: Establish dc_context conditioning category */      if ((m) < (int) (((INT32) 1 << cinfo->arith_dc_L) >> 1))	entropy->context = 0;	        /* zero diff category */      else if ((m) > (int) (((INT32) 1 << cinfo->arith_dc_U)>>1 ))	entropy->context += 8;	        /* large diff category */      /* Figure F.9: Encoding the magnitude bit pattern of v */      st += 14;      while (m >>= 1)	arith_encode(cinfo, st, (m & v) ? 1 : 0);    }    entropy->context_b[num]=entropy->context;    Rc=entropy->val_b[num];    last_val=entropy->val_b[num]=row[num];  }    }  

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
性做久久久久久久久| 欧美不卡一区二区三区| 欧美国产日韩在线观看| 视频一区二区中文字幕| 欧美亚洲综合网| 美女视频黄免费的久久| 欧美日韩精品高清| 蜜臀av一区二区三区| 9i看片成人免费高清| 中文字幕免费在线观看视频一区| 国产精品一色哟哟哟| 欧美精品一区二区三区蜜桃视频 | 国产精品的网站| 国产凹凸在线观看一区二区| 久久久国际精品| 国产精品自拍在线| 国产日韩精品一区| 99久久99久久精品免费看蜜桃| 国产精品美女久久久久aⅴ| 国产成人自拍网| 国产精品高潮呻吟久久| 91美女片黄在线| 午夜精品久久久久久久久久| 欧美午夜精品理论片a级按摩| 亚洲国产日韩a在线播放| 欧美高清视频一二三区| 奇米影视7777精品一区二区| 欧美大白屁股肥臀xxxxxx| 国产精品一区二区无线| 中文字幕在线一区免费| 欧美写真视频网站| 亚洲18女电影在线观看| 亚洲高清在线精品| 精品国产凹凸成av人网站| 粉嫩一区二区三区在线看| 一区二区三区在线观看视频| 911精品国产一区二区在线| 国产欧美精品一区aⅴ影院| 欧美日韩在线电影| 国产麻豆91精品| 亚洲夂夂婷婷色拍ww47| 欧美精品一级二级| 国产一区二区在线视频| 一区二区三区在线影院| 日韩欧美国产综合| 欧洲av在线精品| 久久综合狠狠综合| 亚洲 欧美综合在线网络| 91在线免费播放| 亚洲观看高清完整版在线观看| 日韩欧美国产午夜精品| 亚洲最新视频在线播放| 日韩欧美资源站| 捆绑调教一区二区三区| 亚洲人亚洲人成电影网站色| 欧美一区二区三区成人| 成人国产亚洲欧美成人综合网| 亚洲国产综合在线| 中文字幕va一区二区三区| 欧美日本在线一区| 国产成人精品在线看| 久久精品72免费观看| 亚洲自拍偷拍图区| 国产精品理论在线观看| 日韩欧美国产麻豆| 久久精品免费在线观看| 老司机午夜精品| 亚洲品质自拍视频| 91精品蜜臀在线一区尤物| 亚洲18女电影在线观看| 久久久国产精华| 97精品国产露脸对白| 日韩美女久久久| 美国一区二区三区在线播放| 欧美大肚乱孕交hd孕妇| 国产sm精品调教视频网站| 日韩一区二区免费高清| 亚洲一区二区三区四区中文字幕| 国产原创一区二区| 天天色综合成人网| 日韩一级高清毛片| 久久综合狠狠综合| 三级不卡在线观看| 视频一区在线视频| 国内精品在线播放| 亚洲成在人线在线播放| 国产精品免费看片| 欧美电影免费观看高清完整版在线观看 | 欧美三电影在线| 激情综合色播五月| 精品夜夜嗨av一区二区三区| 日韩精品成人一区二区三区| 久久综合久久综合亚洲| 宅男噜噜噜66一区二区66| 欧美亚洲动漫另类| 91影院在线观看| jizz一区二区| 色综合久久久久网| 欧美性大战久久久久久久蜜臀| 91麻豆国产自产在线观看| 成人免费精品视频| 色欧美日韩亚洲| 色婷婷综合久久| 在线国产电影不卡| 欧美一区二区播放| 国产精品一卡二卡| 亚洲国产一区二区在线播放| 亚洲人成精品久久久久久| 亚洲日本va在线观看| 午夜私人影院久久久久| 日韩中文字幕不卡| 免费视频一区二区| 成人网在线免费视频| 精品国产露脸精彩对白| 欧美在线观看18| 亚洲精品一区二区三区香蕉| 一区二区三区在线看| 成人午夜免费电影| 天堂一区二区在线免费观看| 日韩视频一区在线观看| 欧美一区二区三级| 亚洲午夜影视影院在线观看| 欧美日韩一区二区在线观看视频| 亚洲精品第一国产综合野| 欧美激情在线看| 成人a免费在线看| 亚洲电影欧美电影有声小说| 日韩免费视频一区| 国产成人精品www牛牛影视| 一个色综合网站| 91精品国产入口在线| 国产精品天美传媒| 久久精品久久精品| 欧洲色大大久久| 欧美极品美女视频| 亚洲一区影音先锋| 91蜜桃免费观看视频| 日韩欧美国产不卡| 色乱码一区二区三区88| 欧美女孩性生活视频| 午夜精品久久久久久久99樱桃| 国产一区激情在线| 欧美精三区欧美精三区| √…a在线天堂一区| 国内精品伊人久久久久av影院 | 亚洲制服欧美中文字幕中文字幕| 国产电影精品久久禁18| 51午夜精品国产| 亚洲精品高清在线| 成人国产精品免费观看视频| 日韩精品一区二区三区在线观看| 亚洲宅男天堂在线观看无病毒| 国产91精品一区二区| 精品成人免费观看| 婷婷六月综合亚洲| 欧美日韩小视频| 亚洲一卡二卡三卡四卡五卡| 99久久精品免费看| 国产精品电影一区二区| 成人黄色电影在线| 亚洲国产精品精华液ab| 国产成人在线看| 精品少妇一区二区三区| 美腿丝袜亚洲色图| 欧美不卡视频一区| 久久精品国产精品亚洲精品 | 欧美va亚洲va| 日韩精品成人一区二区三区| 欧美日韩精品一区二区三区四区| 亚洲一区二区三区四区五区中文 | 视频一区在线播放| 欧美人动与zoxxxx乱| 手机精品视频在线观看| 91精品国产91久久久久久一区二区| 亚洲国产一区二区a毛片| 在线观看免费视频综合| 亚洲午夜激情网页| 欧美日韩亚洲综合一区二区三区| 亚洲一二三区不卡| 51精品久久久久久久蜜臀| 偷拍亚洲欧洲综合| 日韩一级免费一区| 国产美女在线精品| 欧美国产一区视频在线观看| 成人黄色在线看| 亚洲女子a中天字幕| 在线免费不卡电影| 日本视频免费一区| 久久免费精品国产久精品久久久久| 国产一区二区视频在线| 国产精品日韩成人| 91国产免费看| 日本sm残虐另类| 久久尤物电影视频在线观看| 国产成a人亚洲| 亚洲精品你懂的| 欧美电影一区二区| 国产综合色产在线精品| 国产精品久久久久天堂| 欧美无人高清视频在线观看|