📄 mp4parse.c
字号:
return MP4_STATUS_PARSE_ERROR;
}
} else {
if (VOL->verid != 1) {
VOL->scalability = mp4_GetBit(pInfo);
if (VOL->scalability) {
mp4_Error("Error: VOL scalability is not supported");
return MP4_STATUS_PARSE_ERROR;
}
}
VOL->resync_marker_disable = mp4_GetBit(pInfo);
}
VOL->VideoObjectPlane.sprite_transmit_mode = MP4_SPRITE_TRANSMIT_MODE_PIECE;
#if 0
{
Ipp8u *sbp = pInfo->bufptr;
Ipp32s v, b, i;
if (mp4_SeekStartCodeValue(pInfo, MP4_USER_DATA_SC)) {
if (pInfo->bufptr[0] == 'D' && pInfo->bufptr[1] == 'i' && pInfo->bufptr[2] == 'v' && pInfo->bufptr[3] == 'X') {
pInfo->ftype = 2;
v = (pInfo->bufptr[4] - '0') * 100 + (pInfo->bufptr[5] - '0') * 10 + (pInfo->bufptr[6] - '0');
if (v < 503)
pInfo->ftype_f = 1;
else if (v == 503) {
i = 8;
b = 0;
while (pInfo->bufptr[i] != 0) {
if (pInfo->bufptr[i] >= '0' && pInfo->bufptr[i] <= '9')
b = b * 10 + (pInfo->bufptr[i] - '0');
i ++;
}
pInfo->ftype_f = (b < 959) ? 1 : 0;
} else
pInfo->ftype_f = 0;
}
}
pInfo->bufptr = sbp;
}
#else
{
Ipp8u *sbp = pInfo->bufptr;
if (mp4_SeekStartCodeValue(pInfo, MP4_USER_DATA_SC)) {
if (pInfo->bufptr[0] == 'D' && pInfo->bufptr[1] == 'i' && pInfo->bufptr[2] == 'v' && pInfo->bufptr[3] == 'X') {
pInfo->ftype = 2;
pInfo->ftype_f = 1;
}
}
pInfo->bufptr = sbp;
}
#endif
return MP4_STATUS_OK;
}
/*static */mp4_Status mp4_Sprite_Trajectory(mp4_Info* pInfo) {
Ipp32s i, dmv_code, dmv_length, fb;
Ipp32u code;
for (i = 0; i < pInfo->VisualObject.VideoObject.sprite_warping_points; i ++) {
code = mp4_ShowBits9(pInfo, 3);
if (code == 7) {
mp4_FlushBits(pInfo, 3);
code = mp4_ShowBits9(pInfo, 9);
fb = 1;
while (code & 256) {
code <<= 1;
fb ++;
}
if (fb > 9) {
mp4_Error("Error when decode sprite_trajectory");
return MP4_STATUS_PARSE_ERROR;
}
dmv_length = fb + 5;
} else {
fb = (code <= 1) ? 2 : 3;
dmv_length = code - 1;
}
mp4_FlushBits(pInfo, fb);
if (dmv_length <= 0)
dmv_code = 0;
else {
dmv_code = mp4_GetBits(pInfo, dmv_length);
if ((dmv_code & (1 << (dmv_length - 1))) == 0)
dmv_code -= (1 << dmv_length) - 1;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
pInfo->VisualObject.VideoObject.VideoObjectPlane.warping_mv_code_du[i] = dmv_code;
code = mp4_ShowBits9(pInfo, 3);
if (code == 7) {
mp4_FlushBits(pInfo, 3);
code = mp4_ShowBits9(pInfo, 9);
fb = 1;
while (code & 256) {
code <<= 1;
fb ++;
}
if (fb > 9) {
mp4_Error("Error when decode sprite_trajectory");
return MP4_STATUS_PARSE_ERROR;
}
dmv_length = fb + 5;
} else {
fb = (code <= 1) ? 2 : 3;
dmv_length = code - 1;
}
mp4_FlushBits(pInfo, fb);
if (dmv_length <= 0)
dmv_code = 0;
else {
dmv_code = mp4_GetBits(pInfo, dmv_length);
if ((dmv_code & (1 << (dmv_length - 1))) == 0)
dmv_code -= (1 << dmv_length) - 1;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
pInfo->VisualObject.VideoObject.VideoObjectPlane.warping_mv_code_dv[i] = dmv_code;
}
return MP4_STATUS_OK;
}
mp4_Status mp4_Parse_GroupOfVideoObjectPlane(mp4_Info* pInfo)
{
Ipp32u hour, min, sec;
hour = mp4_GetBits9(pInfo, 5);
min = mp4_GetBits9(pInfo, 6);
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
sec = mp4_GetBits9(pInfo, 6);
pInfo->VisualObject.VideoObject.GroupOfVideoObjectPlane.time_code = sec + min * 60 + hour * 3600;
pInfo->VisualObject.VideoObject.GroupOfVideoObjectPlane.time_code *= pInfo->VisualObject.VideoObject.vop_time_increment_resolution;
pInfo->VisualObject.VideoObject.GroupOfVideoObjectPlane.closed_gov = mp4_GetBit(pInfo);
pInfo->VisualObject.VideoObject.GroupOfVideoObjectPlane.broken_link = mp4_GetBit(pInfo);
return MP4_STATUS_OK;
}
mp4_Status mp4_Parse_VideoObjectPlane(mp4_Info* pInfo)
{
Ipp32u code;
mp4_VideoObject *VOL = &pInfo->VisualObject.VideoObject;
mp4_VideoObjectPlane *VOP = &pInfo->VisualObject.VideoObject.VideoObjectPlane;
mp4_VideoObjectPlaneH263 *VOPSH = &pInfo->VisualObject.VideoObject.VideoObjectPlaneH263;
if (VOL->short_video_header) {
code = mp4_GetBits9(pInfo, 6); // read rest bits of short_video_start_marker
VOPSH->temporal_reference = mp4_GetBits9(pInfo, 8);
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
code = mp4_GetBit(pInfo); // zero_bit
VOPSH->split_screen_indicator = mp4_GetBit(pInfo);
VOPSH->document_camera_indicator = mp4_GetBit(pInfo);
VOPSH->full_picture_freeze_release = mp4_GetBit(pInfo);
VOPSH->source_format = mp4_GetBits9(pInfo, 3);
if (VOPSH->source_format == 0 || VOPSH->source_format > 5) {
mp4_Error("Error: Bad value for VideoPlaneWithShortHeader.source_format");
return MP4_STATUS_PARSE_ERROR;
}
VOPSH->picture_coding_type = mp4_GetBit(pInfo);
VOP->coding_type = VOPSH->picture_coding_type;
code = mp4_GetBits9(pInfo, 4); // four_reserved_zero_bits
VOPSH->vop_quant = mp4_GetBits9(pInfo, 5);
code = mp4_GetBit(pInfo); // zero_bit
for (;;) {
code = mp4_GetBit(pInfo); // pei
if (!code)
break;
code = mp4_GetBits9(pInfo, 8); // psupp
}
return MP4_STATUS_OK;
}
VOP->coding_type = mp4_GetBits9(pInfo, 2);
if (((VOP->coding_type != MP4_VOP_TYPE_I) && (pInfo->noPVOPs)) || ((VOP->coding_type == MP4_VOP_TYPE_B) && (pInfo->noBVOPs))) {
mp4_Error("Error: Bad vop_coding_type");
return MP4_STATUS_PARSE_ERROR;
}
VOP->modulo_time_base = 0;
do {
code = mp4_GetBit(pInfo);
VOP->modulo_time_base += code;
} while (code);
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
if (VOL->vop_time_increment_resolution_bits != 0 ) {
VOP->time_increment = mp4_GetBits(pInfo, VOL->vop_time_increment_resolution_bits);
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOP->coded = mp4_GetBit(pInfo);
if (!VOP->coded)
return MP4_STATUS_OK;
if (VOL->newpred_enable) {
int vop_id_length = VOL->vop_time_increment_resolution_bits + 3;
if (vop_id_length > 15)
vop_id_length = 15;
VOP->vop_id = mp4_GetBits(pInfo, vop_id_length);
VOP->vop_id_for_prediction_indication = mp4_GetBit(pInfo);
if (VOP->vop_id_for_prediction_indication)
VOP->vop_id_for_prediction = mp4_GetBits(pInfo, vop_id_length);
if (!mp4_GetMarkerBit(pInfo))
return MP4_STATUS_PARSE_ERROR;
}
if (VOL->shape != MP4_SHAPE_TYPE_BINARYONLY && (VOP->coding_type == MP4_VOP_TYPE_P ||
(VOP->coding_type == MP4_VOP_TYPE_S && VOL->sprite_enable == MP4_SPRITE_GMC)))
VOP->rounding_type = mp4_GetBit(pInfo);
if (VOL->reduced_resolution_vop_enable && VOL->shape == MP4_SHAPE_TYPE_RECTANGULAR &&
(VOP->coding_type == MP4_VOP_TYPE_I || VOP->coding_type == MP4_VOP_TYPE_P)) {
VOP->reduced_resolution = mp4_GetBit(pInfo);
if (VOP->reduced_resolution) {
mp4_Error("Error: Reduced Resolution VOP is not supported");
return MP4_STATUS_PARSE_ERROR;
}
}
if (VOL->shape != MP4_SHAPE_TYPE_RECTANGULAR) {
if (!(VOL->sprite_enable == MP4_SPRITE_STATIC && VOP->coding_type == MP4_VOP_TYPE_I)) {
VOP->vop_width = mp4_GetBits(pInfo, 13);
if (VOP->vop_width == 0) {
mp4_Error("Error: wrong value of vop_width");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOP->vop_height = mp4_GetBits(pInfo, 13);
if (VOP->vop_height == 0) {
mp4_Error("Error: wrong value of vop_height");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOP->vop_horizontal_mc_spatial_ref = mp4_GetBits(pInfo, 13);
VOP->vop_horizontal_mc_spatial_ref <<= (32 - 13);
VOP->vop_horizontal_mc_spatial_ref >>= (32 - 13);
if (VOP->vop_horizontal_mc_spatial_ref & 1) {
mp4_Error("Error: vop_horizontal_mc_spatial_ref must be divisible by 2");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOP->vop_vertical_mc_spatial_ref = mp4_GetBits(pInfo, 13);
VOP->vop_vertical_mc_spatial_ref <<= (32 - 13);
VOP->vop_vertical_mc_spatial_ref >>= (32 - 13);
if (VOP->vop_vertical_mc_spatial_ref & 1) {
mp4_Error("Error: vop_vertical_mc_spatial_ref must be divisible by 2");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
}
//f if ((VOL->shape != MP4_SHAPE_TYPE_BINARYONLY) && VOL->scalability && enhancement_type)
//f background_composition = mp4_GetBit(pInfo);
VOP->change_conv_ratio_disable = mp4_GetBit(pInfo);
VOP->vop_constant_alpha = mp4_GetBit(pInfo);
if (VOP->vop_constant_alpha)
VOP->vop_constant_alpha_value = mp4_GetBits9(pInfo, 8);
else
VOP->vop_constant_alpha_value = 255;
}
if (VOL->shape != MP4_SHAPE_TYPE_BINARYONLY) {
if (!VOL->complexity_estimation_disable) {
if (VOL->ComplexityEstimation.estimation_method == 0) {
if (VOP->coding_type == MP4_VOP_TYPE_I) {
if (VOL->ComplexityEstimation.opaque) VOL->ComplexityEstimation.dcecs_opaque = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.transparent) VOL->ComplexityEstimation.dcecs_transparent = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.intra_cae) VOL->ComplexityEstimation.dcecs_intra_cae = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.inter_cae) VOL->ComplexityEstimation.dcecs_inter_cae = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.no_update) VOL->ComplexityEstimation.dcecs_no_update = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.upsampling) VOL->ComplexityEstimation.dcecs_upsampling = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.intra_blocks) VOL->ComplexityEstimation.dcecs_intra_blocks = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.not_coded_blocks) VOL->ComplexityEstimation.dcecs_not_coded_blocks = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.dct_coefs) VOL->ComplexityEstimation.dcecs_dct_coefs = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.dct_lines) VOL->ComplexityEstimation.dcecs_dct_lines = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.vlc_symbols) VOL->ComplexityEstimation.dcecs_vlc_symbols = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.vlc_bits) VOL->ComplexityEstimation.dcecs_vlc_bits = mp4_GetBits9(pInfo, 4);
if (VOL->ComplexityEstimation.sadct) VOL->ComplexityEstimation.dcecs_sadct = mp4_GetBits9(pInfo, 8);
}
if (VOP->coding_type == MP4_VOP_TYPE_P) {
if (VOL->ComplexityEstimation.opaque) VOL->ComplexityEstimation.dcecs_opaque = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.transparent) VOL->ComplexityEstimation.dcecs_transparent = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.intra_cae) VOL->ComplexityEstimation.dcecs_intra_cae = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.inter_cae) VOL->ComplexityEstimation.dcecs_inter_cae = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.no_update) VOL->ComplexityEstimation.dcecs_no_update = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.upsampling) VOL->ComplexityEstimation.dcecs_upsampling = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.intra_blocks) VOL->ComplexityEstimation.dcecs_intra_blocks = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.not_coded_blocks) VOL->ComplexityEstimation.dcecs_not_coded_blocks = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.dct_coefs) VOL->ComplexityEstimation.dcecs_dct_coefs = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.dct_lines) VOL->ComplexityEstimation.dcecs_dct_lines = mp4_GetBits9(pInfo, 8);
if (VOL->ComplexityEstimation.vlc_symbols) VOL->ComplexityEstimation.dcecs_vlc_symbols = mp4_GetBits9(pInfo, 8);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -