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

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

?? header.c

?? H264解碼器,本解碼器實現(xiàn)了圖像的264解碼
?? 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_type = 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;

  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);
    
    for (j=1; j<3; j++)
    {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲愉拍自拍另类高清精品| av网站免费线看精品| 欧美日韩一级二级三级| 亚洲高清免费在线| 色中色一区二区| 亚洲国产视频一区| 欧美日本高清视频在线观看| 婷婷国产v国产偷v亚洲高清| 欧美一区二区三区四区久久| 久久99精品国产麻豆不卡| 久久久精品免费网站| 国产成人av资源| 亚洲欧美日韩久久| 欧美乱妇23p| 国产乱码精品一区二区三区av| 久久这里都是精品| 91丨九色porny丨蝌蚪| 偷拍与自拍一区| 久久精品欧美一区二区三区不卡| 高清shemale亚洲人妖| 自拍偷在线精品自拍偷无码专区| 91久久精品一区二区| 亚洲午夜久久久久久久久久久| 91精品久久久久久蜜臀| 国产一区美女在线| 亚洲欧美一区二区久久| 成人综合激情网| 亚洲午夜羞羞片| 精品国产乱码久久久久久影片| 国产成人av影院| 一区二区三区欧美日| 日韩三级电影网址| 99精品一区二区| 日本va欧美va欧美va精品| 日本一区二区三区国色天香 | 欧美亚洲综合久久| 精品一区二区三区欧美| 日韩美女啊v在线免费观看| 91精品国产高清一区二区三区| 懂色av中文字幕一区二区三区| 亚洲成av人影院在线观看网| 久久精品亚洲一区二区三区浴池| 91国在线观看| 国产成人av电影在线| 欧美一区二区三区在| 亚洲日本丝袜连裤袜办公室| 成人做爰69片免费看网站| 欧美电视剧在线观看完整版| 久久国产尿小便嘘嘘尿| 欧美亚洲国产一区二区三区va| 日韩美一区二区三区| 亚洲欧美视频在线观看| 国产成人8x视频一区二区| 久久精品亚洲乱码伦伦中文| 一本久久精品一区二区| 91免费国产在线| 国产精品乱子久久久久| 91精品午夜视频| 91丨porny丨国产入口| 国产成人aaaa| 国产成人精品一区二| 另类调教123区| 日韩理论片在线| 日韩视频免费直播| 激情深爱一区二区| 极品美女销魂一区二区三区 | 免费精品视频在线| 一区二区三区四区高清精品免费观看 | 97久久超碰国产精品电影| 狠狠色丁香婷婷综合| 亚洲人吸女人奶水| 2017欧美狠狠色| 成人精品国产免费网站| 国产乱码一区二区三区| 午夜精品一区在线观看| 国产视频视频一区| 欧美手机在线视频| 狠狠色丁香久久婷婷综合_中| 久久超碰97人人做人人爱| 亚洲欧洲av另类| 久久综合九色综合欧美亚洲| 欧美午夜寂寞影院| 欧美精品乱人伦久久久久久| 懂色av一区二区三区蜜臀| 午夜成人免费视频| 欧美激情中文字幕一区二区| 色综合夜色一区| 成人午夜免费av| 蜜桃视频在线一区| 一区二区在线观看av| 69堂亚洲精品首页| 欧美成人官网二区| 欧美日韩国产不卡| 91麻豆精东视频| 精品一区二区久久久| 国产精品12区| 日本va欧美va瓶| 一区二区三区在线影院| 欧美午夜电影网| 精品国产一区久久| 欧美日韩高清一区| 成人综合婷婷国产精品久久蜜臀| 综合久久国产九一剧情麻豆| 亚洲精品美国一| 亚洲人精品午夜| 国产精品午夜春色av| 99re8在线精品视频免费播放| 精品视频全国免费看| 日本韩国精品在线| 欧美在线综合视频| av一区二区三区四区| 4438成人网| 欧美高清视频在线高清观看mv色露露十八| 91在线播放网址| 成人免费观看视频| 91精品国产丝袜白色高跟鞋| 91精品国产综合久久精品| 欧美日韩精品电影| 色妞www精品视频| 色综合久久综合网欧美综合网| 成人免费看视频| 91在线观看免费视频| 国产剧情一区二区| 国产在线一区二区综合免费视频| 激情国产一区二区| 国产99久久久国产精品潘金| 色网站国产精品| 欧美巨大另类极品videosbest| 精品视频全国免费看| 日韩一卡二卡三卡国产欧美| 亚洲少妇中出一区| 亚洲成人免费电影| 丝袜a∨在线一区二区三区不卡| 国产欧美精品国产国产专区| 日韩成人午夜电影| 九九**精品视频免费播放| 丁香亚洲综合激情啪啪综合| 国产精品一区二区三区四区 | 欧美日韩综合色| 欧美日韩精品系列| 国产精品一级黄| 成人国产电影网| 久久精品99久久久| 韩国一区二区三区| 99久久精品99国产精品| 日韩国产欧美在线播放| 黄色精品一二区| 色婷婷狠狠综合| 精品欧美乱码久久久久久1区2区| 精品少妇一区二区| 国产精品的网站| 日本成人在线网站| 亚洲一区二区美女| 国产成人av自拍| 日韩视频在线观看一区二区| 久久久久久久久蜜桃| 亚洲chinese男男1069| 国产一区999| 91网站黄www| 99久久亚洲一区二区三区青草| 欧美一区二区三区四区在线观看 | 亚洲国产综合人成综合网站| 亚洲成人一二三| www.亚洲色图.com| 色综合 综合色| 97se狠狠狠综合亚洲狠狠| 国产一区二区不卡| 日韩精品一区二区三区四区| 亚洲欧洲av一区二区三区久久| 欧美国产成人在线| 午夜视频一区二区| 国产成人8x视频一区二区| 欧美色老头old∨ideo| 91精品国产高清一区二区三区蜜臀 | 国产在线观看一区二区| 欧美夫妻性生活| 香蕉久久一区二区不卡无毒影院| 麻豆中文一区二区| 欧美日韩五月天| 偷窥少妇高潮呻吟av久久免费| 国产精品亚洲а∨天堂免在线| 日韩精品一区二区在线| 欧美大黄免费观看| 欧美高清视频在线高清观看mv色露露十八 | 中文字幕亚洲一区二区av在线| 秋霞国产午夜精品免费视频| 国产美女视频91| 欧美久久一二三四区| 亚洲欧洲在线观看av| 久久99在线观看| 91精品国产综合久久福利| 精品一区二区三区在线播放| 欧美日韩成人一区二区| 国产精品久久一级| 国产精品91一区二区| 亚洲欧美日韩国产综合在线| 亚洲美女区一区| 国产成人综合亚洲网站| 久久久国际精品| 国产精品美女久久福利网站|