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

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

?? erc_do_p.c

?? 可以用H.264編碼解碼器源碼(c語言)
?? C
?? 第 1 頁 / 共 2 頁
字號:

/*!
 *************************************************************************************
 * \file 
 *      erc_do_p.c
 *
 * \brief
 *      Inter (P) frame error concealment algorithms for decoder
 *
 *  \author
 *      - Viktor Varsa                     <viktor.varsa@nokia.com>
 *      - Ye-Kui Wang                   <wyk@ieee.org>
 *
 *************************************************************************************
 */

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

extern int erc_mvperMB;
struct img_par *erc_img;

// static function declarations
static int concealByCopy(frame *recfr, int currMBNum,
  objectBuffer_t *object_list, int32 picSizeX);
static int concealByTrial(frame *recfr, byte *predMB, 
                          int currMBNum, objectBuffer_t *object_list, int predBlocks[], 
                          int32 picSizeX, int32 picSizeY, int *yCondition);
static int edgeDistortion (int predBlocks[], int currYBlockNum, byte *predMB, 
                           byte *recY, int32 picSizeX, int32 regionSize);
static void copyBetweenFrames (frame *recfr, 
   int currYBlockNum, int32 picSizeX, int32 regionSize);
static void buildPredRegionYUV(struct img_par *img, int32 *mv, int x, int y, byte *predMB);
static void copyPredMB (int currYBlockNum, byte *predMB, frame *recfr, 
                        int32 picSizeX, int32 regionSize);

/*!
 ************************************************************************
 * \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)
                  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)
                  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)
                  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] = dec_picture->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] = dec_picture->imgUV[0][j][k];
        recfr->vptr[location] = dec_picture->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 = 0, numMBPerLine,
      compSplit1 = 0, compSplit2 = 0, 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一区二区三区免费野_久草精品视频
韩国v欧美v亚洲v日本v| 久久国产精品第一页| 国产区在线观看成人精品 | 另类人妖一区二区av| 国产欧美日产一区| 久久午夜电影网| 精品国一区二区三区| 欧美性xxxxx极品少妇| 国产精品夜夜爽| 国产精品影视网| gogo大胆日本视频一区| 97精品国产露脸对白| 欧美日韩在线综合| 欧美一区二区人人喊爽| 欧美www视频| 国产亚洲一区字幕| 日韩一区二区三区四区五区六区| 国产在线观看一区二区| voyeur盗摄精品| 欧美亚日韩国产aⅴ精品中极品| 欧美日韩不卡一区| 精品福利av导航| ...xxx性欧美| 日本亚洲天堂网| 一本一道久久a久久精品 | 亚洲欧美一区二区三区国产精品 | 欧美日韩精品系列| 在线观看91av| 欧美成人性战久久| 中文字幕巨乱亚洲| 亚洲综合在线观看视频| 国产激情91久久精品导航| 欧美性受极品xxxx喷水| 国产精品网站在线| 日韩精品午夜视频| 不卡的av电影| 久久久久久久久岛国免费| 亚洲一二三区在线观看| 国产成人精品亚洲午夜麻豆| 国产精品456| 自拍av一区二区三区| 成人动漫在线一区| 日韩美女视频一区二区| 精品无码三级在线观看视频| 欧美日韩一区二区电影| 中文字幕一区免费在线观看| 国产高清不卡一区二区| 欧美日韩国产影片| 国产精品国产自产拍在线| 蜜桃一区二区三区在线| 91精品国产福利| 亚洲中国最大av网站| 欧美系列在线观看| 天堂精品中文字幕在线| 7777精品伊人久久久大香线蕉超级流畅| 亚洲精选免费视频| 欧美探花视频资源| 亚洲欧洲成人自拍| 一本久久综合亚洲鲁鲁五月天| 日韩免费高清电影| 成人av电影观看| 日韩国产高清影视| 亚洲欧美日韩电影| 日韩免费高清av| 91免费观看国产| 久久精品国产一区二区三区免费看| 久久久影视传媒| 一本到不卡精品视频在线观看 | 欧美极品另类videosde| 国产精品亚洲午夜一区二区三区| 国产精品嫩草99a| 欧美一区二区在线视频| 97精品国产97久久久久久久久久久久| 肉色丝袜一区二区| 国产精品久久久久三级| 精品国产精品一区二区夜夜嗨| 91久久人澡人人添人人爽欧美| 亚洲福利国产精品| 欧美大片拔萝卜| 欧美一级免费观看| 欧美亚洲一区二区三区四区| 国产91高潮流白浆在线麻豆| 国产精品亚洲一区二区三区妖精| 日本强好片久久久久久aaa| 夜夜亚洲天天久久| 亚洲乱码精品一二三四区日韩在线| 日韩精品中文字幕在线一区| 国产成人自拍高清视频在线免费播放| 国产精品网站在线| 亚洲色图欧美在线| 久久综合色综合88| 国产欧美精品国产国产专区| 国产区在线观看成人精品| 久久这里只有精品首页| 久久精品在线观看| 中文字幕精品一区二区三区精品| 日韩欧美亚洲一区二区| 久久夜色精品国产噜噜av| 日韩午夜中文字幕| 精品久久久久久综合日本欧美| 中文字幕免费不卡| 日韩国产精品久久久| 国产伦精品一区二区三区在线观看| 欧美精选一区二区| 欧美xingq一区二区| 国产精品女主播在线观看| 亚洲国产欧美日韩另类综合 | 国产日韩欧美电影| 久久成人精品无人区| 91久久香蕉国产日韩欧美9色| 91精品免费在线观看| 久久久99精品免费观看| 亚洲美女一区二区三区| 性欧美疯狂xxxxbbbb| 另类小说欧美激情| 在线免费一区三区| 日本一区二区视频在线观看| 亚洲一卡二卡三卡四卡五卡| www.色综合.com| 精品成人a区在线观看| 午夜激情综合网| 成人a免费在线看| 国产清纯白嫩初高生在线观看91 | 91麻豆国产香蕉久久精品| 成人av电影在线观看| 久久这里只有精品6| 蜜臀av性久久久久蜜臀av麻豆| 欧美亚洲免费在线一区| 国产精品对白交换视频| 美女一区二区三区在线观看| 在线观看日韩国产| 亚洲三级在线播放| 欧美私模裸体表演在线观看| 亚洲欧洲av另类| 色婷婷av久久久久久久| 亚洲综合网站在线观看| 欧美三区在线观看| 亚洲免费视频中文字幕| 成人激情动漫在线观看| 五月婷婷激情综合| 日韩欧美一区在线| 久久66热re国产| 久久网这里都是精品| 国产黄色精品网站| 亚洲国产精品激情在线观看 | 亚洲午夜久久久久久久久久久 | 2017欧美狠狠色| 国内精品久久久久影院色| 国产日韩欧美a| 丁香啪啪综合成人亚洲小说| 亚洲欧美福利一区二区| 欧美电影影音先锋| 久久97超碰色| 国产精品伦理在线| 日韩精品最新网址| 色综合天天综合给合国产| 亚洲一区视频在线| 亚洲国产激情av| 欧美日韩二区三区| 一本久道中文字幕精品亚洲嫩| 首页亚洲欧美制服丝腿| 欧美国产一区二区在线观看| 在线观看91视频| 国产一区三区三区| 国产一区不卡在线| 精品一区二区三区久久| 亚洲成在人线免费| 一级中文字幕一区二区| 精品不卡在线视频| 久久先锋影音av| 欧美videos大乳护士334| 日韩精品最新网址| 色综合久久久久网| 色综合中文字幕国产 | 亚洲一区二区综合| 在线成人免费观看| 7777精品伊人久久久大香线蕉的| 欧美伊人精品成人久久综合97 | 日韩视频永久免费| 69久久99精品久久久久婷婷 | 91在线精品一区二区| 91久久国产综合久久| 99久久伊人网影院| 在线看日韩精品电影| 欧美一区二区三区视频| 国产午夜精品理论片a级大结局| 中文无字幕一区二区三区| 亚洲激情男女视频| 国内精品久久久久影院色 | 国产制服丝袜一区| 国产91精品欧美| 4438亚洲最大| 国产精品国产三级国产aⅴ入口| 亚洲欧美激情在线| 国产精品香蕉一区二区三区| 欧美日韩精品欧美日韩精品| 精品第一国产综合精品aⅴ| 亚洲动漫第一页| 粉嫩在线一区二区三区视频| 欧美福利视频一区|