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

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

?? header.c

?? H264解碼器,本解碼器實現了圖像的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一区二区三区免费野_久草精品视频
亚洲综合丁香婷婷六月香| 激情综合亚洲精品| 国产精品视频免费看| 精品美女被调教视频大全网站| 在线观看成人小视频| 成人高清免费在线播放| 国产精品88888| 国产一区二区不卡在线| 看国产成人h片视频| 日韩国产高清影视| 日日欢夜夜爽一区| 日日夜夜免费精品| 蜜桃视频一区二区| 免费成人小视频| 精品一区二区在线播放| 九九国产精品视频| 国产精品亚洲第一| 国产成人亚洲综合a∨婷婷图片 | 精品国产三级电影在线观看| 欧美一区二区三区播放老司机| 欧美日韩免费电影| 欧美一区二区在线免费观看| 日韩亚洲欧美中文三级| 精品国产91洋老外米糕| 精品国产乱子伦一区| 日本一区二区三区电影| 亚洲日本中文字幕区| 一区二区三区av电影| 日韩成人免费在线| 国产一区二区三区在线观看精品 | 亚洲精品少妇30p| 午夜视频一区在线观看| 极品美女销魂一区二区三区免费| 国产suv精品一区二区6| 亚洲成人资源网| 亚洲夂夂婷婷色拍ww47| 精油按摩中文字幕久久| 成人动漫在线一区| 精品国产乱码久久久久久夜甘婷婷| 欧美精品一区二区三区很污很色的 | 激情偷乱视频一区二区三区| 成人污视频在线观看| 欧美精品一二三区| 精品国产露脸精彩对白| 中文字幕在线播放不卡一区| 亚洲成a人片综合在线| 国产一区在线不卡| 日本久久一区二区| 久久伊人蜜桃av一区二区| 亚洲国产精品久久人人爱蜜臀 | 日韩午夜激情视频| 亚洲人成7777| 国产成人99久久亚洲综合精品| 欧美在线免费播放| 国产精品乱人伦中文| 日韩精品成人一区二区在线| av不卡在线播放| 久久免费的精品国产v∧| 亚洲成av人片一区二区| 成人黄色av网站在线| 久久夜色精品一区| 免费高清在线视频一区·| 欧美日韩一本到| 亚洲免费在线观看| 成人免费视频视频在线观看免费 | aaa欧美日韩| 国产日韩成人精品| 久久精品国产精品亚洲综合| 欧美日韩免费观看一区二区三区| 国产精品素人视频| 九一九一国产精品| 精品国产一区久久| 奇米色一区二区三区四区| 欧美日韩视频专区在线播放| 亚洲黄色录像片| 在线一区二区观看| 一区二区三区中文字幕精品精品| 99久久99久久免费精品蜜臀| 亚洲国产精品ⅴa在线观看| 欧美日韩一区在线| 亚洲成人激情综合网| 欧美日韩国产a| 蜜乳av一区二区| 欧美xxxxxxxx| 国产精品99久久久久久久女警| 精品国产制服丝袜高跟| 国模大尺度一区二区三区| 久久久久久久综合色一本| 国产黄色精品视频| 国产精品福利影院| 欧美午夜不卡视频| 日韩经典中文字幕一区| 91传媒视频在线播放| 一区二区在线看| 欧美老肥妇做.爰bbww| 精品一区二区免费看| 国产欧美一区二区精品久导航 | 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美一区中文字幕| 国产精品18久久久久久久久 | 国v精品久久久网| 亚洲精品国产第一综合99久久| 欧美老肥妇做.爰bbww视频| 久久成人综合网| 国产精品网站在线播放| 欧美精品高清视频| 国产精品资源站在线| 一区二区三区免费观看| 日韩一区二区中文字幕| 成人av在线一区二区| 日本亚洲最大的色成网站www| 日韩激情一区二区| 国产精品美女久久久久久久网站| 欧美视频一区二区三区四区| 国内精品嫩模私拍在线| 亚洲一区二区三区爽爽爽爽爽| 欧美本精品男人aⅴ天堂| 91精品福利在线| 国产91对白在线观看九色| 日韩va欧美va亚洲va久久| 国产蜜臀97一区二区三区| 欧美精品 日韩| 91蜜桃免费观看视频| 久久精品免费看| 亚洲高清久久久| 国产精品久久久久久久午夜片 | 亚洲嫩草精品久久| 久久欧美中文字幕| 欧美日本国产视频| 91视频在线观看免费| 精品一区二区免费视频| 日韩国产欧美在线播放| 亚洲婷婷国产精品电影人久久| 久久综合九色综合欧美亚洲| 日韩欧美国产小视频| 4438x亚洲最大成人网| 色综合久久久久久久| 不卡在线观看av| 国产成人av一区二区| 国产一区福利在线| 久久99精品国产麻豆婷婷| 欧美a一区二区| 日韩激情av在线| 日本人妖一区二区| 日韩一区精品字幕| 视频在线观看一区| 午夜免费欧美电影| 日本视频一区二区| 精品中文字幕一区二区| 激情五月婷婷综合网| 国产一区二区伦理片| 国产精品白丝jk白祙喷水网站| 国产乱子轮精品视频| 丁香婷婷深情五月亚洲| av亚洲精华国产精华精华| 91免费国产在线| 欧美色图免费看| 欧美日韩精品系列| 欧美mv和日韩mv国产网站| 国产精品资源在线观看| 国产精品夫妻自拍| 久久久久成人黄色影片| 久久久久久久久久久电影| 欧美国产在线观看| 国产精品家庭影院| 亚洲国产欧美日韩另类综合| 亚洲综合色视频| 麻豆精品视频在线观看| 国产一区二区三区四| www.欧美.com| 欧美精品第一页| 国产欧美日韩不卡免费| 亚洲色图在线看| 香蕉久久一区二区不卡无毒影院| 蜜臀av性久久久久蜜臀aⅴ四虎| 成人激情开心网| 欧美三级日韩三级国产三级| 久久网这里都是精品| 亚洲综合在线免费观看| 国产精品综合网| 欧美午夜精品一区二区三区| 久久蜜桃一区二区| 亚洲品质自拍视频| 人人爽香蕉精品| 色综合久久中文字幕| 日韩午夜激情免费电影| 一级中文字幕一区二区| 国产精品88888| 91精品国产欧美一区二区18| 一区在线中文字幕| 国产美女一区二区三区| 精品视频在线免费看| 亚洲欧美日本在线| 蜜桃av噜噜一区| 欧美日韩精品免费| 亚洲一卡二卡三卡四卡| 国产成人在线观看免费网站| 欧美一区二区视频网站| 亚洲成人午夜影院| 91丝袜高跟美女视频|