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

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

?? cabac.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2001, International Telecommunications Union, Geneva
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the user without any
* license fee or royalty on an "as is" basis. The ITU disclaims
* any and all warranties, whether express, implied, or
* statutory, including any implied warranties of merchantability
* or of fitness for a particular purpose.  In no event shall the
* contributor or the ITU be liable for any incidental, punitive, or
* consequential damages of any kind whatsoever arising from the
* use of these programs.
*
* This disclaimer of warranty extends to the user of these programs
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The ITU does not represent or warrant that the programs furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of ITU-T Recommendations, including
* shareware, may be subject to royalty fees to patent holders.
* Information regarding the ITU-T patent policy is available from
* the ITU Web site at http://www.itu.int.
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.
************************************************************************
*/

/*!
 *************************************************************************************
 * \file cabac.c
 *
 * \brief
 *    CABAC entropy coding routines
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Detlev Marpe                    <marpe@hhi.de>
 **************************************************************************************
 */

#include <stdlib.h>
#include <math.h>
#include <memory.h>
#include <string.h>
#include "cabac.h"
#include "memalloc.h"
#include "elements.h"
#include "bitsbuf.h"
#include "header.h"

extern const int BLOCK_STEP[8][2];
int symbolCount = 0;

/*!
 ************************************************************************
 * \brief
 *    Allocation of contexts models for the motion info
 *    used for arithmetic decoding
 *
 ************************************************************************
 */
MotionInfoContexts* create_contexts_MotionInfo(void)
{
  int j;
  MotionInfoContexts *deco_ctx;

  deco_ctx = (MotionInfoContexts*) calloc(1, sizeof(MotionInfoContexts) );
  if( deco_ctx == NULL )
    no_mem_exit("create_contexts_MotionInfo: deco_ctx");

  for (j=0; j<2; j++)
  {
    deco_ctx->mb_type_contexts[j] = (BiContextTypePtr) malloc(NUM_MB_TYPE_CTX  * sizeof( BiContextType ) );

    if( deco_ctx->mb_type_contexts[j] == NULL )
      no_mem_exit("create_contexts_MotionInfo: deco_ctx->mb_type_contexts");

    deco_ctx->mv_res_contexts[j] = (BiContextTypePtr) malloc(NUM_MV_RES_CTX  * sizeof( BiContextType ) );

    if( deco_ctx->mv_res_contexts[j] == NULL )
      no_mem_exit("create_contexts_MotionInfo: deco_ctx->mv_res_contexts");
  }

  deco_ctx->ref_no_contexts = (BiContextTypePtr) malloc(NUM_REF_NO_CTX * sizeof( BiContextType ) );

  if( deco_ctx->ref_no_contexts == NULL )
    no_mem_exit("create_contexts_MotionInfo: deco_ctx->ref_no_contexts");

  deco_ctx->delta_qp_contexts = (BiContextTypePtr) malloc(NUM_DELTA_QP_CTX * sizeof( BiContextType ) );

  if( deco_ctx->delta_qp_contexts == NULL )
    no_mem_exit("create_contexts_MotionInfo: deco_ctx->delta_qp_contexts");
  return deco_ctx;
}


/*!
 ************************************************************************
 * \brief
 *    Allocates of contexts models for the texture info
 *    used for arithmetic decoding
 ************************************************************************
 */
TextureInfoContexts* create_contexts_TextureInfo(void)
{

  int j,k;
  TextureInfoContexts *deco_ctx;

  deco_ctx = (TextureInfoContexts*) calloc(1, sizeof(TextureInfoContexts) );
  if( deco_ctx == NULL )
    no_mem_exit("create_contexts_TextureInfo: deco_ctx");

  for (j=0; j < 6; j++)
  {

    deco_ctx->ipr_contexts[j] = (BiContextTypePtr) malloc(NUM_IPR_CTX  * sizeof( BiContextType ) );

    if( deco_ctx->ipr_contexts[j] == NULL )
      no_mem_exit("create_contexts_TextureInfo: deco_ctx->ipr_contexts");

  }

  for (k=0; k<2; k++)
    for (j=0; j<3; j++)
    {

      deco_ctx->cbp_contexts[k][j] = (BiContextTypePtr) malloc(NUM_CBP_CTX  * sizeof( BiContextType ) );

      if( deco_ctx->cbp_contexts[k][j] == NULL )
        no_mem_exit("create_contexts_TextureInfo: deco_ctx->cbp_contexts");
    }


  for (j=0; j < NUM_TRANS_TYPE; j++)
  {

    deco_ctx->level_context[j] = (BiContextTypePtr) malloc(NUM_LEVEL_CTX  * sizeof( BiContextType ) );

    if( deco_ctx->level_context[j] == NULL )
      no_mem_exit("create_contexts_TextureInfo: deco_ctx->level_context");


    deco_ctx->run_context[j] = (BiContextTypePtr) malloc(NUM_RUN_CTX  * sizeof( BiContextType ) );

    if( deco_ctx->run_context[j] == NULL )
      no_mem_exit("create_contexts_TextureInfo: deco_ctx->run_context");

  }
  return deco_ctx;
}


/*!
 ************************************************************************
 * \brief
 *    Initializes an array of contexts models with some pre-defined
 *    counts (ini_flag = 1) or with a flat histogram (ini_flag = 0)
 *
 ************************************************************************
 */
void init_contexts_MotionInfo(struct img_par *img, MotionInfoContexts *deco_ctx, int ini_flag)
{

  int i,j;
  int scale_factor;
  int qp_factor;
  int ini[3];

  if(img->qp <= 10)
    qp_factor=0;
  else
    qp_factor=img->qp-10;

  if ( (img->width*img->height) <=  (IMG_WIDTH * IMG_HEIGHT) ) //  format <= QCIF
        scale_factor=1;
    else
        scale_factor=2;


  for (j=0; j<2; j++)
  {
    if (ini_flag)
    {
      for (i=0; i < NUM_MB_TYPE_CTX; i++)
      {
        ini[0] = MB_TYPE_Ini[j][i][0]+(MB_TYPE_Ini[j][i][3]*qp_factor)/10;
        ini[1] = MB_TYPE_Ini[j][i][1]+(MB_TYPE_Ini[j][i][4]*qp_factor)/10;
        ini[2] = MB_TYPE_Ini[j][i][2]*scale_factor;
        biari_init_context(deco_ctx->mb_type_contexts[j] + i,ini[0],ini[1],ini[2]);
      }
    }
    else
    {
      for (i=0; i < NUM_MB_TYPE_CTX; i++)
        biari_init_context(deco_ctx->mb_type_contexts[j] + i,1,1,100);
    }

    if (ini_flag)
    {
      for (i=0; i < NUM_MV_RES_CTX; i++)
        biari_init_context(deco_ctx->mv_res_contexts[j] + i,MV_RES_Ini[j][i][0]*scale_factor,MV_RES_Ini[j][i][1]*scale_factor,MV_RES_Ini[j][i][2]*scale_factor);
    }
    else
    {
      for (i=0; i < NUM_MV_RES_CTX; i++)
        biari_init_context(deco_ctx->mv_res_contexts[j] + i,1,1,1000);
    }
  }

  if (ini_flag)
  {
    for (i=0; i < NUM_REF_NO_CTX; i++)
      biari_init_context(deco_ctx->ref_no_contexts + i,REF_NO_Ini[i][0]*scale_factor,REF_NO_Ini[i][1]*scale_factor,REF_NO_Ini[i][2]*scale_factor);
  }
  else
  {
    for (i=0; i < NUM_REF_NO_CTX; i++)
      biari_init_context(deco_ctx->ref_no_contexts + i,1,1,1000);
  }

  if (ini_flag)
  {
    for (i=0; i < NUM_DELTA_QP_CTX; i++)
      biari_init_context(deco_ctx->delta_qp_contexts + i,DELTA_QP_Ini[i][0]*scale_factor,DELTA_QP_Ini[i][1]*scale_factor,DELTA_QP_Ini[i][2]*scale_factor);
  }
  else
  {
    for (i=0; i < NUM_DELTA_QP_CTX; i++)
      biari_init_context(deco_ctx->delta_qp_contexts + i,1,1,1000);
  }
}

/*!
 ************************************************************************
 * \brief
 *    Initializes an array of contexts models with some pre-defined
 *    counts (ini_flag = 1) or with a flat histogram (ini_flag = 0)
 *
 ************************************************************************
 */
void init_contexts_TextureInfo(struct img_par *img, TextureInfoContexts *deco_ctx, int ini_flag)
{

  int i,j,k;
  int scale_factor;
  int qp_factor;
  int ini[3];

  if(img->qp <= 10)
    qp_factor=0;
  else
    qp_factor=img->qp-10;

  if ( (img->width*img->height) <=  (IMG_WIDTH * IMG_HEIGHT) ) //  format <= QCIF
        scale_factor=1;
    else
        scale_factor=2;

  for (j=0; j < 6; j++)
  {
    if (ini_flag)
    {
      for (i=0; i < NUM_IPR_CTX; i++)
        biari_init_context(deco_ctx->ipr_contexts[j] + i,IPR_Ini[j][i][0]*scale_factor,IPR_Ini[j][i][1]*scale_factor,IPR_Ini[j][i][2]*scale_factor);
    }
    else
    {
      for (i=0; i < NUM_IPR_CTX; i++)
        biari_init_context(deco_ctx->ipr_contexts[j] + i,2,1,50);
    }
  }

  for (k=0; k<2; k++)
    for (j=0; j<3; j++)
    {
      if (ini_flag)
      {
        for (i=0; i < NUM_CBP_CTX; i++)
        {
          ini[0] = CBP_Ini[k][j][i][0]+(CBP_Ini[k][j][i][3]*qp_factor)/10;
          ini[1] = CBP_Ini[k][j][i][1]+(CBP_Ini[k][j][i][4]*qp_factor)/10;
          ini[2] = CBP_Ini[k][j][i][2]*scale_factor;
          biari_init_context(deco_ctx->cbp_contexts[k][j] + i,ini[0],ini[1],ini[2]);
        }
      }
      else
      {
        for (i=0; i < NUM_CBP_CTX; i++)
          biari_init_context(deco_ctx->cbp_contexts[k][j] + i,1,1,100);
      }
    }


  for (j=0; j < NUM_TRANS_TYPE; j++)
  {

    if (ini_flag)
    {
      for (i=0; i < NUM_LEVEL_CTX; i++)
      {
        ini[0] = (Level_Ini[j][i][0]+(Level_Ini[j][i][3]*qp_factor)/10)*scale_factor;
        ini[1] = (Level_Ini[j][i][1]+(Level_Ini[j][i][4]*qp_factor)/10)*scale_factor;
        ini[2] = Level_Ini[j][i][2]*scale_factor;
        biari_init_context(deco_ctx->level_context[j] + i,ini[0],ini[1],ini[2]);
      }
    }
    else
    {
      for (i=0; i < NUM_LEVEL_CTX; i++)
        biari_init_context(deco_ctx->level_context[j] + i,1,1,100);
    }

    if (ini_flag)
    {
      for (i=0; i < NUM_RUN_CTX; i++)
      {
        ini[0] = Run_Ini[j][i][0]*scale_factor;
        ini[1] = Run_Ini[j][i][1]*scale_factor;
        ini[2] = Run_Ini[j][i][2]*scale_factor;
        biari_init_context(deco_ctx->run_context[j] + i,ini[0],ini[1],ini[2]);
      }
    }
    else
    {
      for (i=0; i < NUM_RUN_CTX; i++)
        biari_init_context(deco_ctx->run_context[j] + i,1,1,100);
    }
  }
}


/*!
 ************************************************************************
 * \brief
 *    Frees the memory of the contexts models
 *    used for arithmetic decoding of the motion info.
 ************************************************************************
 */
void delete_contexts_MotionInfo(MotionInfoContexts *deco_ctx)
{

  int j;

  if( deco_ctx == NULL )
    return;

  for (j=0; j<2; j++)
  {
    if (deco_ctx->mb_type_contexts[j] != NULL)
      free(deco_ctx->mb_type_contexts[j] );

    if (deco_ctx->mv_res_contexts[j]  != NULL)
      free(deco_ctx->mv_res_contexts[j] );
  }

  if (deco_ctx->ref_no_contexts != NULL)
    free(deco_ctx->ref_no_contexts);

  if (deco_ctx->delta_qp_contexts != NULL)
    free(deco_ctx->delta_qp_contexts);

  free( deco_ctx );

  return;

}

/*!
 ************************************************************************
 * \brief
 *    Frees the memory of the contexts models
 *    used for arithmetic decoding of the texture info.
 ************************************************************************
 */
void delete_contexts_TextureInfo(TextureInfoContexts *deco_ctx)
{

  int j,k;

  if( deco_ctx == NULL )
    return;

  for (j=0; j < 6; j++)
  {
    if (deco_ctx->ipr_contexts[j] != NULL)
      free(deco_ctx->ipr_contexts[j]);
  }

  for (k=0; k<2; k++)
    for (j=0; j<3; j++)
    {
      if (deco_ctx->cbp_contexts[k][j] != NULL)
        free(deco_ctx->cbp_contexts[k][j]);
    }

  for (j=0; j < NUM_TRANS_TYPE; j++)
  {
    if (deco_ctx->level_context[j] != NULL)
      free(deco_ctx->level_context[j]);

    if (deco_ctx->run_context[j] != NULL)
      free(deco_ctx->run_context[j]);
  }
  free( deco_ctx );

  return;

}



/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode the motion
 *    vector data of a B-frame MB.
 ************************************************************************
 */
void readBiMVD2Buffer_CABAC( SyntaxElement *se,
                             struct inp_par *inp,
                             struct img_par *img,
                             DecodingEnvironmentPtr dep_dp)
{
  int step_h, step_v;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲自拍偷拍图区| 欧美成人精品福利| 精品国产1区二区| 亚洲一区二区三区四区五区中文| 激情六月婷婷久久| 欧美高清激情brazzers| 国产精品大尺度| 国产精品996| 日韩一区二区三区在线| 亚洲一区二区三区四区五区黄| 国产不卡在线一区| 日韩欧美久久一区| 午夜精品久久久久久久99樱桃| 91看片淫黄大片一级| 国产日韩亚洲欧美综合| 午夜伊人狠狠久久| 色综合天天综合色综合av| 精品国产欧美一区二区| 日韩成人dvd| 欧美艳星brazzers| 国产精品热久久久久夜色精品三区| 久久av中文字幕片| 91.麻豆视频| 亚洲在线视频一区| 成人午夜视频免费看| 久久久久国产成人精品亚洲午夜| 青青草国产成人99久久| 欧美日韩黄色影视| 天天操天天干天天综合网| 欧美在线一区二区| 一区二区三区蜜桃网| 91免费国产在线观看| 中文字幕欧美三区| 成人18视频日本| 国产精品麻豆久久久| 懂色av一区二区夜夜嗨| 国产亚洲福利社区一区| 国产成人免费视| 国产日韩欧美精品一区| 国产91精品一区二区| 欧美国产乱子伦 | 亚洲精品久久久久久国产精华液| 成人av资源在线| 国产精品福利一区| 99久久99久久精品免费看蜜桃| 国产精品灌醉下药二区| 91性感美女视频| 亚洲黄色片在线观看| 欧美性猛片xxxx免费看久爱| 亚洲国产精品影院| 欧美精品一卡两卡| 久久er精品视频| 国产午夜亚洲精品不卡| 粉嫩aⅴ一区二区三区四区| 综合中文字幕亚洲| 欧美亚洲图片小说| 婷婷久久综合九色综合绿巨人| 91精品一区二区三区久久久久久| 免费观看一级欧美片| 久久综合色一综合色88| 粉嫩av一区二区三区在线播放| 自拍偷拍亚洲欧美日韩| 91福利在线看| 热久久久久久久| 欧美一级久久久| 国产精品亚洲第一区在线暖暖韩国 | 97aⅴ精品视频一二三区| 亚洲乱码国产乱码精品精98午夜| 欧美视频一区二区三区| 美女尤物国产一区| 国产亚洲精品超碰| 在线精品视频一区二区三四| 日韩国产在线观看| 久久亚洲精品小早川怜子| 91亚洲精品乱码久久久久久蜜桃| 亚洲bt欧美bt精品777| 欧美成人三级电影在线| 99热99精品| 亚洲成人手机在线| 久久久久久免费网| 在线免费av一区| 久久99精品久久久久久久久久久久| 国产日产欧产精品推荐色| 91蜜桃婷婷狠狠久久综合9色| 午夜精品免费在线观看| 久久午夜老司机| 在线视频观看一区| 国产一区二区中文字幕| 亚洲视频在线一区二区| 日韩一区二区三区精品视频| 国产成人综合在线播放| 亚洲一区在线观看视频| 久久久久88色偷偷免费| 欧美午夜精品一区二区三区| 国产在线不卡一区| 亚洲国产精品影院| 欧美国产精品一区| 91精品中文字幕一区二区三区 | 亚洲午夜久久久久久久久电影院 | 色呦呦日韩精品| 久久精品国产精品亚洲综合| 国产精品久久久久久久久免费丝袜| 69堂亚洲精品首页| 99精品黄色片免费大全| 卡一卡二国产精品| 一区二区三区不卡视频| 国产日韩欧美麻豆| 日韩一区二区免费电影| 一本久道久久综合中文字幕| 国产乱码精品一区二区三区五月婷| 亚洲精品日韩综合观看成人91| 精品成a人在线观看| 欧美性感一区二区三区| 成人免费av网站| 黄页视频在线91| 日日夜夜免费精品视频| 亚洲靠逼com| 国产目拍亚洲精品99久久精品| 91精品国产综合久久小美女| 色域天天综合网| 高清成人免费视频| 激情图片小说一区| 日韩av网站免费在线| 一区二区三区免费看视频| 国产精品无人区| 2021中文字幕一区亚洲| 日韩一区二区精品| 欧美老年两性高潮| 欧美性受极品xxxx喷水| 99精品国产热久久91蜜凸| 国产一区在线精品| 精品夜夜嗨av一区二区三区| 首页亚洲欧美制服丝腿| 一区二区三区欧美日韩| 亚洲欧美另类久久久精品2019| 欧美国产视频在线| 国产日韩高清在线| 久久久精品日韩欧美| 日韩免费一区二区| 69堂亚洲精品首页| 亚洲日本免费电影| 国产精品精品国产色婷婷| 亚洲国产精品成人综合| 久久久噜噜噜久久中文字幕色伊伊| 欧美一区二区三区在线观看视频 | 99麻豆久久久国产精品免费| 国产精品综合一区二区三区| 狠狠色狠狠色综合日日91app| 日韩高清欧美激情| 日韩和欧美一区二区| 午夜精品久久久久久久| 视频一区中文字幕国产| 偷拍一区二区三区四区| 亚洲午夜av在线| 亚洲综合清纯丝袜自拍| 有码一区二区三区| 亚洲国产成人高清精品| 首页亚洲欧美制服丝腿| 日韩av不卡在线观看| 免费在线观看日韩欧美| 蜜臀av一级做a爰片久久| 久久99精品视频| 国产精品性做久久久久久| 成人一区二区三区| 99久久婷婷国产综合精品| 91视频国产观看| 欧美综合久久久| 欧美日韩国产首页在线观看| 91精品久久久久久久99蜜桃| 欧美成va人片在线观看| 久久久久久一二三区| 国产精品黄色在线观看| 亚洲精品一二三| 午夜精品福利久久久| 青青草97国产精品免费观看 | 婷婷综合在线观看| 另类欧美日韩国产在线| 国产麻豆精品久久一二三| 成人动漫视频在线| 在线观看不卡一区| 91精品国产高清一区二区三区蜜臀| 欧美一区二区在线看| 久久伊人中文字幕| 国产精品福利一区| 婷婷开心激情综合| 国模冰冰炮一区二区| 99精品一区二区| 69成人精品免费视频| 亚洲精品一区二区三区在线观看| 欧美激情中文字幕一区二区| 亚洲美女在线一区| 青椒成人免费视频| 成人激情免费电影网址| 欧美在线短视频| 欧美高清激情brazzers| 国产日韩精品久久久| 亚洲电影一区二区三区| 国产专区欧美精品| 色婷婷久久久久swag精品| 日韩欧美在线1卡|