예제 #1
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");
            }
        }
예제 #2
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: private static VUIParameters ReadVUIParameters(com.googlecode.mp4parser.h264.read.CAVLCReader reader) throws java.io.IOException
        private static VUIParameters ReadVUIParameters(CAVLCReader reader)
        {
            VUIParameters vuip = new VUIParameters();

            vuip.aspect_ratio_info_present_flag = reader.readBool("VUI: aspect_ratio_info_present_flag");
            if (vuip.aspect_ratio_info_present_flag)
            {
                vuip.aspect_ratio = AspectRatio.fromValue((int)reader.readNBit(8, "VUI: aspect_ratio"));
                if (vuip.aspect_ratio == AspectRatio.Extended_SAR)
                {
                    vuip.sar_width  = (int)reader.readNBit(16, "VUI: sar_width");
                    vuip.sar_height = (int)reader.readNBit(16, "VUI: sar_height");
                }
            }
            vuip.overscan_info_present_flag = reader.readBool("VUI: overscan_info_present_flag");
            if (vuip.overscan_info_present_flag)
            {
                vuip.overscan_appropriate_flag = reader.readBool("VUI: overscan_appropriate_flag");
            }
            vuip.video_signal_type_present_flag = reader.readBool("VUI: video_signal_type_present_flag");
            if (vuip.video_signal_type_present_flag)
            {
                vuip.video_format                    = (int)reader.readNBit(3, "VUI: video_format");
                vuip.video_full_range_flag           = reader.readBool("VUI: video_full_range_flag");
                vuip.colour_description_present_flag = reader.readBool("VUI: colour_description_present_flag");
                if (vuip.colour_description_present_flag)
                {
                    vuip.colour_primaries         = (int)reader.readNBit(8, "VUI: colour_primaries");
                    vuip.transfer_characteristics = (int)reader.readNBit(8, "VUI: transfer_characteristics");
                    vuip.matrix_coefficients      = (int)reader.readNBit(8, "VUI: matrix_coefficients");
                }
            }
            vuip.chroma_loc_info_present_flag = reader.readBool("VUI: chroma_loc_info_present_flag");
            if (vuip.chroma_loc_info_present_flag)
            {
                vuip.chroma_sample_loc_type_top_field    = reader.readUE("VUI chroma_sample_loc_type_top_field");
                vuip.chroma_sample_loc_type_bottom_field = reader.readUE("VUI chroma_sample_loc_type_bottom_field");
            }
            vuip.timing_info_present_flag = reader.readBool("VUI: timing_info_present_flag");
            if (vuip.timing_info_present_flag)
            {
                vuip.num_units_in_tick     = (int)reader.readNBit(32, "VUI: num_units_in_tick");
                vuip.time_scale            = (int)reader.readNBit(32, "VUI: time_scale");
                vuip.fixed_frame_rate_flag = reader.readBool("VUI: fixed_frame_rate_flag");
            }
            bool nal_hrd_parameters_present_flag = reader.readBool("VUI: nal_hrd_parameters_present_flag");

            if (nal_hrd_parameters_present_flag)
            {
                vuip.nalHRDParams = readHRDParameters(reader);
            }
            bool vcl_hrd_parameters_present_flag = reader.readBool("VUI: vcl_hrd_parameters_present_flag");

            if (vcl_hrd_parameters_present_flag)
            {
                vuip.vclHRDParams = readHRDParameters(reader);
            }
            if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag)
            {
                vuip.low_delay_hrd_flag = reader.readBool("VUI: low_delay_hrd_flag");
            }
            vuip.pic_struct_present_flag = reader.readBool("VUI: pic_struct_present_flag");
            bool bitstream_restriction_flag = reader.readBool("VUI: bitstream_restriction_flag");

            if (bitstream_restriction_flag)
            {
                vuip.bitstreamRestriction = new VUIParameters.BitstreamRestriction();
                vuip.bitstreamRestriction.motion_vectors_over_pic_boundaries_flag = reader.readBool("VUI: motion_vectors_over_pic_boundaries_flag");
                vuip.bitstreamRestriction.max_bytes_per_pic_denom       = reader.readUE("VUI max_bytes_per_pic_denom");
                vuip.bitstreamRestriction.max_bits_per_mb_denom         = reader.readUE("VUI max_bits_per_mb_denom");
                vuip.bitstreamRestriction.log2_max_mv_length_horizontal = reader.readUE("VUI log2_max_mv_length_horizontal");
                vuip.bitstreamRestriction.log2_max_mv_length_vertical   = reader.readUE("VUI log2_max_mv_length_vertical");
                vuip.bitstreamRestriction.num_reorder_frames            = reader.readUE("VUI num_reorder_frames");
                vuip.bitstreamRestriction.max_dec_frame_buffering       = reader.readUE("VUI max_dec_frame_buffering");
            }

            return(vuip);
        }