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

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

?? cabac.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
  int i = img->subblock_x;
  int j = img->subblock_y;
  int a, b;
  int act_ctx, act_ctx1;
  int act_sym;
  int mv_local_err;
  int mv_sign;
  int backward = se->value2 & 0x01;
  int k = (se->value2>>1); // MVD component

  MotionInfoContexts *ctx = img->currentSlice->mot_ctx;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  if(backward == 0)
  {
    step_h=img->fw_blc_size_h/BLOCK_SIZE;  // horizontal stepsize
    step_v=img->fw_blc_size_v/BLOCK_SIZE;  // vertical stepsize
  }
  else
  {
    step_h=img->bw_blc_size_h/BLOCK_SIZE;  // horizontal stepsize
    step_v=img->bw_blc_size_v/BLOCK_SIZE;  // vertical stepsize
  }

  if (j==0)
  {
    if (currMB->mb_available[0][1] == NULL)
      b = 0;
    else
      b = absm((currMB->mb_available[0][1])->mvd[backward][BLOCK_SIZE-1][i][k]);
  }
  else
    b = absm(currMB->mvd[backward][j-step_v][i][k]);

  if (i==0)
  {
    if (currMB->mb_available[1][0] == NULL)
      a = 0;
    else
      a = absm((currMB->mb_available[1][0])->mvd[backward][j][BLOCK_SIZE-1][k]);
  }
  else
    a = absm(currMB->mvd[backward][j][i-step_h][k]);

  if ((mv_local_err=a+b)<3)
    act_ctx = 5*k;
  else
  {
    if (mv_local_err>32)
      act_ctx=5*k+3;
    else
      act_ctx=5*k+2;
  }
  se->context = act_ctx;

  act_ctx1 = act_ctx;

  act_sym = biari_decode_symbol(dep_dp,&ctx->mv_res_contexts[0][act_ctx] );

  if (act_sym != 0)
  {
    act_ctx = 5*k+4;
    mv_sign = biari_decode_symbol(dep_dp, &ctx->mv_res_contexts[1][act_ctx] );
    act_ctx=5*k;
    act_sym = unary_mv_decode(dep_dp,ctx->mv_res_contexts[1]+act_ctx,3);
    act_sym++;

    if(mv_sign)
      act_sym = -act_sym;
  }
  se->value1 = act_sym;

#if TRACE
  fprintf(p_trace, "@%d      %s\t\t\t%3d \n",symbolCount++, se->tracestring, se->value1);
  fflush(p_trace);
#endif
}


/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode the forward
 *    or backward bidirectional blocksize (for B frames only)
 ************************************************************************
 */
void readBiDirBlkSize2Buffer_CABAC( SyntaxElement *se,
                                    struct inp_par *inp,
                                    struct img_par *img,
                                    DecodingEnvironmentPtr dep_dp)
{
  int act_ctx;
  MotionInfoContexts *ctx = img->currentSlice->mot_ctx;

  act_ctx=4;

  // using the context models of mb_type
  se->value1 = unary_bin_max_decode(dep_dp,ctx->mb_type_contexts[1]+act_ctx,1,6);

#if TRACE
  fprintf(p_trace, "@%d%s\t\t\t%3d\n",symbolCount++, se->tracestring, se->value1);
  fflush(p_trace);
#endif
}


/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode the macroblock
 *    type info of a given MB.
 ************************************************************************
 */
void readMB_typeInfoFromBuffer_CABAC( SyntaxElement *se,
                                      struct inp_par *inp,
                                      struct img_par *img,
                                      DecodingEnvironmentPtr dep_dp)
{
  int a, b;
  int act_ctx;
  int act_sym;
  int log_sym;
  int bin_sym;
  int mode_sym;
  int ct = 0;

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

  int curr_mb_type;

  if(img->type == INTRA_IMG)  // INTRA-frame
  {
    if (currMB->mb_available[0][1] == NULL)
      b = 0;
    else
      b = (( (currMB->mb_available[0][1])->mb_type != 0) ? 1 : 0 );
    if (currMB->mb_available[1][0] == NULL)
      a = 0;
    else
      a = (( (currMB->mb_available[1][0])->mb_type != 0) ? 1 : 0 );

    act_ctx = a + b;
    act_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx);
    se->context = act_ctx; // store context

    if (act_sym==0) // 4x4 Intra
      curr_mb_type = act_sym;
    else // 16x16 Intra
    {
      act_sym = 1;
      act_ctx = 4;
      mode_sym =  biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx ); // decoding of AC/no AC
      act_sym += mode_sym*12;
      act_ctx = 5;
      // decoding of cbp: 0,1,2
        mode_sym =  biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx );
      if (mode_sym!=0)
      {
        act_ctx=6;
        mode_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx );
        act_sym+=4;
        if (mode_sym!=0)
            act_sym+=4;
          }
        // decoding of I pred-mode: 0,1,2,3
        act_ctx = 7;
        mode_sym =  biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx );
        act_sym += mode_sym*2;
        act_ctx = 8;
        mode_sym =  biari_decode_symbol(dep_dp, ctx->mb_type_contexts[0] + act_ctx );
        act_sym += mode_sym;
        curr_mb_type = act_sym;
    }
  }
  else
  {
    ct = 1;
    if (currMB->mb_available[0][1] == NULL)
      b = 0;
    else
      b = (( (currMB->mb_available[0][1])->mb_type != 0) ? 1 : 0 );
    if (currMB->mb_available[1][0] == NULL)
      a = 0;
    else
      a = (( (currMB->mb_available[1][0])->mb_type != 0) ? 1 : 0 );

      act_ctx = a + b;

      // decode unary part
    log_sym = biari_decode_symbol(dep_dp, &ctx->mb_type_contexts[1][act_ctx] );

    if (log_sym != 0)
    {
      act_ctx=4;
      log_sym=0;
      do
      {
        act_sym = biari_decode_symbol(dep_dp, &ctx->mb_type_contexts[1][act_ctx] );
        if (log_sym==0) act_ctx=5;
        log_sym++;
      }
      while ( (act_sym!=0) && (log_sym<2+((img->type == B_IMG_1 || img->type == B_IMG_MULT)?1:0)));
      if( (act_sym!=0) && (log_sym==2+((img->type == B_IMG_1 || img->type == B_IMG_MULT)?1:0))  )
        log_sym++;
    }
    act_sym = (1<<log_sym);


    // decode binary part
    if (log_sym!=0)
    {
      act_ctx=6;
      if (log_sym==(3+((img->type == B_IMG_1 || img->type == B_IMG_MULT)?1:0)) ) log_sym=2; // only 2 LSBs are actually set for mode 7-9 (P-frame) or 15-17 (B-frame)
        bin_sym=0;
      do
      {
        log_sym--;
        bin_sym <<=1;
        bin_sym |=  (biari_decode_symbol(dep_dp,  &ctx->mb_type_contexts[1][act_ctx] ));
      }
      while (log_sym!=0);
      act_sym += bin_sym;
    }
    act_sym--;

    if (act_sym<=8 || (((img->type == B_IMG_1 || img->type == B_IMG_MULT)?1:0) && act_sym<=16))
      curr_mb_type = act_sym;
    else  // additional info for 16x16 Intra-mode
    {
      act_ctx = 7;
      mode_sym =  biari_decode_symbol(dep_dp, ctx->mb_type_contexts[1] + act_ctx ); // decoding of AC/no AC
      act_sym += mode_sym*12;

      // decoding of cbp: 0,1,2
      act_ctx = 8;
      mode_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[1] + act_ctx );
      if (mode_sym != 0)
      {
        act_sym+=4;
        mode_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[1] + act_ctx );
        if (mode_sym != 0)
          act_sym+=4;
      }

      // decoding of I pred-mode: 0,1,2,3
      act_ctx = 9;
      mode_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[1] + act_ctx );
      act_sym += mode_sym*2;
      mode_sym = biari_decode_symbol(dep_dp, ctx->mb_type_contexts[1] + act_ctx );
      act_sym += mode_sym;
      curr_mb_type = act_sym;
    }
  }
    se->value1 = curr_mb_type;

#if TRACE
    fprintf(p_trace, "@%d%s\t\t\t%3d\n",symbolCount++, se->tracestring, se->value1);
    fflush(p_trace);
#endif
}

/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode a pair of
 *    intra prediction modes of a given MB.
 ************************************************************************
 */
void readIntraPredModeFromBuffer_CABAC( SyntaxElement *se,
                                        struct inp_par *inp,
                                        struct img_par *img,
                                        DecodingEnvironmentPtr dep_dp)
{
  static int prev_sym = 0;
  static int count = 0; // to detect a new row of intra prediction modes

  TextureInfoContexts *ctx = img->currentSlice->tex_ctx;

  if (count % 2 == 0)
    prev_sym = 0;

  se->value1 = unary_bin_max_decode(dep_dp,ctx->ipr_contexts[prev_sym],1,5);
  prev_sym = se->value1;
  se->value2 = unary_bin_max_decode(dep_dp,ctx->ipr_contexts[prev_sym],1,5);
  prev_sym = se->value2;


  if(++count == MB_BLOCK_SIZE/2) // all modes of one MB have been processed
    count=0;

#if TRACE
  fprintf(p_trace, "@%d%s\t\t\t%3d\n",symbolCount++, se->tracestring, se->value1);
  fflush(p_trace);
#endif

}

/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode the reference
 *    parameter of a given MB.
 ************************************************************************
 */
void readRefFrameFromBuffer_CABAC(  SyntaxElement *se,
                                    struct inp_par *inp,
                                    struct img_par *img,
                                    DecodingEnvironmentPtr dep_dp)
{
  MotionInfoContexts *ctx = img->currentSlice->mot_ctx;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  int a, b;
  int act_ctx;
  int act_sym;

  if (currMB->mb_available[0][1] == NULL)
    b = 0;
  else
      b = ( ((currMB->mb_available[0][1])->predframe_no != 0) ? 1 : 0);
  if (currMB->mb_available[1][0] == NULL)
    a = 0;
  else
      a = ( ((currMB->mb_available[1][0])->predframe_no != 0) ? 1 : 0);
  act_ctx = a + 2*b;
  se->context = act_ctx; // store context

  act_sym = biari_decode_symbol(dep_dp,ctx->ref_no_contexts + act_ctx );

  if (act_sym != 0)
  {
    act_ctx = 4;
    act_sym = unary_bin_decode(dep_dp,ctx->ref_no_contexts+act_ctx,1);
    act_sym++;
  }
  se->value1 = act_sym;

#if TRACE
  fprintf(p_trace, "@%d%s\t\t\t%3d",symbolCount++, se->tracestring, se->value1);
  fprintf(p_trace," c: %d :%d \n",ctx->ref_no_contexts[act_ctx].cum_freq[0],ctx->ref_no_contexts[act_ctx].cum_freq[1]);
  fflush(p_trace);
#endif
}

/*!
 ************************************************************************
 * \brief
 *    This function is used to arithmetically decode the motion
 *    vector data of a given MB.
 ************************************************************************
 */
void readMVDFromBuffer_CABAC(SyntaxElement *se,
                             struct inp_par *inp,
                             struct img_par *img,
                             DecodingEnvironmentPtr dep_dp)
{
  int step_h, step_v;
  int i = img->subblock_x;
  int j = img->subblock_y;
  int a, b;
  int act_ctx;
  int act_sym;
  int mv_pred_res;
  int mv_local_err;
  int mv_sign;
  int k = se->value2; // MVD component

  MotionInfoContexts *ctx = img->currentSlice->mot_ctx;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  step_h=BLOCK_STEP[img->mb_mode][0];
  step_v=BLOCK_STEP[img->mb_mode][1];

  if (j==0)
  {
    if (currMB->mb_available[0][1] == NULL)
      b = 0;
    else
      b = absm((currMB->mb_available[0][1])->mvd[0][BLOCK_SIZE-1][i][k]);
  }
  else
    b = absm(currMB->mvd[0][j-step_v][i][k]);

  if (i==0)
  {
    if (currMB->mb_available[1][0] == NULL)
      a = 0;
    else
      a = absm((currMB->mb_available[1][0])->mvd[0][j][BLOCK_SIZE-1][k]);
  }
  else
    a = absm(currMB->mvd[0][j][i-step_h][k]);

  if ((mv_local_err=a+b)<3)
    act_ctx = 5*k;
  else
  {
    if (mv_local_err>32)
      act_ctx=5*k+3;
    else
      act_ctx=5*k+2;
  }
    se->context = act_ctx;

    act_sym = biari_decode_symbol(dep_dp, &ctx->mv_res_contexts[0][act_ctx] );

    if (act_sym == 0)
        mv_pred_res = 0;
    else
    {
  
        act_ctx=5*k;
        act_sym = unary_mv_decode(dep_dp,ctx->mv_res_contexts[1]+act_ctx,3);
        act_sym++;
        act_ctx=5*k+4;
        mv_sign = biari_decode_symbol(dep_dp,&ctx->mv_res_contexts[1][act_ctx] );

        mv_pred_res = ((mv_sign != 0) ? (-act_sym) : act_sym);
    }
    se->value1 = mv_pred_res;

#if TRACE
    fprintf(p_trace, "@%d%s\t\t\t%3d\n",symbolCount++, se->tracestring, se->value1);
    fflush(p_trace);
#endif
}

/*!
 ************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99精品久久久| 久久99精品久久久久婷婷| 日韩精品五月天| 国产精品亚洲一区二区三区在线| 91亚洲精品乱码久久久久久蜜桃| 欧美一区二区三区爱爱| 亚洲视频免费观看| 国产一区二区伦理片| 精品视频999| 中文字幕不卡的av| 精品一区二区精品| 欧美日韩黄色影视| 一区二区三区毛片| 99麻豆久久久国产精品免费| 亚洲精品一区二区三区精华液 | 欧美激情一区二区在线| 欧美aa在线视频| 欧美三级电影在线看| 亚洲日本在线天堂| av电影天堂一区二区在线| 2021国产精品久久精品| 日本成人在线视频网站| 欧美性一二三区| 亚洲精品videosex极品| av在线不卡网| 亚洲欧洲另类国产综合| 国产成人综合网站| 久久日韩精品一区二区五区| 久久精品国产第一区二区三区| 欧美日韩精品欧美日韩精品| 夜夜嗨av一区二区三区网页 | 激情欧美日韩一区二区| 91精品国产综合久久国产大片 | 亚洲亚洲精品在线观看| www.av精品| 最新中文字幕一区二区三区 | 在线不卡免费欧美| 午夜视频在线观看一区二区| 欧美精品一卡两卡| 奇米色777欧美一区二区| 欧美一级免费观看| 久久av中文字幕片| 精品国产自在久精品国产| 国产自产高清不卡| 中文字幕国产一区二区| 色婷婷综合久久| 亚洲午夜免费福利视频| 56国语精品自产拍在线观看| 日本va欧美va精品| 国产偷国产偷亚洲高清人白洁 | 亚洲天堂免费在线观看视频| 91女人视频在线观看| 亚洲欧美激情视频在线观看一区二区三区 | 欧美自拍偷拍午夜视频| 五月天国产精品| 精品国产一区二区三区忘忧草 | 国产婷婷色一区二区三区| 国产精品18久久久久久久久 | www精品美女久久久tv| 国产成人精品亚洲日本在线桃色 | 26uuu成人网一区二区三区| 国产成人在线视频网址| 亚洲男人的天堂在线观看| 欧美日韩一本到| 国产在线一区观看| 亚洲欧美二区三区| 91精品国产一区二区三区香蕉| 国产很黄免费观看久久| 一区二区在线观看免费视频播放| 6080午夜不卡| 99久久精品久久久久久清纯| 五月婷婷另类国产| 国产精品天干天干在线综合| 欧美日韩视频在线观看一区二区三区 | 欧美国产精品专区| 欧美性大战久久久| 国产精品一区三区| 午夜av电影一区| 日本一区二区在线不卡| 在线观看91av| 色先锋资源久久综合| 国内成人自拍视频| 亚洲成人av中文| 国产精品免费久久| 日韩精品一区二区在线| 日本精品裸体写真集在线观看| 激情综合色丁香一区二区| 亚洲一区在线观看网站| 国产日产欧产精品推荐色| 欧美酷刑日本凌虐凌虐| 91麻豆精品在线观看| 国产精品一区二区久久不卡| 日韩电影在线一区| 亚洲精品国产精华液| 欧美国产日韩亚洲一区| 日韩免费高清视频| 欧洲在线/亚洲| 99精品热视频| 丁香六月综合激情| 国产东北露脸精品视频| 韩国v欧美v亚洲v日本v| 日韩av电影免费观看高清完整版| 一区二区三区日韩精品| 国产精品蜜臀av| 国产蜜臀97一区二区三区| 久久久美女毛片| 久久影院视频免费| 精品嫩草影院久久| 精品精品国产高清a毛片牛牛 | 成人禁用看黄a在线| 国产美女在线精品| 国内精品伊人久久久久影院对白| 日本女人一区二区三区| 日韩黄色片在线观看| 天堂在线一区二区| 日韩av在线播放中文字幕| 午夜精品久久一牛影视| 亚洲va在线va天堂| 香蕉av福利精品导航| 一区二区三区**美女毛片| 依依成人综合视频| 亚洲一二三四区不卡| 污片在线观看一区二区| 丝袜美腿亚洲色图| 蜜臀久久久久久久| 激情小说欧美图片| 成人听书哪个软件好| 97成人超碰视| 欧美视频一区二区三区在线观看| 欧美日韩国产综合视频在线观看| 在线不卡一区二区| 精品日本一线二线三线不卡| www国产精品av| 中文字幕一区二区三区在线观看| 中文字幕在线观看一区二区| 一区二区视频在线| 欧美aaaaaa午夜精品| 国产一二三精品| 91啪亚洲精品| 91精品婷婷国产综合久久| 26uuu久久天堂性欧美| 国产精品美日韩| 五月婷婷激情综合| 国产毛片精品一区| 日本韩国欧美在线| 欧美一区二视频| 国产人伦精品一区二区| 亚洲一区二区五区| 韩国理伦片一区二区三区在线播放 | 免费观看久久久4p| 国产精品自在欧美一区| 一本色道综合亚洲| 日韩一级片在线观看| 中文字幕av一区二区三区| 亚洲高清视频在线| 成人午夜在线播放| 欧美性大战久久| 国产精品丝袜91| 日韩va欧美va亚洲va久久| 成人h精品动漫一区二区三区| 欧美中文字幕不卡| 久久色在线视频| 午夜久久久久久久久| 成人aaaa免费全部观看| 在线成人av影院| 一区二区三区免费观看| 国产精一区二区三区| 91精选在线观看| 亚洲精品videosex极品| 国产91富婆露脸刺激对白| 91精品国产综合久久婷婷香蕉| 国产精品国产三级国产a| 美女精品自拍一二三四| 欧美亚洲国产bt| 国产精品午夜在线观看| 久久69国产一区二区蜜臀| 欧美亚洲一区二区在线观看| 国产精品欧美极品| 激情综合网天天干| 日韩欧美综合在线| 性感美女极品91精品| 色综合欧美在线视频区| 亚洲欧洲日本在线| 成人免费高清视频| 国产精品久久久久一区二区三区| 国内外精品视频| 日韩一区二区不卡| 免费观看一级欧美片| 56国语精品自产拍在线观看| 亚洲一区视频在线观看视频| 99久久99久久精品免费观看| 中文字幕av免费专区久久| 国产高清不卡一区| 国产亚洲欧美激情| 国产一区二区影院| 久久精品一区蜜桃臀影院| 国内精品嫩模私拍在线| 久久久三级国产网站| 国产成人亚洲综合a∨猫咪| 久久久久9999亚洲精品|