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

📄 ippvideoencodermpeg4_headers.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            cBS.PutBits(VOL.hor_sampling_factor_m, 5);            cBS.PutBits(VOL.vert_sampling_factor_n, 5);            cBS.PutBits(VOL.vert_sampling_factor_m, 5);            cBS.PutBits(VOL.enhancement_type, 1);            if (VOL.video_object_layer_shape == MP4_SHAPE_TYPE_BINARY && VOL.hierarchy_type == 0) {                cBS.PutBits(VOL.use_ref_shape, 1);                cBS.PutBits(VOL.use_ref_texture, 1);                cBS.PutBits(VOL.shape_hor_sampling_factor_n, 5);                cBS.PutBits(VOL.shape_hor_sampling_factor_m, 5);                cBS.PutBits(VOL.shape_vert_sampling_factor_n, 5);                cBS.PutBits(VOL.shape_vert_sampling_factor_m, 5);            }        }    } else {        if (VOL.video_object_layer_verid != 1) {            cBS.PutBits(VOL.scalability, 1);            if (VOL.scalability) {                cBS.PutBits(VOL.shape_hor_sampling_factor_n, 5);                cBS.PutBits(VOL.shape_hor_sampling_factor_m, 5);                cBS.PutBits(VOL.shape_vert_sampling_factor_n, 5);                cBS.PutBits(VOL.shape_vert_sampling_factor_m, 5);            }        }        cBS.PutBits(VOL.resync_marker_disable, 1);    }    EncodeStuffingBitsAlign();    EncodeStartCode(MP4_USER_DATA_SC);    cBS.PutStr(" MPEG-4 encode sample based on Intel(R) IPP");}void ippVideoEncoderMPEG4::EncodeGOV_Header(){    int  sec, min, hour;    EncodeStartCode(MP4_GROUP_OF_VOP_SC);    sec = GOV.time_code;    hour = sec / 3600;    sec -= hour * 3600;    min = sec / 60;    sec -= min * 60;    GOV.time_code = (hour << 13) + (min << 7) + (1 << 6) + sec;    cBS.PutBits(GOV.time_code, 18);    cBS.PutBits(GOV.closed_gov, 1);    cBS.PutBits(GOV.broken_link, 1);    EncodeStuffingBitsAlign();    //f EncodeStartCode(MP4_USER_DATA_SC);    //f user_data}void ippVideoEncoderMPEG4::EncodeVOP_Header(){    EncodeStartCode(MP4_VIDEO_OBJECT_PLANE_SC);    cBS.PutBits(VOP.vop_coding_type, 2);    int i = VOP.modulo_time_base;    while (i > 0) {        cBS.PutMarkerBit();        i --;    }    cBS.PutZeroBit();    cBS.PutMarkerBit();    cBS.PutBits(VOP.vop_time_increment, VOL.vop_time_increment_resolution_bits);    cBS.PutMarkerBit();    cBS.PutBits(VOP.vop_coded, 1);    if (VOP.vop_coded == 0) {        EncodeStuffingBitsAlign();        return;    }    if (VOL.newpred_enable) {//f        vop_id    4-15        cBS.PutBits(VOP.vop_id_for_prediction_indication, 1);        if (VOP.vop_id_for_prediction_indication) {//f            vop_id_for_prediction    4-15            cBS.PutMarkerBit();        }    }    if ((VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) && (VOP.vop_coding_type == MP4_VOP_TYPE_P || (VOP.vop_coding_type == MP4_VOP_TYPE_S && VOL.sprite_enable == MP4_SPRITE_GMC)))        cBS.PutBits(VOP.vop_rounding_type, 1);    if ((VOL.reduced_resolution_vop_enable) && (VOL.video_object_layer_shape == MP4_SHAPE_TYPE_RECTANGULAR) && ((VOP.vop_coding_type == MP4_VOP_TYPE_P) || (VOP.vop_coding_type == MP4_VOP_TYPE_I)))        cBS.PutBits(VOP.vop_reduced_resolution, 1);    if (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_RECTANGULAR) {        if (!(VOL.sprite_enable == MP4_SPRITE_STATIC && VOP.vop_coding_type == MP4_VOP_TYPE_I)) {            cBS.PutBits(VOP.vop_width, 13);            cBS.PutMarkerBit();            cBS.PutBits(VOP.vop_height, 13);            cBS.PutMarkerBit();            cBS.PutBits(VOP.vop_horizontal_mc_spatial_ref, 13);            cBS.PutMarkerBit();            cBS.PutBits(VOP.vop_vertical_mc_spatial_ref, 13);            cBS.PutMarkerBit();        }        if ((VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) && VOL.scalability && VOL.enhancement_type)            cBS.PutBits(VOP.background_composition, 1);        cBS.PutBits(VOP.change_conv_ratio_disable, 1);        cBS.PutBits(VOP.vop_constant_alpha, 1);        if (VOP.vop_constant_alpha)            cBS.PutBits(VOP.vop_constant_alpha_value, 8);    }//f    if (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY)//f        if (!complexity_estimation_disable)//f            read_vop_complexity_estimation_header()    if  (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) {        cBS.PutBits(VOP.intra_dc_vlc_thr, 3);        if (VOL.interlaced) {            cBS.PutBits(VOP.top_field_first, 1);            cBS.PutBits(VOP.alternate_vertical_scan_flag, 1);        }    }    if ((VOL.sprite_enable == MP4_SPRITE_STATIC || VOL.sprite_enable == MP4_SPRITE_GMC) && VOP.vop_coding_type == MP4_VOP_TYPE_S) {        if (VOL.no_of_sprite_warping_points > 0) {            int     dmv, dmva, i, j;            static const int wc[15] = {0, 2, 3, 4, 5, 6, 14, 30, 62, 126, 254, 510, 1022, 2046, 4094};            static const int wl[15] = {2, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};            for (i = 0; i < VOL.no_of_sprite_warping_points; i ++) {                dmv = VOP.warping_mv_code_du[i];                if (dmv == 0) {                    cBS.PutBits(0, 2);                } else {                    dmva = (dmv < 0) ? -dmv : dmv;                    j = 1;                    while (dmva >>= 1)                        j ++;                    cBS.PutBits(wc[j], wl[j]);                    if (dmv < 0)                        dmv += (1 << j) - 1;                    cBS.PutBits(dmv, j);                }                cBS.PutMarkerBit();                dmv = VOP.warping_mv_code_dv[i];                if (dmv == 0) {                    cBS.PutBits(0, 2);                } else {                    dmva = (dmv < 0) ? -dmv : dmv;                    j = 1;                    while (dmva >>= 1)                        j ++;                    cBS.PutBits(wc[j], wl[j]);                    if (dmv < 0)                        dmv += (1 << j) - 1;                    cBS.PutBits(dmv, j);                }                cBS.PutMarkerBit();            }        }        if (VOL.sprite_brightness_change) {            int  i, j;            j = VOP.brightness_change_factor;            if (j < 0)                j = -j;            if (j <= 16) {                j += (VOP.brightness_change_factor < 0) ? 16 : 15;                i = 6;            } else if (j <= 48) {                j += (VOP.brightness_change_factor < 0) ? 48 + 128 : 15 + 128;                i = 8;            } else if (j <= 112) {                j += (VOP.brightness_change_factor < 0) ? 112 + 768 : 15 + 768;                i = 10;            } else if (j <= 624) {                j -= 113 - 7168;                i = 13;            } else {                j -= 625 - 15360;                i = 14;            }            cBS.PutBits(j, i);        }        if (VOL.sprite_enable == MP4_SPRITE_STATIC)            return;    }    if (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) {        cBS.PutBits(VOP.vop_quant, VOL.quant_precision);//f        if (VOL.video_object_layer_shape == MP4_SHAPE_TYPE_GRAYSCALE)//f            for(i=0; i<aux_comp_count; i++)//f                vop_alpha_quant[i]    6    uimsbf        if (VOP.vop_coding_type != MP4_VOP_TYPE_I)            cBS.PutBits(VOP.vop_fcode_forward, 3);        if (VOP.vop_coding_type == MP4_VOP_TYPE_B)            cBS.PutBits(VOP.vop_fcode_backward, 3);        if (!VOL.scalability) {            if (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_RECTANGULAR && VOP.vop_coding_type != MP4_VOP_TYPE_I)                cBS.PutBits(VOP.vop_shape_coding_type, 1);        } else {//f  scalability        }    }}void ippVideoEncoderMPEG4::EncodeVOPSH_Header(){    cBS.PutBits(32, 22);    cBS.PutBits(VOP.temporal_reference, 8);    cBS.PutMarkerBit();    cBS.PutZeroBit();    cBS.PutBits(VOP.split_screen_indicator, 1);    cBS.PutBits(VOP.document_camera_indicator, 1);    cBS.PutBits(VOP.full_picture_freeze_release, 1);    cBS.PutBits(VOP.source_format, 3);    cBS.PutBits(VOP.picture_coding_type, 1);    cBS.PutBits(0, 4);    cBS.PutBits(VOP.vop_quant, 5);    cBS.PutZeroBit();    cBS.PutZeroBit();  //f pei}int ippVideoEncoderMPEG4::EncodeHeader(){    if (!mIsInit)        return MP4_STS_ERR_NOTINIT;    if (!VOL.short_video_header) {        Ipp8u *sPtr = cBS.GetBitPtr();        EncodeVOS_Header();        EncodeVO_Header();        EncodeVOL_Header();        mBitsEncodedTotal += (cBS.GetBitPtr() - sPtr) << 3;    }    return MP4_STS_NOERR;}

⌨️ 快捷键说明

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