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

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

?? erc_do_p.c

?? TML的參考源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
***********************************************************************
* 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 
 *      erc_do_p.c
 *
 * \brief
 *      Inter (P) frame error concealment algorithms for decoder
 *
 *  \author
 *      - Viktor Varsa                     <viktor.varsa@nokia.com>
 *      - Ye-Kui Wang                   <wangy@cs.tut.fi>
 *
 *************************************************************************************
 */

#include <stdlib.h>
#include "mbuffer.h"
#include "global.h"
#include "memalloc.h"
#include "erc_do.h"

extern int erc_mvperMB;
struct img_par *erc_img;

/*!
 ************************************************************************
 * \brief
 *      The main function for Inter (P) frame concealment.
 * \return
 *      0, if the concealment was not successful and simple concealment should be used
 *      1, otherwise (even if none of the blocks were concealed)
 * \param recfr
 *      Reconstructed frame buffer
 * \param object_list
 *      Motion info for all MBs in the frame
 * \param picSizeX
 *      Width of the frame in pixels
 * \param picSizeY
 *      Height of the frame in pixels
 * \param errorVar   
 *      Variables for error concealment
 ************************************************************************
 */
int ercConcealInterFrame(frame *recfr, objectBuffer_t *object_list, 
                         int32 picSizeX, int32 picSizeY, ercVariables_t *errorVar ) 
{
  int lastColumn = 0, lastRow = 0, predBlocks[8];
  int lastCorruptedRow = -1, firstCorruptedRow = -1, currRow = 0, 
    row, column, columnInd, areaHeight = 0, i = 0;
  byte *predMB;
  
  /* if concealment is on */
  if ( errorVar && errorVar->concealment ) 
  {
    /* if there are segments to be concealed */
    if ( errorVar->nOfCorruptedSegments ) 
    {
      
      predMB = (byte *) malloc(DEF_REGION_SIZE);
      if ( predMB == NULL ) no_mem_exit("ercConcealInterFrame: predMB");
      
      lastRow = (int) (picSizeY>>4);
      lastColumn = (int) (picSizeX>>4);
      
      for ( columnInd = 0; columnInd < lastColumn; columnInd ++) 
      {
        
        column = ((columnInd%2) ? (lastColumn - columnInd/2 -1) : (columnInd/2));
        
        for ( row = 0; row < lastRow; row++) 
        {
          
          if ( errorVar->yCondition[MBxy2YBlock(column, row, 0, picSizeX)] <= ERC_BLOCK_CORRUPTED ) 
          {                           // ERC_BLOCK_CORRUPTED (1) or ERC_BLOCK_EMPTY (0)
            firstCorruptedRow = row;
            /* find the last row which has corrupted blocks (in same continuous area) */
            for ( lastCorruptedRow = row+1; lastCorruptedRow < lastRow; lastCorruptedRow++) 
            {
              /* check blocks in the current column */
              if (errorVar->yCondition[MBxy2YBlock(column, lastCorruptedRow, 0, picSizeX)] > ERC_BLOCK_CORRUPTED) 
              {
                /* current one is already OK, so the last was the previous one */
                lastCorruptedRow --;
                break;
              }
            }
            if ( lastCorruptedRow >= lastRow ) 
            {
              /* correct only from above */
              lastCorruptedRow = lastRow-1;
              for ( currRow = firstCorruptedRow; currRow < lastRow; currRow++ ) 
              {
                
                ercCollect8PredBlocks (predBlocks, (currRow<<1), (column<<1), 
                  errorVar->yCondition, (lastRow<<1), (lastColumn<<1), 2, 0);      
                
                if(erc_mvperMB >= MVPERMB_THR*(erc_img->mv_res+1))
                  concealByTrial(recfr, predMB, 
                    currRow*lastColumn+column, object_list, predBlocks, 
                    picSizeX, picSizeY,
                    errorVar->yCondition);
                else 
                  concealByCopy(recfr, currRow*lastColumn+column, 
                    object_list, picSizeX);
                
                ercMarkCurrMBConcealed (currRow*lastColumn+column, -1, picSizeX, errorVar);
              }
              row = lastRow;
            } 
            else if ( firstCorruptedRow == 0 ) 
            {
              /* correct only from below */
              for ( currRow = lastCorruptedRow; currRow >= 0; currRow-- ) 
              {
                
                ercCollect8PredBlocks (predBlocks, (currRow<<1), (column<<1), 
                  errorVar->yCondition, (lastRow<<1), (lastColumn<<1), 2, 0);      
                
                if(erc_mvperMB >= MVPERMB_THR*(erc_img->mv_res+1))
                  concealByTrial(recfr, predMB, 
                    currRow*lastColumn+column, object_list, predBlocks, 
                    picSizeX, picSizeY,
                    errorVar->yCondition);
                else 
                  concealByCopy(recfr, currRow*lastColumn+column, 
                    object_list, picSizeX);
                
                ercMarkCurrMBConcealed (currRow*lastColumn+column, -1, picSizeX, errorVar);
              }
              
              row = lastCorruptedRow+1;
            }
            else 
            {
              /* correct bi-directionally */
              
              row = lastCorruptedRow+1;
              
              areaHeight = lastCorruptedRow-firstCorruptedRow+1;
              
              /* 
              *  Conceal the corrupted area switching between the up and the bottom rows 
              */
              for ( i = 0; i < areaHeight; i++) 
              {
                if ( i % 2 ) 
                {
                  currRow = lastCorruptedRow;
                  lastCorruptedRow --;
                }
                else 
                {
                  currRow = firstCorruptedRow;
                  firstCorruptedRow ++; 
                }
                
                ercCollect8PredBlocks (predBlocks, (currRow<<1), (column<<1), 
                  errorVar->yCondition, (lastRow<<1), (lastColumn<<1), 2, 0);      
                
                if(erc_mvperMB >= MVPERMB_THR*(erc_img->mv_res+1))
                  concealByTrial(recfr, predMB, 
                    currRow*lastColumn+column, object_list, predBlocks, 
                    picSizeX, picSizeY,
                    errorVar->yCondition);
                else
                  concealByCopy(recfr, currRow*lastColumn+column, 
                    object_list, picSizeX);
                
                ercMarkCurrMBConcealed (currRow*lastColumn+column, -1, picSizeX, errorVar);
                
              }
            }
            lastCorruptedRow = -1;
            firstCorruptedRow = -1;
          }
        }
      }
    
      free(predMB);
    }
    return 1;
  }
  else
    return 0;
}

/*!
 ************************************************************************
 * \brief
 *      It conceals a given MB by simply copying the pixel area from the reference image 
 *      that is at the same location as the macroblock in the current image. This correcponds 
 *      to COPY MBs. 
 * \return
 *      Always zero (0).
 * \param recfr
 *      Reconstructed frame buffer
 * \param currMBNum
 *      current MB index
 * \param object_list
 *      Motion info for all MBs in the frame
 * \param picSizeX
 *      Width of the frame in pixels
 ************************************************************************
 */
static int concealByCopy(frame *recfr, int currMBNum,
  objectBuffer_t *object_list, int32 picSizeX)
{
  objectBuffer_t *currRegion;
   
  currRegion = object_list+(currMBNum<<2);
  currRegion->regionMode = REGMODE_INTER_COPY;
   
  currRegion->xMin = (xPosMB(currMBNum,picSizeX)<<4);
  currRegion->yMin = (yPosMB(currMBNum,picSizeX)<<4);
   
  copyBetweenFrames (recfr, MBNum2YBlock(currMBNum,0,picSizeX), picSizeX, 16);
   
  return 0;
}

/*!
 ************************************************************************
 * \brief
 *      Copies the co-located pixel values from the reference to the current frame. 
 *      Used by concealByCopy
 * \param recfr
 *      Reconstructed frame buffer
 * \param currYBlockNum
 *      index of the block (8x8) in the Y plane
 * \param picSizeX
 *      Width of the frame in pixels
 * \param regionSize      
 *      can be 16 or 8 to tell the dimension of the region to copy
 ************************************************************************
 */
static void copyBetweenFrames (frame *recfr, 
   int currYBlockNum, int32 picSizeX, int32 regionSize)
{
  int j, k, location, xmin, ymin;
   
  /* set the position of the region to be copied */
  xmin = (xPosYBlock(currYBlockNum,picSizeX)<<3);
  ymin = (yPosYBlock(currYBlockNum,picSizeX)<<3);
   
  for (j = ymin; j < ymin + regionSize; j++)
    for (k = xmin; k < xmin + regionSize; k++)
    {
      location = j * picSizeX + k; 
      recfr->yptr[location] = imgY[j][k];
    }
     
    for (j = ymin / 2; j < (ymin + regionSize) / 2; j++)
      for (k = xmin / 2; k < (xmin + regionSize) / 2; k++)
      {
        location = j * picSizeX / 2 + k;
        recfr->uptr[location] = imgUV[0][j][k];
        recfr->vptr[location] = imgUV[1][j][k];
      }                                
}

/*!
 ************************************************************************
 * \brief
 *      It conceals a given MB by using the motion vectors of one reliable neighbor. That MV of a 
 *      neighbor is selected wich gives the lowest pixel difference at the edges of the MB 
 *      (see function edgeDistortion). This corresponds to a spatial smoothness criteria.
 * \return
 *      Always zero (0).
 * \param recfr
 *      Reconstructed frame buffer
 * \param predMB
 *      memory area for storing temporary pixel values for a macroblock
 *      the Y,U,V planes are concatenated y = predMB, u = predMB+256, v = predMB+320
 * \param currMBNum
 *      current MB index
 * \param object_list
 *      array of region structures storing region mode and mv for each region
 * \param predBlocks
 *      status array of the neighboring blocks (if they are OK, concealed or lost)
 * \param picSizeX
 *      Width of the frame in pixels
 * \param picSizeY
 *      Height of the frame in pixels
 * \param yCondition
 *      array for conditions of Y blocks from ercVariables_t
 ************************************************************************
 */
static int concealByTrial(frame *recfr, byte *predMB, 
                          int currMBNum, objectBuffer_t *object_list, int predBlocks[], 
                          int32 picSizeX, int32 picSizeY, int *yCondition)
{
  int predMBNum, numMBPerLine,
      compSplit1, compSplit2, compLeft = 1, comp = 0, compPred, order = 1,
      fInterNeighborExists, numIntraNeighbours,
      fZeroMotionChecked, predSplitted = 0,
      threshold = ERC_BLOCK_OK,
      minDist, currDist, i, k, bestDir;
  int32 regionSize;
  objectBuffer_t *currRegion;
  int32 mvBest[3] , mvPred[3], *mvptr;
  
  numMBPerLine = (int) (picSizeX>>4);
  
  comp = 0;
  regionSize = 16;
  
  do 
  { /* 4 blocks loop */
    
    currRegion = object_list+(currMBNum<<2)+comp;
    
    /* set the position of the region to be concealed */
    
    currRegion->xMin = (xPosYBlock(MBNum2YBlock(currMBNum,comp,picSizeX),picSizeX)<<3);
    currRegion->yMin = (yPosYBlock(MBNum2YBlock(currMBNum,comp,picSizeX),picSizeX)<<3);
    
    do 
    { /* reliability loop */
      
      minDist = 0; fInterNeighborExists = 0; numIntraNeighbours = 0; fZeroMotionChecked = 0;
      
      /* loop the 4 neighbours */
      for (i = 4; i < 8; i++) 
      {
        
        /* if reliable, try it */
        if (predBlocks[i] >= threshold) 
        {
          switch (i) 
          {
          case 4:
            predMBNum = currMBNum-numMBPerLine;
            compSplit1 = 2;
            compSplit2 = 3;
            break;
              
          case 5:
            predMBNum = currMBNum-1;
            compSplit1 = 1;
            compSplit2 = 3;
            break;
              
          case 6:
            predMBNum = currMBNum+numMBPerLine;
            compSplit1 = 0;
            compSplit2 = 1;
            break;
              
          case 7:
            predMBNum = currMBNum+1;
            compSplit1 = 0;
            compSplit2 = 2;
            break;
          }
          
          /* try the concealment with the Motion Info of the current neighbour
          only try if the neighbour is not Intra */
          if (isBlock(object_list,predMBNum,compSplit1,INTRA) || 
            isBlock(object_list,predMBNum,compSplit2,INTRA))
          {            
            numIntraNeighbours++;
          } 
          else 
          {
            /* if neighbour MB is splitted, try both neighbour blocks */
            for (predSplitted = isSplitted(object_list, predMBNum), 
              compPred = compSplit1;
              predSplitted >= 0;
              compPred = compSplit2,
              predSplitted -= ((compSplit1 == compSplit2) ? 2 : 1)) 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影一区二区三区四区| 日韩国产精品大片| 青娱乐精品在线视频| 99综合影院在线| 精品国产一区二区三区四区四| 亚洲视频1区2区| 国产精品影视天天线| 国产精品你懂的| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 国内精品不卡在线| 91福利在线播放| 国产精品亲子乱子伦xxxx裸| 日本欧美肥老太交大片| 欧美又粗又大又爽| 中文乱码免费一区二区| 精品一区二区三区蜜桃| 3d动漫精品啪啪一区二区竹菊| 亚洲男人的天堂在线观看| 成人国产亚洲欧美成人综合网| 日韩一区二区电影| 日韩成人免费电影| 欧美精品v日韩精品v韩国精品v| 亚洲欧洲日产国产综合网| 福利电影一区二区| 国产亚洲成aⅴ人片在线观看 | 亚洲一区二区三区在线| 不卡的av网站| 国产欧美日韩中文久久| 国产一区美女在线| 精品av综合导航| 国产激情视频一区二区在线观看| 欧美www视频| 国产最新精品免费| 国产欧美视频一区二区| 国产91露脸合集magnet| 日本一区二区三区电影| 成人久久18免费网站麻豆 | 日韩午夜激情电影| 精品一区二区久久久| 亚洲免费视频中文字幕| 在线免费观看不卡av| 亚洲一二三级电影| 欧美一区二区在线视频| 免费成人在线视频观看| 久久久久一区二区三区四区| 国产精品一区二区视频| 中文字幕日韩一区| 欧美三级欧美一级| 久久精品国产亚洲5555| 久久久亚洲综合| 9久草视频在线视频精品| 亚洲最新在线观看| 日韩欧美一二三区| 国产一区二区三区日韩| 亚洲女人小视频在线观看| 欧美日韩亚洲综合在线| 麻豆91精品视频| 欧美极品另类videosde| 欧洲亚洲国产日韩| 久久精品国产在热久久| 欧美国产国产综合| 欧美日韩一区久久| 国产福利一区在线| 亚洲妇女屁股眼交7| 久久伊人中文字幕| 欧美在线观看一区二区| 国产在线视视频有精品| 一区二区三区在线视频免费| 精品国产乱码久久久久久免费| av中文字幕亚洲| 奇米在线7777在线精品| 最新欧美精品一区二区三区| 91精品国产综合久久国产大片| 成人午夜视频网站| 日韩不卡一二三区| 亚洲免费在线播放| 久久精品视频免费观看| 欧美一卡在线观看| 99精品1区2区| 国产一区二区成人久久免费影院 | 国产精品久久久久影院亚瑟| 欧美日韩一级黄| 91在线视频免费91| 久久激情综合网| 一区二区三区在线视频免费观看| 久久精品亚洲精品国产欧美kt∨| 欧美日韩你懂的| 成人动漫一区二区在线| 国模冰冰炮一区二区| 日韩高清国产一区在线| 亚洲美女区一区| 国产欧美精品一区二区色综合 | 国产麻豆精品视频| 日韩影院免费视频| 亚洲国产毛片aaaaa无费看| 久久精品亚洲乱码伦伦中文| 国产精品久久久久久户外露出| 日韩免费性生活视频播放| 91福利精品视频| av福利精品导航| 国产成人av影院| 国产精品自拍网站| 激情综合色综合久久综合| 天堂久久一区二区三区| 夜夜亚洲天天久久| 亚洲精品成a人| 国产精品麻豆一区二区| 欧美国产国产综合| 国产精品免费视频观看| 国产拍欧美日韩视频二区 | 日韩精品在线网站| 日韩欧美国产系列| 欧美精品色一区二区三区| 日本道精品一区二区三区| 97久久久精品综合88久久| 成人三级伦理片| aaa欧美日韩| 91免费版pro下载短视频| 不卡的电影网站| 91免费观看国产| 欧美最猛黑人xxxxx猛交| 色久综合一二码| 在线亚洲欧美专区二区| 欧美性生活大片视频| 在线一区二区视频| 欧美日韩国产一级| 日韩午夜三级在线| 精品免费视频一区二区| 久久香蕉国产线看观看99| 国产精品毛片无遮挡高清| 一区二区三区产品免费精品久久75| 亚洲精品第1页| 丝瓜av网站精品一区二区| 极品少妇xxxx精品少妇| 不卡电影一区二区三区| 在线免费精品视频| 日韩欧美区一区二| 精品乱人伦一区二区三区| 国产视频一区二区在线| 亚洲欧洲av色图| 日韩国产欧美在线播放| 国产不卡一区视频| 精品视频全国免费看| 久久综合色鬼综合色| 亚洲理论在线观看| 免费高清在线视频一区·| 国产91精品一区二区麻豆网站| 在线观看日韩毛片| 久久亚洲综合色一区二区三区| 亚洲视频一区二区在线观看| 麻豆精品新av中文字幕| 不卡一二三区首页| 91精品国产免费| 一区在线中文字幕| 裸体在线国模精品偷拍| 色婷婷亚洲精品| 久久精品人人做| 亚洲第一激情av| 丰满亚洲少妇av| 51精品国自产在线| 亚洲人成7777| 国产成人小视频| 日韩一区二区在线观看视频| 中文字幕在线观看不卡视频| 日韩av网站在线观看| eeuss影院一区二区三区| 亚洲欧美日韩国产另类专区| 欧美aaaaaa午夜精品| 色狠狠综合天天综合综合| 欧美精品一区在线观看| 亚洲国产aⅴ成人精品无吗| 99久久精品免费看国产 | 亚洲男人天堂一区| 国产乱妇无码大片在线观看| 88在线观看91蜜桃国自产| 亚洲另类一区二区| 成人激情校园春色| 久久色.com| 麻豆国产欧美一区二区三区| 欧美系列一区二区| 亚洲精品免费视频| 成人国产在线观看| 国产欧美精品区一区二区三区| 久久99日本精品| 日韩一区二区三区视频| 亚洲成人综合在线| 91豆麻精品91久久久久久| 亚洲视频一区二区在线| a级精品国产片在线观看| 亚洲国产精品二十页| 国产黄人亚洲片| 久久综合资源网| 精品在线免费视频| 精品国产制服丝袜高跟| 免费在线视频一区| 欧美变态tickle挠乳网站| 国精产品一区一区三区mba视频| 欧美电影精品一区二区 | 日韩电影在线免费| 在线成人午夜影院|