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

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

?? 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)) 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人动漫av| 国产精品区一区二区三区| 99re热视频精品| 国产精品小仙女| 美腿丝袜亚洲一区| 一区二区三区在线观看国产 | 色综合天天综合| 国产不卡在线播放| 国产成人午夜电影网| 国产乱子轮精品视频| 国产乱妇无码大片在线观看| 国产电影精品久久禁18| 懂色av噜噜一区二区三区av| 成人午夜在线播放| 97国产一区二区| 在线观看国产精品网站| 欧美色图激情小说| 3atv在线一区二区三区| 日韩一级黄色片| 精品国产91乱码一区二区三区| 欧美精品一区二| 中文字幕第一区综合| 亚洲天堂免费看| 亚洲国产精品麻豆| 奇米777欧美一区二区| 久久99精品国产| 国产麻豆成人精品| 99久精品国产| 91高清在线观看| 欧美一卡在线观看| 欧美激情综合五月色丁香小说| 亚洲三级在线免费| 日韩av电影免费观看高清完整版在线观看 | 884aa四虎影成人精品一区| 欧美一区二区视频免费观看| 人人狠狠综合久久亚洲| 日韩激情av在线| 国内偷窥港台综合视频在线播放| 国产高清不卡一区二区| 色香蕉久久蜜桃| 日韩一级免费一区| 中文字幕日韩一区| 成人在线视频一区| 欧美色成人综合| 日韩免费高清av| 久久九九全国免费| 亚洲精品中文字幕乱码三区| 免费看黄色91| av不卡在线播放| 欧美伦理视频网站| 欧美国产精品劲爆| 日韩国产在线一| 不卡一二三区首页| 欧美一区二区三区视频免费播放| 蜜臀av国产精品久久久久| 成人黄页在线观看| 日韩一区二区免费在线观看| 国产精品拍天天在线| 日本视频免费一区| 91一区二区在线| 久久欧美一区二区| 亚洲国产一区二区三区青草影视| 国产乱码精品一区二区三区忘忧草 | 亚洲精品国产无天堂网2021| 精品一区二区三区久久| 99精品一区二区三区| 亚洲精品一区二区三区香蕉| 亚洲精品中文在线观看| 国产成人av电影免费在线观看| 91精品免费观看| 亚洲激情av在线| 国产99久久久国产精品| 91 com成人网| 亚洲综合视频在线| 成熟亚洲日本毛茸茸凸凹| 在线不卡中文字幕| 亚洲免费av高清| 不卡视频免费播放| 国产清纯白嫩初高生在线观看91| 亚洲精选视频免费看| 国产成人精品免费| 56国语精品自产拍在线观看| 亚洲精品videosex极品| 成人91在线观看| 337p日本欧洲亚洲大胆精品| 日本成人在线电影网| 在线区一区二视频| 亚洲欧美偷拍三级| 成人av先锋影音| 久久久久亚洲蜜桃| 韩国女主播一区二区三区| 欧美日韩免费观看一区三区| 一区二区三区在线不卡| www.欧美日韩国产在线| 国产欧美日韩在线| 捆绑调教一区二区三区| 欧美高清视频一二三区| 亚洲不卡av一区二区三区| 99re成人精品视频| 国产精品久久精品日日| 成人晚上爱看视频| 久久久久亚洲蜜桃| 国产一区二区三区美女| 欧美sm美女调教| 激情久久久久久久久久久久久久久久| 日韩一区二区免费在线电影| 国产日韩三级在线| 狠狠色伊人亚洲综合成人| 日韩一区二区在线观看视频 | 免费精品99久久国产综合精品| 欧美在线观看一区| 亚洲成av人片在线观看无码| 欧美日韩中文国产| 日韩高清不卡在线| 色就色 综合激情| 亚洲一区在线观看视频| 欧美无人高清视频在线观看| 午夜精品一区二区三区免费视频 | 91麻豆国产精品久久| 亚洲欧洲韩国日本视频| 色欧美日韩亚洲| 亚洲v中文字幕| 91精品国产入口在线| 久久99精品国产.久久久久久 | 一区二区三区在线观看视频| 欧美午夜片在线看| 青青草91视频| 久久久www成人免费毛片麻豆 | 国产成人在线视频网站| 国产三区在线成人av| 99精品一区二区| 亚洲线精品一区二区三区| 91精品午夜视频| 国产精品66部| 狠狠色伊人亚洲综合成人| 国产精品久久久久久福利一牛影视 | 91一区二区三区在线播放| 亚洲国产欧美另类丝袜| 欧美成人猛片aaaaaaa| 国产精品一级片| 亚洲美女淫视频| 欧美一级免费大片| 国产成人福利片| 亚洲一区二区在线免费看| 日韩欧美黄色影院| 成人污污视频在线观看| 亚洲图片自拍偷拍| 久久久电影一区二区三区| 99re这里只有精品首页| 亚洲妇熟xx妇色黄| 精品国产电影一区二区| 99精品视频中文字幕| 欧美96一区二区免费视频| 99国产精品久久久久久久久久| 日韩激情av在线| 中文字幕一区二区三中文字幕| 欧美日韩www| 国产夫妻精品视频| 丝袜亚洲另类欧美综合| 中文字幕五月欧美| 精品国产乱码久久久久久久| 91国偷自产一区二区开放时间| 国产在线国偷精品免费看| 一区二区免费在线| 国产视频一区不卡| 91精品国产综合久久精品性色| 成人毛片视频在线观看| 天堂一区二区在线| 中文字幕视频一区| 精品国产污污免费网站入口 | 波多野结衣91| 麻豆精品蜜桃视频网站| 亚洲伦在线观看| 国产日韩av一区二区| 91精品婷婷国产综合久久竹菊| 精品久久久久久久久久久院品网 | 波多野结衣欧美| 日韩高清在线不卡| 亚洲人成在线播放网站岛国 | 久久99精品久久久久久| 亚洲永久免费av| 国产精品久久久久久久久果冻传媒| 日韩一级二级三级精品视频| 欧亚一区二区三区| 成人91在线观看| 国产精品系列在线播放| 秋霞成人午夜伦在线观看| 亚洲一区二区三区在线| 中文字幕中文字幕中文字幕亚洲无线 | 欧美三区在线观看| 欧美一级欧美一级在线播放| 欧美日韩不卡在线| av电影一区二区| 国产成人综合自拍| 精彩视频一区二区三区| 日韩电影免费在线| 亚洲va中文字幕| 亚洲一区在线看| 一区二区三区四区五区视频在线观看 | 久久精品国产亚洲一区二区三区|