Ejemplo n.º 1
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private void writeHRDParameters(HRDParameters hrd, com.googlecode.mp4parser.h264.write.CAVLCWriter writer) throws java.io.IOException
        private void writeHRDParameters(HRDParameters hrd, CAVLCWriter writer)
        {
            writer.writeUE(hrd.cpb_cnt_minus1, "HRD: cpb_cnt_minus1");
            writer.writeNBit(hrd.bit_rate_scale, 4, "HRD: bit_rate_scale");
            writer.writeNBit(hrd.cpb_size_scale, 4, "HRD: cpb_size_scale");

            for (int SchedSelIdx = 0; SchedSelIdx <= hrd.cpb_cnt_minus1; SchedSelIdx++)
            {
                writer.writeUE(hrd.bit_rate_value_minus1[SchedSelIdx], "HRD: ");
                writer.writeUE(hrd.cpb_size_value_minus1[SchedSelIdx], "HRD: ");
                writer.writeBool(hrd.cbr_flag[SchedSelIdx], "HRD: ");
            }
            writer.writeNBit(hrd.initial_cpb_removal_delay_length_minus1, 5, "HRD: initial_cpb_removal_delay_length_minus1");
            writer.writeNBit(hrd.cpb_removal_delay_length_minus1, 5, "HRD: cpb_removal_delay_length_minus1");
            writer.writeNBit(hrd.dpb_output_delay_length_minus1, 5, "HRD: dpb_output_delay_length_minus1");
            writer.writeNBit(hrd.time_offset_length, 5, "HRD: time_offset_length");
        }
Ejemplo n.º 2
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private void writeVUIParameters(VUIParameters vuip, com.googlecode.mp4parser.h264.write.CAVLCWriter writer) throws java.io.IOException
        private void writeVUIParameters(VUIParameters vuip, CAVLCWriter writer)
        {
            writer.writeBool(vuip.aspect_ratio_info_present_flag, "VUI: aspect_ratio_info_present_flag");
            if (vuip.aspect_ratio_info_present_flag)
            {
                writer.writeNBit(vuip.aspect_ratio.Value, 8, "VUI: aspect_ratio");
                if (vuip.aspect_ratio == AspectRatio.Extended_SAR)
                {
                    writer.writeNBit(vuip.sar_width, 16, "VUI: sar_width");
                    writer.writeNBit(vuip.sar_height, 16, "VUI: sar_height");
                }
            }
            writer.writeBool(vuip.overscan_info_present_flag, "VUI: overscan_info_present_flag");
            if (vuip.overscan_info_present_flag)
            {
                writer.writeBool(vuip.overscan_appropriate_flag, "VUI: overscan_appropriate_flag");
            }
            writer.writeBool(vuip.video_signal_type_present_flag, "VUI: video_signal_type_present_flag");
            if (vuip.video_signal_type_present_flag)
            {
                writer.writeNBit(vuip.video_format, 3, "VUI: video_format");
                writer.writeBool(vuip.video_full_range_flag, "VUI: video_full_range_flag");
                writer.writeBool(vuip.colour_description_present_flag, "VUI: colour_description_present_flag");
                if (vuip.colour_description_present_flag)
                {
                    writer.writeNBit(vuip.colour_primaries, 8, "VUI: colour_primaries");
                    writer.writeNBit(vuip.transfer_characteristics, 8, "VUI: transfer_characteristics");
                    writer.writeNBit(vuip.matrix_coefficients, 8, "VUI: matrix_coefficients");
                }
            }
            writer.writeBool(vuip.chroma_loc_info_present_flag, "VUI: chroma_loc_info_present_flag");
            if (vuip.chroma_loc_info_present_flag)
            {
                writer.writeUE(vuip.chroma_sample_loc_type_top_field, "VUI: chroma_sample_loc_type_top_field");
                writer.writeUE(vuip.chroma_sample_loc_type_bottom_field, "VUI: chroma_sample_loc_type_bottom_field");
            }
            writer.writeBool(vuip.timing_info_present_flag, "VUI: timing_info_present_flag");
            if (vuip.timing_info_present_flag)
            {
                writer.writeNBit(vuip.num_units_in_tick, 32, "VUI: num_units_in_tick");
                writer.writeNBit(vuip.time_scale, 32, "VUI: time_scale");
                writer.writeBool(vuip.fixed_frame_rate_flag, "VUI: fixed_frame_rate_flag");
            }
            writer.writeBool(vuip.nalHRDParams != null, "VUI: ");
            if (vuip.nalHRDParams != null)
            {
                writeHRDParameters(vuip.nalHRDParams, writer);
            }
            writer.writeBool(vuip.vclHRDParams != null, "VUI: ");
            if (vuip.vclHRDParams != null)
            {
                writeHRDParameters(vuip.vclHRDParams, writer);
            }

            if (vuip.nalHRDParams != null || vuip.vclHRDParams != null)
            {
                writer.writeBool(vuip.low_delay_hrd_flag, "VUI: low_delay_hrd_flag");
            }
            writer.writeBool(vuip.pic_struct_present_flag, "VUI: pic_struct_present_flag");
            writer.writeBool(vuip.bitstreamRestriction != null, "VUI: ");
            if (vuip.bitstreamRestriction != null)
            {
                writer.writeBool(vuip.bitstreamRestriction.motion_vectors_over_pic_boundaries_flag, "VUI: motion_vectors_over_pic_boundaries_flag");
                writer.writeUE(vuip.bitstreamRestriction.max_bytes_per_pic_denom, "VUI: max_bytes_per_pic_denom");
                writer.writeUE(vuip.bitstreamRestriction.max_bits_per_mb_denom, "VUI: max_bits_per_mb_denom");
                writer.writeUE(vuip.bitstreamRestriction.log2_max_mv_length_horizontal, "VUI: log2_max_mv_length_horizontal");
                writer.writeUE(vuip.bitstreamRestriction.log2_max_mv_length_vertical, "VUI: log2_max_mv_length_vertical");
                writer.writeUE(vuip.bitstreamRestriction.num_reorder_frames, "VUI: num_reorder_frames");
                writer.writeUE(vuip.bitstreamRestriction.max_dec_frame_buffering, "VUI: max_dec_frame_buffering");
            }
        }
Ejemplo n.º 3
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public void write(java.io.OutputStream out) throws java.io.IOException
        public void write(Stream @out)
        {
            CAVLCWriter writer = new CAVLCWriter(@out);

            writer.writeNBit(profile_idc, 8, "SPS: profile_idc");
            writer.writeBool(constraint_set_0_flag, "SPS: constraint_set_0_flag");
            writer.writeBool(constraint_set_1_flag, "SPS: constraint_set_1_flag");
            writer.writeBool(constraint_set_2_flag, "SPS: constraint_set_2_flag");
            writer.writeBool(constraint_set_3_flag, "SPS: constraint_set_3_flag");
            writer.writeNBit(0, 4, "SPS: reserved");
            writer.writeNBit(level_idc, 8, "SPS: level_idc");
            writer.writeUE(seq_parameter_set_id, "SPS: seq_parameter_set_id");

            if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 144)
            {
                writer.writeUE(chroma_format_idc.Id, "SPS: chroma_format_idc");
                if (chroma_format_idc == ChromaFormat.YUV_444)
                {
                    writer.writeBool(residual_color_transform_flag, "SPS: residual_color_transform_flag");
                }
                writer.writeUE(bit_depth_luma_minus8, "SPS: ");
                writer.writeUE(bit_depth_chroma_minus8, "SPS: ");
                writer.writeBool(qpprime_y_zero_transform_bypass_flag, "SPS: qpprime_y_zero_transform_bypass_flag");
                writer.writeBool(scalingMatrix != null, "SPS: ");
                if (scalingMatrix != null)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        if (i < 6)
                        {
                            writer.writeBool(scalingMatrix.ScalingList4x4[i] != null, "SPS: ");
                            if (scalingMatrix.ScalingList4x4[i] != null)
                            {
                                scalingMatrix.ScalingList4x4[i].write(writer);
                            }
                        }
                        else
                        {
                            writer.writeBool(scalingMatrix.ScalingList8x8[i - 6] != null, "SPS: ");
                            if (scalingMatrix.ScalingList8x8[i - 6] != null)
                            {
                                scalingMatrix.ScalingList8x8[i - 6].write(writer);
                            }
                        }
                    }
                }
            }
            writer.writeUE(log2_max_frame_num_minus4, "SPS: log2_max_frame_num_minus4");
            writer.writeUE(pic_order_cnt_type, "SPS: pic_order_cnt_type");
            if (pic_order_cnt_type == 0)
            {
                writer.writeUE(log2_max_pic_order_cnt_lsb_minus4, "SPS: log2_max_pic_order_cnt_lsb_minus4");
            }
            else if (pic_order_cnt_type == 1)
            {
                writer.writeBool(delta_pic_order_always_zero_flag, "SPS: delta_pic_order_always_zero_flag");
                writer.writeSE(offset_for_non_ref_pic, "SPS: offset_for_non_ref_pic");
                writer.writeSE(offset_for_top_to_bottom_field, "SPS: offset_for_top_to_bottom_field");
                writer.writeUE(offsetForRefFrame.Length, "SPS: ");
                for (int i = 0; i < offsetForRefFrame.Length; i++)
                {
                    writer.writeSE(offsetForRefFrame[i], "SPS: ");
                }
            }
            writer.writeUE(num_ref_frames, "SPS: num_ref_frames");
            writer.writeBool(gaps_in_frame_num_value_allowed_flag, "SPS: gaps_in_frame_num_value_allowed_flag");
            writer.writeUE(pic_width_in_mbs_minus1, "SPS: pic_width_in_mbs_minus1");
            writer.writeUE(pic_height_in_map_units_minus1, "SPS: pic_height_in_map_units_minus1");
            writer.writeBool(frame_mbs_only_flag, "SPS: frame_mbs_only_flag");
            if (!frame_mbs_only_flag)
            {
                writer.writeBool(mb_adaptive_frame_field_flag, "SPS: mb_adaptive_frame_field_flag");
            }
            writer.writeBool(direct_8x8_inference_flag, "SPS: direct_8x8_inference_flag");
            writer.writeBool(frame_cropping_flag, "SPS: frame_cropping_flag");
            if (frame_cropping_flag)
            {
                writer.writeUE(frame_crop_left_offset, "SPS: frame_crop_left_offset");
                writer.writeUE(frame_crop_right_offset, "SPS: frame_crop_right_offset");
                writer.writeUE(frame_crop_top_offset, "SPS: frame_crop_top_offset");
                writer.writeUE(frame_crop_bottom_offset, "SPS: frame_crop_bottom_offset");
            }
            writer.writeBool(vuiParams != null, "SPS: ");
            if (vuiParams != null)
            {
                writeVUIParameters(vuiParams, writer);
            }

            writer.writeTrailingBits();
        }