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

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

?? slice.c

?? h264標準的VC實現
?? C
?? 第 1 頁 / 共 3 頁
字號:
        FrameRDCost = rdopt->min_rdcost;
        //***   Top MB coded as frame MB ***//

        //Rate control
        img->bot_MB = 1; //for Rate control
        
        // go to the bottom MB in the MB pair
        img->field_mode = 0;  // MB coded as frame  //GB
        
        start_macroblock (CurrentMbAddr+1, FALSE);
        rdopt = &rddata_bot_frame_mb; // store data in top frame MB
        encode_one_macroblock ();     // code the MB as frame
        FrameRDCost += rdopt->min_rdcost;

        //***   Bottom MB coded as frame MB ***//
      }

      if ((input->MbInterlace == ADAPTIVE_CODING) || (input->MbInterlace == FIELD_CODING))
      {
        //Rate control
        img->bot_MB = 0; 
        
        //=========== start coding the MB pair as a field MB pair =============
        //---------------------------------------------------------------------
        img->field_mode = 1;  // MB coded as frame
        img->top_field = 1;   // Set top field to 1
        img->buf_cycle <<= 1;
        input->num_ref_frames <<= 1;
        img->num_ref_idx_l0_active <<= 1;
        img->num_ref_idx_l0_active += 1;
        start_macroblock (CurrentMbAddr, TRUE);
        

        rdopt = &rddata_top_field_mb; // store data in top frame MB 
//        TopFieldIsSkipped = 0;        // set the top field MB skipped flag to 0
        encode_one_macroblock ();     // code the MB as frame
        FieldRDCost = rdopt->min_rdcost;
        //***   Top MB coded as field MB ***//
        //Rate control
        img->bot_MB = 1;//for Rate control

        img->top_field = 0;   // Set top field to 0
        start_macroblock (CurrentMbAddr+1, TRUE);
        rdopt = &rddata_bot_field_mb; // store data in top frame MB 
        encode_one_macroblock ();     // code the MB as frame
        FieldRDCost += rdopt->min_rdcost;
        //***   Bottom MB coded as field MB ***//
      }

      //Rate control
      img->write_macroblock_frame = 0;  //Rate control

      //=========== decide between frame/field MB pair ============
      //-----------------------------------------------------------
      if ((input->MbInterlace == ADAPTIVE_CODING) && (FrameRDCost < FieldRDCost))
      {
        img->field_mode = 0;
        img->buf_cycle >>= 1;
        input->num_ref_frames >>= 1;
        MBPairIsField = 0;
        img->num_ref_idx_l0_active -= 1;
        img->num_ref_idx_l0_active >>= 1;
        
        //Rate control
        img->write_macroblock_frame = 1;  //for Rate control
      }
      else
      {
        img->field_mode = 1;
        MBPairIsField = 1;
      }
      
      //Rate control
      img->write_macroblock = 1;//Rate control 
      
      if (MBPairIsField)
        img->top_field = 1;
      else
        img->top_field = 0;
      
      //Rate control
      img->bot_MB = 0;// for Rate control

      // go back to the Top MB in the MB pair
      start_macroblock (CurrentMbAddr, img->field_mode);
      
      rdopt =  img->field_mode ? &rddata_top_field_mb : &rddata_top_frame_mb;
      copy_rdopt_data (0);  // copy the MB data for Top MB from the temp buffers
      write_one_macroblock (1);     // write the Top MB data to the bitstream
      NumberOfCodedMBs++;   // only here we are sure that the coded MB is actually included in the slice
      terminate_macroblock (&end_of_slice, &recode_macroblock);     // done coding the Top MB 
      proceed2nextMacroblock (CurrentMbAddr);        // Go to next macroblock
      
      //Rate control
      img->bot_MB = 1;//for Rate control
      // go to the Bottom MB in the MB pair
      img->top_field = 0;
      start_macroblock (CurrentMbAddr+1, img->field_mode);

      rdopt = img->field_mode ? &rddata_bot_field_mb : &rddata_bot_frame_mb;
      copy_rdopt_data (1);  // copy the MB data for Bottom MB from the temp buffers
      
      write_one_macroblock (0);     // write the Bottom MB data to the bitstream
      NumberOfCodedMBs++;   // only here we are sure that the coded MB is actually included in the slice
      terminate_macroblock (&end_of_slice, &recode_macroblock);     // done coding the Top MB 
      proceed2nextMacroblock (CurrentMbAddr);        // Go to next macroblock
      
      if (MBPairIsField)    // if MB Pair was coded as field the buffer size variables back to frame mode
      {
        img->buf_cycle >>= 1;
        input->num_ref_frames >>= 1;
        img->num_ref_idx_l0_active -= 1;
        img->num_ref_idx_l0_active >>= 1;
      }
      img->field_mode = img->top_field = 0; // reset to frame mode
      
      
      // go to next MB pair, not next MB
      CurrentMbAddr = FmoGetNextMBNr (CurrentMbAddr);
      CurrentMbAddr = FmoGetNextMBNr (CurrentMbAddr);
      
      if (CurrentMbAddr == FmoGetLastCodedMBOfSliceGroup (FmoMB2SliceGroup (CurrentMbAddr)))
        end_of_slice = TRUE;        // just in case it does n't get set in terminate_macroblock
    }
  }  
/*
  // Tian Dong: June 7, 2002 JVT-B042
  // Restore the short_used
  if (input->NumFramesInELSubSeq)
    {
      fb->short_used = short_used;
      img->nb_references = img_ref;
    }
*/
  terminate_slice ();
  return NumberOfCodedMBs;
}



/*!
 ************************************************************************
 * \brief
 *    Initializes the parameters for a new slice and
 *     allocates the memory for the coded slice in the Picture structure
 *  \par Side effects:
 *      Adds slice/partition header symbols to the symbol buffer
 *      increments Picture->no_slices, allocates memory for the
 *      slice, sets img->currSlice
 ************************************************************************
 */
static void init_slice (int start_mb_addr)
{
  int i;
  Picture *currPic = img->currentPicture;
  DataPartition *dataPart;
  Bitstream *currStream;
  Slice *currSlice;

  img->current_mb_nr = start_mb_addr;

  // Allocate new Slice in the current Picture, and set img->currentSlice
  assert (currPic != NULL);
  currPic->no_slices++;
  if (currPic->no_slices >= MAXSLICEPERPICTURE)
    error ("Too many slices per picture, increase MAXLSICESPERPICTURE in global.h.", -1);

  currPic->slices[currPic->no_slices-1] = malloc_slice();
  currSlice = currPic->slices[currPic->no_slices-1];

  img->currentSlice = currSlice;

  currSlice->picture_id = img->tr % 256;
  currSlice->qp = img->qp;
  currSlice->start_mb_nr = start_mb_addr;
  currSlice->slice_too_big = dummy_slice_too_big;

  for (i = 0; i < currSlice->max_part_nr; i++)
  {
    dataPart = &(currSlice->partArr[i]);
    if (input->symbol_mode == UVLC)
      dataPart->writeSyntaxElement = writeSyntaxElement_UVLC;
    else
      dataPart->writeSyntaxElement = writeSyntaxElement_CABAC;
    
    currStream = dataPart->bitstream;
    currStream->bits_to_go = 8;
    currStream->byte_pos = 0;
    currStream->byte_buf = 0;
  }

    // restrict list 1 size
//  img->num_ref_idx_l0_active = max(1, (img->type==B_SLICE ? active_pps->num_ref_idx_l0_active_minus1 + 1: active_pps->num_ref_idx_l0_active_minus1 +1 )); 
//  img->num_ref_idx_l1_active = (img->type==B_SLICE ? active_pps->num_ref_idx_l1_active_minus1 + 1 : 0);
  img->num_ref_idx_l0_active = active_pps->num_ref_idx_l0_active_minus1 + 1; 
  img->num_ref_idx_l1_active = active_pps->num_ref_idx_l1_active_minus1 + 1;

  // generate reference picture lists
  init_lists(img->type, img->structure);

  // assign list 0 size from list size
  img->num_ref_idx_l0_active = listXsize[0];
  img->num_ref_idx_l1_active = listXsize[1];

  //if (!img->MbaffFrameFlag)
  {
    if ((img->type == P_SLICE || img->type == SP_SLICE) && input->P_List0_refs)
    {
      img->num_ref_idx_l0_active = min(img->num_ref_idx_l0_active, input->P_List0_refs);
      listXsize[0] = min(listXsize[0], input->P_List0_refs);  
    }
    if (img->type == B_SLICE )
    {
      
      if (input->B_List0_refs)
      {
        img->num_ref_idx_l0_active = min(img->num_ref_idx_l0_active, input->B_List0_refs);
        listXsize[0] = min(listXsize[0], input->B_List0_refs);  
      }
      if (input->B_List1_refs)
      {
        
        img->num_ref_idx_l1_active = min(img->num_ref_idx_l1_active, input->B_List1_refs);
        listXsize[1] = min(listXsize[1], input->B_List1_refs);  
      }
    }
  } 

  //Perform memory management based on poc distances for PyramidCoding
  if (img->nal_reference_idc  && input->PyramidCoding && input->PocMemoryManagement && dpb.used_size == dpb.size)
  {    
    poc_based_ref_management(img->frame_num);
  }

  init_ref_pic_list_reordering();

  //Perform reordering based on poc distances for PyramidCoding
  if (img->type==P_SLICE && input->PyramidCoding && input->PyramidRefReorder)
  {
    
    int i, num_ref;

    alloc_ref_pic_list_reordering_buffer(currSlice);
    
    if ((img->type != I_SLICE) && (img->type !=SI_SLICE))
    {
      for (i=0; i<img->num_ref_idx_l0_active + 1; i++)
      {
        currSlice->remapping_of_pic_nums_idc_l0[i] = 3;
        currSlice->abs_diff_pic_num_minus1_l0[i] = 0;
        currSlice->long_term_pic_idx_l0[i] = 0;
      }
      
      if (img->type == B_SLICE)
      {
        for (i=0; i<img->num_ref_idx_l1_active + 1; i++)
        {
          currSlice->remapping_of_pic_nums_idc_l1[i] = 3;
          currSlice->abs_diff_pic_num_minus1_l1[i] = 0;
          currSlice->long_term_pic_idx_l1[i] = 0;
        }
      }
    }
    
    if ((img->type != I_SLICE) && (img->type !=SI_SLICE))
    {
      num_ref = img->num_ref_idx_l0_active;
      poc_ref_pic_reorder(listX[LIST_0], 
                          num_ref, 
                          currSlice->remapping_of_pic_nums_idc_l0, 
                          currSlice->abs_diff_pic_num_minus1_l0, 
                          currSlice->long_term_pic_idx_l0, 0, LIST_0);
      
      //reference picture reordering
      reorder_ref_pic_list(listX[LIST_0], &listXsize[LIST_0], 
                           img->num_ref_idx_l0_active - 1, 
                           currSlice->remapping_of_pic_nums_idc_l0, 
                           currSlice->abs_diff_pic_num_minus1_l0, 
                           currSlice->long_term_pic_idx_l0);
      
		// This is not necessary since order is already poc based...  
      if (img->type == B_SLICE)
      {
        num_ref = img->num_ref_idx_l1_active;
        poc_ref_pic_reorder(listX[LIST_1], 
                            num_ref, 
                            currSlice->remapping_of_pic_nums_idc_l1, 
                            currSlice->abs_diff_pic_num_minus1_l1, 
                            currSlice->long_term_pic_idx_l1, 0, LIST_1);
        
        //reference picture reordering
        reorder_ref_pic_list(listX[LIST_1], &listXsize[LIST_1], 
                             img->num_ref_idx_l1_active - 1, 
                             currSlice->remapping_of_pic_nums_idc_l1, 
                             currSlice->abs_diff_pic_num_minus1_l1, 
                             currSlice->long_term_pic_idx_l1);
      }
    }
  }


  //if (img->MbaffFrameFlag)
  if (img->structure==FRAME)
    init_mbaff_lists();

  if (img->type != I_SLICE && (input->WeightedPrediction == 1 || (input->WeightedBiprediction > 0 && (img->type == B_SLICE))))
  {
  	if (img->type==P_SLICE || img->type==SP_SLICE)
       estimate_weighting_factor_P_slice ();
    else
       estimate_weighting_factor_B_slice ();
  }

  set_ref_pic_num();

  if (img->type == B_SLICE)
    compute_collocated(Co_located, listX);

}


/*!
 ************************************************************************
 * \brief
 *    Allocates a slice structure along with its dependent data structures
 * \return
 *    Pointer to a Slice
 ************************************************************************
 */
static Slice *malloc_slice()
{
  int i;
  DataPartition *dataPart;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91黄视频在线| 色综合久久综合网| 亚洲欧美激情一区二区| 欧美网站一区二区| 国产乱子伦一区二区三区国色天香| 亚洲蜜臀av乱码久久精品蜜桃| 日韩视频一区二区三区在线播放| 成人av影院在线| 免费人成在线不卡| 依依成人精品视频| 国产偷v国产偷v亚洲高清| 欧美撒尿777hd撒尿| jlzzjlzz亚洲女人18| 精品亚洲porn| 亚洲免费av观看| 国产精品国产成人国产三级| 日韩你懂的在线观看| 欧美影片第一页| 波多野结衣在线一区| 韩国视频一区二区| 日本欧美韩国一区三区| 亚洲午夜影视影院在线观看| 中文字幕一区在线| 国产视频一区二区三区在线观看| 日韩亚洲国产中文字幕欧美| 欧美色老头old∨ideo| 91在线观看美女| 成人av电影免费在线播放| 狠狠色狠狠色合久久伊人| 视频在线观看一区二区三区| 亚洲国产精品人人做人人爽| 亚洲欧美经典视频| 亚洲欧美二区三区| 亚洲欧美中日韩| 亚洲国产成人午夜在线一区| 久久精品无码一区二区三区 | 91精品国产综合久久蜜臀| 色欧美片视频在线观看在线视频| 成a人片亚洲日本久久| 国产成人在线视频网站| 国产毛片精品国产一区二区三区| 蜜桃免费网站一区二区三区| 日韩**一区毛片| 免费成人在线影院| 蜜臀91精品一区二区三区| 男人的天堂亚洲一区| 日韩国产欧美在线观看| 日韩激情视频网站| 亚洲不卡一区二区三区| 亚洲国产综合在线| 亚洲不卡av一区二区三区| 天天综合色天天综合| 天天操天天干天天综合网| 午夜电影网一区| 免费视频一区二区| 国产成人久久精品77777最新版本| 国产成人精品亚洲777人妖| 成人精品小蝌蚪| 日本高清不卡在线观看| 欧美日韩免费视频| 精品福利一区二区三区免费视频| 久久久精品影视| 国产精品国产a级| 亚洲一区在线视频| 日韩中文字幕亚洲一区二区va在线 | 水蜜桃久久夜色精品一区的特点| 欧美aa在线视频| 国产99久久久久久免费看农村| a4yy欧美一区二区三区| 精品视频在线看| 精品久久久网站| 国产精品福利在线播放| 亚洲成人午夜影院| 国产麻豆精品视频| 欧洲人成人精品| 精品久久久久久久久久久久包黑料 | 国产喂奶挤奶一区二区三区| 国产精品不卡一区| 偷拍自拍另类欧美| 国产老女人精品毛片久久| 99视频精品在线| 欧美日韩精品三区| 久久精品人人做| 亚洲一级二级三级在线免费观看| 老鸭窝一区二区久久精品| 成人免费av在线| 6080国产精品一区二区| 国产精品私房写真福利视频| 亚洲午夜视频在线观看| 国产高清亚洲一区| 欧美日韩三级一区二区| 国产精品拍天天在线| 日精品一区二区三区| 97久久超碰精品国产| 日韩欧美一二三四区| 一级特黄大欧美久久久| 国产毛片精品视频| 欧美老肥妇做.爰bbww| 亚洲欧美中日韩| 国产乱人伦偷精品视频免下载| 欧美日韩国产免费一区二区| 欧美高清在线精品一区| 美国十次综合导航| 一本大道久久a久久精品综合| 精品盗摄一区二区三区| 亚洲成国产人片在线观看| 成人精品视频一区| 久久综合狠狠综合久久激情| 午夜婷婷国产麻豆精品| 成人黄色在线视频| 精品国产一区二区在线观看| 亚洲高清不卡在线观看| 99久久精品费精品国产一区二区 | 亚洲精品中文字幕乱码三区| 国产馆精品极品| 欧美成人精精品一区二区频| 亚洲成在线观看| 一本到不卡免费一区二区| 久久久久久综合| 蜜桃av一区二区| 欧美日韩精品电影| 一二三四社区欧美黄| av不卡在线播放| 国产精品久久久久影院老司| 国产精品一区二区在线观看不卡| 日韩一级完整毛片| 午夜精品福利在线| 欧美日韩专区在线| 一区二区三区四区在线播放| 一本到不卡免费一区二区| 亚洲人被黑人高潮完整版| av资源站一区| 中国色在线观看另类| 国产不卡免费视频| 国产日本欧洲亚洲| 国产精品影音先锋| 久久久91精品国产一区二区精品 | 国产另类ts人妖一区二区| 精品成a人在线观看| 久久99久久99| 精品国产电影一区二区| 久久机这里只有精品| 欧美xxxx在线观看| 精品无人码麻豆乱码1区2区| 2021国产精品久久精品| 国产一区二区三区黄视频| 久久久久99精品一区| 国产a久久麻豆| 中文字幕日本不卡| 色一情一乱一乱一91av| 一区二区三区美女视频| 欧美日韩一区高清| 日韩综合一区二区| 精品国产乱码久久久久久免费| 国产剧情一区在线| 中文字幕一区二区视频| 日本韩国欧美一区二区三区| 天堂蜜桃91精品| 日韩欧美美女一区二区三区| 国产精品一区二区你懂的| 国产精品美女久久久久久2018| 97久久精品人人做人人爽50路| 亚洲六月丁香色婷婷综合久久| 欧美日韩一区二区在线观看| 经典三级在线一区| 国产精品久久久久9999吃药| 色婷婷亚洲综合| 天堂久久一区二区三区| 国产婷婷色一区二区三区四区 | 亚洲精品国产视频| 91精品国产综合久久香蕉麻豆| 国产乱码字幕精品高清av| 亚洲三级电影网站| 欧美一区二区三区啪啪| 国产高清精品久久久久| 一区二区三区在线播放| 精品国产免费久久 | 99久久久久免费精品国产 | 亚洲国产电影在线观看| 欧美三级资源在线| 国产精品99久久久久久宅男| 亚洲女人小视频在线观看| 日韩一级成人av| eeuss影院一区二区三区| 五月婷婷久久综合| 中文字幕第一页久久| 欧美一区二区三区日韩视频| 99久久婷婷国产| 狠狠色伊人亚洲综合成人| 亚洲在线视频一区| 久久精品视频一区二区三区| 欧美性生活久久| 成人一区二区三区视频在线观看| 亚洲1区2区3区4区| 国产精品成人一区二区艾草| 精品国产污网站| 欧美视频日韩视频在线观看| 成人精品国产一区二区4080| 免费高清在线一区| 亚洲成人在线观看视频|