Exemplo n.º 1
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: private static void readScalingListMatrix(com.googlecode.mp4parser.h264.read.CAVLCReader reader, SeqParameterSet sps) throws java.io.IOException
 private static void readScalingListMatrix(CAVLCReader reader, SeqParameterSet sps)
 {
     sps.scalingMatrix = new ScalingMatrix();
     for (int i = 0; i < 8; i++)
     {
         bool seqScalingListPresentFlag = reader.readBool("SPS: seqScalingListPresentFlag");
         if (seqScalingListPresentFlag)
         {
             sps.scalingMatrix.ScalingList4x4 = new ScalingList[8];
             sps.scalingMatrix.ScalingList8x8 = new ScalingList[8];
             if (i < 6)
             {
                 sps.scalingMatrix.ScalingList4x4[i] = ScalingList.read(reader, 16);
             }
             else
             {
                 sps.scalingMatrix.ScalingList8x8[i - 6] = ScalingList.read(reader, 64);
             }
         }
     }
 }
Exemplo n.º 2
0
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public static SeqParameterSet read(java.io.InputStream is) throws java.io.IOException
        public static SeqParameterSet read(Stream @is)
        {
            CAVLCReader     reader = new CAVLCReader(@is);
            SeqParameterSet sps    = new SeqParameterSet();

            sps.profile_idc           = (int)reader.readNBit(8, "SPS: profile_idc");
            sps.constraint_set_0_flag = reader.readBool("SPS: constraint_set_0_flag");
            sps.constraint_set_1_flag = reader.readBool("SPS: constraint_set_1_flag");
            sps.constraint_set_2_flag = reader.readBool("SPS: constraint_set_2_flag");
            sps.constraint_set_3_flag = reader.readBool("SPS: constraint_set_3_flag");
            sps.constraint_set_4_flag = reader.readBool("SPS: constraint_set_4_flag");
            sps.constraint_set_5_flag = reader.readBool("SPS: constraint_set_5_flag");

            reader.readNBit(2, "SPS: reserved_zero_2bits");
            sps.level_idc            = (int)reader.readNBit(8, "SPS: level_idc");
            sps.seq_parameter_set_id = reader.readUE("SPS: seq_parameter_set_id");

            if (sps.profile_idc == 100 || sps.profile_idc == 110 || sps.profile_idc == 122 || sps.profile_idc == 144)
            {
                sps.chroma_format_idc = ChromaFormat.fromId(reader.readUE("SPS: chroma_format_idc"));
                if (sps.chroma_format_idc == ChromaFormat.YUV_444)
                {
                    sps.residual_color_transform_flag = reader.readBool("SPS: residual_color_transform_flag");
                }
                sps.bit_depth_luma_minus8   = reader.readUE("SPS: bit_depth_luma_minus8");
                sps.bit_depth_chroma_minus8 = reader.readUE("SPS: bit_depth_chroma_minus8");
                sps.qpprime_y_zero_transform_bypass_flag = reader.readBool("SPS: qpprime_y_zero_transform_bypass_flag");
                bool seqScalingMatrixPresent = reader.readBool("SPS: seq_scaling_matrix_present_lag");
                if (seqScalingMatrixPresent)
                {
                    readScalingListMatrix(reader, sps);
                }
            }
            else
            {
                sps.chroma_format_idc = ChromaFormat.YUV_420;
            }
            sps.log2_max_frame_num_minus4 = reader.readUE("SPS: log2_max_frame_num_minus4");
            sps.pic_order_cnt_type        = reader.readUE("SPS: pic_order_cnt_type");
            if (sps.pic_order_cnt_type == 0)
            {
                sps.log2_max_pic_order_cnt_lsb_minus4 = reader.readUE("SPS: log2_max_pic_order_cnt_lsb_minus4");
            }
            else if (sps.pic_order_cnt_type == 1)
            {
                sps.delta_pic_order_always_zero_flag      = reader.readBool("SPS: delta_pic_order_always_zero_flag");
                sps.offset_for_non_ref_pic                = reader.readSE("SPS: offset_for_non_ref_pic");
                sps.offset_for_top_to_bottom_field        = reader.readSE("SPS: offset_for_top_to_bottom_field");
                sps.num_ref_frames_in_pic_order_cnt_cycle = reader.readUE("SPS: num_ref_frames_in_pic_order_cnt_cycle");
                sps.offsetForRefFrame = new int[sps.num_ref_frames_in_pic_order_cnt_cycle];
                for (int i = 0; i < sps.num_ref_frames_in_pic_order_cnt_cycle; i++)
                {
                    sps.offsetForRefFrame[i] = reader.readSE("SPS: offsetForRefFrame [" + i + "]");
                }
            }
            sps.num_ref_frames = reader.readUE("SPS: num_ref_frames");
            sps.gaps_in_frame_num_value_allowed_flag = reader.readBool("SPS: gaps_in_frame_num_value_allowed_flag");
            sps.pic_width_in_mbs_minus1        = reader.readUE("SPS: pic_width_in_mbs_minus1");
            sps.pic_height_in_map_units_minus1 = reader.readUE("SPS: pic_height_in_map_units_minus1");
            sps.frame_mbs_only_flag            = reader.readBool("SPS: frame_mbs_only_flag");
            if (!sps.frame_mbs_only_flag)
            {
                sps.mb_adaptive_frame_field_flag = reader.readBool("SPS: mb_adaptive_frame_field_flag");
            }
            sps.direct_8x8_inference_flag = reader.readBool("SPS: direct_8x8_inference_flag");
            sps.frame_cropping_flag       = reader.readBool("SPS: frame_cropping_flag");
            if (sps.frame_cropping_flag)
            {
                sps.frame_crop_left_offset   = reader.readUE("SPS: frame_crop_left_offset");
                sps.frame_crop_right_offset  = reader.readUE("SPS: frame_crop_right_offset");
                sps.frame_crop_top_offset    = reader.readUE("SPS: frame_crop_top_offset");
                sps.frame_crop_bottom_offset = reader.readUE("SPS: frame_crop_bottom_offset");
            }
            bool vui_parameters_present_flag = reader.readBool("SPS: vui_parameters_present_flag");

            if (vui_parameters_present_flag)
            {
                sps.vuiParams = ReadVUIParameters(reader);
            }

            reader.readTrailingBits();

            return(sps);
        }