亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
偷窥少妇高潮呻吟av久久免费| 精品亚洲成av人在线观看| 亚洲国产一区在线观看| 午夜精品福利在线| 国产一区二区伦理| 国产一区二区三区四区在线观看| 懂色av中文一区二区三区| 成人av在线网站| 99vv1com这只有精品| 日韩精品一区国产麻豆| 亚洲国产精品久久人人爱| 色94色欧美sute亚洲线路一ni| 欧美视频在线观看一区二区| 亚洲免费看黄网站| 免费看日韩a级影片| 欧美午夜免费电影| 亚洲综合丝袜美腿| 在线观看一区二区精品视频| 亚洲欧洲制服丝袜| www.亚洲激情.com| 亚洲欧美福利一区二区| jiyouzz国产精品久久| 中文字幕一区三区| 91在线观看美女| 一区二区三区四区不卡视频| 在线观看日韩电影| 亚洲国产另类av| 欧美一级高清片| 亚洲精品免费视频| 久久在线免费观看| 亚洲综合一区二区精品导航| 国产成人一级电影| 精品国产成人在线影院| 午夜精品在线看| 欧洲精品视频在线观看| 最新不卡av在线| 波多野结衣中文字幕一区二区三区| 精品粉嫩超白一线天av| 免费观看在线色综合| 欧美成人精精品一区二区频| 日韩高清不卡一区二区三区| 欧美日韩一卡二卡三卡| 亚洲午夜精品网| 欧美日韩黄色影视| 亚洲国产精品一区二区久久恐怖片| 色吧成人激情小说| 亚洲专区一二三| 欧美老肥妇做.爰bbww视频| 日韩精品亚洲一区二区三区免费| 欧美视频完全免费看| 亚洲午夜精品网| 日韩视频在线一区二区| 久久se精品一区二区| 久久久国产精品麻豆| jlzzjlzz亚洲日本少妇| 亚洲三级在线播放| 欧美色中文字幕| 天天色综合成人网| 欧美成人精品二区三区99精品| 国产99久久久国产精品免费看| 中文字幕一区二区三区不卡 | 日韩一区有码在线| 欧美在线综合视频| 国产乱人伦精品一区二区在线观看| 国产欧美中文在线| 欧美日韩国产精选| 精品一区二区在线观看| 亚洲欧美日韩在线不卡| 日韩亚洲国产中文字幕欧美| 福利一区二区在线观看| 日韩精品成人一区二区在线| 久久久久国产精品免费免费搜索| 色8久久人人97超碰香蕉987| 日本免费新一区视频| 国产精品国产三级国产aⅴ无密码| 欧美无人高清视频在线观看| 国内精品写真在线观看| 亚洲已满18点击进入久久| 久久精品免费在线观看| 欧美人妖巨大在线| 色婷婷国产精品久久包臀 | 久久99热狠狠色一区二区| 一区二区三区四区在线| 欧美激情一区二区在线| 欧美高清精品3d| 在线观看91精品国产入口| 国产91色综合久久免费分享| 久久不见久久见中文字幕免费| 亚洲国产精品欧美一二99| 欧美一级黄色大片| 欧美在线|欧美| 在线欧美日韩精品| 99re免费视频精品全部| 99久久久国产精品| 不卡的av在线| 91伊人久久大香线蕉| 成人精品国产一区二区4080| 成人爽a毛片一区二区免费| 国产成人免费在线视频| 成人免费看视频| 成年人国产精品| 91国偷自产一区二区使用方法| 欧美日韩国产系列| 精品视频免费看| 欧美高清激情brazzers| 精品捆绑美女sm三区| 久久无码av三级| 成人欧美一区二区三区白人| 亚洲精品国产一区二区三区四区在线| 亚洲精品高清在线观看| 亚洲尤物视频在线| 麻豆中文一区二区| 懂色av中文一区二区三区| 色哟哟一区二区三区| 欧美性大战久久久| 精品国产免费人成在线观看| 久久久久久一级片| 亚洲成av人片一区二区三区| 秋霞电影网一区二区| 亚洲小说春色综合另类电影| 国内精品久久久久影院薰衣草 | 国产无遮挡一区二区三区毛片日本 | 亚洲女女做受ⅹxx高潮| 免费在线欧美视频| 成人av网在线| 日韩亚洲欧美综合| 亚洲人成伊人成综合网小说| 麻豆精品视频在线观看视频| 成人自拍视频在线观看| 91精品国产欧美日韩| 亚洲人成影院在线观看| 国产一区二区三区美女| 欧美精品丝袜中出| 亚洲免费在线电影| 国产一区二区导航在线播放| 欧美日韩精品电影| 夜夜嗨av一区二区三区网页 | 不卡电影免费在线播放一区| 日韩一区二区三区视频在线| 一二三区精品福利视频| 精品少妇一区二区| 亚洲成人动漫精品| 99在线精品视频| 久久久99免费| 欧美午夜电影一区| 欧美性猛交xxxx乱大交退制版| 国产偷国产偷精品高清尤物| 日韩中文字幕不卡| 欧美网站大全在线观看| 一区二区三区精品| 色丁香久综合在线久综合在线观看| 国产精品欧美精品| caoporm超碰国产精品| 国产清纯白嫩初高生在线观看91| 免费成人小视频| 欧美不卡在线视频| 韩国一区二区视频| 国产精品欧美经典| 97久久精品人人做人人爽| 亚洲猫色日本管| 欧美系列一区二区| 日韩成人一区二区| 精品久久久久久久一区二区蜜臀| 欧美aⅴ一区二区三区视频| 日韩欧美中文字幕精品| 国产一区二区三区精品欧美日韩一区二区三区 | 在线成人午夜影院| 青青青爽久久午夜综合久久午夜| 精品免费国产一区二区三区四区| 国产精品一区三区| 亚洲视频图片小说| 日韩一区二区三区高清免费看看| 九九热在线视频观看这里只有精品| 久久久久久免费毛片精品| 91在线精品秘密一区二区| 天堂资源在线中文精品| 国产亚洲欧美日韩日本| 在线亚洲免费视频| 国产福利一区二区三区视频| 亚洲乱码一区二区三区在线观看| 欧美一级日韩免费不卡| av成人免费在线观看| 麻豆一区二区99久久久久| 亚洲码国产岛国毛片在线| 久久丝袜美腿综合| 欧美日韩久久不卡| 成人美女在线观看| 麻豆久久久久久久| 一区二区三区四区在线播放 | 丁香婷婷综合激情五月色| 日韩电影网1区2区| 亚洲一区二区视频在线| 中文字幕在线免费不卡| 精品国产三级电影在线观看| 欧美日韩另类一区| 在线观看日韩电影| 色偷偷久久一区二区三区| 粉嫩欧美一区二区三区高清影视| 久久精品噜噜噜成人88aⅴ| 午夜精品成人在线|