📄 umc_mp4_video_parser.cpp
字号:
}
VOL->interlaced = mp4_GetBit(pInfo);
VOL->obmc_disable = mp4_GetBit(pInfo);
VOL->sprite_enable = mp4_GetBits9(pInfo, VOL->verid != 1 ? 2 : 1);
if (VOL->sprite_enable == MP4_SPRITE_STATIC || VOL->sprite_enable == MP4_SPRITE_GMC) {
if (VOL->sprite_enable == MP4_SPRITE_STATIC) {
VOL->sprite_width = mp4_GetBits(pInfo, 13);
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOL->sprite_height = mp4_GetBits(pInfo, 13);
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOL->sprite_left_coordinate = mp4_GetBits(pInfo, 13);
VOL->sprite_left_coordinate <<= (32 - 13);
VOL->sprite_left_coordinate >>= (32 - 13);
if (VOL->sprite_left_coordinate & 1) {
mp4_Error("Error: sprite_left_coordinate must be divisible by 2");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOL->sprite_top_coordinate = mp4_GetBits(pInfo, 13);
VOL->sprite_top_coordinate <<= (32 - 13);
VOL->sprite_top_coordinate >>= (32 - 13);
if (VOL->sprite_top_coordinate & 1) {
mp4_Error("Error: sprite_top_coordinate must be divisible by 2");
return MP4_STATUS_PARSE_ERROR;
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
}
VOL->sprite_warping_points = mp4_GetBits9(pInfo, 6);
if (VOL->sprite_warping_points > 4 ||
(VOL->sprite_warping_points == 4 &&
VOL->sprite_enable == MP4_SPRITE_GMC)) {
mp4_Error("Error: bad no_of_sprite_warping_points");
return MP4_STATUS_PARSE_ERROR;
}
VOL->sprite_warping_accuracy = mp4_GetBits9(pInfo, 2);
VOL->sprite_brightness_change = mp4_GetBit(pInfo);
if (VOL->sprite_enable == MP4_SPRITE_GMC) {
if (VOL->sprite_brightness_change) {
mp4_Error("Error: sprite_brightness_change should be 0 for GMC sprites");
return MP4_STATUS_PARSE_ERROR;
}
}
if (VOL->sprite_enable != MP4_SPRITE_GMC) {
VOL->low_latency_sprite_enable = mp4_GetBit(pInfo);
if (VOL->low_latency_sprite_enable) {
mp4_Error("Error: low_latency_sprite not supported");
return MP4_STATUS_PARSE_ERROR;
}
}
}
if (VOL->verid != 1 && VOL->shape != MP4_SHAPE_TYPE_RECTANGULAR) {
VOL->sadct_disable = mp4_GetBit(pInfo);
if (!VOL->sadct_disable) {
mp4_Error("Error: Shape Adaptive DCT is not supported");
return MP4_STATUS_PARSE_ERROR;
}
}
VOL->not_8_bit = mp4_GetBit(pInfo);
if (VOL->not_8_bit) {
mp4_Error("Error: only 8-bits data is supported");
return MP4_STATUS_PARSE_ERROR;
}
if (VOL->not_8_bit) {
VOL->quant_precision = mp4_GetBits9(pInfo, 4);
if (VOL->quant_precision < 3 || VOL->quant_precision > 9) {
mp4_Error("Error: quant_precision must be in range [3; 9]");
return MP4_STATUS_PARSE_ERROR;
}
VOL->bits_per_pixel = mp4_GetBits9(pInfo, 4);
if (VOL->bits_per_pixel < 4 || VOL->bits_per_pixel > 12) {
mp4_Error("Error: bits_per_pixel must be in range [4; 12]");
return MP4_STATUS_PARSE_ERROR;
}
} else {
VOL->quant_precision = 5;
VOL->bits_per_pixel = 8;
}
if (VOL->shape == MP4_SHAPE_TYPE_GRAYSCALE) {
VOL->no_gray_quant_update = mp4_GetBit(pInfo);
VOL->composition_method = mp4_GetBit(pInfo);
VOL->linear_composition = mp4_GetBit(pInfo);
}
VOL->quant_type = mp4_GetBit(pInfo);
if (VOL->quant_type) {
VOL->load_intra_quant_mat = mp4_GetBit(pInfo);
if (VOL->load_intra_quant_mat) {
if (mp4_Parse_QuantMatrix(pInfo) != MP4_STATUS_OK)
return MP4_STATUS_PARSE_ERROR;
}
VOL->load_nonintra_quant_mat = mp4_GetBit(pInfo);
if (VOL->load_nonintra_quant_mat) {
if (mp4_Parse_QuantMatrix(pInfo) != MP4_STATUS_OK)
return MP4_STATUS_PARSE_ERROR;
}
if (VOL->shape == MP4_SHAPE_TYPE_GRAYSCALE) {
Ipp32s ac, i;
ac = mp4_aux_comp_count[VOL->shape_extension];
for (i = 0; i < ac; i ++) {
VOL->load_intra_quant_mat_grayscale[i] = mp4_GetBit(pInfo);
if (VOL->load_intra_quant_mat_grayscale[i]) {
if (mp4_Parse_QuantMatrix(pInfo) != MP4_STATUS_OK)
return MP4_STATUS_PARSE_ERROR;
}
VOL->load_nonintra_quant_mat_grayscale[i] = mp4_GetBit(pInfo);
if (VOL->load_nonintra_quant_mat_grayscale[i]) {
if (mp4_Parse_QuantMatrix(pInfo) != MP4_STATUS_OK)
return MP4_STATUS_PARSE_ERROR;
}
}
}
}
if (VOL->verid != 1)
VOL->quarter_sample = mp4_GetBit(pInfo);
VOL->complexity_estimation_disable = mp4_GetBit(pInfo);
if (!VOL->complexity_estimation_disable) {
VOL->ComplexityEstimation.estimation_method = mp4_GetBits9(pInfo, 2);
if (VOL->ComplexityEstimation.estimation_method <= 1) {
VOL->ComplexityEstimation.shape_complexity_estimation_disable = mp4_GetBit(pInfo);
if (!VOL->ComplexityEstimation.shape_complexity_estimation_disable) {
VOL->ComplexityEstimation.opaque = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.transparent = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.intra_cae = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.inter_cae = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.no_update = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.upsampling = mp4_GetBit(pInfo);
}
VOL->ComplexityEstimation.texture_complexity_estimation_set_1_disable = mp4_GetBit(pInfo);
if (!VOL->ComplexityEstimation.texture_complexity_estimation_set_1_disable) {
VOL->ComplexityEstimation.intra_blocks = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.inter_blocks = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.inter4v_blocks = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.not_coded_blocks = mp4_GetBit(pInfo);
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
VOL->ComplexityEstimation.texture_complexity_estimation_set_2_disable = mp4_GetBit(pInfo);
if (!VOL->ComplexityEstimation.texture_complexity_estimation_set_2_disable) {
VOL->ComplexityEstimation.dct_coefs = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.dct_lines = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.vlc_symbols = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.vlc_bits = mp4_GetBit(pInfo);
}
VOL->ComplexityEstimation.motion_compensation_complexity_disable = mp4_GetBit(pInfo);
if (!VOL->ComplexityEstimation.motion_compensation_complexity_disable) {
VOL->ComplexityEstimation.apm = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.npm = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.interpolate_mc_q = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.forw_back_mc_q = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.halfpel2 = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.halfpel4 = mp4_GetBit(pInfo);
}
}
if (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
if (VOL->ComplexityEstimation.estimation_method == 1) {
// verid != 1
VOL->ComplexityEstimation.version2_complexity_estimation_disable = mp4_GetBit(pInfo);
if (!VOL->ComplexityEstimation.version2_complexity_estimation_disable) {
VOL->ComplexityEstimation.sadct = mp4_GetBit(pInfo);
VOL->ComplexityEstimation.quarterpel = mp4_GetBit(pInfo);
}
}
}
VOL->resync_marker_disable = mp4_GetBit(pInfo);
VOL->data_partitioned = mp4_GetBit(pInfo);
//f GrayScale Shapes does not support data_part
if (VOL->data_partitioned)
VOL->reversible_vlc = mp4_GetBit(pInfo);
if (VOL->verid != 1) {
VOL->newpred_enable = mp4_GetBit(pInfo);
if (VOL->newpred_enable) {
mp4_Error("Error: NEWPRED mode is not supported");
return MP4_STATUS_PARSE_ERROR;
//f VOL->requested_upstream_message_type = mp4_GetBits9(pInfo, 2);
//f VOL->newpred_segment_type = mp4_GetBit(pInfo);
}
VOL->reduced_resolution_vop_enable = mp4_GetBit(pInfo);
if (VOL->reduced_resolution_vop_enable) {
mp4_Error("Error: Reduced Resolution VOP is not supported");
return MP4_STATUS_PARSE_ERROR;
}
}
VOL->scalability = mp4_GetBit(pInfo);
if (VOL->scalability) {
mp4_Error("Error: VOL scalability is not supported");
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;
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -