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

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

?? header.c

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

/*!
 *************************************************************************************
 * \file header.c
 *
 * \brief
 *    H.264 Slice headers
 *
 *************************************************************************************
 */

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

#include "global.h"
#include "elements.h"
#include "defines.h"
#include "fmo.h"
#include "vlc.h"
#include "mbuffer.h"
#include "header.h"

#include "ctx_tables.h"

extern StorablePicture *dec_picture;

#if TRACE
#define SYMTRACESTRING(s) strncpy(sym.tracestring,s,TRACESTRING_SIZE)
#else
#define SYMTRACESTRING(s) // to nothing
#endif

extern int UsedBits;

static void ref_pic_list_reordering();
static void pred_weight_table();


/*!
 ************************************************************************
 * \brief
 *    calculate Ceil(Log2(uiVal))
 ************************************************************************
 */
unsigned CeilLog2( unsigned uiVal)
{
  unsigned uiTmp = uiVal-1;
  unsigned uiRet = 0;

  while( uiTmp != 0 )
  {
    uiTmp >>= 1;
    uiRet++;
  }
  return uiRet;
}


/*!
 ************************************************************************
 * \brief
 *    read the first part of the header (only the pic_parameter_set_id)
 * \return
 *    Length of the first part of the slice header (in bits)
 ************************************************************************
 */
int FirstPartOfSliceHeader()
{
  Slice *currSlice = img->currentSlice;
  int dP_nr = assignSE2partition[currSlice->dp_mode][SE_HEADER];
  DataPartition *partition = &(currSlice->partArr[dP_nr]);
  Bitstream *currStream = partition->bitstream;
  int tmp;

  UsedBits= partition->bitstream->frame_bitoffset; // was hardcoded to 31 for previous start-code. This is better.

  // Get first_mb_in_slice
  currSlice->start_mb_nr = ue_v ("SH: first_mb_in_slice", currStream);

  tmp = ue_v ("SH: slice_type", currStream);
  
  if (tmp>4) tmp -=5;

  img->type = currSlice->picture_type = (SliceType) tmp;

  currSlice->pic_parameter_set_id = ue_v ("SH: pic_parameter_set_id", currStream);
  
  return UsedBits;
}

/*!
 ************************************************************************
 * \brief
 *    read the scond part of the header (without the pic_parameter_set_id 
 * \return
 *    Length of the second part of the Slice header in bits
 ************************************************************************
 */
int RestOfSliceHeader()
{
  Slice *currSlice = img->currentSlice;
  int dP_nr = assignSE2partition[currSlice->dp_mode][SE_HEADER];
  DataPartition *partition = &(currSlice->partArr[dP_nr]);
  Bitstream *currStream = partition->bitstream;

  int val, len;

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

  /* Tian Dong: frame_num gap processing, if found */
  if (img->idr_flag)
  {
    img->pre_frame_num = img->frame_num;
    assert(img->frame_num == 0);
  }

  if (active_sps->frame_mbs_only_flag)
  {
    img->structure = FRAME;
    img->field_pic_flag=0;
  }
  else
  {
    // field_pic_flag   u(1)
    img->field_pic_flag = u_1("SH: field_pic_flag", currStream);
    if (img->field_pic_flag)
    {
      // bottom_field_flag  u(1)
      img->bottom_field_flag = u_1("SH: bottom_field_flag", currStream);

      img->structure = img->bottom_field_flag ? BOTTOM_FIELD : TOP_FIELD;
    }
    else
    {
      img->structure = FRAME;
      img->bottom_field_flag=0;
    }
  }

  currSlice->structure = img->structure;

  img->MbaffFrameFlag=(active_sps->mb_adaptive_frame_field_flag && (img->field_pic_flag==0));

  if (img->structure == FRAME       ) assert (img->field_pic_flag == 0);
  if (img->structure == TOP_FIELD   ) assert (img->field_pic_flag == 1 && img->bottom_field_flag == 0);
  if (img->structure == BOTTOM_FIELD) assert (img->field_pic_flag == 1 && img->bottom_field_flag == 1);

  if (img->idr_flag)
  {
    img->idr_pic_id = ue_v("SH: idr_pic_id", currStream);
  }

  if (active_sps->pic_order_cnt_type == 0)
  {
    img->pic_order_cnt_lsb = u_v(active_sps->log2_max_pic_order_cnt_lsb_minus4 + 4, "SH: pic_order_cnt_lsb", currStream);
    if( active_pps->pic_order_present_flag  ==  1 &&  !img->field_pic_flag )
      img->delta_pic_order_cnt_bottom = se_v("SH: delta_pic_order_cnt_bottom", currStream);
    else
      img->delta_pic_order_cnt_bottom = 0;  
  }
  if( active_sps->pic_order_cnt_type == 1 && !active_sps->delta_pic_order_always_zero_flag ) 
  {
    img->delta_pic_order_cnt[ 0 ] = se_v("SH: delta_pic_order_cnt[0]", currStream);
    if( active_pps->pic_order_present_flag  ==  1  &&  !img->field_pic_flag )
      img->delta_pic_order_cnt[ 1 ] = se_v("SH: delta_pic_order_cnt[1]", currStream);
  }else
  {
    if (active_sps->pic_order_cnt_type == 1)
    {
      img->delta_pic_order_cnt[ 0 ] = 0;
      img->delta_pic_order_cnt[ 1 ] = 0;
    }
  }
  
  //! redundant_pic_cnt is missing here
  if (active_pps->redundant_pic_cnt_present_flag)
  {
    img->redundant_pic_cnt = ue_v ("SH: redundant_pic_cnt", currStream);
  }

  if(img->type==B_SLICE)
  {
    img->direct_spatial_mv_pred_flag = u_1 ("SH: direct_spatial_mv_pred_flag", currStream);
  }

  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;

  if(img->type==P_SLICE || img->type == SP_SLICE || img->type==B_SLICE)
  {
    val = u_1 ("SH: num_ref_idx_override_flag", currStream);
    if (val)
    {
      img->num_ref_idx_l0_active = 1 + ue_v ("SH: num_ref_idx_l0_active_minus1", currStream);
      
      if(img->type==B_SLICE)
      {
        img->num_ref_idx_l1_active = 1 + ue_v ("SH: num_ref_idx_l1_active_minus1", currStream);
      }
    }
  }
  if (img->type!=B_SLICE)
  {
    img->num_ref_idx_l1_active = 0;
  }

  ref_pic_list_reordering();

  img->apply_weights = ((active_pps->weighted_pred_flag && (currSlice->picture_type == P_SLICE || currSlice->picture_type == SP_SLICE) )
          || ((active_pps->weighted_bipred_idc > 0 ) && (currSlice->picture_type == B_SLICE)));

  if ((active_pps->weighted_pred_flag&&(img->type==P_SLICE|| img->type == SP_SLICE))||
      (active_pps->weighted_bipred_idc==1 && (img->type==B_SLICE)))
  {
    pred_weight_table();
  }

  if (img->nal_reference_idc)
    dec_ref_pic_marking(currStream);

  if (active_pps->entropy_coding_mode_flag && img->type!=I_SLICE && img->type!=SI_SLICE)
  {
    img->model_number = ue_v("SH: cabac_init_idc", currStream);
  }
  else 
  {
    img->model_number = 0;
  }

  val = se_v("SH: slice_qp_delta", currStream);
  currSlice->qp = img->qp = 26 + active_pps->pic_init_qp_minus26 + val;

  
  currSlice->slice_qp_delta = val;  

  if(img->type==SP_SLICE || img->type == SI_SLICE) 
  {
    if(img->type==SP_SLICE)
    {
      img->sp_switch = u_1 ("SH: sp_for_switch_flag", currStream);
    }
    val = se_v("SH: slice_qs_delta", currStream);
    img->qpsp = 26 + active_pps->pic_init_qs_minus26 + val;
  }

  if (active_pps->deblocking_filter_control_present_flag)
  {
    currSlice->LFDisableIdc = ue_v ("SH: disable_deblocking_filter_idc", currStream);

    if (currSlice->LFDisableIdc!=1)
    {
      currSlice->LFAlphaC0Offset = 2 * se_v("SH: slice_alpha_c0_offset_div2", currStream);
      currSlice->LFBetaOffset = 2 * se_v("SH: slice_beta_offset_div2", currStream);
    }
    else
    {
      currSlice->LFAlphaC0Offset = currSlice->LFBetaOffset = 0;
    }
  }
  else 
  {
    currSlice->LFDisableIdc = currSlice->LFAlphaC0Offset = currSlice->LFBetaOffset = 0;
  }

  if (active_pps->num_slice_groups_minus1>0 && active_pps->slice_group_map_type>=3 &&
      active_pps->slice_group_map_type<=5)
  {
    len = (active_sps->pic_height_in_map_units_minus1+1)*(active_sps->pic_width_in_mbs_minus1+1)/ 
          (active_pps->slice_group_change_rate_minus1+1);
    if (((active_sps->pic_height_in_map_units_minus1+1)*(active_sps->pic_width_in_mbs_minus1+1))% 
          (active_pps->slice_group_change_rate_minus1+1))
          len +=1;

    len = CeilLog2(len+1);

    img->slice_group_change_cycle = u_v (len, "SH: slice_group_change_cycle", currStream);
  }
  img->PicHeightInMbs = img->FrameHeightInMbs / ( 1 + img->field_pic_flag );
  img->PicSizeInMbs   = img->PicWidthInMbs * img->PicHeightInMbs;
  img->FrameSizeInMbs = img->PicWidthInMbs * img->FrameHeightInMbs;

  return UsedBits;
}


/*!
 ************************************************************************
 * \brief
 *    read the reference picture reordering information
 ************************************************************************
 */
static void ref_pic_list_reordering()
{
  Slice *currSlice = img->currentSlice;
  int dP_nr = assignSE2partition[currSlice->dp_mode][SE_HEADER];
  DataPartition *partition = &(currSlice->partArr[dP_nr]);
  Bitstream *currStream = partition->bitstream;
  int i, val;

  alloc_ref_pic_list_reordering_buffer(currSlice);
  
  if (img->type!=I_SLICE && img->type!=SI_SLICE)
  {
    val = currSlice->ref_pic_list_reordering_flag_l0 = u_1 ("SH: ref_pic_list_reordering_flag_l0", currStream);
    
    if (val)
    {
      i=0;
      do
      {
        val = currSlice->remapping_of_pic_nums_idc_l0[i] = ue_v("SH: remapping_of_pic_nums_idc_l0", currStream);
        if (val==0 || val==1)
        {
          currSlice->abs_diff_pic_num_minus1_l0[i] = ue_v("SH: abs_diff_pic_num_minus1_l0", currStream);
        }
        else
        {
          if (val==2)
          {
            currSlice->long_term_pic_idx_l0[i] = ue_v("SH: long_term_pic_idx_l0", currStream);
          }
        }
        i++;
        // assert (i>img->num_ref_idx_l0_active);
      } while (val != 3);
    }
  }

  if (img->type==B_SLICE)
  {
    val = currSlice->ref_pic_list_reordering_flag_l1 = u_1 ("SH: ref_pic_list_reordering_flag_l1", currStream);
    
    if (val)
    {
      i=0;
      do
      {
        val = currSlice->remapping_of_pic_nums_idc_l1[i] = ue_v("SH: remapping_of_pic_nums_idc_l1", currStream);
        if (val==0 || val==1)
        {
          currSlice->abs_diff_pic_num_minus1_l1[i] = ue_v("SH: abs_diff_pic_num_minus1_l1", currStream);
        }
        else
        {
          if (val==2)
          {
            currSlice->long_term_pic_idx_l1[i] = ue_v("SH: long_term_pic_idx_l1", currStream);
          }
        }
        i++;
        // assert (i>img->num_ref_idx_l1_active);
      } while (val != 3);
    }
  }
}

/*!
 ************************************************************************
 * \brief
 *    read the weighted prediction tables
 ************************************************************************
 */
static void pred_weight_table()
{
  Slice *currSlice = img->currentSlice;
  int dP_nr = assignSE2partition[currSlice->dp_mode][SE_HEADER];
  DataPartition *partition = &(currSlice->partArr[dP_nr]);
  Bitstream *currStream = partition->bitstream;
  int luma_weight_flag_l0, luma_weight_flag_l1, chroma_weight_flag_l0, chroma_weight_flag_l1;
  int i,j;

  img->luma_log2_weight_denom = ue_v ("SH: luma_log2_weight_denom", currStream);
  img->wp_round_luma = img->luma_log2_weight_denom ? 1<<(img->luma_log2_weight_denom - 1): 0;
  
  img->chroma_log2_weight_denom = ue_v ("SH: chroma_log2_weight_denom", currStream);
  img->wp_round_chroma = img->chroma_log2_weight_denom ? 1<<(img->chroma_log2_weight_denom - 1): 0;

  reset_wp_params(img);

  for (i=0; i<img->num_ref_idx_l0_active; i++)
  {
    luma_weight_flag_l0 = u_1("SH: luma_weight_flag_l0", currStream);
    
    if (luma_weight_flag_l0)
    {
      img->wp_weight[0][i][0] = se_v ("SH: luma_weight_l0", currStream);
      img->wp_offset[0][i][0] = se_v ("SH: luma_offset_l0", currStream);
    }
    else
    {
      img->wp_weight[0][i][0] = 1<<img->luma_log2_weight_denom;
      img->wp_offset[0][i][0] = 0;
    }
    
    chroma_weight_flag_l0 = u_1 ("SH: chroma_weight_flag_l0", currStream);
    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一区二区三区四区| 亚洲青青青在线视频| 91色综合久久久久婷婷| 国产精品一二三区| 国产91精品久久久久久久网曝门| 成人激情动漫在线观看| 日韩高清不卡在线| 天天色图综合网| 蜜臂av日日欢夜夜爽一区| 久久国产夜色精品鲁鲁99| 国产一区在线观看视频| 成人网在线播放| 91美女片黄在线| 欧美色图片你懂的| 欧美成人女星排行榜| 久久九九久久九九| 一区二区三区四区视频精品免费| 91搞黄在线观看| 欧美精品久久一区| www国产亚洲精品久久麻豆| 国产欧美日韩综合| 一区二区三区小说| 免费精品99久久国产综合精品| 欧美v国产在线一区二区三区| 国产大陆精品国产| 石原莉奈在线亚洲三区| 精品国产免费视频| 国产精品福利一区二区| 亚洲二区在线视频| 亚洲国产美国国产综合一区二区| 91丨porny丨国产入口| 91色婷婷久久久久合中文| 91精品欧美一区二区三区综合在 | 欧美日韩在线精品一区二区三区激情| 亚洲激情网站免费观看| 美女脱光内衣内裤视频久久影院| 一色桃子久久精品亚洲| 午夜久久久久久久久| 激情国产一区二区| 欧美性大战xxxxx久久久| 欧美一区二区视频在线观看2020 | 亚洲嫩草精品久久| 麻豆成人av在线| 色诱亚洲精品久久久久久| 精品成人在线观看| 亚洲va国产va欧美va观看| 成人av网站在线| 精品日本一线二线三线不卡| 一区二区日韩电影| 日韩精品在线看片z| 亚洲女与黑人做爰| 日本不卡一区二区三区| 日本乱码高清不卡字幕| 国产欧美精品国产国产专区| 久久精品国产亚洲aⅴ| 欧美日韩视频在线第一区| 中文字幕在线不卡| 国产成人综合亚洲网站| 91精品婷婷国产综合久久性色| 欧美唯美清纯偷拍| 亚洲免费观看高清在线观看| 成人av一区二区三区| 久久久久久夜精品精品免费| 老司机精品视频在线| 欧美一区二区视频在线观看 | 日韩精品电影一区亚洲| 色94色欧美sute亚洲线路二| 久久精品一区二区三区不卡| 美日韩一区二区| 欧美欧美欧美欧美| 水野朝阳av一区二区三区| 欧美日韩一区高清| 亚洲福利电影网| 欧美群妇大交群中文字幕| 亚洲成人激情社区| 欧美四级电影网| 亚洲成年人影院| 欧美久久一二三四区| 亚洲欧美偷拍三级| 亚洲mv大片欧洲mv大片精品| 欧美性大战久久久久久久蜜臀| 精品视频1区2区| 亚洲成人自拍网| 6080国产精品一区二区| 午夜精品久久久久久久99樱桃| 奇米四色…亚洲| 日韩免费电影一区| 久久99热99| 亚洲国产精品ⅴa在线观看| 成人午夜在线免费| 一区二区三区久久久| 91传媒视频在线播放| 婷婷成人激情在线网| 精品国产网站在线观看| 国产精品自在欧美一区| 中文字幕一区二区三区精华液| 一个色在线综合| 6080日韩午夜伦伦午夜伦| 国产一区二区看久久| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 夜色激情一区二区| 欧美日韩一区国产| 国产综合一区二区| 一色屋精品亚洲香蕉网站| 欧美日韩国产综合久久| 国产在线播放一区三区四| 亚洲视频资源在线| 日韩欧美成人激情| av亚洲精华国产精华| 欧美性生活一区| 久久精品国产网站| 亚洲精品日产精品乱码不卡| 日韩欧美在线网站| 色综合色狠狠综合色| 九色综合狠狠综合久久| 亚洲美女免费视频| 国产欧美视频在线观看| 777奇米四色成人影色区| 波多野结衣欧美| 久久99精品视频| 亚洲国产精品精华液网站| 国产精品美女久久久久aⅴ| 欧美丰满美乳xxx高潮www| aaa国产一区| 国产经典欧美精品| 久久精品国产第一区二区三区| 91色综合久久久久婷婷| 久久精品久久综合| 成人欧美一区二区三区黑人麻豆| 成人黄色777网| 久久电影网电视剧免费观看| 亚洲国产日韩一区二区| 国产精品白丝在线| 亚洲精品在线三区| 欧美一区日本一区韩国一区| 色吧成人激情小说| 97aⅴ精品视频一二三区| 国产99久久久久久免费看农村| 欧美激情一区二区三区四区| 欧美一区二区视频网站| 91高清视频免费看| 91蝌蚪porny九色| 成人蜜臀av电影| 国产91精品免费| 国产亚洲欧美一级| 久久精品亚洲麻豆av一区二区| 日本不卡一区二区三区高清视频| 日韩一区二区麻豆国产| 欧美群妇大交群的观看方式| 欧美一a一片一级一片| 色狠狠av一区二区三区| 日本道精品一区二区三区| 91蜜桃网址入口| 欧美综合一区二区| 在线观看视频一区二区| 99久久伊人精品| 91尤物视频在线观看| 91亚洲精品久久久蜜桃网站| 色吊一区二区三区| 欧美精品高清视频| 日韩欧美国产三级电影视频| 亚洲精品在线电影| 欧美国产日韩一二三区| 亚洲欧洲国产日韩| 亚洲第一主播视频| 蜜臀久久久久久久| 经典一区二区三区| 成人精品小蝌蚪| 欧美午夜精品久久久久久超碰| 国产精品三级av在线播放| 国产精品进线69影院| 中文一区二区在线观看| 亚洲嫩草精品久久| 视频一区视频二区中文字幕| 奇米888四色在线精品| 国产美女视频91| 91丨九色丨蝌蚪丨老版| 欧美怡红院视频| 欧美精品一区二区三区蜜臀| 国产精品久久久一本精品 | 免费在线看一区| 亚洲高清免费视频| 国产在线国偷精品免费看| 99久久久久久99| 欧美区在线观看| 国产片一区二区三区| 一区av在线播放| 国产一区二区三区av电影 | 精品久久久久久久一区二区蜜臀| 成人精品视频.| 91精品婷婷国产综合久久竹菊| 99国产精品久| 日韩一区二区在线观看| 最新日韩av在线| 国产一区二区在线观看免费| 欧美午夜寂寞影院| 国产欧美日韩精品在线| 亚洲国产精品久久一线不卡| 高清国产一区二区| 欧美成人精精品一区二区频|