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

📄 umc_mp4_video_parser.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
            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_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);
    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;
    //f if (newpred_enable)
    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 (!mp4_GetMarkerBit(pInfo)) return MP4_STATUS_PARSE_ERROR;
            VOP->vop_height = mp4_GetBits(pInfo, 13);
            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 (!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 (!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);
                    if (VOL->ComplexityEstimation.vlc_bits) VOL->ComplexityEstimation.dcecs_vlc_bits =  mp4_GetBits9(pInfo, 4);
                    if (VOL->ComplexityEstimation.inter_blocks) VOL->ComplexityEstimation.dcecs_inter_blocks =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.inter4v_blocks) VOL->ComplexityEstimation.dcecs_inter4v_blocks =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.apm) VOL->ComplexityEstimation.dcecs_apm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.npm) VOL->ComplexityEstimation.dcecs_npm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.forw_back_mc_q) VOL->ComplexityEstimation.dcecs_forw_back_mc_q =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel2) VOL->ComplexityEstimation.dcecs_halfpel2 =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel4) VOL->ComplexityEstimation.dcecs_halfpel4 =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.sadct) VOL->ComplexityEstimation.dcecs_sadct =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.quarterpel) VOL->ComplexityEstimation.dcecs_quarterpel =  mp4_GetBits9(pInfo, 8);
                }
                if (VOP->coding_type == MP4_VOP_TYPE_B) {
                    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.inter_blocks) VOL->ComplexityEstimation.dcecs_inter_blocks =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.inter4v_blocks) VOL->ComplexityEstimation.dcecs_inter4v_blocks =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.apm) VOL->ComplexityEstimation.dcecs_apm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.npm) VOL->ComplexityEstimation.dcecs_npm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.forw_back_mc_q) VOL->ComplexityEstimation.dcecs_forw_back_mc_q =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel2) VOL->ComplexityEstimation.dcecs_halfpel2 =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel4) VOL->ComplexityEstimation.dcecs_halfpel4 =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.interpolate_mc_q) VOL->ComplexityEstimation.dcecs_interpolate_mc_q =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.sadct) VOL->ComplexityEstimation.dcecs_sadct =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.quarterpel) VOL->ComplexityEstimation.dcecs_quarterpel =  mp4_GetBits9(pInfo, 8);
                }
                if (VOP->coding_type == MP4_VOP_TYPE_S && VOL->sprite_enable == MP4_SPRITE_STATIC) {
                    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.inter_blocks) VOL->ComplexityEstimation.dcecs_inter_blocks =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.inter4v_blocks) VOL->ComplexityEstimation.dcecs_inter4v_blocks =  mp4_GetBits(pInfo, 8);
                    if (VOL->ComplexityEstimation.apm) VOL->ComplexityEstimation.dcecs_apm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.npm) VOL->ComplexityEstimation.dcecs_npm =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.forw_back_mc_q) VOL->ComplexityEstimation.dcecs_forw_back_mc_q =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel2) VOL->ComplexityEstimation.dcecs_halfpel2 =  mp4_GetBits9(pInfo, 8);
                    if (VOL->ComplexityEstimation.halfpel4) VOL->ComplexityEstimation.dcecs_halfpel4 =  mp4_GetBits(pInfo, 8);
                    if (VOL->ComplexityEstimation.interpolate_mc_q) VOL->ComplexityEstimation.dcecs_interpolate_mc_q =  mp4_GetBits9(pInfo, 8);
                }
            }
        }
        VOP->intra_dc_vlc_thr = mp4_GetBits9(pInfo, 3);
        if (VOL->interlaced) {
            VOP->top_field_first = mp4_GetBit(pInfo);
            VOP->alternate_vertical_scan_flag = mp4_GetBit(pInfo);
        }
    }
    if ((VOL->sprite_enable == MP4_SPRITE_STATIC || VOL->sprite_enable == MP4_SPRITE_GMC) && VOP->coding_type == MP4_VOP_TYPE_S) {
        if (VOL->sprite_warping_points > 0)
            if (mp4_Sprite_Trajectory(pInfo) != MP4_STATUS_OK)
                return MP4_STATUS_PARSE_ERROR;
        if (VOL->sprite_brightness_change) {
            code = mp4_ShowBits9(pInfo, 4);
            if (code == 15) {
                mp4_FlushBits(pInfo, 4);
                VOP->brightness_change_factor = 625 + mp4_GetBits(pInfo, 10);
            } else if (code == 14) {
                mp4_FlushBits(pInfo, 4);
                VOP->brightness_change_factor = 113 + mp4_GetBits9(pInfo, 9);
            } else if (code >= 12) {
                mp4_FlushBits(pInfo, 3);
                code = mp4_GetBits9(pInfo, 7);
                VOP->brightness_change_factor = (code < 64) ? code - 112 : code - 15;
            } else if (code >= 8) {
                mp4_FlushBits(pInfo, 2);
                code = mp4_GetBits9(pInfo, 6);
                VOP->brightness_change_factor = (code < 32) ? code - 48 : code - 15;
            } else {
                mp4_FlushBits(pInfo, 1);
                code = mp4_GetBits9(pInfo, 5);
                VOP->brightness_change_factor = (code < 16) ? code - 16 : code - 15;
            }
        } else
            VOP->brightness_change_factor = 0;
        if (VOL->sprite_enable == MP4_SPRITE_STATIC)
            return MP4_STATUS_OK;
    }
    if (VOL->shape != MP4_SHAPE_TYPE_BINARYONLY) {
        VOP->quant = mp4_GetBits9(pInfo, VOL->quant_precision);
        if (VOL->shape == MP4_SHAPE_TYPE_GRAYSCALE) {
            Ipp32s   ac, i;

            ac = mp4_aux_comp_count[VOL->shape_extension];
            for (i = 0; i < ac; i ++)
                VOP->alpha_quant[i] = mp4_GetBits9(pInfo, 6);
        }
        if (VOP->coding_type != MP4_VOP_TYPE_I) {
            VOP->fcode_forward = mp4_GetBits9(pInfo, 3);
            if (VOP->fcode_forward == 0) {
                mp4_Error("Error: vop_fcode_forward == 0");
                return MP4_STATUS_PARSE_ERROR;
            }
        }
        if (VOP->coding_type == MP4_VOP_TYPE_B) {
            VOP->fcode_backward = mp4_GetBits9(pInfo, 3);
            if (VOP->fcode_backward == 0) {
                mp4_Error("Error: vop_fcode_backward == 0");
                return MP4_STATUS_PARSE_ERROR;
            }
        }
        if (!VOL->scalability) {
            if (VOL->shape != MP4_SHAPE_TYPE_RECTANGULAR && VOP->coding_type != MP4_VOP_TYPE_I)
                VOP->shape_coding_type = mp4_GetBit(pInfo);
        } else {
            //f if (VOL->enhancement_type) {
                //f VOP->load_backward_shape = mp4_GetBit(pInfo);
                //f if (VOP->load_backward_shape) {
                    //f shape

⌨️ 快捷键说明

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