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

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

?? lencod.c

?? AVS編解碼是學習AVS程序開發的入門資料,可以幫助初學者獲得很多的收獲.
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
*****************************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2003, Advanced Audio Video Coding Standard, Part II
*
* DISCLAIMER OF WARRANTY
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations under
* the License.
*                     
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
* The AVS Working Group doesn't represent or warrant that the programs
* furnished here under are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy for standardization procedure is available at 
* AVS Web site http://www.avs.org.cn. Patent Licensing is outside
* of AVS Working Group.
*
* The Original Code is Reference Software for China National Standard 
* GB/T 20090.2-2006 (short for AVS-P2 or AVS Video) at version RM52J.
*
* The Initial Developer of the Original Code is Video subgroup of AVS
* Workinggroup (Audio and Video coding Standard Working Group of China).
* Contributors:   Guoping Li,    Siwei Ma,    Jian Lou,    Qiang Wang , 
*   Jianwen Chen,Haiwu Zhao,  Xiaozhen Zheng, Junhao Zheng, Zhiming Wang
* 
******************************************************************************
*/



/*
*************************************************************************************
* File name: 
* Function: 
*
*************************************************************************************
*/
#include "contributors.h"

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

#if defined WIN32
  #include <conio.h>
#endif
#include <assert.h>

#include "global.h"
#include "configfile.h"
#include "memalloc.h"
#include "mbuffer.h"
#include "image.h"
#include "header.h"
#include "ratectl.h"
#include "vlc.h"	// Added by cjw, 20070327
#include "bitstream.h"

#ifdef FastME
#include "fast_me.h"
#endif


#define RM      "5"
#define VERSION "5.2j"

InputParameters inputs, *input = &inputs;
ImageParameters images, *img   = &images;
SNRParameters   snrs,   *snr   = &snrs;
StatParameters  stats,*stat=&stats;


int    start_tr_in_this_IGOP = 0;


/*
*************************************************************************
* Function:Main function for encoder.
* Input:argc
      number of command line arguments
       argv
      command line arguments
* Output:
* Return: exit code
* Attention:
*************************************************************************
*/

void Init_Motion_Search_Module ();
void Clear_Motion_Search_Module ();

int main(int argc,char **argv)
{
  int image_type;
  int M, N, np, nb, n;
  int len=0;			// Added by cjw, 20070327
  Bitstream *bitstream = currBitStream;	// Added by cjw, 20070327
  
  p_dec = p_dec_u = p_dec_v = p_stat = p_log = p_datpart = p_trace = NULL;

   
  Configure (argc, argv);
  init_img();

  frame_pic = malloc_picture();
  if (input->InterlaceCodingOption != FRAME_CODING)
  {
	top_pic = malloc_picture();
    bot_pic = malloc_picture();
  }

  init_rdopt ();
  init_frame_buffers(input,img);
  init_global_buffers();
  Init_Motion_Search_Module ();
  information_init();

    //Rate control 
  if(input->RCEnable)
	  rc_init_seq();

  //FAST MOTION ESTIMATION. ZHIBO CHEN 2003.3
#ifdef FastME
  DefineThreshold();
#endif

  // B pictures
  Bframe_ctr=0;
  tot_time=0;                 // time for total encoding session
  img->pn = -1;    
  input->skip_mode_flag = 1; 

  // Write sequence header 
  stat->bit_slice = start_sequence();
  printf("Sequence Header \n");
  img->Seqheader_flag=1;				   // Add by cjw, 20070327
  img->count_PAFF=0;					   // Add by cjw, 20070327
  img->curr_picture_distance = img->last_picture_distance = 0;	// Added by Xiaozhen Zheng, 20070405
  

  tmp_buf_cycle = img->buf_cycle;  
 
  for (img->number=0; img->number < input->no_frames; img->number++)
  {
	  // Added by cjw, 20070327, Begin
	  if(img->number!=0 && input->vec_period!=0 && img->number%(input->vec_period*input->seqheader_period*input->intra_period)==0 ){
		  len=  WriteVideoEditCode(); //added by cjw 20070419
		  stat->bit_slice += len;
	  }
	  
	  if(img->number!=0 && input->seqheader_period!=0 && img->number%(input->seqheader_period*input->intra_period)==0){
		   stat->bit_slice += start_sequence();
		   printf("Sequence Header \n");
		   img->Seqheader_flag=1;				   
		   img->count_PAFF=0;					   
	  }
	  // Added by cjw, 20070327, End


    img->pn = (img->pn+1) % (img->buf_cycle+1); 
	img->buf_cycle = tmp_buf_cycle;  

    //frame_num for this frame
    img->frame_num = IMG_NUMBER % (1 << (LOG2_MAX_FRAME_NUM_MINUS4 + 4));

    SetImgType();

	stat->bit_use_header[img->type] += len;		// Added by cjw, 20070327

//    if(img->number==0) //modified by cjw AVS 20070204  Spec. 7.2.3.1 //commented Hisilicon XiaoZhen Zheng 20070327
//      picture_distance = 0;
//    else
//   {
//      if(img->type==B_IMG)
//          picture_distance = ((IMG_NUMBER - 1) * (input->jumpd + 1) + img->b_interval * img->b_frame_to_code)%256;	// Tsinghua 200701
//      else
//          picture_distance = (IMG_NUMBER * (input->jumpd + 1))%256;	// Tsinghua 200701
//    }

    image_type = img->type;
	
	if(image_type == INTRA_IMG)    // jlzheng 7.21
    //img->buf_cycle /= 2;				
	  img->buf_cycle  = 1;       // cjw 20060321 
								 // for 1 reference is used field coding (I bottom only 1 reference is used)

    //Rate control
    if (img->type == INTRA_IMG)
    {
      if(input->RCEnable)
      {
        if (input->intra_period == 0)
        {
          n = input->no_frames + (input->no_frames - 1) * input->successive_Bframe;
          
          /* number of P frames */
          np = input->no_frames-1; 
          
          /* number of B frames */
          nb = (input->no_frames - 1) * input->successive_Bframe;
        }else
        {
          N = input->intra_period*(input->successive_Bframe+1);
          M = input->successive_Bframe+1;
          n = (img->number==0) ? N - ( M - 1) : N;
          
          /* last GOP may contain less frames */
          if(img->number/input->intra_period >= input->no_frames / input->intra_period)
          {
            if (img->number != 0)
              n = (input->no_frames - img->number) + (input->no_frames - img->number - 1) * input->successive_Bframe + input->successive_Bframe;
            else
              n = input->no_frames  + (input->no_frames - 1) * input->successive_Bframe;
          }
          
          /* number of P frames */
          if (img->number == 0)
            np = (n + 2 * (M - 1)) / M - 1; /* first GOP */
          else
            np = (n + (M - 1)) / M - 1;
          
          /* number of B frames */
          nb = n - np - 1;
        }
        rc_init_GOP(np,nb);
      }
    }

    encode_one_frame(); // encode one I- or P-frame

    img->nb_references += 1;
    img->nb_references = min(img->nb_references, 2);// Tian Dong. June 7, 2002

    if ((input->successive_Bframe != 0) && (IMG_NUMBER > 0)) // B-frame(s) to encode
    {
      img->type = B_IMG;            // set image type to B-frame
      picture_coding_type = 1;
      img->types = INTER_IMG;
      
	  //cjw for weighted prediction
		  img->buf_cycle = tmp_buf_cycle;

      img->frame_num++;                 //increment frame_num once for B-frames
      img->frame_num %= (1 << (LOG2_MAX_FRAME_NUM_MINUS4 + 4));
   
      for(img->b_frame_to_code=1; img->b_frame_to_code<=input->successive_Bframe; img->b_frame_to_code++)
      {
//		picture_distance = (IMG_NUMBER - 1) * (input->successive_Bframe + 1) + img->b_frame_to_code;	// Tsinghua 200701 //commented Hisilicon XiaoZhen Zheng 20070327
        encode_one_frame();  // encode one B-frame
      }
    }
  }
  
  // terminate sequence
  terminate_sequence();

  fclose(p_in);

  if (p_dec)
    fclose(p_dec);
  if (p_trace)
    fclose(p_trace);

  Clear_Motion_Search_Module ();
  
  // free structure for rd-opt. mode decision
  clear_rdopt ();

  // report everything
  report();

  free_picture (frame_pic);

  free_global_buffers();

  // free image mem
  free_img ();

  return 0;
}

/*
*************************************************************************
* Function:Initializes the Image structure with appropriate parameters.
* Input:Input Parameters struct inp_par *inp
* Output:Image Parameters struct img_par *img
* Return: 
* Attention:
*************************************************************************
*/

void init_img()
{
  int i,j;
  float FrameRate[8] = {{24000/1001}, {24}, {25}, {30000/1001}, {30}, {50}, {60000/1001}, {60}};


  img->no_multpred=input->no_multpred;
  img->buf_cycle = input->no_multpred;

  img->lindex=0;
  img->max_lindex=0;
  img->width    = (input->img_width+img->auto_crop_right);  //add by wuzhongmou 0610
  img->height   = (input->img_height+img->auto_crop_bottom); //add by wuzhongmou 0610
  img->width_cr =img->width/2;                                
  img->height_cr= img->height/2;                //add by wuzhongmou 0610
  
  img->framerate = (int)FrameRate[input->frame_rate_code-1];
  
  //img->framerate=INIT_FRAME_RATE;   // The basic frame rate (of the original sequence)
  if(input->InterlaceCodingOption != FRAME_CODING) 
    img->buf_cycle *= 2;

  get_mem_mv (&(img->mv));
  get_mem_mv (&(img->p_fwMV));
  get_mem_mv (&(img->p_bwMV));
  get_mem_mv (&(img->all_mv));
  get_mem_mv (&(img->all_bmv));

  get_mem_ACcoeff (&(img->cofAC));
  get_mem_DCcoeff (&(img->cofDC));
  get_mem_mv (&(img->omv));
  get_mem_mv (&(img->all_omv));
  get_mem_mv (&(img->omv_fld));
  get_mem_mv (&(img->all_omv_fld));

   /*Lou Start*/
 	get_mem4Dint(&(img->chromacofAC),2,4,2,17);
   /*Lou End*/

   /*lgp*/
  if(input->InterlaceCodingOption != FRAME_CODING) 
    img->buf_cycle /= 2;
  
  if ((img->MB_SyntaxElements = (SyntaxElement*)calloc (((img->height*img->width/256)+1200), sizeof(SyntaxElement))) == NULL)
    no_mem_exit ("init_img: MB_SyntaxElements");     

  if ((img->quad = (int*)calloc (511, sizeof(int))) == NULL)
    no_mem_exit ("init_img: img->quad");

  img->quad+=255;

  for (i=0; i < 256; ++i) // fix from TML1 / TML2 sw, truncation removed
  {
    img->quad[i]=img->quad[-i]=i*i;
  }

  if(((img->mb_data) = (Macroblock *) calloc((img->width/MB_BLOCK_SIZE) * (img->height/MB_BLOCK_SIZE),sizeof(Macroblock))) == NULL)
    no_mem_exit("init_img: img->mb_data");

	
	for (i=0; i < (img->width/MB_BLOCK_SIZE) * (img->height/MB_BLOCK_SIZE); i++)
	{  
		get_mem4Dint (&(img->mb_data[i].cofAC),6,4,2,65);/*lgp*dct*modify*/
		get_mem4Dint(&(img->mb_data[i].chromacofAC),2,4,2,17);
	
	}

  for (i=0; i < (img->width/MB_BLOCK_SIZE) * (img->height/MB_BLOCK_SIZE); i++)
  {
    img->mb_data[i].slice_nr = 0;
  }

  // allocate memory for intra pred mode buffer for each block: img->ipredmode
 get_mem2Dint(&(img->ipredmode), img->width/B8_SIZE+100, img->height/B8_SIZE+100);        //need two extra rows at right and bottom

  // Prediction mode is set to -1 outside the frame, indicating that no prediction can be made from this part
	for (i=0; i < img->width/(B8_SIZE)+100; i++)
	{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产首页| 一本色道久久综合亚洲精品按摩| 亚洲午夜免费福利视频| 亚洲色图.com| 亚洲女子a中天字幕| 亚洲美女在线一区| 亚洲综合在线第一页| 亚洲一线二线三线视频| 亚洲自拍偷拍欧美| 午夜精品成人在线视频| 奇米888四色在线精品| 男人的j进女人的j一区| 国产激情一区二区三区| 成人在线一区二区三区| 色综合久久精品| 欧美少妇性性性| 日韩欧美国产麻豆| www成人在线观看| 亚洲丝袜另类动漫二区| 亚洲成av人片| 精品亚洲免费视频| jlzzjlzz国产精品久久| 欧美日韩国产一级二级| 精品国产欧美一区二区| 国产精品久久久久久户外露出| 亚洲理论在线观看| 久久er99精品| 99久久综合精品| 91精品国产综合久久久久| 国产亚洲欧美日韩在线一区| 亚洲视频资源在线| 男女男精品视频网| 色婷婷综合久久久中文字幕| 在线电影院国产精品| 亚洲国产高清不卡| 午夜精品久久久久久久久久久| 国产精品羞羞答答xxdd | 亚洲精品在线电影| 国产精品久久久久久亚洲毛片 | 久久国产生活片100| 成人黄色在线看| 欧美一区二区三区白人| 综合av第一页| 国产精品亚洲专一区二区三区 | 1024国产精品| 看电影不卡的网站| 欧美午夜一区二区三区| 国产精品久久久久久久久晋中 | 成人做爰69片免费看网站| 欧美日韩国产首页| 亚洲人一二三区| 国产一区二区精品久久99| 欧美日韩视频一区二区| 一区精品在线播放| 懂色av一区二区夜夜嗨| 日韩欧美在线网站| 视频一区二区国产| 欧美丝袜第三区| 亚洲美女免费视频| 99久久婷婷国产综合精品| 久久久亚洲国产美女国产盗摄| 图片区小说区区亚洲影院| 在线视频一区二区免费| 一区二区三区免费观看| 日本乱人伦aⅴ精品| 亚洲精品五月天| 色综合一区二区| 亚洲品质自拍视频网站| 成人的网站免费观看| 国产精品理论在线观看| 成人av网址在线| 中文字幕一区三区| 91色porny在线视频| 亚洲美女偷拍久久| 欧美性猛交一区二区三区精品| 亚洲理论在线观看| 欧美视频自拍偷拍| 肉丝袜脚交视频一区二区| 欧美浪妇xxxx高跟鞋交| 日韩中文字幕麻豆| 日韩三级中文字幕| 国产精品综合二区| 国产精品久久久一本精品| 91污在线观看| 亚洲一区二区视频在线| 51午夜精品国产| 久久爱另类一区二区小说| 国产视频一区二区三区在线观看| 成人一区在线看| 一区二区三区在线视频观看58 | 日本电影欧美片| 视频一区二区三区中文字幕| 欧美一级高清片| 成人精品一区二区三区四区| 中文字幕在线观看不卡| 欧美日韩国产精选| 国产真实乱对白精彩久久| 国产精品网曝门| 欧美日韩成人综合在线一区二区| 久久精品久久综合| 国产精品久99| 欧美一级日韩一级| 成人午夜在线视频| 亚洲成人激情自拍| 国产视频一区在线观看| 欧美色网一区二区| 国产v日产∨综合v精品视频| 一区二区三区在线视频观看| 日韩美女视频在线| 色综合久久综合中文综合网| 美脚の诱脚舐め脚责91| 最新国产成人在线观看| 69成人精品免费视频| 成人av资源在线| 久久国产人妖系列| 亚洲国产毛片aaaaa无费看 | 久久久午夜精品理论片中文字幕| 色婷婷亚洲一区二区三区| 国产精品一二三在| 日韩精品欧美精品| 亚洲一区二区黄色| 国产精品欧美经典| 久久久三级国产网站| 欧美日韩高清一区二区三区| www.欧美亚洲| 国产精品一区二区视频| 视频一区视频二区在线观看| 亚洲女性喷水在线观看一区| 26uuuu精品一区二区| 欧美另类高清zo欧美| 91黄视频在线| 99国产精品99久久久久久| 久久精品国产第一区二区三区| 亚洲国产精品天堂| 日韩美女久久久| 中文字幕在线播放不卡一区| 久久久99精品免费观看| 日韩精品一区二区三区视频在线观看| 欧美性受xxxx黑人xyx性爽| 色成人在线视频| 日本韩国欧美国产| 91麻豆自制传媒国产之光| 成人美女视频在线看| 国产福利一区二区三区| 国产一区二区视频在线播放| 久久综合综合久久综合| 激情国产一区二区| 国内外成人在线| 国产一区二区美女诱惑| 精品一区二区三区久久久| 久久国产夜色精品鲁鲁99| 久久99热国产| 国产剧情一区二区| 东方aⅴ免费观看久久av| 国产另类ts人妖一区二区| 粗大黑人巨茎大战欧美成人| 成人动漫一区二区| 色婷婷久久久久swag精品| 色激情天天射综合网| 欧美日韩另类一区| 91精品国产综合久久久久久久| 日韩欧美高清在线| 2023国产精华国产精品| 国产人成亚洲第一网站在线播放 | 欧美成人a∨高清免费观看| 精品电影一区二区三区| 欧美国产成人精品| 亚洲欧洲性图库| 亚洲成精国产精品女| 蜜桃久久久久久久| 成人综合婷婷国产精品久久 | 精品视频免费在线| 欧美撒尿777hd撒尿| 日韩一区二区三区四区五区六区| 欧美大片在线观看一区二区| 久久久噜噜噜久久中文字幕色伊伊 | 麻豆中文一区二区| 国产一区二区三区综合| 99re热这里只有精品视频| 欧美日韩二区三区| 国产午夜精品一区二区三区嫩草 | 国产成人免费在线| 色综合天天做天天爱| 欧美一区永久视频免费观看| 久久精品一区二区| 精品在线你懂的| 国产成人精品亚洲777人妖 | 欧美电影免费观看高清完整版在线 | 亚洲va欧美va天堂v国产综合| 蜜臀久久99精品久久久久久9| 国产精品亚洲第一区在线暖暖韩国 | 欧美色视频在线| 337p日本欧洲亚洲大胆精品| 一区二区三区中文字幕电影| 国产毛片精品一区| 欧美日产在线观看| 一区在线观看视频| 国产综合成人久久大片91| 欧美日韩另类一区| 亚洲男人都懂的|