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

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

?? erc_do_p.c

?? jm_frext22.ZIP的壓縮文件,主要用于嵌入式系統圖象的編解碼的開發.
?? 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, imgpel *predMB, 
                          int currMBNum, objectBuffer_t *object_list, int predBlocks[], 
                          int32 picSizeX, int32 picSizeY, int *yCondition);
static int edgeDistortion (int predBlocks[], int currYBlockNum, imgpel *predMB, 
                           imgpel *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, imgpel *predMB);
static void copyPredMB (int currYBlockNum, imgpel *predMB, frame *recfr, 
                        int32 picSizeX, int32 regionSize);

extern const unsigned char subblk_offset_y[3][8][4];
extern const unsigned char subblk_offset_x[3][8][4];
static int uv_div[2][4] = {{0, 1, 1, 0}, {0, 1, 0, 0}}; //[x/y][yuv_format]

/*!
 ************************************************************************
 * \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;
  imgpel *predMB;
  
  /* if concealment is on */
  if ( errorVar && errorVar->concealment ) 
  {
    /* if there are segments to be concealed */
    if ( errorVar->nOfCorruptedSegments ) 
    {
      
      predMB = (imgpel *) malloc(256 + (img->mb_cr_size_x*img->mb_cr_size_y)*2);
      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;
  StorablePicture* refPic = listX[0][0];

  /* 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; 
//th      recfr->yptr[location] = dec_picture->imgY[j][k];
      recfr->yptr[location] = refPic->imgY[j][k];
    }
     
    for (j = ymin >> uv_div[1][img->yuv_format]; j < (ymin + regionSize) >> uv_div[1][img->yuv_format]; j++)
      for (k = xmin >> uv_div[0][img->yuv_format]; k < (xmin + regionSize) >> uv_div[0][img->yuv_format]; k++)
      {
//        location = j * picSizeX / 2 + k;
        location = ((j * picSizeX) >> uv_div[0][img->yuv_format]) + k;
        
//th        recfr->uptr[location] = dec_picture->imgUV[0][j][k];
//th        recfr->vptr[location] = dec_picture->imgUV[1][j][k];
        recfr->uptr[location] = refPic->imgUV[0][j][k];
        recfr->vptr[location] = refPic->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, imgpel *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)) 
            {
              
              /* if Zero Motion Block, do the copying. This option is tried only once */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩天堂在线观看| 国产一区在线不卡| 欧美无乱码久久久免费午夜一区 | 91精品国产免费| 首页综合国产亚洲丝袜| 5858s免费视频成人| 麻豆国产欧美日韩综合精品二区| 日韩一区二区三免费高清| 久久99精品久久久久久久久久久久| 精品美女被调教视频大全网站| 国产精品 日产精品 欧美精品| 国产日韩欧美麻豆| 不卡av电影在线播放| 一区二区三区成人| 欧美sm极限捆绑bd| 成人理论电影网| 亚洲午夜激情网站| 国产精品系列在线| 在线欧美日韩国产| 九九久久精品视频| 亚洲精品自拍动漫在线| 欧美日韩在线播| 国产精品一区二区你懂的| 中文字幕一区日韩精品欧美| 欧美精品自拍偷拍| 成人av在线网站| 人人爽香蕉精品| 亚洲婷婷综合色高清在线| 91精品免费观看| eeuss鲁片一区二区三区 | 国产精品视频麻豆| 欧美三电影在线| 国产69精品一区二区亚洲孕妇| 亚洲电影欧美电影有声小说| 国产三级精品视频| 88在线观看91蜜桃国自产| 成人小视频免费在线观看| 日韩精品欧美成人高清一区二区| 国产欧美日韩精品在线| 欧美精品 国产精品| 99久久精品情趣| 国内精品国产成人| 亚洲成人你懂的| 国产精品久久99| 日韩欧美综合一区| 欧美亚洲综合久久| 国产伦精一区二区三区| 亚洲第一成年网| 国产精品久久久久久妇女6080| 欧美日产在线观看| 色综合久久久久综合体桃花网| 亚洲18女电影在线观看| 国产精品久久毛片av大全日韩| 91成人免费网站| 99re这里只有精品6| 极品少妇xxxx精品少妇偷拍| 丝袜国产日韩另类美女| 日韩毛片高清在线播放| 国产欧美在线观看一区| 日韩一区二区不卡| 欧美精品高清视频| 91色porny在线视频| 成人av电影在线| 国产做a爰片久久毛片| 久久99热狠狠色一区二区| 亚洲一区在线视频| 一区二区三区在线看| 欧美激情在线观看视频免费| 2023国产精品视频| 日韩视频免费直播| 91精品欧美福利在线观看| 欧美亚日韩国产aⅴ精品中极品| 91在线云播放| 91在线视频网址| 99在线精品免费| 高清在线不卡av| www.亚洲国产| 成人18视频日本| 色综合天天性综合| av影院午夜一区| 91色.com| 色婷婷av一区二区三区gif | 欧美一二三四区在线| 日本韩国一区二区三区| 欧美偷拍一区二区| 在线视频一区二区三| 日本精品一级二级| 在线免费不卡电影| 欧美日韩国产一区| 欧美女孩性生活视频| 在线播放/欧美激情| 4438x亚洲最大成人网| 欧美一区二区三区成人| 欧美丰满少妇xxxxx高潮对白| 日韩一区二区三区电影在线观看| 欧美人狂配大交3d怪物一区| 日韩视频永久免费| 337p日本欧洲亚洲大胆色噜噜| 久久九九国产精品| 国产精品久久久久久久久晋中 | 国内精品第一页| 成人午夜激情片| 91在线视频官网| 在线播放中文字幕一区| 日韩视频免费观看高清完整版在线观看 | 有坂深雪av一区二区精品| 1000部国产精品成人观看| 亚洲另类一区二区| 秋霞影院一区二区| 激情综合色综合久久综合| 99麻豆久久久国产精品免费| 色综合久久中文综合久久97| 日韩欧美国产综合在线一区二区三区| 日韩一区二区三区免费看 | 日韩中文字幕av电影| 免费在线看成人av| 成人avav在线| 欧美精品久久99久久在免费线| 久久久久国产精品免费免费搜索| 国产精品三级电影| 日韩和欧美的一区| 国内久久精品视频| 欧美日韩亚洲不卡| 欧美xxx久久| 亚洲国产一区二区三区青草影视 | 精品一区二区三区不卡 | 欧美日韩中文国产| 精品久久久久久无| 亚洲国产精品久久艾草纯爱 | 国产成人免费视频精品含羞草妖精| 国产精品888| 91精品蜜臀在线一区尤物| 国产欧美一区二区精品忘忧草| 日韩av高清在线观看| 成人午夜在线视频| 精品1区2区在线观看| 亚洲日本在线a| 美女任你摸久久| 色婷婷精品大在线视频| 欧美一区二区三区思思人| 国产精品毛片高清在线完整版| 亚州成人在线电影| 97久久精品人人做人人爽 | 在线观看日韩精品| 久久色成人在线| 蜜臀久久99精品久久久久宅男| 99久久精品国产一区二区三区| 久久亚洲一区二区三区明星换脸 | 国内精品国产成人国产三级粉色| 国产麻豆精品在线观看| 欧美日韩在线精品一区二区三区激情| 久久精品人人爽人人爽| 麻豆精品一二三| 欧美日韩国产综合草草| 夜夜亚洲天天久久| 国产91精品精华液一区二区三区| 久久嫩草精品久久久久| 日韩国产一二三区| 欧美一区二区三区视频| 国产精品久久久久久久久图文区| 国产高清无密码一区二区三区| 日韩av二区在线播放| 在线成人av网站| 亚洲欧美日韩中文字幕一区二区三区| 成人性生交大合| 欧美日韩中文一区| 视频一区二区三区中文字幕| 欧美日韩精品久久久| 一区二区三区视频在线观看| 在线一区二区三区四区五区| 亚洲日穴在线视频| 91成人网在线| 一级中文字幕一区二区| 欧美色综合天天久久综合精品| 成人欧美一区二区三区视频网页 | 成人av片在线观看| 亚洲天堂精品在线观看| 成人免费高清在线观看| 最新成人av在线| 成人ar影院免费观看视频| 国产精品人成在线观看免费| 国产一区二区三区综合| 国产欧美综合在线观看第十页| 日本不卡1234视频| 日韩欧美一区电影| 国产乱理伦片在线观看夜一区| 欧美成人一区二区三区在线观看| 国产伦精品一区二区三区免费迷 | 精品1区2区在线观看| 奇米精品一区二区三区四区| 精品毛片乱码1区2区3区| 成人免费视频app| 亚洲欧美日韩久久| 日韩精品在线看片z| 极品少妇xxxx精品少妇| 亚洲视频在线一区| 欧美性一二三区| 精品一区二区三区欧美| 在线播放视频一区| 国产+成+人+亚洲欧洲自线|