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

📄 encodeheader.c

📁 adi bf533视频编码程序
💻 C
📖 第 1 页 / 共 2 页
字号:
            PutBits(VOL.linear_composition, 1);
        }
        PutBits(VOL.quant_type, 1);
        if (VOL.quant_type) {
            int  i;
            PutBits(VOL.load_intra_quant_mat, 1);
            if (VOL.load_intra_quant_mat)
                for (i = 0; i < VOL.load_intra_quant_mat_len; i ++)
                    PutBits(VOL.intra_quant_mat[i], 8);
            PutBits(VOL.load_nonintra_quant_mat, 1);
            if (VOL.load_nonintra_quant_mat)
                for (i = 0; i < VOL.load_nonintra_quant_mat_len; i ++)
                    PutBits(VOL.nonintra_quant_mat[i], 8);
            if (VOL.video_object_layer_shape == MP4_SHAPE_TYPE_GRAYSCALE)  {
                //f for(i=0; i<aux_comp_count; i++) {
                //f     load_intra_quant_mat_grayscale    1
                //f     if(load_intra_quant_mat_grayscale)    
                //f         intra_quant_mat_grayscale[i]    8*[2-64]
                //f     load_nonintra_quant_mat_grayscale    1
                //f     if(load_nonintra_quant_mat_grayscale)
                //f         nonintra_quant_mat_grayscale[i]    8*[2-64]
                //f }
            }
        }
        if (VOL.video_object_layer_verid != MP4_ISO_IEC_14496_2)
            PutBits(VOL.quarter_sample, 1);
        PutBits(VOL.complexity_estimation_disable, 1);
        if (!VOL.complexity_estimation_disable) {
            //f define_vop_complexity_estimation_header()
        }
        PutBits(VOL.resync_marker_disable, 1);
        PutBits(VOL.data_partitioned, 1);
        if (VOL.data_partitioned)
            PutBits(VOL.reversible_vlc, 1);
        if (VOL.video_object_layer_verid != MP4_ISO_IEC_14496_2) {
            PutBits(VOL.newpred_enable, 1);
            if (VOL.newpred_enable) {
                PutBits(VOL.requested_upstream_message_type, 2);
                PutBits(VOL.newpred_segment_type, 1);
            }
            PutBits(VOL.reduced_resolution_vop_enable, 1);
        }
         PutBits(VOL.scalability, 1);
        if (VOL.scalability) {
            PutBits(VOL.hierarchy_type, 1);
            PutBits(VOL.ref_layer_id, 4);
            PutBits(VOL.ref_layer_sampling_direct, 1);
            PutBits(VOL.hor_sampling_factor_n, 5);
            PutBits(VOL.hor_sampling_factor_m, 5);
            PutBits(VOL.vert_sampling_factor_n, 5);
            PutBits(VOL.vert_sampling_factor_m, 5);
            PutBits(VOL.enhancement_type, 1);
            if (VOL.video_object_layer_shape == MP4_SHAPE_TYPE_BINARY && VOL.hierarchy_type == 0) {
                PutBits(VOL.use_ref_shape, 1);
                PutBits(VOL.use_ref_texture, 1);
                PutBits(VOL.shape_hor_sampling_factor_n, 5);
                PutBits(VOL.shape_hor_sampling_factor_m, 5);
                PutBits(VOL.shape_vert_sampling_factor_n, 5);
                PutBits(VOL.shape_vert_sampling_factor_m, 5);
            }
        }
    } else {
        if (VOL.video_object_layer_verid != MP4_ISO_IEC_14496_2) {
            PutBits(VOL.scalability, 1);
            if (VOL.scalability) {
                PutBits(VOL.shape_hor_sampling_factor_n, 5);
                PutBits(VOL.shape_hor_sampling_factor_m, 5);
                PutBits(VOL.shape_vert_sampling_factor_n, 5);
                PutBits(VOL.shape_vert_sampling_factor_m, 5);
            }
        }
          PutBits(VOL.resync_marker_disable, 1);
    }
    EncodeStuffingBitsAlign();
    PutBits(1, 24);
    PutBits(MP4_USER_DATA_SC, 8);
    PutStr(" MPEG-4 encoder sample based on Intel(R) IPP");
    
}

/*
void EncodeGOP_Header()
{
    PutBits(1, 24);
    PutBits(MP4_GROUP_OF_VOP_SC, 8);
    PutBits(GOP.time_code, 18);
    PutBits(GOP.closed_gov, 1);
    PutBits(GOP.broken_link, 1);
    EncodeStuffingBitsAlign();
    //f cBS.PutBits(1, 24);
    //f cBS.PutBits(MP4_USER_DATA_SC, 8);
    //f user_data
}
*/
 void EncodeVO_Header()
{
    PutBits(1, 24);
    PutBits(MP4_VISUAL_OBJECT_SC, 8);			//B5
    PutBits(VO.is_visual_object_identifier, 1);	// 1
    if (VO.is_visual_object_identifier) {
        PutBits(VO.visual_object_verid, 4);		// 1
        PutBits(VO.visual_object_priority, 3);	// 1, highest;
    }
    PutBits(VO.visual_object_type, 4);			// 1
    if (VO.visual_object_type == MP4_VIDEO_OBJECT_TYPE_VIDEO || VO.visual_object_type == MP4_VIDEO_OBJECT_TYPE_TEXTURE) {
        PutBits(VO.video_signal_type, 1);		// 0
        if (VO.video_signal_type) {
            PutBits(VO.video_format, 3);
            PutBits(VO.video_range, 1);
            PutBits(VO.colour_description, 1);
            if (VO.colour_description) {
                PutBits(VO.colour_primaries, 8);
                PutBits(VO.transfer_characteristics, 8);
                PutBits(VO.matrix_coefficients, 8);
            }
        }
    }
    EncodeStuffingBitsAlign();
    //f cBS.PutBits(1, 24);
    //f cBS.PutBits(MP4_USER_DATA_SC, 8);
    //f user_data
    if (VO.visual_object_type == MP4_VIDEO_OBJECT_TYPE_VIDEO) {
        PutBits(1, 24);
        PutBits(MP4_VIDEO_OBJECT_MIN_SC + 2, 8);				//?
    }
}


void EncodeVOP_Header()
{
	int i;
    PutBits(1, 24);
    PutBits(MP4_VIDEO_OBJECT_PLANE_SC, 8);
    PutBits(VOP.vop_coding_type, 2);
     i = VOP.modulo_time_base;
    while (i) {
        PutMarkerBit();
        i --;
    }
    PutZeroBit();
    PutMarkerBit();
    PutBits(VOP.vop_time_increment, VOL.vop_time_increment_resolution_bits);
    PutMarkerBit();
    PutBits(VOP.vop_coded, 1);
    if (VOP.vop_coded == 0) {
        EncodeStuffingBitsAlign();
        return;
    }
    if (VOL.newpred_enable) {
//f        vop_id    4-15
        PutBits(VOP.vop_id_for_prediction_indication, 1);
        if (VOP.vop_id_for_prediction_indication) {
//f            vop_id_for_prediction    4-15
            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)))
        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)))
        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)) {
            PutBits(VOP.vop_width, 13);
            PutMarkerBit();
            PutBits(VOP.vop_height, 13);
            PutMarkerBit();
            PutBits(VOP.vop_horizontal_mc_spatial_ref, 13);
            PutMarkerBit();
            PutBits(VOP.vop_vertical_mc_spatial_ref, 13);
            PutMarkerBit();
        }        
        if ((VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) && VOL.scalability && VOL.enhancement_type)
            PutBits(VOP.background_composition, 1);
        PutBits(VOP.change_conv_ratio_disable, 1);
        PutBits(VOP.vop_constant_alpha, 1);
        if (VOP.vop_constant_alpha)
            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) {
        PutBits(VOP.intra_dc_vlc_thr, 3);
        if (VOL.interlaced) {
            PutBits(VOP.top_field_first, 1);
            PutBits(VOP.alternate_vertical_scan_flag, 1);
        }
    }
//f    if ((VOL.sprite_enable == MP4_SPRITE_STATIC || VOL.sprite_enable == MP4_SPRITE_GMC) && VOP.vop_coding_type == MP4_VOP_TYPE_S) {
//f        if (no_of_sprite_warping_points > 0)
//f            sprite_trajectory()
//f        if (sprite_brightness_change) 
//f            brightness_change_factor()
//f        if(sprite_enable == "static") {
//f            if (sprite_transmit_mode != "stop"             && low_latency_sprite_enable) {
//f                do {
//f                    sprite_transmit_mode    2    uimsbf
//f                    if ((sprite_transmit_mode == "piece") ||                    (sprite_transmit_mode == "update"))
//f                        decode_sprite_piece()
//f                } while (sprite_transmit_mode != "stop" &&                    sprite_transmit_mode != "pause")
//f            }
//f            EncodeStuffingBitsAlign();
//f            return;
//f        }
//f    }
    if (VOL.video_object_layer_shape != MP4_SHAPE_TYPE_BINARYONLY) {
        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)
            PutBits(VOP.vop_fcode_forward, 3);
        if (VOP.vop_coding_type == MP4_VOP_TYPE_B)
            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)
                PutBits(VOP.vop_shape_coding_type, 1);
        } else {
//f  scalability
        }
    }
}

/*
void EncodeVOPSH_Header()
{
    PutBits(32, 22);
    PutBits(VOP.temporal_reference, 8);
    PutMarkerBit();
    PutZeroBit();
    PutBits(VOP.split_screen_indicator, 1);
    PutBits(VOP.document_camera_indicator, 1);
    PutBits(VOP.full_picture_freeze_release, 1);
    PutBits(VOP.source_format, 3);
    PutBits(VOP.picture_coding_type, 1);
    PutBits(0, 4);
    PutBits(VOP.vop_quant, 5);
    PutZeroBit();
    PutZeroBit();  //f pei
}
*/

⌨️ 快捷键说明

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