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

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

?? ratectl.c

?? jpeg and mpeg 編解碼技術源代碼
?? C
字號:
/* ratectl.c, 比特流控制程序*/#include <stdio.h>#include <math.h>#include "config.h"#include "global.h"/* private prototypes */static void calc_actj _ANSI_ARGS_((unsigned char *frame));static double var_sblk _ANSI_ARGS_((unsigned char *p, int lx));/* rate control variables */int Xi, Xp, Xb, r, d0i, d0p, d0b;double avg_act;static int R, T, d;static double actsum;static int Np, Nb, S, Q;static int prev_mquant;void rc_init_seq(){  /* reaction parameter (constant) */  if (r==0)  r = (int)floor(2.0*bit_rate/frame_rate + 0.5);  /* average activity */  if (avg_act==0.0)  avg_act = 400.0;  /* remaining # of bits in GOP */  R = 0;  /* global complexity measure */  if (Xi==0) Xi = (int)floor(160.0*bit_rate/115.0 + 0.5);  if (Xp==0) Xp = (int)floor( 60.0*bit_rate/115.0 + 0.5);  if (Xb==0) Xb = (int)floor( 42.0*bit_rate/115.0 + 0.5);  /* virtual buffer fullness */  if (d0i==0) d0i = (int)floor(10.0*r/31.0 + 0.5);  if (d0p==0) d0p = (int)floor(10.0*r/31.0 + 0.5);  if (d0b==0) d0b = (int)floor(1.4*10.0*r/31.0 + 0.5);/*  if (d0i==0) d0i = (int)floor(10.0*r/(qscale_tab[0] ? 56.0 : 31.0) + 0.5);  if (d0p==0) d0p = (int)floor(10.0*r/(qscale_tab[1] ? 56.0 : 31.0) + 0.5);  if (d0b==0) d0b = (int)floor(1.4*10.0*r/(qscale_tab[2] ? 56.0 : 31.0) + 0.5);*/  fprintf(statfile,"\nrate control: sequence initialization\n");  fprintf(statfile,    " initial global complexity measures (I,P,B): Xi=%d, Xp=%d, Xb=%d\n",    Xi, Xp, Xb);  fprintf(statfile," reaction parameter: r=%d\n", r);  fprintf(statfile,    " initial virtual buffer fullness (I,P,B): d0i=%d, d0p=%d, d0b=%d\n",    d0i, d0p, d0b);  fprintf(statfile," initial average activity: avg_act=%.1f\n", avg_act);}void rc_init_GOP(np,nb)int np,nb;{  R += (int) floor((1 + np + nb) * bit_rate / frame_rate + 0.5);  Np = fieldpic ? 2*np+1 : np;  Nb = fieldpic ? 2*nb : nb;  fprintf(statfile,"\nrate control: new group of pictures (GOP)\n");  fprintf(statfile," target number of bits for GOP: R=%d\n",R);  fprintf(statfile," number of P pictures in GOP: Np=%d\n",Np);  fprintf(statfile," number of B pictures in GOP: Nb=%d\n",Nb);}/* Note: we need to substitute K for the 1.4 and 1.0 constants -- this can   be modified to fit image content *//* Step 1: compute target bits for current picture being coded */void rc_init_pict(frame)unsigned char *frame;{  double Tmin;  switch (pict_type)  {  case I_TYPE:    T = (int) floor(R/(1.0+Np*Xp/(Xi*1.0)+Nb*Xb/(Xi*1.4)) + 0.5);    d = d0i;    break;  case P_TYPE:    T = (int) floor(R/(Np+Nb*1.0*Xb/(1.4*Xp)) + 0.5);    d = d0p;    break;  case B_TYPE:    T = (int) floor(R/(Nb+Np*1.4*Xp/(1.0*Xb)) + 0.5);    d = d0b;    break;  }  Tmin = (int) floor(bit_rate/(8.0*frame_rate) + 0.5);  if (T<Tmin)    T = Tmin;  S = bitcount();  Q = 0;  calc_actj(frame);  actsum = 0.0;  fprintf(statfile,"\nrate control: start of picture\n");  fprintf(statfile," target number of bits: T=%d\n",T);}static void calc_actj(frame)unsigned char *frame;{  int i,j,k;  unsigned char *p;  double actj,var;  k = 0;  for (j=0; j<height2; j+=16)    for (i=0; i<width; i+=16)    {      p = frame + ((pict_struct==BOTTOM_FIELD)?width:0) + i + width2*j;      /* take minimum spatial activity measure of luminance blocks */      actj = var_sblk(p,width2);      var = var_sblk(p+8,width2);      if (var<actj) actj = var;      var = var_sblk(p+8*width2,width2);      if (var<actj) actj = var;      var = var_sblk(p+8*width2+8,width2);      if (var<actj) actj = var;      if (!fieldpic && !prog_seq)      {        /* field */        var = var_sblk(p,width<<1);        if (var<actj) actj = var;        var = var_sblk(p+8,width<<1);        if (var<actj) actj = var;        var = var_sblk(p+width,width<<1);        if (var<actj) actj = var;        var = var_sblk(p+width+8,width<<1);        if (var<actj) actj = var;      }      actj+= 1.0;      mbinfo[k++].act = actj;    }}void rc_update_pict(){  double X;  S = bitcount() - S; /* total # of bits in picture */  R-= S; /* remaining # of bits in GOP */  X = (int) floor(S*((0.5*(double)Q)/(mb_width*mb_height2)) + 0.5);  d+= S - T;  avg_act = actsum/(mb_width*mb_height2);  switch (pict_type)  {  case I_TYPE:    Xi = X;    d0i = d;    break;  case P_TYPE:    Xp = X;    d0p = d;    Np--;    break;  case B_TYPE:    Xb = X;    d0b = d;    Nb--;    break;  }  fprintf(statfile,"\nrate control: end of picture\n");  fprintf(statfile," actual number of bits: S=%d\n",S);  fprintf(statfile," average quantization parameter Q=%.1f\n",    (double)Q/(mb_width*mb_height2));  fprintf(statfile," remaining number of bits in GOP: R=%d\n",R);  fprintf(statfile,    " global complexity measures (I,P,B): Xi=%d, Xp=%d, Xb=%d\n",    Xi, Xp, Xb);  fprintf(statfile,    " virtual buffer fullness (I,P,B): d0i=%d, d0p=%d, d0b=%d\n",    d0i, d0p, d0b);  fprintf(statfile," remaining number of P pictures in GOP: Np=%d\n",Np);  fprintf(statfile," remaining number of B pictures in GOP: Nb=%d\n",Nb);  fprintf(statfile," average activity: avg_act=%.1f\n", avg_act);}/* compute initial quantization stepsize (at the beginning of picture) */int rc_start_mb(){  int mquant;  if (q_scale_type)  {    mquant = (int) floor(2.0*d*31.0/r + 0.5);    /* clip mquant to legal (linear) range */    if (mquant<1)      mquant = 1;    if (mquant>112)      mquant = 112;    /* map to legal quantization level */    mquant = non_linear_mquant_table[map_non_linear_mquant[mquant]];  }  else  {    mquant = (int) floor(d*31.0/r + 0.5);    mquant <<= 1;    /* clip mquant to legal (linear) range */    if (mquant<2)      mquant = 2;    if (mquant>62)      mquant = 62;    prev_mquant = mquant;  }/*  fprintf(statfile,"rc_start_mb:\n");  fprintf(statfile,"mquant=%d\n",mquant);*/  return mquant;}/* Step 2: measure virtual buffer - estimated buffer discrepancy */int rc_calc_mquant(j)int j;{  int mquant;  double dj, Qj, actj, N_actj;  /* measure virtual buffer discrepancy from uniform distribution model */  dj = d + (bitcount()-S) - j*(T/(mb_width*mb_height2));  /* scale against dynamic range of mquant and the bits/picture count */  Qj = dj*31.0/r;/*Qj = dj*(q_scale_type ? 56.0 : 31.0)/r;  */  actj = mbinfo[j].act;  actsum+= actj;  /* compute normalized activity */  N_actj = (2.0*actj+avg_act)/(actj+2.0*avg_act);  if (q_scale_type)  {    /* modulate mquant with combined buffer and local activity measures */    mquant = (int) floor(2.0*Qj*N_actj + 0.5);    /* clip mquant to legal (linear) range */    if (mquant<1)      mquant = 1;    if (mquant>112)      mquant = 112;    /* map to legal quantization level */    mquant = non_linear_mquant_table[map_non_linear_mquant[mquant]];  }  else  {    /* modulate mquant with combined buffer and local activity measures */    mquant = (int) floor(Qj*N_actj + 0.5);    mquant <<= 1;    /* clip mquant to legal (linear) range */    if (mquant<2)      mquant = 2;    if (mquant>62)      mquant = 62;    /* ignore small changes in mquant */    if (mquant>=8 && (mquant-prev_mquant)>=-4 && (mquant-prev_mquant)<=4)      mquant = prev_mquant;    prev_mquant = mquant;  }  Q+= mquant; /* for calculation of average mquant *//*  fprintf(statfile,"rc_calc_mquant(%d): ",j);  fprintf(statfile,"bitcount=%d, dj=%f, Qj=%f, actj=%f, N_actj=%f, mquant=%d\n",    bitcount(),dj,Qj,actj,N_actj,mquant);*/  return mquant;}/* compute variance of 8x8 block */static double var_sblk(p,lx)unsigned char *p;int lx;{  int i, j;  unsigned int v, s, s2;  s = s2 = 0;  for (j=0; j<8; j++)  {    for (i=0; i<8; i++)    {      v = *p++;      s+= v;      s2+= v*v;    }    p+= lx - 8;  }  return s2/64.0 - (s/64.0)*(s/64.0);}/* VBV calculations * * generates warnings if underflow or overflow occurs *//* vbv_end_of_picture * * - has to be called directly after writing picture_data() * - needed for accurate VBV buffer overflow calculation * - assumes there is no byte stuffing prior to the next start code */static int bitcnt_EOP;void vbv_end_of_picture(){  bitcnt_EOP = bitcount();  bitcnt_EOP = (bitcnt_EOP + 7) & ~7; /* account for bit stuffing */}/* calc_vbv_delay * * has to be called directly after writing the picture start code, the * reference point for vbv_delay */void calc_vbv_delay(){  double picture_delay;  static double next_ip_delay; /* due to frame reordering delay */  static double decoding_time;  /* number of 1/90000 s ticks until next picture is to be decoded */  if (pict_type == B_TYPE)  {    if (prog_seq)    {      if (!repeatfirst)        picture_delay = 90000.0/frame_rate; /* 1 frame */      else      {        if (!topfirst)          picture_delay = 90000.0*2.0/frame_rate; /* 2 frames */        else          picture_delay = 90000.0*3.0/frame_rate; /* 3 frames */      }    }    else    {      /* interlaced */      if (fieldpic)        picture_delay = 90000.0/(2.0*frame_rate); /* 1 field */      else      {        if (!repeatfirst)          picture_delay = 90000.0*2.0/(2.0*frame_rate); /* 2 flds */        else          picture_delay = 90000.0*3.0/(2.0*frame_rate); /* 3 flds */      }    }  }  else  {    /* I or P picture */    if (fieldpic)    {      if(topfirst==(pict_struct==TOP_FIELD))      {        /* first field */        picture_delay = 90000.0/(2.0*frame_rate);      }      else      {        /* second field */        /* take frame reordering delay into account */        picture_delay = next_ip_delay - 90000.0/(2.0*frame_rate);      }    }    else    {      /* frame picture */      /* take frame reordering delay into account*/      picture_delay = next_ip_delay;    }    if (!fieldpic || topfirst!=(pict_struct==TOP_FIELD))    {      /* frame picture or second field */      if (prog_seq)      {        if (!repeatfirst)          next_ip_delay = 90000.0/frame_rate;        else        {          if (!topfirst)            next_ip_delay = 90000.0*2.0/frame_rate;          else            next_ip_delay = 90000.0*3.0/frame_rate;        }      }      else      {        if (fieldpic)          next_ip_delay = 90000.0/(2.0*frame_rate);        else        {          if (!repeatfirst)            next_ip_delay = 90000.0*2.0/(2.0*frame_rate);          else            next_ip_delay = 90000.0*3.0/(2.0*frame_rate);        }      }    }  }  if (decoding_time==0.0)  {    /* first call of calc_vbv_delay */    /* we start with a 7/8 filled VBV buffer (12.5% back-off) */    picture_delay = ((vbv_buffer_size*16384*7)/8)*90000.0/bit_rate;    if (fieldpic)      next_ip_delay = (int)(90000.0/frame_rate+0.5);  }  /* VBV checks */  /* check for underflow (previous picture) */  if (!low_delay && (decoding_time < bitcnt_EOP*90000.0/bit_rate))  {    /* picture not completely in buffer at intended decoding time */    if (!quiet)      fprintf(stderr,"vbv_delay underflow! (decoding_time=%.1f, t_EOP=%.1f\n)",        decoding_time, bitcnt_EOP*90000.0/bit_rate);  }  /* when to decode current frame */  decoding_time += picture_delay;  /* warning: bitcount() may overflow (e.g. after 9 min. at 8 Mbit/s */  vbv_delay = (int)(decoding_time - bitcount()*90000.0/bit_rate);  /* check for overflow (current picture) */  if ((decoding_time - bitcnt_EOP*90000.0/bit_rate)      > (vbv_buffer_size*16384)*90000.0/bit_rate)  {    if (!quiet)      fprintf(stderr,"vbv_delay overflow!\n");  }  fprintf(statfile,    "\nvbv_delay=%d (bitcount=%d, decoding_time=%.2f, bitcnt_EOP=%d)\n",    vbv_delay,bitcount(),decoding_time,bitcnt_EOP);  if (vbv_delay<0)  {    if (!quiet)      fprintf(stderr,"vbv_delay underflow: %d\n",vbv_delay);    vbv_delay = 0;  }  if (vbv_delay>65535)  {    if (!quiet)      fprintf(stderr,"vbv_delay overflow: %d\n",vbv_delay);    vbv_delay = 65535;  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美精品一区| 久久午夜羞羞影院免费观看| 91麻豆6部合集magnet| 欧美视频一区二区三区四区| 精品国精品国产| 国产精品免费看片| 午夜激情一区二区| 懂色一区二区三区免费观看| 91久久精品一区二区二区| 欧美一区二区三区免费视频 | 亚洲精品一区二区三区影院| 亚洲欧美日韩一区| 国内精品国产成人| 欧美精品欧美精品系列| 中文字幕+乱码+中文字幕一区| 一区二区三区av电影| 国产原创一区二区| 欧美久久一二三四区| 国产喂奶挤奶一区二区三区| 亚洲妇女屁股眼交7| 麻豆freexxxx性91精品| 欧美色爱综合网| 亚洲免费观看高清完整版在线| 韩国成人福利片在线播放| 欧美日韩一区二区三区四区五区| 久久婷婷国产综合国色天香| 视频在线观看91| 在线观看视频91| 中文字幕免费在线观看视频一区| 精品在线一区二区| 中文字幕电影一区| 成人免费黄色在线| 国产精品色呦呦| 成人91在线观看| 中文字幕在线一区免费| 国产成人精品免费网站| 国产精品第13页| av一二三不卡影片| 最新高清无码专区| 色婷婷狠狠综合| 天堂在线亚洲视频| 69堂成人精品免费视频| 奇米精品一区二区三区在线观看一| 4438x亚洲最大成人网| 午夜国产不卡在线观看视频| 欧美精品第1页| 国产成人午夜视频| 一片黄亚洲嫩模| 日韩欧美高清一区| 91在线精品一区二区三区| 亚洲午夜电影在线观看| 久久蜜桃av一区精品变态类天堂| 国产成人精品亚洲日本在线桃色 | 国产一区二区三区日韩| 亚洲天堂福利av| 911精品产国品一二三产区| 国产中文一区二区三区| 亚洲综合小说图片| 久久婷婷国产综合国色天香| 在线免费观看日韩欧美| 国产精品538一区二区在线| 亚洲123区在线观看| 国产精品久久三| 久久久久久久久久美女| 在线播放日韩导航| 91麻豆福利精品推荐| 国产成人自拍网| 黑人巨大精品欧美黑白配亚洲| 亚洲一区欧美一区| 亚洲欧美视频在线观看视频| 国产亚洲一本大道中文在线| 日韩欧美在线1卡| 欧美日韩精品福利| 欧美日韩国产三级| 欧美日韩精品专区| 精品视频1区2区3区| 欧美在线观看一二区| 欧美日韩高清影院| 91精品综合久久久久久| 91精品欧美福利在线观看| 欧美三级三级三级爽爽爽| 欧美日韩国产乱码电影| 日本高清无吗v一区| 欧美美女黄视频| 欧美疯狂做受xxxx富婆| 精品国产一二三区| 国产欧美日韩综合| 亚洲综合免费观看高清完整版| 香蕉久久一区二区不卡无毒影院| 亚洲一区二区三区爽爽爽爽爽| 三级欧美在线一区| 经典一区二区三区| 成人黄色777网| 欧美精品 日韩| 久久女同精品一区二区| 亚洲男女一区二区三区| 美腿丝袜在线亚洲一区| www.成人网.com| 欧美一级xxx| 17c精品麻豆一区二区免费| 亚洲一区在线视频观看| 国产精品一级片在线观看| 99精品欧美一区二区蜜桃免费| 欧美亚洲精品一区| 国产三级三级三级精品8ⅰ区| 亚洲午夜精品在线| 成人久久久精品乱码一区二区三区| 在线视频欧美精品| 国产精品私人自拍| 国产一区在线精品| 欧美一卡二卡在线| 五月婷婷久久丁香| 欧洲一区在线观看| 亚洲精品免费一二三区| 国产suv精品一区二区6| 精品成人一区二区三区四区| 日韩电影免费在线| 欧美日韩国产一区| 视频一区视频二区中文| 99久精品国产| 亚洲最大成人综合| 欧洲精品中文字幕| 樱花影视一区二区| 欧美喷潮久久久xxxxx| 亚洲影视在线观看| 欧美日韩国产电影| 日韩av中文在线观看| 日韩欧美综合一区| 精品一区中文字幕| 成人免费一区二区三区视频| 国产一区二区精品久久91| 国产三级欧美三级| 丁香天五香天堂综合| 亚洲伦在线观看| 日韩一区二区三区视频在线 | 日韩三级在线观看| 国产一区二区女| 亚洲男人的天堂一区二区| 欧美美女黄视频| 成人在线视频首页| 亚洲韩国一区二区三区| 日韩无一区二区| 成人av在线网站| 免费不卡在线观看| 日韩美女视频一区二区| 精品少妇一区二区三区日产乱码| 成人午夜大片免费观看| 日韩av一级电影| 亚洲色欲色欲www| 久久香蕉国产线看观看99| 欧美三区在线视频| 91在线视频免费观看| 国产乱码精品一品二品| 青青草国产精品亚洲专区无| 亚洲另类在线视频| 国产精品美女久久久久久久网站| 欧美精品在欧美一区二区少妇| 成人激情综合网站| 极品少妇xxxx偷拍精品少妇| 亚洲午夜一区二区三区| 亚洲乱码日产精品bd| 亚洲国产精品国自产拍av| 久久久九九九九| 久久久久久久久久久久久久久99| 91麻豆精品91久久久久久清纯| 欧洲在线/亚洲| 在线视频中文字幕一区二区| 91九色02白丝porn| 在线视频亚洲一区| 欧美久久一二区| 欧美一区二区在线观看| 欧美一区二区三区日韩视频| 91精品视频网| 国产日韩欧美综合一区| 久久综合色天天久久综合图片| 欧美一区二区三区免费| 精品国产制服丝袜高跟| 国产午夜精品久久久久久免费视 | 国产一区二区调教| 成人av电影在线网| 欧美综合在线视频| 日韩精品一区二区三区在线播放| 欧美精品一区二区蜜臀亚洲| 欧美激情综合在线| 亚洲一区二区高清| 国产精品77777| 欧美唯美清纯偷拍| 久久午夜羞羞影院免费观看| 亚洲乱码国产乱码精品精的特点| 视频在线观看一区| 成人午夜大片免费观看| 欧美日韩成人一区二区| 久久嫩草精品久久久精品| 亚洲精品免费电影| 国产风韵犹存在线视精品| 欧美男同性恋视频网站| 中文字幕中文在线不卡住| 玖玖九九国产精品| 在线亚洲一区观看| 国产精品传媒入口麻豆|