⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorconcealment.cpp

📁 h264编解码.用C++实现了图像的编解码功能。
💻 CPP
字号:

/*!
 ***********************************************************************
 * \file errorconcealment.c
 *
 * \brief
 *    Implements error concealment scheme for H.26L decoder
 *
 * \date
 *    6.10.2000
 *
 * \version
 *    1.0
 *
 * \note
 *    This simple error concealment implemented in this decoder uses
 *    the existing dependencies of syntax elements.
 *    In case that an element is detected as false this elements and all
 *    dependend elements are marked as elements to conceal in the ec_flag[]
 *    array. If the decoder requests a new element by the function
 *    readSyntaxElement_xxxx() this array is checked first if an error concealment has
 *    to be applied on this element.
 *    In case that an error occured a concealed element is given to the
 *    decoding function in macroblock().
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Sebastian Purreiter   <sebastian.purreiter@mch.siemens.de>
 ***********************************************************************
 */
#include <stdlib.h>
#include "contributors.h"
#include "global.h"
#include "elements.h"
#include "..\Decoder264.h"
static int ec_flag[SE_MAX_ELEMENTS];        //!< array to set errorconcealment

/*!
 ***********************************************************************
 * \brief
 *    set concealment for all elements in same partition
 *    and dependend syntax elements
 * \return
 *    1, elements of same type or depending type need error concealment. \n
 ***********************************************************************
 */
int set_ec_flag(
  int se)   //!< type of syntax element to conceal
{
  switch (se)
  {
  case SE_HEADER :
    ec_flag[SE_HEADER] = 1;
  case SE_PTYPE :
    ec_flag[SE_PTYPE] = 1;
  case SE_MBTYPE :
    ec_flag[SE_MBTYPE] = 1;

  case SE_REFFRAME :
    ec_flag[SE_REFFRAME] = 1;
    ec_flag[SE_MVD] = 1; // set all motion vectors to zero length
    se = SE_CBP_INTER;      // conceal also Inter texture elements
    break;

  case SE_INTRAPREDMODE :
    ec_flag[SE_INTRAPREDMODE] = 1;
    se = SE_CBP_INTRA;      // conceal also Intra texture elements
    break;
  case SE_MVD :
    ec_flag[SE_MVD] = 1;
    se = SE_CBP_INTER;      // conceal also Inter texture elements
    break;

  default:
    break;
  }

  switch (se)
  {
  case SE_CBP_INTRA :
    ec_flag[SE_CBP_INTRA] = 1;
  case SE_LUM_DC_INTRA :
    ec_flag[SE_LUM_DC_INTRA] = 1;
  case SE_CHR_DC_INTRA :
    ec_flag[SE_CHR_DC_INTRA] = 1;
  case SE_LUM_AC_INTRA :
    ec_flag[SE_LUM_AC_INTRA] = 1;
  case SE_CHR_AC_INTRA :
    ec_flag[SE_CHR_AC_INTRA] = 1;
    break;

  case SE_CBP_INTER :
    ec_flag[SE_CBP_INTER] = 1;
  case SE_LUM_DC_INTER :
    ec_flag[SE_LUM_DC_INTER] = 1;
  case SE_CHR_DC_INTER :
    ec_flag[SE_CHR_DC_INTER] = 1;
  case SE_LUM_AC_INTER :
    ec_flag[SE_LUM_AC_INTER] = 1;
  case SE_CHR_AC_INTER :
    ec_flag[SE_CHR_AC_INTER] = 1;
    break;
  case SE_DELTA_QUANT_INTER :
    ec_flag[SE_DELTA_QUANT_INTER] = 1;
    break;
  case SE_DELTA_QUANT_INTRA :
    ec_flag[SE_DELTA_QUANT_INTRA] = 1;
    break;
  default:
    break;

  }
  return 1;
}


/*!
 ************************************************************************
 * \brief
 *    Error handling procedure. Print error message to stderr and exit
 *    with supplied code.
 * \param text
 *    Error message
 * \param code
 *    Exit code
 ************************************************************************
 */
void error(char *text, int code)
{
  fprintf(stderr, "%s\n", text);
  ErrHandFunc(text,code);
  //exit(code);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -