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

📄 h263parse.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 2 页
字号:
            return H263_STATUS_PARSE_ERROR;          }          VPicFmt->PAR_height = h263_GetBits9(pInfo, 8);          if (VPicFmt->PAR_height == 0) {            h263_Error("Error: Zero PAR height");            return H263_STATUS_PARSE_ERROR;          }        }      } else {        VPicFmt->height = h263_pic_height[source_format - 1];        VPicFmt->width = h263_pic_width[source_format - 1];      }      if (VPic->PCF) { /* custom picture clock frequency */        code = h263_GetBits9(pInfo, 9);        VPic->clock_conversion_code = code >> 8;        VPic->clock_divisor = code & 0xFF;        if (VPic->clock_divisor == 0) {          h263_Error("Error: Zero clock divisor");          return H263_STATUS_PARSE_ERROR;        }      }    }    if (VPic->PCF) { /* custom picture clock frequency */      etr = h263_GetBits9(pInfo, 2);      VPic->temporal_reference += (etr << 8);    }    if (VPic->ufep == 1) {      if (oppmodes.UMV) {        code = h263_GetBit(pInfo);        if (code)          VPic->unlimited_UMV = 0;        else {          code = h263_GetBit(pInfo);          if (!code) {            h263_Error("Error: Invalid UUI");            return H263_STATUS_PARSE_ERROR;          }          VPic->unlimited_UMV = 1;        }      }      if (oppmodes.sliceStruct)        VPic->sliceSubmodes = h263_GetBits9(pInfo, 2); /* if ufep==0, the last decoded value is used */    }    if (scalability) {      VPic->enh_layer_num = h263_GetBits9(pInfo, 4);      VSeqOppModes = &(pInfo->VideoSequence.oppmodes[VPic->enh_layer_num - 1]);      VSeqFmt = &(pInfo->VideoSequence.format[VPic->enh_layer_num - 1]);      if (VPic->ufep == 1) {        VPic->ref_layer_num = h263_GetBits9(pInfo, 4);        if (VPicFmt->height != pInfo->VideoSequence.format[VPic->ref_layer_num - 1].height) {          if (VPicFmt->width != pInfo->VideoSequence.format[VPic->ref_layer_num - 1].width)            VPicFmt->scalability_type = H263_SCALABILITY_SPATIAL_XY;          else            VPicFmt->scalability_type = H263_SCALABILITY_SPATIAL_Y;        } else {          if (VPicFmt->width != pInfo->VideoSequence.format[VPic->ref_layer_num - 1].width)            VPicFmt->scalability_type = H263_SCALABILITY_SPATIAL_X;          else            VPicFmt->scalability_type = (VPic->picture_coding_type == H263_PIC_TYPE_B ? H263_SCALABILITY_TEMPORAL : H263_SCALABILITY_SNR);        }      } else {        VPic->ref_layer_num = pInfo->VideoSequence.ref_layer_num[VPic->enh_layer_num - 1];        if (VPic->picture_coding_type == H263_PIC_TYPE_B) {          if (pInfo->VideoSequence.prev_pic_type[VPic->enh_layer_num - 1] != H263_PIC_TYPE_B)            VPic->ref_layer_num = pInfo->VideoSequence.ref_layer_num_b[VPic->enh_layer_num - 1] = VPic->enh_layer_num;          else            VPic->ref_layer_num = pInfo->VideoSequence.ref_layer_num_b[VPic->enh_layer_num - 1];        }      }    } else {      VPic->enh_layer_num = 1;      VSeqOppModes = &(pInfo->VideoSequence.oppmodes[0]);      VSeqFmt = &(pInfo->VideoSequence.format[0]);    }    if (oppmodes.RPS) {      if (VPic->ufep == 1) {        VPic->RPSflags = h263_GetBits9(pInfo, 3);        if (VPic->RPSflags < 4) {          h263_Error("Error: Invalid PRSMF");          return H263_STATUS_PARSE_ERROR;        }      }      code = h263_GetBit(pInfo); /* TRPI */      if (code) {        VPic->pred_temp_ref = h263_GetBits(pInfo, 10); /* TRP */      }      code = h263_GetBit(pInfo); /* BCI */      if (code) {        h263_parse_BCM(pInfo); /* not implemented yet !!! */      } else {        code = h263_GetBit(pInfo);        if (!code) {          h263_Error("Error: Invalid BCI");          return H263_STATUS_PARSE_ERROR;        }      }    }    if (modes.resample) {      VPic->wda = h263_GetBits9(pInfo, 2);      if (VPic->wda < 2) {        h263_Error("Error: Invalid wda");        return H263_STATUS_PARSE_ERROR;      }      VPic->wda &= 1;      h263_decode_resampleParams(pInfo);    }    if (VPic->ufep == 1) {      *VSeqOppModes = oppmodes;      *VPicOppModes = oppmodes;      *VSeqFmt = *VPicFmt;    } else {      *VPicOppModes = *VSeqOppModes;      *VPicFmt = *VSeqFmt;    }    VPic->height = VPicFmt->height;    VPic->width = VPicFmt->width;  } else { /* PLUSPTYPE */    VPic->rtype = 0;    code = h263_GetBits(pInfo, 5); /* the rest of PTYPE */    VPic->picture_coding_type = (code >> 4) & 1;    modes.UMV = (code >> 3) & 1;    modes.SAC = (code >> 2) & 1;    modes.advPred = (code >> 1) & 1;    modes.PBframes = code & 1;    modes.redResUp = 0;    modes.resample = 0;    if (modes.PBframes)      VPic->picture_coding_type = H263_PIC_TYPE_PB;    VSeqOppModes = &(pInfo->VideoSequence.oppmodes[0]);    h263_zero_oppmodes(VSeqOppModes);    h263_zero_oppmodes(VPicOppModes);    VPic->height = h263_pic_height[source_format - 1];    VPic->width = h263_pic_width[source_format - 1];/* ??? may need that only if there are frames with and without PLUSPTYPE in the same sequence    pInfo->VideoSequence.format[0].height = VPic->height;    pInfo->VideoSequence.format[0].width = VPic->width;*/  }  *VPicModes = modes;  /* Mode restrictions (Rec. 5.1.4.5)  ??? */  if (VPic->picture_coding_type == H263_PIC_TYPE_I) {    VPicModes->UMV = VPicModes->advPred =      VPicOppModes->UMV = VPicOppModes->advPred =      VPicOppModes->altInterVLC = 0;      VPicModes->resample = VPicModes->redResUp = 0;  } else if (VPic->picture_coding_type == H263_PIC_TYPE_B) {    VPicModes->SAC = VPicOppModes->SAC =      VPicOppModes->deblockFilt =      VPicOppModes->advPred = 0;  } else if (VPic->picture_coding_type == H263_PIC_TYPE_EI) {    VPicModes->UMV = VPicModes->SAC = VPicModes->advPred =    VPicOppModes->UMV = VPicOppModes->SAC = VPicOppModes->advPred =      VPicOppModes->altInterVLC = 0;      VPicModes->resample = VPicModes->redResUp = 0;  } else if (VPic->picture_coding_type == H263_PIC_TYPE_EP) {    VPicModes->SAC = VPicModes->advPred = 0;    VPicOppModes->SAC = VPicOppModes->advPred = 0;  }  VPic->pic_quant = h263_GetBits9(pInfo, 5);  if (!VPic->plusptype) {    VPic->CPM = h263_GetBit(pInfo);    if (VPic->CPM)      VPic->PSBI = h263_GetBits9(pInfo, 2);  }#if 0  if (VPic->width != VSeq->format[VPic->enh_layer_num - 1].width || VPic->height != VSeq->format[VPic->enh_layer_num - 1].height) { /* ??? */    if (!VPicModes->resample && !scalability && VPic->picture_coding_type != H263_PIC_TYPE_I) {      h263_Error("Error: Source format change is incompatible with picture type");      return H263_STATUS_PARSE_ERROR;    }  }#endif  if (VPic->picture_coding_type == H263_PIC_TYPE_PB ||    VPic->picture_coding_type == H263_PIC_TYPE_iPB) {    if (VPic->PCF)      VPic->temporal_reference_B = h263_GetBits9(pInfo, 5);    else      VPic->temporal_reference_B = h263_GetBits9(pInfo, 3);     VPic->dbquant = h263_GetBits9(pInfo, 2);  }  for (;;) {    code = h263_GetBit(pInfo); /* pei */    if (!code)      break;    code = h263_GetBits9(pInfo, 8); /* psupp (Annex L) TODO ??? */  }  if (!VPicModes->redResUp) {    VPic->MacroBlockPerRow = (VPic->width + 15) >> 4;    VPic->MacroBlockPerCol = (VPic->height + 15) >> 4;    if (VPic->height <= 400) {      VPic->RowsPerGOB = 1;      VPic->num_gobs_in_pic = VPic->MacroBlockPerCol;    } else if (VPic->height <= 800) {      VPic->RowsPerGOB = 2;      VPic->num_gobs_in_pic = (VPic->MacroBlockPerCol  + 1) >> 1;    } else { /* if (VPic->height <= 1152) */      VPic->RowsPerGOB = 4;      VPic->num_gobs_in_pic = (VPic->MacroBlockPerCol + 3) >> 2;    }  } else {    VPic->MacroBlockPerRow = (VPic->width + 31) >> 5;    VPic->MacroBlockPerCol = (VPic->height + 31) >> 5;    if (VPic->height <= 800) {      VPic->RowsPerGOB = 1;      VPic->num_gobs_in_pic = VPic->MacroBlockPerCol;    } else { /* if (VPic->height <= 1152) */      VPic->RowsPerGOB = 2;      VPic->num_gobs_in_pic = (VPic->MacroBlockPerCol + 1) >> 1;    }  }  return H263_STATUS_OK;}int h263_ParseGOBHeader(h263_Info* pInfo){  Ipp32u code;  code = h263_ShowBits(pInfo, 17);  if (code > 1)                        /* No GOB header  */    return 0;  if (code == 1) {                     /* GOB Start code, no GSTUF */    h263_FlushBits(pInfo, 17);  } else {    int index = 2 + ((pInfo->bitoff + 7) >> 3);    if (pInfo->bufptr[index] > 127) {  /* GOB Start code, with GSTUF */      pInfo->bufptr += index;      pInfo->bitoff = 1;    } else {      return -1;    }  }  pInfo->VideoSequence.VideoPicture.gob_number = h263_GetBits9(pInfo, 5);  if (pInfo->VideoSequence.VideoPicture.gob_number > 30) /* EOS or EOSBS */    return 1;  if (pInfo->VideoSequence.VideoPicture.CPM)    pInfo->VideoSequence.VideoPicture.GSBI = h263_GetBits9(pInfo, 2);  pInfo->VideoSequence.VideoPicture.GFID = h263_GetBits9(pInfo, 2);  pInfo->VideoSequence.VideoPicture.pic_quant = h263_GetBits9(pInfo, 5);  return 1;}

⌨️ 快捷键说明

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