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

📄 h263parse.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ///////////////////////////////////////////////////////////////////////////               INTEL CORPORATION PROPRIETARY INFORMATION//  This software is supplied under the terms of a license agreement or//  nondisclosure agreement with Intel Corporation and may not be copied//  or disclosed except in accordance with the terms of that agreement.//        Copyright (c) 2005 Intel Corporation. All Rights Reserved.////  Description:    Parses H.263++ headers//*/#include "h263.h"#include "h263dec.h"static void h263_zero_oppmodes(h263_OPPTYPEmodes *modes){  ippsZero_8u((Ipp8u *)modes, sizeof(h263_OPPTYPEmodes));}static void h263_zero_modes(h263_PTYPEmodes *modes){  ippsZero_8u((Ipp8u *)modes, sizeof(h263_PTYPEmodes));}static h263_Status h263_parse_BCM(h263_Info* pInfo){#if 0  h263_VideoPicture *VPic = &pInfo->VideoSequence.VideoPicture;  Ipp32u code;  code = h263_GetBits(pInfo, 14);  VPic->back_mess_type = code >> 12;  if (VPic->back_mess_type < 2)    return H263_STATUS_PARSE_ERROR;  VPic->URF = (code >> 11) & 1;  VPic->BT_TR = (code >> 1) & 0x3FF;  if (code & 1) /* ELNUMI */    VPic->BT_ELNUM = h263_GetBits9(pInfo, 4);  else    VPic->BT_ELNUM = 0; /* ??? */  VPic->BCPM = h263_GetBit(pInfo);  if (VPic->BCPM)    VPic->BSBI = h263_GetBits9(pInfo, 2);  h263_FlushBits(pInfo, 1); /* BEPB1 - only if videomux mode is in use ???s */  /* GOB number / MBA ......*/#endif  return H263_STATUS_OK;}static h263_Status h263_decode_resampleParams(h263_Info* pInfo){  h263_VideoPicture *VPic = &pInfo->VideoSequence.VideoPicture;  h263_PictureFormat *VPicFmt = &pInfo->VideoSequence.VideoPicture.format;  int i, wx, wy, bit, scaleX, scaleY;  Ipp32u bits;  IppMotionVector *ref_warps;  if (VPic->picture_coding_type != H263_PIC_TYPE_EP) {    for (i = 0; i < 4; i++) {      h263_DecodeMVD_umvplus(pInfo, &wx, &wy);      VPic->warpParams[i].dx = (Ipp16s)wx;      VPic->warpParams[i].dy = (Ipp16s)wy;    }    VPic->fillMode = h263_GetBits9(pInfo, 2);    if (VPic->fillMode == 0) {      VPic->fillColor[0] = h263_GetBits9(pInfo, 8);      for (i = 1; i < 3; i++) {        bits = h263_GetBits9(pInfo, 9);#ifdef H263_METICULOUS        if (bits & 0x100) {          h263_Error("Error: Wrong Color Fill (zero anti-emulation bit)");          return H263_STATUS_PARSE_ERROR;        }#endif        VPic->fillColor[i] = bits & 0xff;      }    }  } else { /* one-bit refinements */    bits = h263_GetBits9(pInfo, 8);    if (VPic->ref_layer_num == 1)      ref_warps = pInfo->VideoSequence.warpParams;    else      ref_warps = pInfo->VideoSequence.enhLayers[VPic->ref_layer_num - 2]->warpParams;    scaleX = (VPicFmt->scalability_type == H263_SCALABILITY_SPATIAL_Y ? 0 : 1);    scaleY = (VPicFmt->scalability_type == H263_SCALABILITY_SPATIAL_X ? 0 : 1);    /* refinement should be 0 if scale == 0 ??? */    for (i = 0; i < 4; i++) {      bit = (bits >> (7 - 2*i)) & 1;      pInfo->VideoSequence.enhLayers[VPic->enh_layer_num - 2]->warpParams[i].dx =        VPic->warpParams[i].dx = (Ipp16s)((ref_warps[i].dx << scaleX) + bit);      bit = (bits >> (6 - 2*i)) & 1;      pInfo->VideoSequence.enhLayers[VPic->enh_layer_num - 2]->warpParams[i].dy =        VPic->warpParams[i].dy = (Ipp16s)((ref_warps[i].dy << scaleY) + bit);    }    /* fillMode of the ref layer is used -> the base layer fillMode is used in ALL enh layers ??? */    VPic->fillMode = pInfo->VideoSequence.fillMode;    if (VPic->fillMode == 0) {      for (i = 0; i < 3; i++)        VPic->fillColor[i] = pInfo->VideoSequence.fillColor[i];    }  }  return H263_STATUS_OK;}h263_Status h263_Parse_PictureHeader(h263_Info* pInfo){/*  h263_VideoSequence *VSeq = &pInfo->VideoSequence; */  h263_VideoPicture *VPic = &pInfo->VideoSequence.VideoPicture;  Ipp32u code;  h263_PTYPEmodes *VPicModes = &pInfo->VideoSequence.VideoPicture.modes;  h263_OPPTYPEmodes *VSeqOppModes;  h263_OPPTYPEmodes *VPicOppModes = &pInfo->VideoSequence.VideoPicture.oppmodes;  h263_PictureFormat *VSeqFmt;  h263_PictureFormat *VPicFmt = &pInfo->VideoSequence.VideoPicture.format;  h263_PTYPEmodes modes;  h263_OPPTYPEmodes oppmodes;  int source_format;  int etr;  int scalability;  h263_FlushBits(pInfo, 22); /* Flush Picture Start Code */  VPic->prev_temporal_reference = VPic->temporal_reference;  VPic->temporal_reference = h263_GetBits9(pInfo, 8);  code = h263_GetBits(pInfo, 8);  /* PTYPE */  if ((code >> 6) != 2) {    h263_Error("Error: Wrong PTYPE (first 2 bits)");    return H263_STATUS_PARSE_ERROR;  }  VPic->split_screen_indicator = (code >> 5) & 1;  VPic->document_camera_indicator = (code >> 4) & 1;  VPic->full_picture_freeze_release = (code >> 3) & 1;  source_format = code & 7;  if (source_format == 0 || source_format == 6) {    h263_Error("Error: Bad value of source format");    return H263_STATUS_PARSE_ERROR;  }  if (source_format == 7)    VPic->plusptype = 1;  else    VPic->plusptype = 0;  VPic->prev_PCF = VPic->PCF;  VPic->prev_clock_conversion_code = VPic->clock_conversion_code;  VPic->prev_clock_divisor = VPic->clock_divisor;  VPic->PCF = 0;  VPic->clock_conversion_code = 0;  VPic->clock_divisor = 0;  if (VPic->plusptype) { /* PLUSPTYPE */    h263_zero_modes(&modes);    VPic->ufep = h263_GetBits9(pInfo, 3);    if (VPic->ufep > 1) {#ifdef H263_METICULUOS      h263_Error("Error: Wrong UFEP value");      return H263_STATUS_PARSE_ERROR;#endif      VPic->ufep = 1;    }    if (VPic->ufep == 1) { /* OPPTYPE  */      code = h263_GetBits(pInfo, 18);      source_format = code >> 15;      if (source_format == 0 || source_format == 7) {        h263_Error("Error: Bad value of plustype source format");        return H263_STATUS_PARSE_ERROR;      }      VPic->PCF = (Ipp8u)((code >> 14) & 1); /* ??? */      oppmodes.UMV = (Ipp8u)((code >> 13) & 1);      oppmodes.SAC = (Ipp8u)((code >> 12) & 1);      oppmodes.advPred = (Ipp8u)((code >> 11) & 1);      oppmodes.advIntra = (Ipp8u)((code >> 10) & 1);      oppmodes.deblockFilt = (Ipp8u)((code >> 9) & 1);      oppmodes.sliceStruct = (Ipp8u)((code >> 8) & 1);      oppmodes.RPS = (Ipp8u)((code >> 7) & 1);      oppmodes.ISD = (Ipp8u)((code >> 6) & 1);      oppmodes.altInterVLC = (Ipp8u)((code >> 5) & 1);      oppmodes.modQuant = (Ipp8u)((code >> 4) & 1);#ifdef H263_METICULOUS      if ((code & 15) != 8) {        h263_Error("Error: Wrong OPPTYPE (last 4 bits)");        return H263_STATUS_PARSE_ERROR;      }#endif    } else { /* OPPTYPE  */      h263_zero_oppmodes(&oppmodes);    }    code = h263_GetBits(pInfo, 9); /* MPPTYPE */    VPic->picture_coding_type = code >> 6;    if (VPic->picture_coding_type > 5) {      h263_Error("Error: Bad value of picture coding type (in MPPTYPE)");      return H263_STATUS_PARSE_ERROR;    }    if (VPic->picture_coding_type == H263_PIC_TYPE_B || VPic->picture_coding_type == H263_PIC_TYPE_EP || VPic->picture_coding_type == H263_PIC_TYPE_EI)      scalability = 1;    else      scalability = 0;    modes.resample = (code >> 5) & 1;    modes.redResUp = (code >> 4) & 1;    VPic->rtype = (code >> 3) & 1;#ifdef H263_METICULOUS    if ((code & 7) != 1) {      h263_Error("Error: Wrong MPPTYPE (last 3 bits)");      return H263_STATUS_PARSE_ERROR;    }#endif#ifdef H263_METICULOUS    if (VPic->rtype && !(VPic->picture_coding_type == H263_PIC_TYPE_iPB ||                         VPic->picture_coding_type == H263_PIC_TYPE_P ||                         VPic->picture_coding_type == H263_PIC_TYPE_EP)) {      h263_Error("Error: Wrong RTYPE");      return H263_STATUS_PARSE_ERROR;    }#endif    VPic->CPM = h263_GetBit(pInfo);    if (VPic->CPM)      VPic->PSBI = h263_GetBits9(pInfo, 2);    if (VPic->ufep == 1) {      if (source_format == 6) {  /* custom picture format */        int pwi, phi;        code = h263_GetBits(pInfo, 23);        VPicFmt->PAR_code = code >> 19;        pwi = (code >> 10) & 511;#ifdef H263_METICULOUS        if ((code >> 9) & 1) {          h263_Error("Error: Wrong CPFMT (zero anti-emulation bit)");          return H263_STATUS_PARSE_ERROR;        }#endif        phi = code & 511;        VPicFmt->height = phi * 4;        VPicFmt->width = (pwi + 1) * 4;        if (VPicFmt->PAR_code == H263_ASPECT_RATIO_EXTPAR) { /* Extended PAR */          VPicFmt->PAR_width = h263_GetBits9(pInfo, 8);          if (VPicFmt->PAR_width == 0) {            h263_Error("Error: Zero PAR width");

⌨️ 快捷键说明

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