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

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

?? cabac.c

?? 一個簡單的視頻會議VC++MFC工程文件
?? C
?? 第 1 頁 / 共 4 頁
字號:

/*!
 *************************************************************************************
 * \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 <assert.h>

#include "global.h"

#include "cabac.h"
#include "image.h"
#include "mb_access.h"

int last_dquant = 0;

/***********************************************************************
 * L O C A L L Y   D E F I N E D   F U N C T I O N   P R O T O T Y P E S
 ***********************************************************************
 */


void unary_bin_encode(EncodingEnvironmentPtr eep_frame,
                      unsigned int symbol,
                      BiContextTypePtr ctx,
                      int ctx_offset);

void unary_bin_max_encode(EncodingEnvironmentPtr eep_frame,
                          unsigned int symbol,
                          BiContextTypePtr ctx,
                          int ctx_offset,
                          unsigned int max_symbol);

void unary_exp_golomb_level_encode( EncodingEnvironmentPtr eep_dp,
                                   unsigned int symbol,
                                   BiContextTypePtr ctx);

void unary_exp_golomb_mv_encode(EncodingEnvironmentPtr eep_dp,
                                unsigned int symbol,
                                BiContextTypePtr ctx,
                                unsigned int max_bin);


void cabac_new_slice()
{
  last_dquant=0;
}


/*!
 ************************************************************************
 * \brief
 *    Check for available neighbouring blocks
 *    and set pointers in current macroblock
 ************************************************************************
 */
void CheckAvailabilityOfNeighborsCABAC()
{
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];
  PixelPos up, left;
  
  getNeighbour(img->current_mb_nr, -1,  0, 1, &left);
  getNeighbour(img->current_mb_nr,  0, -1, 1, &up);
  
  if (up.available)
    currMB->mb_available_up = &img->mb_data[up.mb_addr];
  else
    currMB->mb_available_up = NULL;
  
  if (left.available)
    currMB->mb_available_left = &img->mb_data[left.mb_addr];
  else
    currMB->mb_available_left = NULL;
}

/*!
 ************************************************************************
 * \brief
 *    Allocation of contexts models for the motion info
 *    used for arithmetic encoding
 ************************************************************************
 */
MotionInfoContexts* create_contexts_MotionInfo(void)
{
  MotionInfoContexts* enco_ctx;

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

  return enco_ctx;
}


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

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

  return enco_ctx;
}




/*!
 ************************************************************************
 * \brief
 *    Frees the memory of the contexts models
 *    used for arithmetic encoding of the motion info.
 ************************************************************************
 */
void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx)
{
  if( enco_ctx == NULL )
    return;

  free( enco_ctx );

  return;
}

/*!
 ************************************************************************
 * \brief
 *    Frees the memory of the contexts models
 *    used for arithmetic encoding of the texture info.
 ************************************************************************
 */
void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx)
{
  if( enco_ctx == NULL )
    return;

  free( enco_ctx );

  return;
}


/*!
 **************************************************************************
 * \brief
 *    generates arithmetic code and passes the code to the buffer
 **************************************************************************
 */
int writeSyntaxElement_CABAC(SyntaxElement *se, DataPartition *this_dataPart)
{
  int curr_len;
  EncodingEnvironmentPtr eep_dp = &(this_dataPart->ee_cabac);

  curr_len = arienco_bits_written(eep_dp);

  // perform the actual coding by calling the appropriate method
  se->writing(se, eep_dp);

  if(se->type != SE_HEADER)
    this_dataPart->bitstream->write_flag = 1;

  return (se->len = (arienco_bits_written(eep_dp) - curr_len));
}

/*!
 ***************************************************************************
 * \brief
 *    This function is used to arithmetically encode the field
 *    mode info of a given MB  in the case of mb-based frame/field decision
 ***************************************************************************
 */
void writeFieldModeInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp)
{
  int a,b,act_ctx;
  MotionInfoContexts *ctx         = (img->currentSlice)->mot_ctx;
  Macroblock         *currMB      = &img->mb_data[img->current_mb_nr];
  int                mb_field = se->value1;
  
  if (currMB->mbAvailA)
    a = img->mb_data[currMB->mbAddrA].mb_field;
  else
    a = 0;
  if (currMB->mbAvailB)
    b = img->mb_data[currMB->mbAddrB].mb_field;
  else
    b=0;

  act_ctx = a + b;

  if (mb_field==0) // frame
    biari_encode_symbol(eep_dp, 0,&ctx->mb_aff_contexts[act_ctx]);
  else
    biari_encode_symbol(eep_dp, 1,&ctx->mb_aff_contexts[act_ctx]);
  
  se->context = act_ctx;
  
  return;
}

/*!
***************************************************************************
* \brief
*    This function is used to arithmetically encode the mb_skip_flag.
***************************************************************************
*/
void writeMB_skip_flagInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp)
{
  int a,b,act_ctx;
  int bframe   = (img->type==B_SLICE);
  MotionInfoContexts *ctx         = (img->currentSlice)->mot_ctx;
  Macroblock         *currMB      = &img->mb_data[img->current_mb_nr];
  int                curr_mb_type = se->value1;
  
  if (bframe)
  {
    if (currMB->mb_available_up == NULL)
      b = 0;
    else
      b = (currMB->mb_available_up->skip_flag==0 ? 0 : 1);
    if (currMB->mb_available_left == NULL)
      a = 0;
    else
      a = (currMB->mb_available_left->skip_flag==0 ? 0 : 1);
    
    act_ctx = 7 + a + b;

    if (se->value1==0 && se->value2==0) // DIRECT mode, no coefficients
      biari_encode_symbol (eep_dp, 1, &ctx->mb_type_contexts[2][act_ctx]);
    else
      biari_encode_symbol (eep_dp, 0, &ctx->mb_type_contexts[2][act_ctx]);   

    currMB->skip_flag = (se->value1==0 && se->value2==0)?0:1;
  }
  else
  {
    if (currMB->mb_available_up == NULL)
      b = 0;
    else
      b = (( (currMB->mb_available_up)->skip_flag != 0) ? 1 : 0 );
    if (currMB->mb_available_left == NULL)
      a = 0;
    else
      a = (( (currMB->mb_available_left)->skip_flag != 0) ? 1 : 0 );

    act_ctx = a + b;

    if (curr_mb_type==0) // SKIP
      biari_encode_symbol(eep_dp, 1,&ctx->mb_type_contexts[1][act_ctx]);
    else
      biari_encode_symbol(eep_dp, 0,&ctx->mb_type_contexts[1][act_ctx]);

    currMB->skip_flag = (curr_mb_type==0)?0:1;
  }
  se->context = act_ctx;

  return;
}

/*!
***************************************************************************
* \brief
*    This function is used to arithmetically encode the macroblock
*    intra_pred_size flag info of a given MB.
***************************************************************************
*/

void writeMB_transform_size_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp)
{
  int a, b;
  int act_ctx = 0;
  int act_sym;
  
  MotionInfoContexts *ctx         = (img->currentSlice)->mot_ctx;
  Macroblock         *currMB      = &img->mb_data[img->current_mb_nr];
  
  
  if (currMB->mb_available_up == NULL)
    b = 0;
  else 
    b = currMB->mb_available_up->luma_transform_size_8x8_flag;
  
  if (currMB->mb_available_left == NULL)
    a = 0;
  else 
    a = currMB->mb_available_left->luma_transform_size_8x8_flag;
    
  act_ctx     = a + b;
  act_sym     = currMB->luma_transform_size_8x8_flag;
  se->context = act_ctx; // store context
  if(act_sym == 0)          // 4x4
    biari_encode_symbol(eep_dp, 0, ctx->transform_size_contexts + act_ctx );
  else                      // 8x8
    biari_encode_symbol(eep_dp, 1, ctx->transform_size_contexts + act_ctx );
  
}

/*!
 ***************************************************************************
 * \brief
 *    This function is used to arithmetically encode the macroblock
 *    type info of a given MB.
 ***************************************************************************
 */

void writeMB_typeInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp)
{
  int a, b;
  int act_ctx = 0;
  int act_sym;
  int csym;
  int bframe   = (img->type==B_SLICE);
  int mode_sym = 0;
  int mode16x16;


  MotionInfoContexts *ctx         = (img->currentSlice)->mot_ctx;
  Macroblock         *currMB      = &img->mb_data[img->current_mb_nr];
  int                curr_mb_type = se->value1;

  if(img->type == I_SLICE)  // INTRA-frame
  {
    if (currMB->mb_available_up == NULL)
      b = 0;
    else 
      b = ((currMB->mb_available_up->mb_type != I4MB &&  currMB->mb_available_up->mb_type != I8MB) ? 1 : 0 );

    if (currMB->mb_available_left == NULL)
      a = 0;
    else 
      a = ((currMB->mb_available_left->mb_type != I4MB &&  currMB->mb_available_left->mb_type != I8MB) ? 1 : 0 );
    
    act_ctx     = a + b;
    act_sym     = curr_mb_type;
    se->context = act_ctx; // store context

    if (act_sym==0) // 4x4 Intra
    {
      biari_encode_symbol(eep_dp, 0, ctx->mb_type_contexts[0] + act_ctx );
    }
    else if( act_sym == 25 ) // PCM-MODE
    {
      biari_encode_symbol(eep_dp, 1, ctx->mb_type_contexts[0] + act_ctx );

      biari_encode_symbol_final(eep_dp, 1);
    }
    else // 16x16 Intra
    {
      biari_encode_symbol(eep_dp, 1, ctx->mb_type_contexts[0] + act_ctx );

      biari_encode_symbol_final(eep_dp, 0);

      mode_sym = act_sym-1; // Values in the range of 0...23
      act_ctx  = 4;
      act_sym  = mode_sym/12;
      biari_encode_symbol(eep_dp, (unsigned char) act_sym, ctx->mb_type_contexts[0] + act_ctx ); // coding of AC/no AC
      mode_sym = mode_sym % 12;
      act_sym  = mode_sym / 4; // coding of cbp: 0,1,2
      act_ctx  = 5;
      if (act_sym==0)
      {
        biari_encode_symbol(eep_dp, 0, ctx->mb_type_contexts[0] + act_ctx );
      }
      else
      {
        biari_encode_symbol(eep_dp, 1, ctx->mb_type_contexts[0] + act_ctx );
        act_ctx=6;
        if (act_sym==1)
        {
          biari_encode_symbol(eep_dp, 0, ctx->mb_type_contexts[0] + act_ctx );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人先锋电影| 日韩激情视频在线观看| 欧美一区2区视频在线观看| 91丨九色丨蝌蚪丨老版| 国产成a人亚洲| 国产成人aaa| 国产在线精品一区二区夜色| 精品国产91亚洲一区二区三区婷婷| av一区二区不卡| 国模套图日韩精品一区二区| 日本成人在线不卡视频| 怡红院av一区二区三区| 中文字幕一区在线| 欧美国产欧美亚州国产日韩mv天天看完整 | av中文字幕亚洲| 亚洲欧美日韩在线播放| 亚洲综合色视频| 91老师国产黑色丝袜在线| av成人动漫在线观看| 欧美亚洲丝袜传媒另类| 一本色道a无线码一区v| 国产一区视频导航| 国产91在线|亚洲| 粉嫩aⅴ一区二区三区四区| 国产精品1024| 99国产欧美久久久精品| 色网站国产精品| 91精品国产综合久久国产大片| 在线观看视频91| 欧美精品乱码久久久久久按摩 | 亚洲高清一区二区三区| 亚洲成人在线观看视频| 蜜臀久久99精品久久久久宅男| 精品一区免费av| 一本久道中文字幕精品亚洲嫩| 在线看不卡av| 国产日韩欧美精品在线| 亚洲欧美中日韩| 日韩国产一二三区| 国产精品一区二区久久精品爱涩 | 成人小视频在线| www.亚洲精品| 麻豆91免费看| 国产精品亚洲成人| 国产一区二区三区精品欧美日韩一区二区三区 | 777xxx欧美| av亚洲精华国产精华精| 久久99国内精品| 午夜精品aaa| 久88久久88久久久| 国产一区在线观看麻豆| 欧美色中文字幕| 色偷偷一区二区三区| 黄色资源网久久资源365| 91小视频免费观看| 国产精品一区二区黑丝| 在线观看国产日韩| 一个色在线综合| 亚洲一二三四在线| 亚洲成人久久影院| 亚洲综合色网站| 国产激情视频一区二区三区欧美| 福利视频网站一区二区三区| 成人午夜看片网址| 日韩欧美一区在线| 亚洲视频免费观看| 欧美精品一区二区不卡| 国产精品福利一区| 日韩毛片视频在线看| 亚洲在线成人精品| 国产成人av电影在线观看| 欧美高清性hdvideosex| 波多野洁衣一区| 2023国产精品视频| 91在线观看污| 欧美亚洲国产一卡| 91麻豆国产福利精品| 亚洲成人精品一区| 欧美激情在线观看视频免费| 亚洲一区二区高清| 激情文学综合插| 2023国产精品| 亚洲成a人片在线不卡一二三区| 色噜噜狠狠色综合中国| 一区二区三区小说| 精品99一区二区| 欧美成人一级视频| 亚洲品质自拍视频网站| 国产一二精品视频| 国产乱色国产精品免费视频| 欧美日韩视频在线一区二区 | 国产 日韩 欧美大片| 一本色道**综合亚洲精品蜜桃冫| 精品国产一二三区| 欧美色综合网站| 国产成人午夜精品5599| 国产一区视频在线看| 美女视频一区二区| 午夜影视日本亚洲欧洲精品| av毛片久久久久**hd| 秋霞电影一区二区| 蜜臀精品久久久久久蜜臀| 精品视频在线免费看| 亚洲一区二区三区美女| 欧美综合色免费| 亚洲动漫第一页| 一本大道综合伊人精品热热| 亚洲女人的天堂| 欧美三级在线视频| 日本最新不卡在线| 久久视频一区二区| 91在线观看成人| 丝袜美腿亚洲综合| 欧美日韩精品三区| 麻豆国产精品官网| 国产精品―色哟哟| 高清国产一区二区| 一区二区三区免费网站| 99re免费视频精品全部| 亚洲国产美女搞黄色| 日韩一级高清毛片| 热久久免费视频| 亚洲一区视频在线| 精品人伦一区二区色婷婷| 亚洲图片欧美色图| 欧美人体做爰大胆视频| 日韩成人免费电影| 久久久精品日韩欧美| 色噜噜狠狠成人中文综合| 免费av成人在线| 中文字幕免费一区| 欧美日韩国产在线播放网站| 国产一区二区三区久久悠悠色av| 综合久久久久久久| 欧美成人激情免费网| 91在线免费播放| 久久99精品久久久| 亚洲一区二区三区免费视频| 精品少妇一区二区| 91久久一区二区| 国产成人av自拍| 日韩精彩视频在线观看| 国产女人aaa级久久久级| 717成人午夜免费福利电影| av电影一区二区| 国产成人亚洲综合a∨猫咪| 亚洲成人激情社区| 五月婷婷综合网| 国产日韩精品一区| 精品久久久久久久人人人人传媒 | 成人免费一区二区三区视频| 日韩欧美国产wwwww| 在线观看www91| 国产成a人无v码亚洲福利| 免费在线观看一区二区三区| 亚洲乱码中文字幕综合| 国产欧美精品在线观看| 精品国产区一区| 欧美日本乱大交xxxxx| 91色porny| 9i在线看片成人免费| 国产麻豆成人精品| 久久精品国产久精国产爱| 亚洲国产精品久久人人爱蜜臀| 精品福利在线导航| 日韩欧美亚洲另类制服综合在线| 欧美日韩不卡一区二区| 欧美一区二区三区精品| 欧美日韩国产免费一区二区| 成人美女在线视频| av中文一区二区三区| 视频一区二区中文字幕| 136国产福利精品导航| 国产精品久久久久永久免费观看| 久久免费国产精品| 久久精品人人爽人人爽| 久久美女艺术照精彩视频福利播放| 欧美一区二区免费视频| 欧美精品丝袜久久久中文字幕| 欧美日韩二区三区| 欧美日韩久久不卡| 日韩视频不卡中文| 色综合天天在线| 91色乱码一区二区三区| 91久久精品一区二区| 欧美视频一区在线观看| 欧美日韩国产免费一区二区| 日韩午夜av电影| 欧美二区乱c少妇| 欧美日韩国产精品成人| 欧美成人精品1314www| 中文字幕av一区 二区| 日韩理论电影院| 久久成人免费电影| 成人精品电影在线观看| 欧美老人xxxx18| 久久久五月婷婷| 亚洲精品视频在线| 蜜桃一区二区三区四区| 国产999精品久久久久久绿帽|