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

📄 mp4parse.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 3 页
字号:
    //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) {            int   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                //f }            //f }            VOP->ref_select_code = mp4_GetBits9(pInfo, 2);        }    }    return MP4_STATUS_OK;}/*// decode VideoPacket*/mp4_Status mp4_DecodeVideoPacket(mp4_Info* pInfo, int *quant_scale, int *found){    Ipp32u      code;    int         header_extension_code, rml;    mp4_VideoObject       *VOL = &pInfo->VisualObject.VideoObject;    mp4_VideoObjectPlane  *VOP = &pInfo->VisualObject.VideoObject.VideoObjectPlane;    if (VOP->coding_type == MP4_VOP_TYPE_I)        rml = 17;    else if (VOP->coding_type == MP4_VOP_TYPE_B)        rml = 16 + IPP_MAX(VOP->fcode_forward, VOP->fcode_backward);    else        rml = 16 + VOP->fcode_forward;    if (mp4_CheckResyncMarker(pInfo, rml)) { // check resync_marker        mp4_AlignBits7F(pInfo);        code = mp4_GetBits(pInfo, rml);        header_extension_code = 0;        if (VOL->shape != MP4_SHAPE_TYPE_RECTANGULAR) {            header_extension_code = mp4_GetBit(pInfo);            if (header_extension_code && !(VOL->sprite_enable == MP4_SPRITE_STATIC && VOP->coding_type == MP4_VOP_TYPE_I)) {                VOP->vop_width = mp4_GetBits(pInfo, 13);                if (!mp4_GetBit(pInfo)) goto err;                VOP->vop_height = mp4_GetBits(pInfo, 13);                if (!mp4_GetBit(pInfo))  goto err;                VOP->vop_horizontal_mc_spatial_ref = mp4_GetBits(pInfo, 13);                if (!mp4_GetBit(pInfo)) goto err;                VOP->vop_vertical_mc_spatial_ref = mp4_GetBits(pInfo, 13);                if (!mp4_GetBit(pInfo))  goto err;            }        }        //f ignore macroblock_number. For error resilience we need use it        code = mp4_GetBits(pInfo, pInfo->VisualObject.VideoObject.mbns);        if (VOL->shape != MP4_SHAPE_TYPE_BINARYONLY) {            *quant_scale = mp4_GetBits9(pInfo, VOL->quant_precision); // quant_scale        }        if (VOL->shape == MP4_SHAPE_TYPE_RECTANGULAR) {            header_extension_code = mp4_GetBit(pInfo);        }        if (header_extension_code) {            //f ignore modulo_time_base            do {                code = mp4_GetBit(pInfo);            } while (code);            if (!mp4_GetBit(pInfo)) goto err;            //f ignore vop_time_increment            if (VOL->vop_time_increment_resolution_bits != 0 ) {                code = mp4_GetBits(pInfo, VOL->vop_time_increment_resolution_bits);            }            if (!mp4_GetBit(pInfo)) goto err;            //f ignore vop_coding_type            code = mp4_GetBits9(pInfo, 2);            if (VOL->shape != MP4_SHAPE_TYPE_RECTANGULAR) {                VOP->change_conv_ratio_disable = mp4_GetBit(pInfo);                if (VOP->coding_type != MP4_VOP_TYPE_I)                    VOP->shape_coding_type = mp4_GetBit(pInfo);            }            if (VOL->shape != MP4_SHAPE_TYPE_BINARYONLY) {                //f ignore intra_dc_vlc_thr                code = mp4_GetBits9(pInfo, 3);                if (VOL->sprite_enable == MP4_SPRITE_GMC && VOP->coding_type == MP4_VOP_TYPE_S && VOL->sprite_warping_points > 0)                    if (mp4_Sprite_Trajectory(pInfo) != MP4_STATUS_OK)                        goto err;                //f ignore vop_reduced_resolution                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))                    code = mp4_GetBit(pInfo);                if (VOP->coding_type != MP4_VOP_TYPE_I)                    VOP->fcode_forward = mp4_GetBits9(pInfo, 3);                if (VOP->coding_type == MP4_VOP_TYPE_B)                    VOP->fcode_backward = mp4_GetBits9(pInfo, 3);            }        }        if (VOL->newpred_enable) {        }        *found = 1;        return MP4_STATUS_OK;    }    *found = 0;    return MP4_STATUS_OK;err:    mp4_Error("Error when decode Video Packet Header");    return MP4_STATUS_PARSE_ERROR;}

⌨️ 快捷键说明

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