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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? macroblock.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*
***********************************************************************
* 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 macroblock.c
 *
 * \brief
 *     Decode a Macroblock
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com>
 *    - Rickard Sjoberg                 <rickard.sjoberg@era.ericsson.se>
 *    - Jani Lainema                     <jani.lainema@nokia.com>
 *    - Sebastian Purreiter             <sebastian.purreiter@mch.siemens.de>
 *    - Thomas Wedi                     <wedi@tnt.uni-hannover.de>
 *    - Detlev Marpe                      <marpe@hhi.de>
 *    - Gabi Blaettermann              <blaetter@hhi.de>
 *    - Ye-Kui Wang                      <wangy@cs.tut.fi>
 ***********************************************************************
*/

#include "contributors.h"

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

#include "global.h"
#include "mbuffer.h"
#include "elements.h"
#include "macroblock.h"


/*!
 ************************************************************************
 * \brief
 *    Checks the availability of neighboring macroblocks of
 *    the current macroblock for prediction and context determination;
 *    marks the unavailable MBs for intra prediction in the
 *    ipredmode-array by -1. Only neighboring MBs in the causal
 *    past of the current MB are checked.
 ************************************************************************
 */
void CheckAvailabilityOfNeighbors(struct img_par *img)
{
  int i,j;
  const int mb_width = img->width/MB_BLOCK_SIZE;
  const int mb_nr = img->current_mb_nr;
  Macroblock *currMB = &img->mb_data[mb_nr];

  // mark all neighbors as unavailable
  for (i=0; i<3; i++)
    for (j=0; j<3; j++)
      img->mb_data[mb_nr].mb_available[i][j]=NULL;
  img->mb_data[mb_nr].mb_available[1][1]=currMB; // current MB

  // Check MB to the left
  if(img->pix_x >= MB_BLOCK_SIZE)
  {
    int remove_prediction = currMB->slice_nr != img->mb_data[mb_nr-1].slice_nr;
    if(img->UseConstrainedIntraPred)
      remove_prediction = (remove_prediction || img->intra_mb[mb_nr-1] ==0);
    if(remove_prediction)
    {
      img->ipredmode[img->block_x][img->block_y+1] = -1;
      img->ipredmode[img->block_x][img->block_y+2] = -1;
      img->ipredmode[img->block_x][img->block_y+3] = -1;
      img->ipredmode[img->block_x][img->block_y+4] = -1;
    } else
      currMB->mb_available[1][0]=&(img->mb_data[mb_nr-1]);
  }


  // Check MB above
  if(img->pix_y >= MB_BLOCK_SIZE)
  {
    int remove_prediction = currMB->slice_nr != img->mb_data[mb_nr-mb_width].slice_nr;
    if(img->UseConstrainedIntraPred)
      remove_prediction = (remove_prediction || img->intra_mb[mb_nr-mb_width] ==0);
    if(remove_prediction)
    {
      img->ipredmode[img->block_x+1][img->block_y] = -1;
      img->ipredmode[img->block_x+2][img->block_y] = -1;
      img->ipredmode[img->block_x+3][img->block_y] = -1;
      img->ipredmode[img->block_x+4][img->block_y] = -1;
    } else
      currMB->mb_available[0][1]=&(img->mb_data[mb_nr-mb_width]);
  }

  // Check MB left above
  if(img->pix_x >= MB_BLOCK_SIZE && img->pix_y  >= MB_BLOCK_SIZE )
  {
    if(currMB->slice_nr == img->mb_data[mb_nr-mb_width-1].slice_nr)
      img->mb_data[mb_nr].mb_available[0][0]=&(img->mb_data[mb_nr-mb_width-1]);
  }

  // Check MB right above
  if(img->pix_y >= MB_BLOCK_SIZE && img->pix_x < (img->width-MB_BLOCK_SIZE ))
  {
    if(currMB->slice_nr == img->mb_data[mb_nr-mb_width+1].slice_nr)
      currMB->mb_available[0][2]=&(img->mb_data[mb_nr-mb_width+1]);
  }
}

/*!
 ************************************************************************
 * \brief
 *    initializes the current macroblock
 ************************************************************************
 */
void start_macroblock(struct img_par *img,struct inp_par *inp)
{
  int i,j,k,l;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  // WYK: Oct. 8, 2001, start ...
  // The following is moved and modified from exit_macroblock(), 
  // to make the decoding process correct when some macroblocks are lost
  /* Update coordinates of the current macroblock */
  img->mb_x = (img->current_mb_nr)%(img->width/MB_BLOCK_SIZE);
  img->mb_y = (img->current_mb_nr)/(img->width/MB_BLOCK_SIZE);
  
  /* Define vertical positions */
  img->block_y = img->mb_y * BLOCK_SIZE;      /* luma block position */
  img->pix_y   = img->mb_y * MB_BLOCK_SIZE;   /* luma macroblock position */
  img->pix_c_y = img->mb_y * MB_BLOCK_SIZE/2; /* chroma macroblock position */
  
  /* Define horizontal positions */
  img->block_x = img->mb_x * BLOCK_SIZE;      /* luma block position */
  img->pix_x   = img->mb_x * MB_BLOCK_SIZE;   /* luma pixel position */
  img->pix_c_x = img->mb_x * MB_BLOCK_SIZE/2; /* chroma pixel position */
  //WYK: Oct. 8, 2001, ... end

  // Save the slice number of this macroblock. When the macroblock below
  // is coded it will use this to decide if prediction for above is possible
  currMB->slice_nr = img->current_slice_nr;
  
  // If MB is next to a slice boundary, mark neighboring blocks unavailable for prediction
  CheckAvailabilityOfNeighbors(img);

  // Reset syntax element entries in MB struct
  currMB->mb_type = 0;
  currMB->ref_frame = 0;
  currMB->predframe_no = 0;
  currMB->delta_quant = 0;

  currMB->cbp     = 0;
  currMB->cbp_blk = 0;

  for (l=0; l < 2; l++)
    for (j=0; j < BLOCK_MULTIPLE; j++)
      for (i=0; i < BLOCK_MULTIPLE; i++)
        for (k=0; k < 2; k++)
          currMB->mvd[l][j][i][k] = 0;

  for (i=0; i < (BLOCK_MULTIPLE*BLOCK_MULTIPLE); i++)
    currMB->intra_pred_modes[i] = 0;
}

/*!
 ************************************************************************
 * \brief
 *    set coordinates of the next macroblock
 *    check end_of_slice condition (have to implement)
 ************************************************************************
 */
int exit_macroblock(struct img_par *img,struct inp_par *inp)
{
  const int number_mb_per_row = img->width / MB_BLOCK_SIZE ;
  Slice *currSlice = img->currentSlice;

  // Update coordinates of the next macroblock
  img->mb_x++;
  if (img->mb_x == number_mb_per_row) // next row of MBs
  {
    img->mb_x = 0; // start processing of next row
    img->mb_y++;
  }
  img->current_mb_nr++;

  // Define vertical positions
  img->block_y = img->mb_y * BLOCK_SIZE;      // luma block position
  img->pix_y   = img->mb_y * MB_BLOCK_SIZE;   // luma macroblock position
  img->pix_c_y = img->mb_y * MB_BLOCK_SIZE/2; // chroma macroblock position

  // Define horizontal positions
  img->block_x = img->mb_x * BLOCK_SIZE;      // luma block position
  img->pix_x   = img->mb_x * MB_BLOCK_SIZE;   // luma pixel position
  img->pix_c_x = img->mb_x * MB_BLOCK_SIZE/2; // chroma pixel position

  if (img->current_mb_nr == img->max_mb_nr)
  {
    if (currSlice->next_header != EOS)
      currSlice->next_header = SOP;
    return TRUE;
  }
  // ask for last mb in the slice  UVLC
  else
  {
    if(nal_startcode_follows(img, inp) == FALSE)
      return FALSE;
    if(img->type == INTRA_IMG || img->type == SP_IMG_1|| img->type == SP_IMG_MULT || inp->symbol_mode == CABAC)
      return TRUE;
    if(img->cod_counter<=0)
      return TRUE;
    return FALSE;
  }
}

/*!
 ************************************************************************
 * \brief
 *    Interpret the mb mode for P-Frames
 ************************************************************************
 */
void interpret_mb_mode_P(struct img_par *img)
{
  const int ICBPTAB[6] = {0,16,32,15,31,47};
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];


  currMB->intraOrInter           = INTER_MB ;

  if (img->mb_mode == INTRA_MB)   // 4x4 intra
  {
    currMB->intraOrInter         = INTRA_MB_4x4 ;
    currMB->mb_imode = img->imod = INTRA_MB_OLD ;
  }
  if (img->mb_mode > INTRA_MB)    // 16x16 intra
  {
    currMB->intraOrInter         = INTRA_MB_16x16 ;
    img->imod = currMB->mb_imode = INTRA_MB_NEW;     // mod0=img->mb_mode-1;kmod=mod0 & 3;cbp = ICBPTAB[mod0/4];
    currMB->intra_pred_modes[0] = (img->mb_mode - INTRA_MB-1) & 3;
    currMB->cbp = ICBPTAB[(img->mb_mode - INTRA_MB-1)>>2];
  }
  if (img->mb_mode < INTRA_MB)    // inter prediction mode (block shape)
    img->imod = currMB->mb_imode = INTRA_MB_INTER;   // intra in inter frame
}

/*!
 ************************************************************************
 * \brief
 *    Interpret the mb mode for I-Frames
 ************************************************************************
 */
void interpret_mb_mode_I(struct img_par *img)
{
  const int ICBPTAB[6] = {0,16,32,15,31,47};
  Macroblock *currMB   = &img->mb_data[img->current_mb_nr];

  if (img->mb_mode == 0)
  {
    currMB->intraOrInter         = INTRA_MB_4x4 ;
    img->imod = currMB->mb_imode = INTRA_MB_OLD;     // 4x4 intra
  }
  else
  {
    currMB->intraOrInter         = INTRA_MB_16x16 ;
    img->imod = currMB->mb_imode = INTRA_MB_NEW;     // 16x16 intra */ /* mod0=img->mb_mode-1;kmod=mod0 & 3;cbp = ICBPTAB[mod0/4];
    currMB->intra_pred_modes[0] = (img->mb_mode - 1) & 3;
    currMB->cbp = ICBPTAB[(img->mb_mode - 1)>>2];
  }
}

/*!
 ************************************************************************
 * \brief
 *    Interpret the mb mode for B-Frames
 ************************************************************************
 */
void interpret_mb_mode_B(struct img_par *img)
{
  const int ICBPTAB[6] = {0,16,32,15,31,47};
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  currMB->intraOrInter         = INTER_MB ;
  if (img->mb_mode == INTRA_MB_B) // 4x4 intra
  {
    currMB->intraOrInter         = INTRA_MB_4x4 ;
    img->imod = currMB->mb_imode = INTRA_MB_OLD;
  }
  if (img->mb_mode > INTRA_MB_B)  // 16x16 intra
  {
    currMB->intraOrInter         = INTRA_MB_16x16 ;
    img->imod = currMB->mb_imode = INTRA_MB_NEW;
    currMB->intra_pred_modes[0] = (img->mb_mode - INTRA_MB_B-1) & 3;
    currMB->cbp = ICBPTAB[(img->mb_mode - INTRA_MB_B-1)>>2];
  }

  if (img->mb_mode < INTRA_MB_B)
  {
    if(img->mb_mode == 0)
      img->imod = currMB->mb_imode = B_Direct;
    else if(img->mb_mode == 3)
      img->imod = currMB->mb_imode = B_Bidirect;
    else if(img->mb_mode==1 || (img->mb_mode>3 && img->mb_mode%2==0))
      img->imod = currMB->mb_imode = B_Forward;
    else if(img->mb_mode==2 || (img->mb_mode>4 && img->mb_mode%2==1))
      img->imod = currMB->mb_imode = B_Backward;
  }
}

/*!
 ************************************************************************
 * \brief
 *    init macroblock I and P frames
 ************************************************************************
 */
void init_macroblock(struct img_par *img)
{
  int i,j;
  int predframe_no;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  img->mv[img->block_x+4][img->block_y][2]=img->number;

  for (i=0;i<BLOCK_SIZE;i++)
  {                           // reset vectors and pred. modes
    for(j=0;j<BLOCK_SIZE;j++)
    {
      img->mv[img->block_x+i+4][img->block_y+j][0] = 0;
      img->mv[img->block_x+i+4][img->block_y+j][1] = 0;
      img->ipredmode[img->block_x+i+1][img->block_y+j+1] = 0;
    }
  }

  currMB->ref_frame = 0;
  currMB->predframe_no = predframe_no = 0;// g.b.1;

  // Set the reference frame information for motion vector prediction
  if (img->imod == INTRA_MB_OLD || img->imod == INTRA_MB_NEW)
    for (j = 0;j < BLOCK_SIZE;j++)
      for (i = 0;i < BLOCK_SIZE;i++)
        refFrArr[img->block_y+j][img->block_x+i] = -1;
  else
    for (j = 0;j < BLOCK_SIZE;j++)
      for (i = 0;i < BLOCK_SIZE;i++)
        refFrArr[img->block_y+j][img->block_x+i] = predframe_no;
}

/*!
 ************************************************************************
 * \brief
 *    Get the syntax elements from the NAL
 ************************************************************************
 */
int read_one_macroblock(struct img_par *img,struct inp_par *inp)
{
  int i, i1, j1;

  SyntaxElement currSE;
  Macroblock *currMB = &img->mb_data[img->current_mb_nr];

  Slice *currSlice = img->currentSlice;
  DataPartition *dP;
  int *partMap = assignSE2partition[currSlice->dp_mode];

  int dbl_ipred_word;

  currMB->qp           = img->qp ;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
石原莉奈在线亚洲三区| 亚洲色图视频免费播放| 久久电影网电视剧免费观看| 欧美一区二区三区日韩| 久久国产人妖系列| 国产视频一区在线观看| 99v久久综合狠狠综合久久| 亚洲国产婷婷综合在线精品| 日韩欧美亚洲国产另类| 国产在线国偷精品免费看| 国产精品乱子久久久久| 欧美亚洲一区三区| 蜜桃久久久久久久| 欧美精彩视频一区二区三区| 一本色道久久综合亚洲91| 无吗不卡中文字幕| 国产日韩精品一区二区三区| 91在线观看下载| 美女网站一区二区| 中文字幕色av一区二区三区| 欧美日韩1234| 国产99久久久国产精品免费看| 亚洲精品成人悠悠色影视| 精品奇米国产一区二区三区| 91小视频在线免费看| 久久成人免费网| 亚洲美女在线一区| 久久综合久色欧美综合狠狠| 色猫猫国产区一区二在线视频| 蜜臀99久久精品久久久久久软件| 中文字幕中文字幕中文字幕亚洲无线| 欧美日韩三级一区| 懂色av噜噜一区二区三区av| 丝袜亚洲另类欧美| 国产精品久久久久永久免费观看| 欧美一级夜夜爽| 欧美中文字幕一区二区三区| 国产福利一区二区三区视频| 五月综合激情婷婷六月色窝| 亚洲欧洲一区二区三区| 精品福利一区二区三区| 欧美日韩中文一区| 色综合天天综合在线视频| 国产麻豆午夜三级精品| 日本午夜一区二区| 亚洲国产精品自拍| 亚洲人精品午夜| 欧美激情一区二区三区四区| 日韩区在线观看| 欧美挠脚心视频网站| 91精品办公室少妇高潮对白| 成人黄色小视频| 国产一区二区在线电影| 日本欧美加勒比视频| 一区二区久久久| 亚洲视频在线一区观看| 中文字幕不卡三区| 久久久国产精品午夜一区ai换脸| 日韩欧美美女一区二区三区| 91精品国产色综合久久不卡电影 | 亚洲激情欧美激情| 国产日韩亚洲欧美综合| 久久蜜桃香蕉精品一区二区三区| 51精品国自产在线| 91精品国产综合久久蜜臀| 精品视频一区二区不卡| 欧美亚洲国产一区在线观看网站 | 国产精品你懂的| 国产亚洲欧美色| 中文字幕欧美区| 亚洲国产精品成人综合色在线婷婷 | 日韩免费高清av| 在线电影国产精品| 欧美一级高清片| 日韩欧美成人午夜| 精品久久一区二区| 26uuu欧美| 国产视频一区在线播放| 国产精品女人毛片| 亚洲精品国产一区二区三区四区在线| 亚洲免费在线电影| 午夜久久久久久久久久一区二区| 日韩不卡一区二区| 精品午夜久久福利影院| 国产成人亚洲精品青草天美| 国产精品综合一区二区三区| 国产99久久久国产精品潘金| 9i在线看片成人免费| 99re在线精品| 欧美美女激情18p| 91精品国产综合久久精品性色 | 欧美日韩国产一二三| 欧美一区二区三区在线观看| 国产日韩欧美在线一区| 国产精品福利电影一区二区三区四区| 亚洲日穴在线视频| 日韩电影在线免费| 国产成人精品免费| 色一情一乱一乱一91av| 欧美精品在线观看播放| 久久综合九色综合97婷婷女人 | 精品成人一区二区三区| 久久久精品tv| 亚洲精品国产品国语在线app| 日韩综合在线视频| 国产福利电影一区二区三区| 欧美在线观看18| 久久久99久久精品欧美| 亚洲精品免费在线| 久久精品国产秦先生| 99精品在线免费| 日韩午夜精品电影| 国产精品天干天干在线综合| 丝袜亚洲精品中文字幕一区| 国产福利91精品| 欧美色成人综合| 国产亚洲制服色| 五月婷婷激情综合| 成人网页在线观看| 欧美精品一卡二卡| 国产精品久久久久久久久免费樱桃 | 欧美日韩综合在线免费观看| 国产亚洲欧美日韩俺去了| 亚洲一区二区精品3399| 国产成人精品免费| 91精品国产一区二区三区香蕉| 中文字幕视频一区| 激情综合五月天| 欧美日韩成人高清| 亚洲欧美色图小说| 成人一道本在线| 欧美大尺度电影在线| 亚洲小说春色综合另类电影| 成人免费av在线| 久久综合九色综合久久久精品综合| 亚洲成国产人片在线观看| 成人av电影在线播放| 欧美videos中文字幕| 婷婷激情综合网| 91久久线看在观草草青青| 久久综合九色综合97婷婷女人| 日本亚洲免费观看| 欧美日韩大陆一区二区| 一卡二卡三卡日韩欧美| 日韩欧美久久久| 天堂久久一区二区三区| 欧美在线观看禁18| 悠悠色在线精品| 色天使色偷偷av一区二区| 国产精品毛片a∨一区二区三区| 国产一区二区不卡| 日韩三级视频在线看| 男人的天堂久久精品| 欧美日韩国产综合久久| 午夜精品久久久久久| 欧美日韩一区精品| 亚洲成人一区在线| 欧美日韩精品专区| 午夜精品视频在线观看| 欧美精品欧美精品系列| 三级欧美在线一区| 日韩一级大片在线| 久久国产尿小便嘘嘘| 精品国产凹凸成av人网站| 久久99久久久久久久久久久| 精品成人一区二区| 国产盗摄一区二区| 中文字幕高清不卡| 91在线看国产| 亚洲高清三级视频| 欧美精品一卡二卡| 久久99精品国产麻豆婷婷洗澡| 精品国产免费人成电影在线观看四季 | 欧美成人午夜电影| 国产尤物一区二区| 中文字幕精品在线不卡| 99国产精品国产精品毛片| 亚洲精品视频免费观看| 欧美日韩综合不卡| 蜜桃视频一区二区三区| 久久久精品2019中文字幕之3| 成人动漫一区二区| 亚洲成av人片在线观看无码| 91麻豆精品国产91久久久资源速度 | 日韩欧美亚洲一区二区| 国产传媒一区在线| 亚洲天堂中文字幕| 777xxx欧美| 国产精品小仙女| 一区二区三区在线视频播放| 91精品一区二区三区久久久久久| 狠狠久久亚洲欧美| 亚洲另类在线制服丝袜| 7777精品伊人久久久大香线蕉完整版| 91浏览器打开| 精品亚洲国产成人av制服丝袜| 中国色在线观看另类| 欧美日韩国产首页在线观看| 国产成人免费视频精品含羞草妖精| 亚洲欧洲成人精品av97|