Beispiel #1
0
        private static HRDParameters readHRDParameters(CAVLCReader reader)
        {
            HRDParameters hrd = new HRDParameters
            {
                Cpb_cnt_minus1 = reader.ReadUE("SPS: cpb_cnt_minus1"),
                bit_rate_scale = (int)reader.ReadNBit(4, "HRD: bit_rate_scale"),
                cpb_size_scale = (int)reader.ReadNBit(4, "HRD: cpb_size_scale")
            };

            hrd.bit_rate_value_minus1 = new int[hrd.Cpb_cnt_minus1 + 1];
            hrd.cpb_size_value_minus1 = new int[hrd.Cpb_cnt_minus1 + 1];
            hrd.cbr_flag = new bool[hrd.Cpb_cnt_minus1 + 1];

            for (int SchedSelIdx = 0; SchedSelIdx <= hrd.Cpb_cnt_minus1; SchedSelIdx++)
            {
                hrd.bit_rate_value_minus1[SchedSelIdx] = reader.ReadUE("HRD: bit_rate_value_minus1");
                hrd.cpb_size_value_minus1[SchedSelIdx] = reader.ReadUE("HRD: cpb_size_value_minus1");
                hrd.cbr_flag[SchedSelIdx] = reader.ReadBool("HRD: cbr_flag");
            }
            hrd.initial_cpb_removal_delay_length_minus1 = (int)reader.ReadNBit(5, "HRD: initial_cpb_removal_delay_length_minus1");
            hrd.cpb_removal_delay_length_minus1         = (int)reader.ReadNBit(5, "HRD: cpb_removal_delay_length_minus1");
            hrd.dpb_output_delay_length_minus1          = (int)reader.ReadNBit(5, "HRD: dpb_output_delay_length_minus1");
            hrd.time_offset_length = (int)reader.ReadNBit(5, "HRD: time_offset_length");
            return(hrd);
        }
Beispiel #2
0
        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");
        }