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

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

?? header.c

?? h264標準的VC實現
?? C
?? 第 1 頁 / 共 2 頁
字號:

/*!
 *************************************************************************************
 * \file header.c
 *
 * \brief
 *    H.264 Slice and Sequence headers
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *      - Stephan Wenger                  <stewe@cs.tu-berlin.de>
 *************************************************************************************
 */

#include <math.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>

#include "global.h"

#include "elements.h"
#include "header.h"
#include "rtp.h"
#include "mbuffer.h"
#include "defines.h"
#include "vlc.h"
#include "parset.h"

// A little trick to avoid those horrible #if TRACE all over the source code
#if TRACE
#define SYMTRACESTRING(s) strncpy(sym->tracestring,s,TRACESTRING_SIZE)
#else
#define SYMTRACESTRING(s) // do nothing
#endif

int * assignSE2partition[2] ;
int assignSE2partition_NoDP[SE_MAX_ELEMENTS] =
  {  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int assignSE2partition_DP[SE_MAX_ELEMENTS] =
  {  0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 2, 2, 2, 2, 0, 0, 0, 0 } ;

static int ref_pic_list_reordering();
static int dec_ref_pic_marking();
static int pred_weight_table();

/*!
 ********************************************************************************************
 * \brief 
 *    Write a slice header
 ********************************************************************************************
*/
int SliceHeader()
{
  int dP_nr = assignSE2partition[input->partition_mode][SE_HEADER];
  DataPartition *partition = &((img->currentSlice)->partArr[dP_nr]);
  Slice* currSlice = img->currentSlice;
  int len = 0;
  unsigned int field_pic_flag = 0, bottom_field_flag = 0;    // POC200301

  int num_bits_slice_group_change_cycle;
  float numtmp;	
	
  if (img->MbaffFrameFlag)
    len  = ue_v("SH: first_mb_in_slice", img->current_mb_nr >> 1,   partition);
  else
    len  = ue_v("SH: first_mb_in_slice", img->current_mb_nr,   partition);

  len += ue_v("SH: slice_type",        get_picture_type (),   partition);

  // Note: Encoder supports only one pic/seq parameter set, hence value is
  // hard coded to zero
//  len += ue_v("SH: pic_parameter_set_id" , 0 ,partition);
  len += ue_v("SH: pic_parameter_set_id" , active_pps->pic_parameter_set_id ,partition);

  // frame_num
//  if(input->no_frames >= 1<<(log2_max_frame_num_minus4+4))
//    error ("Too many frames.  Increase log2_max_frame_num_minus4",-999);  

  len += u_v (log2_max_frame_num_minus4 + 4,"SH: frame_num", img->frame_num, partition);

  if (!active_sps->frame_mbs_only_flag)
  {
    // field_pic_flag    u(1)
    field_pic_flag = (img->structure ==TOP_FIELD || img->structure ==BOTTOM_FIELD)?1:0;
    assert( field_pic_flag == img->fld_flag );
    len += u_1("SH: field_pic_flag", field_pic_flag, partition);

    if (field_pic_flag)
    {
      //bottom_field_flag     u(1)
      bottom_field_flag = (img->structure == BOTTOM_FIELD)?1:0;
      len += u_1("SH: bottom_field_flag" , bottom_field_flag ,partition);
    }
  }

  if (img->currentPicture->idr_flag)
  {
    // idr_pic_id
    // hard coded to zero because we don't have proper IDR handling at the moment
    len += ue_v ("SH: idr_pic_id", 0, partition);
  }

  // POC200301
  if (img->pic_order_cnt_type == 0)
  {
    if (active_sps->frame_mbs_only_flag)
    {
      img->pic_order_cnt_lsb = (img->toppoc & ~((((unsigned int)(-1)) << (log2_max_pic_order_cnt_lsb_minus4+4))) );
    }
    else
    {
      if (!field_pic_flag || img->structure == TOP_FIELD)
        img->pic_order_cnt_lsb = (img->toppoc & ~((((unsigned int)(-1)) << (log2_max_pic_order_cnt_lsb_minus4+4))) );
      else if ( img->structure == BOTTOM_FIELD )
        img->pic_order_cnt_lsb = (img->bottompoc & ~((((unsigned int)(-1)) << (log2_max_pic_order_cnt_lsb_minus4+4))) );
    }

    len += u_v (log2_max_pic_order_cnt_lsb_minus4+4, "SH: pic_order_cnt_lsb", img->pic_order_cnt_lsb, partition);

    if (img->pic_order_present_flag && !field_pic_flag)  // img->fld_flag
    {
      len += se_v ("SH: delta_pic_order_cnt_bottom", img->delta_pic_order_cnt_bottom, partition);
    }
  }
  if (img->pic_order_cnt_type == 1 && !img->delta_pic_order_always_zero_flag)
  {
    len += se_v ("SH: delta_pic_order_cnt[0]", img->delta_pic_order_cnt[0], partition);

    if (img->pic_order_present_flag && !field_pic_flag)  // img->fld_flag
    {
      len += se_v ("SH: delta_pic_order_cnt[1]", img->delta_pic_order_cnt[1], partition);
    }
  }

  // redundant slice info redundant_pic_cnt is missing here
  if (input->redundant_slice_flag)
  {
    len += ue_v ("SH: redundant_pic_cnt", img->redundant_pic_cnt, partition);
  }

  // Direct Mode Type selection for B pictures
  if (img->type==B_SLICE)
  {
    len +=  u_1 ("SH: direct_spatial_mv_pred_flag", img->direct_spatial_mv_pred_flag, partition);  	
  }

  if ((img->type == P_SLICE) || (img->type == B_SLICE) || (img->type==SP_SLICE))
  {
    int override_flag;
    if ((img->type == P_SLICE) || (img->type==SP_SLICE))
    {
      override_flag = (img->num_ref_idx_l0_active != (active_pps->num_ref_idx_l0_active_minus1 +1)) ? 1 : 0;
    }
    else
    {
      override_flag = ((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))) ? 1 : 0;
    }
    // num_ref_idx_active_override_flag here always 1
    len +=  u_1 ("SH: num_ref_idx_active_override_flag", override_flag, partition);
    
    if (override_flag) 
    {
      len += ue_v ("SH: num_ref_idx_l0_active_minus1", img->num_ref_idx_l0_active-1, partition);
      if (img->type==B_SLICE)
      {
        len += ue_v ("SH: num_ref_idx_l1_active_minus1", img->num_ref_idx_l1_active-1, partition);
      }
    }

  }
  len += ref_pic_list_reordering();

  //if (((img->type == P_SLICE || img->type == SP_SLICE) && input->WeightedPrediction) || 
  //   ((img->type == B_SLICE) && input->WeightedBiprediction == 1))
  if (((img->type == P_SLICE || img->type == SP_SLICE) && active_pps->weighted_pred_flag) || 
     ((img->type == B_SLICE) && active_pps->weighted_bipred_idc == 1))  
  {
    len += pred_weight_table();
  }

  if (img->nal_reference_idc)
    len += dec_ref_pic_marking();

  if(input->symbol_mode==CABAC && img->type!=I_SLICE /*&& img->type!=SI_IMG*/)
  {
    len += ue_v("SH: cabac_init_idc", img->model_number, partition);
  }

  // we transmit zero in the pps, so here the real QP
  //len += se_v("SH: slice_qp_delta", (img->qp - 26), partition);
  len += se_v("SH: slice_qp_delta", (currSlice->qp - 26 - active_pps->pic_init_qp_minus26), partition);  

  if (img->type==SP_SLICE /*|| img->type==SI_SLICE*/)
  {
    if (img->type==SP_SLICE) // Switch Flag only for SP pictures
    {
      len += u_1 ("SH: sp_for_switch_flag", 0, partition);   // 1 for switching SP, 0 for normal SP
    }
    len += se_v ("SH: slice_qs_delta", (img->qpsp - 26), partition );
  }
/*
  if (input->LFSendParameters)
  {
    len += ue_v("SH: disable_deblocking_filter_idc",input->LFDisableIdc, partition);  // Turn loop filter on/off on slice basis 

    if (input->LFDisableIdc!=1)
    {
      len += se_v ("SH: slice_alpha_c0_offset_div2", input->LFAlphaC0Offset / 2, partition);

      len += se_v ("SH: slice_beta_offset_div2", input->LFBetaOffset / 2, partition);
    }
  }
*/
  if (active_pps->deblocking_filter_control_present_flag)
  {
    len += ue_v("SH: disable_deblocking_filter_idc",img->LFDisableIdc, partition);  // Turn loop filter on/off on slice basis 

    if (img->LFDisableIdc!=1)
    {
      len += se_v ("SH: slice_alpha_c0_offset_div2", img->LFAlphaC0Offset / 2, partition);

      len += se_v ("SH: slice_beta_offset_div2", img->LFBetaOffset / 2, partition);
    }
  }

	
  if ( active_pps->num_slice_groups_minus1>0 &&
    active_pps->slice_group_map_type>=3 && active_pps->slice_group_map_type<=5)
  {
    numtmp=img->PicHeightInMapUnits*img->PicWidthInMbs/(float)(active_pps->slice_group_change_rate_minus1+1)+1;
    num_bits_slice_group_change_cycle = (int)ceil(log(numtmp)/log(2));

    //! img->slice_group_change_cycle can be changed before calling FmoInit()
    len += u_v (num_bits_slice_group_change_cycle, "SH: slice_group_change_cycle", img->slice_group_change_cycle, partition);
  }

  // NOTE: The following syntax element is actually part 
  //        Slice data partition A RBSP syntax

  if(input->partition_mode&&!img->currentPicture->idr_flag)
  {
    len += ue_v("DPA: slice_id", img->current_slice_nr, partition);
  }

  return len;
}

/*!
 ********************************************************************************************
 * \brief 
 *    writes the ref_pic_list_reordering syntax
 *    based on content of according fields in img structure
 *
 * \return
 *    number of bits used 
 ********************************************************************************************
*/
static int ref_pic_list_reordering()
{
  int dP_nr = assignSE2partition[input->partition_mode][SE_HEADER];
  DataPartition *partition = &((img->currentSlice)->partArr[dP_nr]);
  Slice *currSlice = img->currentSlice;

  int i, len=0;

  if ((img->type!=I_SLICE) /*&&(img->type!=SI_IMG)*/ )
  {
    len += u_1 ("SH: ref_pic_list_reordering_flag_l0", currSlice->ref_pic_list_reordering_flag_l0, partition);
    if (currSlice->ref_pic_list_reordering_flag_l0)
    {
      i=-1;
      do
      {
        i++;
        len += ue_v ("SH: remapping_of_pic_num_idc", currSlice->remapping_of_pic_nums_idc_l0[i], partition);
        if (currSlice->remapping_of_pic_nums_idc_l0[i]==0 ||
            currSlice->remapping_of_pic_nums_idc_l0[i]==1)
        {
          len += ue_v ("SH: abs_diff_pic_num_minus1_l0", currSlice->abs_diff_pic_num_minus1_l0[i], partition);
        }
        else
        {
          if (currSlice->remapping_of_pic_nums_idc_l0[i]==2)
          {
            len += ue_v ("SH: long_term_pic_idx_l0", currSlice->long_term_pic_idx_l0[i], partition);
          }
        }

      } while (currSlice->remapping_of_pic_nums_idc_l0[i] != 3);
    }
  }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品水蜜桃av综合天堂| 欧美亚男人的天堂| 欧美精品一区二区三区四区| 久久精品久久99精品久久| 日韩精品一区二区三区在线观看| 免费日韩伦理电影| 久久精品免费在线观看| 99久久综合狠狠综合久久| 亚洲免费观看在线视频| 欧美性生交片4| 久久狠狠亚洲综合| 国产精品视频一二三区| 欧美怡红院视频| 奇米影视在线99精品| 久久久亚洲高清| 91免费看视频| 视频一区二区三区在线| 欧美mv日韩mv亚洲| 成人av电影观看| 午夜精品福利一区二区蜜股av | 国产成a人亚洲| 日韩一区在线看| 91麻豆精品国产91久久久久| 国产精品一区久久久久| 亚洲另类在线视频| 日韩亚洲欧美在线| bt欧美亚洲午夜电影天堂| 亚洲v精品v日韩v欧美v专区| 久久久久久久久蜜桃| 欧洲一区在线观看| 国产呦精品一区二区三区网站| 国产精品初高中害羞小美女文| 欧美色图12p| 国产成人无遮挡在线视频| 亚洲最新在线观看| 国产亚洲精品资源在线26u| 欧美日本乱大交xxxxx| 国产99精品国产| 免费成人在线视频观看| 亚洲色图欧洲色图| 精品国产凹凸成av人网站| 一本一道综合狠狠老| 精品一二线国产| 亚洲国产日韩在线一区模特| 国产欧美一区二区三区鸳鸯浴| 精品视频在线视频| av不卡免费在线观看| 久久99热狠狠色一区二区| 亚洲精品免费播放| 亚洲国产高清在线| 欧美成va人片在线观看| 欧美三级中文字幕| 一本高清dvd不卡在线观看 | 一区二区三区欧美久久| 久久久影院官网| 91精品国产乱| 欧美日韩dvd在线观看| 色拍拍在线精品视频8848| 国产iv一区二区三区| 精品一区二区免费在线观看| 亚洲午夜激情av| 樱桃视频在线观看一区| 国产精品久久久久婷婷二区次| 欧美tickle裸体挠脚心vk| 91精品国产欧美一区二区成人| 欧美在线视频你懂得| 色悠久久久久综合欧美99| k8久久久一区二区三区| 国产风韵犹存在线视精品| 精品一区二区三区的国产在线播放 | 中日韩av电影| 国产亚洲va综合人人澡精品| 日韩免费电影一区| 欧美精品一区二区三区一线天视频 | 日韩国产高清影视| 午夜精彩视频在线观看不卡| 亚洲国产精品久久人人爱| 一区二区三区日韩精品视频| 一区二区国产盗摄色噜噜| 一区二区三区日韩| 亚洲电影视频在线| 日韩av网站在线观看| 婷婷夜色潮精品综合在线| 午夜精品免费在线| 午夜精品福利在线| 欧美a级一区二区| 久久99精品国产麻豆婷婷洗澡| 激情六月婷婷久久| 国产高清不卡二三区| 国产成人99久久亚洲综合精品| 成人黄色一级视频| 99久久精品情趣| 欧美自拍丝袜亚洲| 91麻豆精品国产无毒不卡在线观看| 欧美理论片在线| 日韩免费视频线观看| 国产欧美一区二区三区在线看蜜臀| 国产精品久久久一本精品| 亚洲女与黑人做爰| 首页欧美精品中文字幕| 久久99精品久久只有精品| 国产一区二区三区香蕉 | 九九视频精品免费| 国产成人免费在线观看不卡| 91视频你懂的| 欧美片在线播放| 国产免费成人在线视频| 亚洲欧美日韩国产成人精品影院 | 久久超碰97中文字幕| 国产精品影视在线观看| 91影院在线观看| 在线成人免费观看| 亚洲国产激情av| 亚洲gay无套男同| 国产成人激情av| 欧美午夜宅男影院| 久久精品欧美一区二区三区不卡 | 亚洲成精国产精品女| 韩国av一区二区三区在线观看| 99久精品国产| 日韩一区二区三区免费看 | 国产午夜亚洲精品不卡| 亚洲欧美aⅴ...| 国产美女av一区二区三区| 色婷婷一区二区| 精品日韩一区二区三区免费视频| 中文字幕一区不卡| 久久97超碰国产精品超碰| 91久久一区二区| 中文字幕电影一区| 蜜臀av性久久久久av蜜臀妖精| 97se亚洲国产综合自在线不卡| 精品少妇一区二区三区在线播放 | 极品少妇xxxx精品少妇| 色www精品视频在线观看| 久久综合九色综合欧美就去吻| 亚洲一区在线视频观看| 国产一区二区免费看| 欧美日韩成人综合天天影院 | 亚洲高清免费观看| 成a人片国产精品| 欧美va亚洲va在线观看蝴蝶网| 亚洲影视在线观看| 99久久精品久久久久久清纯| 日韩久久久久久| 亚洲国产aⅴ成人精品无吗| 成人av动漫网站| 国产校园另类小说区| 美腿丝袜在线亚洲一区| 欧美视频在线不卡| 亚洲男人天堂一区| 成人在线一区二区三区| 久久婷婷成人综合色| 日本欧美一区二区| 欧美人与禽zozo性伦| 亚洲综合图片区| 在线精品国精品国产尤物884a| 国产精品麻豆一区二区 | 麻豆高清免费国产一区| 欧美日韩视频专区在线播放| 亚洲精品视频在线观看网站| 成人精品gif动图一区| 欧美高清在线一区二区| 国产乱子伦视频一区二区三区| 精品国产99国产精品| 精品一区二区在线视频| 日韩女优电影在线观看| 精品一区二区三区在线观看国产| 日韩欧美国产一区二区在线播放| 日韩精品1区2区3区| 5566中文字幕一区二区电影| 亚洲成人7777| 欧美日韩国产片| 亚洲超碰精品一区二区| 欧美日本国产视频| 蜜桃一区二区三区在线观看| 精品国产伦一区二区三区免费 | 制服丝袜亚洲播放| 日韩不卡一区二区三区| 日韩欧美专区在线| 狠狠色丁香久久婷婷综合_中| 国产亚洲欧美日韩俺去了| 成人国产亚洲欧美成人综合网| 国产精品国产三级国产专播品爱网| 91麻豆国产在线观看| 亚洲一区二区欧美激情| 欧美一级在线观看| 九九在线精品视频| 国产精品女主播av| 欧美在线视频全部完| 免费日本视频一区| 国产色产综合色产在线视频| 99精品国产一区二区三区不卡| 亚洲精品成人少妇| 717成人午夜免费福利电影| 九色综合狠狠综合久久| 国产精品国产自产拍高清av| 91国偷自产一区二区三区观看| 日韩电影免费在线| 欧美国产视频在线|