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

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

?? erc_api.c

?? H264解碼器,本解碼器實現了圖像的264解碼
?? C
字號:

/*!
 *************************************************************************************
 * \file erc_api.c
 *
 * \brief
 *    External (still inside video decoder) interface for error concealment module
 *
 *  \author
 *     - Ari Hourunranta                <ari.hourunranta@nokia.com>
 *     - Viktor Varsa                     <viktor.varsa@nokia.com>
 *     - Ye-Kui Wang                   <wyk@ieee.org>
 *
 *************************************************************************************
 */


#include <stdlib.h>

#include "global.h"
#include "memalloc.h"
#include "erc_api.h"

objectBuffer_t *erc_object_list = NULL;
ercVariables_t *erc_errorVar = NULL;
frame erc_recfr;
int erc_mvperMB;

/*!
 ************************************************************************
 * \brief
 *    Initinize the error concealment module
 ************************************************************************
 */
void ercInit(int pic_sizex, int pic_sizey, int flag)
{
  ercClose(erc_errorVar);
  erc_object_list = (objectBuffer_t *) calloc((pic_sizex * pic_sizey) >> 6, sizeof(objectBuffer_t));
  if (erc_object_list == NULL) no_mem_exit("ercInit: erc_object_list");
  
  /* the error concelament instance is allocated */
  erc_errorVar = ercOpen();
  
  /* set error concealment ON */
  ercSetErrorConcealment(erc_errorVar, flag);
}

/*!
 ************************************************************************
 * \brief
 *      Allocates data structures used in error concealment.
 *\return
 *      The allocated ercVariables_t is returned.
 ************************************************************************
 */
ercVariables_t *ercOpen( void )
{
  ercVariables_t *errorVar = NULL;
  
  errorVar = (ercVariables_t *)malloc( sizeof(ercVariables_t));
  if ( errorVar == NULL ) no_mem_exit("ercOpen: errorVar");

  errorVar->nOfMBs = 0;
  errorVar->segments = NULL;
  errorVar->currSegment = 0;
  errorVar->yCondition = NULL;
  errorVar->uCondition = NULL;
  errorVar->vCondition = NULL;
  errorVar->prevFrameYCondition = NULL;
  
  errorVar->concealment = 1;
  
  return errorVar;
}

/*!
 ************************************************************************
 * \brief
 *      Resets the variables used in error detection. 
 *      Should be called always when starting to decode a new frame.
 * \param errorVar
 *      Variables for error concealment
 * \param nOfMBs
 *      Number of macroblocks in a frame
 * \param numOfSegments
 *    Estimated number of segments (memory reserved)
 * \param picSizeX
 *      Width of the frame in pixels.
 ************************************************************************
 */
void ercReset( ercVariables_t *errorVar, int nOfMBs, int numOfSegments, int32 picSizeX )
{
  int *tmp = NULL;
  int i = 0, j = 0;
  
  if ( errorVar && errorVar->concealment ) 
  {
    /* If frame size has been changed */
    if ( nOfMBs != errorVar->nOfMBs && errorVar->yCondition != NULL ) 
    {
      free( errorVar->yCondition );
      errorVar->yCondition = NULL;
      free( errorVar->prevFrameYCondition );
      errorVar->prevFrameYCondition = NULL;
      free( errorVar->uCondition );
      errorVar->uCondition = NULL;
      free( errorVar->vCondition );
      errorVar->vCondition = NULL;
      free( errorVar->segments );
      errorVar->segments = NULL;
    }
    
    /* If the structures are uninitialized (first frame, or frame size is chaned) */
    if ( errorVar->yCondition == NULL ) 
    {
      errorVar->segments = (ercSegment_t *)malloc( numOfSegments*sizeof(ercSegment_t) );
      if ( errorVar->segments == NULL ) no_mem_exit("ercReset: errorVar->segments");
      memset( errorVar->segments, 0, numOfSegments*sizeof(ercSegment_t));
      errorVar->nOfSegments = numOfSegments;
      
      errorVar->yCondition = (int *)malloc( 4*nOfMBs*sizeof(int) );
      if ( errorVar->yCondition == NULL ) no_mem_exit("ercReset: errorVar->yCondition");
      errorVar->prevFrameYCondition = (int *)malloc( 4*nOfMBs*sizeof(int) );
      if ( errorVar->prevFrameYCondition == NULL ) no_mem_exit("ercReset: errorVar->prevFrameYCondition");
      errorVar->uCondition = (int *)malloc( nOfMBs*sizeof(int) );
      if ( errorVar->uCondition == NULL ) no_mem_exit("ercReset: errorVar->uCondition");
      errorVar->vCondition = (int *)malloc( nOfMBs*sizeof(int) );
      if ( errorVar->vCondition == NULL ) no_mem_exit("ercReset: errorVar->vCondition");
      errorVar->nOfMBs = nOfMBs;
    }
    else 
    {
      /* Store the yCondition struct of the previous frame */
      tmp = errorVar->prevFrameYCondition;
      errorVar->prevFrameYCondition = errorVar->yCondition;
      errorVar->yCondition = tmp;
    }
    
    /* Reset tables and parameters */
    memset( errorVar->yCondition, 0, 4*nOfMBs*sizeof(*errorVar->yCondition));
    memset( errorVar->uCondition, 0, nOfMBs*sizeof(*errorVar->uCondition));
    memset( errorVar->vCondition, 0, nOfMBs*sizeof(*errorVar->vCondition));
    
    if (errorVar->nOfSegments != numOfSegments) 
    {
      free( errorVar->segments );
      errorVar->segments = NULL;
      errorVar->segments = (ercSegment_t *)malloc( numOfSegments*sizeof(ercSegment_t) );
      if ( errorVar->segments == NULL ) no_mem_exit("ercReset: errorVar->segments");
      errorVar->nOfSegments = numOfSegments;
    }
    
    memset( errorVar->segments, 0, errorVar->nOfSegments*sizeof(ercSegment_t));

    for ( i = 0; i < errorVar->nOfSegments; i++ ) 
    {
      // mark all the Blocks as empty 
      for ( j = 0; j < nOfMBs; j++ ) 
      {
        errorVar->yCondition[MBNum2YBlock (j, 0, picSizeX)] = ERC_BLOCK_EMPTY;
        errorVar->yCondition[MBNum2YBlock (j, 1, picSizeX)] = ERC_BLOCK_EMPTY;
        errorVar->yCondition[MBNum2YBlock (j, 2, picSizeX)] = ERC_BLOCK_EMPTY;
        errorVar->yCondition[MBNum2YBlock (j, 3, picSizeX)] = ERC_BLOCK_EMPTY;
        errorVar->uCondition[j] = ERC_BLOCK_EMPTY;
        errorVar->vCondition[j] = ERC_BLOCK_EMPTY;
      }
      errorVar->segments[i].fCorrupted = 1; //! mark segments as corrupted
      errorVar->segments[i].startMBPos = 0;
      errorVar->segments[i].endMBPos = nOfMBs - 1;
    }
    
    errorVar->currSegment = 0;
    errorVar->nOfCorruptedSegments = 0;
  }
}

/*!
 ************************************************************************
 * \brief
 *      Resets the variables used in error detection. 
 *      Should be called always when starting to decode a new frame.
 * \param errorVar
 *      Variables for error concealment
 ************************************************************************
 */
void ercClose( ercVariables_t *errorVar )
{
  if ( errorVar != NULL ) 
  {
    if (errorVar->yCondition != NULL) 
    {
      free( errorVar->segments );
      free( errorVar->yCondition );
      free( errorVar->uCondition );
      free( errorVar->vCondition );
      free( errorVar->prevFrameYCondition );
    }
    free( errorVar );
    errorVar = NULL;
  }

  if (erc_object_list)
  {
    free(erc_object_list);
    erc_object_list=NULL;
  }
}

/*!
 ************************************************************************
 * \brief
 *      Sets error concealment ON/OFF. Can be invoked only between frames, not during a frame
 * \param errorVar
 *      Variables for error concealment
 * \param value
 *      New value
 ************************************************************************
 */
void ercSetErrorConcealment( ercVariables_t *errorVar, int value )
{
  if ( errorVar != NULL )
    errorVar->concealment = value;
}

/*!
 ************************************************************************
 * \brief
 *      Creates a new segment in the segment-list, and marks the start MB and bit position.
 *      If the end of the previous segment was not explicitly marked by "ercStopSegment",
 *      also marks the end of the previous segment.
 *      If needed, it reallocates the segment-list for a larger storage place.
 * \param currMBNum
 *      The MB number where the new slice/segment starts
 * \param segment
 *      Segment/Slice No. counted by the caller
 * \param bitPos
 *      Bitstream pointer: number of bits read from the buffer.
 * \param errorVar
 *      Variables for error detector
 ************************************************************************
 */
void ercStartSegment( int currMBNum, int segment, u_int32 bitPos, ercVariables_t *errorVar )
{
  if ( errorVar && errorVar->concealment ) 
  {
    errorVar->currSegmentCorrupted = 0;
        
    errorVar->segments[ segment ].fCorrupted = 0;
    errorVar->segments[ segment ].startMBPos = currMBNum;
    
  }   
}

/*!
 ************************************************************************
 * \brief
 *      Marks the end position of a segment.
 * \param currMBNum
 *      The last MB number of the previous segment
 * \param segment
 *      Segment/Slice No. counted by the caller
 *      If (segment<0) the internal segment counter is used.
 * \param bitPos
 *      Bitstream pointer: number of bits read from the buffer.
 * \param errorVar
 *      Variables for error detector
 ************************************************************************
 */
void ercStopSegment( int currMBNum, int segment, u_int32 bitPos, ercVariables_t *errorVar )
{
  if ( errorVar && errorVar->concealment ) 
  {
    errorVar->segments[ segment ].endMBPos = currMBNum; //! Changed TO 12.11.2001
    errorVar->currSegment++;
  }
}

/*!
 ************************************************************************
 * \brief
 *      Marks the current segment (the one which has the "currMBNum" MB in it)
 *      as lost: all the blocks of the MBs in the segment as corrupted.
 * \param picSizeX
 *      Width of the frame in pixels.
 * \param errorVar
 *      Variables for error detector
 ************************************************************************
 */
void ercMarkCurrSegmentLost(int32 picSizeX, ercVariables_t *errorVar )
{
  int j = 0;
  int current_segment;
  
  current_segment = errorVar->currSegment-1;
  if ( errorVar && errorVar->concealment ) 
  {
    if (errorVar->currSegmentCorrupted == 0) 
    {
      errorVar->nOfCorruptedSegments++;
      errorVar->currSegmentCorrupted = 1;
    }
     
    for ( j = errorVar->segments[current_segment].startMBPos; j <= errorVar->segments[current_segment].endMBPos; j++ ) 
    {
      errorVar->yCondition[MBNum2YBlock (j, 0, picSizeX)] = ERC_BLOCK_CORRUPTED;
      errorVar->yCondition[MBNum2YBlock (j, 1, picSizeX)] = ERC_BLOCK_CORRUPTED;
      errorVar->yCondition[MBNum2YBlock (j, 2, picSizeX)] = ERC_BLOCK_CORRUPTED;
      errorVar->yCondition[MBNum2YBlock (j, 3, picSizeX)] = ERC_BLOCK_CORRUPTED;
      errorVar->uCondition[j] = ERC_BLOCK_CORRUPTED;
      errorVar->vCondition[j] = ERC_BLOCK_CORRUPTED;
    }
    errorVar->segments[current_segment].fCorrupted = 1;
  }
}

/*!
 ************************************************************************
 * \brief
 *      Marks the current segment (the one which has the "currMBNum" MB in it)
 *      as OK: all the blocks of the MBs in the segment as OK.
 * \param picSizeX
 *      Width of the frame in pixels.
 * \param errorVar
 *      Variables for error detector
 ************************************************************************
 */
void ercMarkCurrSegmentOK(int32 picSizeX, ercVariables_t *errorVar )
{
  int j = 0;
  int current_segment;
  
  current_segment = errorVar->currSegment-1;
  if ( errorVar && errorVar->concealment ) 
  {
    // mark all the Blocks belonging to the segment as OK */
    for ( j = errorVar->segments[current_segment].startMBPos; j <= errorVar->segments[current_segment].endMBPos; j++ ) 
    {
      errorVar->yCondition[MBNum2YBlock (j, 0, picSizeX)] = ERC_BLOCK_OK;
      errorVar->yCondition[MBNum2YBlock (j, 1, picSizeX)] = ERC_BLOCK_OK;
      errorVar->yCondition[MBNum2YBlock (j, 2, picSizeX)] = ERC_BLOCK_OK;
      errorVar->yCondition[MBNum2YBlock (j, 3, picSizeX)] = ERC_BLOCK_OK;
      errorVar->uCondition[j] = ERC_BLOCK_OK;
      errorVar->vCondition[j] = ERC_BLOCK_OK;
    }
    errorVar->segments[current_segment].fCorrupted = 0;
  }
}

/*!
 ************************************************************************
 * \brief
 *      Marks the Blocks of the given component (YUV) of the current MB as concealed.
 * \param currMBNum
 *      Selects the segment where this MB number is in.
 * \param comp
 *      Component to mark (0:Y, 1:U, 2:V, <0:All)
 * \param picSizeX
 *      Width of the frame in pixels.
 * \param errorVar
 *      Variables for error detector
 ************************************************************************
 */
void ercMarkCurrMBConcealed( int currMBNum, int comp, int32 picSizeX, ercVariables_t *errorVar )
{
  int setAll = 0;
  
  if ( errorVar && errorVar->concealment ) 
  {
    if (comp < 0) 
    {
      setAll = 1;
      comp = 0;
    }
    
    switch (comp) 
    {
    case 0:
      errorVar->yCondition[MBNum2YBlock (currMBNum, 0, picSizeX)] = ERC_BLOCK_CONCEALED;
      errorVar->yCondition[MBNum2YBlock (currMBNum, 1, picSizeX)] = ERC_BLOCK_CONCEALED;
      errorVar->yCondition[MBNum2YBlock (currMBNum, 2, picSizeX)] = ERC_BLOCK_CONCEALED;
      errorVar->yCondition[MBNum2YBlock (currMBNum, 3, picSizeX)] = ERC_BLOCK_CONCEALED;
      if (!setAll)
        break;
    case 1:
      errorVar->uCondition[currMBNum] = ERC_BLOCK_CONCEALED;
      if (!setAll)
        break;
    case 2:
      errorVar->vCondition[currMBNum] = ERC_BLOCK_CONCEALED;
    }
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一线二线三线| 欧美专区在线观看一区| 亚洲一区二区三区四区五区黄 | 麻豆精品精品国产自在97香蕉| 中文字幕的久久| 26uuu国产日韩综合| 欧美一区二区免费视频| 欧美色图在线观看| 91福利资源站| 欧美影院一区二区三区| 91激情五月电影| 精品视频资源站| 9191国产精品| 欧美电视剧在线观看完整版| 日韩一区二区免费视频| 欧美一区二区日韩| 欧美成人艳星乳罩| 精品久久国产字幕高潮| 欧美成人一区二区三区片免费| 日韩一区二区在线看| 日韩小视频在线观看专区| 91精品久久久久久久99蜜桃| 欧美高清精品3d| 51精品久久久久久久蜜臀| 欧美一区三区四区| 日韩欧美综合在线| 日韩精品一区二区三区中文不卡| 在线成人高清不卡| 日韩精品影音先锋| 日本一区二区免费在线| 国产精品区一区二区三区| 中文字幕 久热精品 视频在线| 国产精品激情偷乱一区二区∴| 亚洲国产精品v| 日韩久久一区二区| 亚洲国产cao| 免费日韩伦理电影| 国产精品18久久久| 色悠悠久久综合| 欧美绝品在线观看成人午夜影视| 欧美一级欧美一级在线播放| 精品久久久三级丝袜| 国产精品污污网站在线观看| 亚洲一区二区欧美日韩 | 日本成人在线电影网| 免费在线观看成人| 国产精品99久久久久久宅男| 成人精品视频一区二区三区尤物| 北条麻妃一区二区三区| 在线视频亚洲一区| 欧美不卡一二三| 日本一区二区三区在线不卡| 亚洲综合偷拍欧美一区色| 蜜桃久久精品一区二区| 91一区二区在线观看| 欧美久久久一区| 国产色产综合产在线视频| 一区二区免费看| 韩国av一区二区三区四区| 91香蕉视频污在线| 日韩欧美在线不卡| 最新不卡av在线| 美女视频第一区二区三区免费观看网站| 国产一区 二区| 7777精品伊人久久久大香线蕉超级流畅| 久久久www免费人成精品| 亚洲免费色视频| 韩国女主播成人在线观看| 在线影院国内精品| 久久精品一区蜜桃臀影院| 午夜av电影一区| 不卡区在线中文字幕| 精品国偷自产国产一区| 亚洲午夜在线电影| 成人va在线观看| 2014亚洲片线观看视频免费| 午夜影视日本亚洲欧洲精品| 成人av一区二区三区| 欧美成人a视频| 亚洲va欧美va人人爽| 99精品热视频| 国产日本欧洲亚洲| 久久av中文字幕片| 欧美精品欧美精品系列| 亚洲美女屁股眼交3| 国产精品一卡二| 日韩欧美三级在线| 日韩电影在线一区| 欧美日韩一区二区三区四区| 亚洲精品视频在线| 99视频热这里只有精品免费| 国产欧美一区二区精品忘忧草| 麻豆国产精品一区二区三区| 91精品国产麻豆| 午夜不卡av免费| 欧美日韩高清一区二区三区| 依依成人精品视频| 日本精品一区二区三区高清| 国产精品久久久久久久久搜平片| 国产精品综合网| 日本一区免费视频| 成人黄动漫网站免费app| 国产精品美女久久久久久久久久久| 国产麻豆精品久久一二三| 久久日韩粉嫩一区二区三区| 国产在线精品一区二区| 26uuuu精品一区二区| 国产在线精品一区在线观看麻豆| 91精品国产色综合久久不卡蜜臀 | 欧美激情一区在线观看| 成人久久久精品乱码一区二区三区| 久久精品亚洲麻豆av一区二区| 国产在线国偷精品产拍免费yy| 欧美精品一区二区在线观看| 国产精品综合网| 中文字幕一区不卡| 色八戒一区二区三区| 亚洲二区在线视频| 欧美一级免费大片| 国产精品白丝jk黑袜喷水| 一区在线观看免费| 欧美亚洲图片小说| 琪琪一区二区三区| 欧美精品一区二区三区在线| 白白色亚洲国产精品| 亚洲在线视频网站| 日韩精品影音先锋| 成人av动漫在线| 舔着乳尖日韩一区| 中文字幕二三区不卡| 在线免费不卡电影| 精品一区二区在线免费观看| 中文字幕精品一区二区精品绿巨人| 91麻豆免费视频| 久久精品国产久精国产爱| 中日韩av电影| 宅男噜噜噜66一区二区66| 国产精品一区二区三区四区 | 亚洲制服欧美中文字幕中文字幕| 在线电影欧美成精品| 懂色av一区二区三区免费观看| 一区二区理论电影在线观看| 欧美www视频| 色婷婷av久久久久久久| 久久成人综合网| 亚洲欧美一区二区不卡| 日韩欧美一级二级三级| 91丨九色丨国产丨porny| 美腿丝袜一区二区三区| 一级做a爱片久久| 精品久久免费看| 欧美亚洲国产一区二区三区| 丝袜美腿亚洲一区| 亚洲激情图片qvod| 国产精品久久久久天堂| 欧美一级淫片007| 91国偷自产一区二区三区成为亚洲经典| 久久精品国产免费| 婷婷中文字幕一区三区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 337p粉嫩大胆色噜噜噜噜亚洲| 欧洲精品一区二区三区在线观看| 国产一区二区按摩在线观看| 日本欧美一区二区三区| 亚洲欧美成人一区二区三区| 国产午夜亚洲精品羞羞网站| 91精品国产综合久久精品app | 91.com在线观看| 欧美在线视频你懂得| 91亚洲永久精品| 99久久综合99久久综合网站| 国产乱一区二区| 精品亚洲国产成人av制服丝袜| 日韩高清在线观看| 性感美女久久精品| 亚洲福利电影网| 亚洲成av人片www| 亚洲图片自拍偷拍| 亚洲主播在线观看| 亚洲一区视频在线| 亚洲一区二区三区在线播放| 亚洲欧美日韩系列| 亚洲视频免费观看| 国产精品日日摸夜夜摸av| 国产精品伦理一区二区| 综合精品久久久| 亚洲六月丁香色婷婷综合久久 | 日本成人在线一区| 精东粉嫩av免费一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 欧美日产在线观看| 欧美一区二区日韩一区二区| 日韩女优毛片在线| 国产亚洲精品aa| 国产精品对白交换视频| 亚洲免费观看高清完整版在线观看熊| 亚洲丝袜精品丝袜在线| 亚洲精品第1页| 免费一级片91| 国产成人精品免费|