Ejemplo n.º 1
0
        private void writeHRDParameters(HRDParameters hrd, BitWriter writer)
        {
            CAVLCWriter.writeUE(writer, hrd.cpb_cnt_minus1, "HRD: cpb_cnt_minus1");
            CAVLCWriter.writeNBit(writer, hrd.bit_rate_scale, 4, "HRD: bit_rate_scale");
            CAVLCWriter.writeNBit(writer, hrd.cpb_size_scale, 4, "HRD: cpb_size_scale");

            for (int SchedSelIdx = 0; SchedSelIdx <= hrd.cpb_cnt_minus1; SchedSelIdx++)
            {
                CAVLCWriter.writeUE(writer, hrd.bit_rate_value_minus1[SchedSelIdx], "HRD: ");
                CAVLCWriter.writeUE(writer, hrd.cpb_size_value_minus1[SchedSelIdx], "HRD: ");
                CAVLCWriter.writeBool(writer, hrd.cbr_flag[SchedSelIdx], "HRD: ");
            }
            CAVLCWriter.writeNBit(writer, hrd.initial_cpb_removal_delay_length_minus1, 5,
                                  "HRD: initial_cpb_removal_delay_length_minus1");
            CAVLCWriter.writeNBit(writer, hrd.cpb_removal_delay_length_minus1, 5, "HRD: cpb_removal_delay_length_minus1");
            CAVLCWriter.writeNBit(writer, hrd.dpb_output_delay_length_minus1, 5, "HRD: dpb_output_delay_length_minus1");
            CAVLCWriter.writeNBit(writer, hrd.time_offset_length, 5, "HRD: time_offset_length");
        }
Ejemplo n.º 2
0
        private static HRDParameters readHRDParameters(BitReader inb)
        {
            HRDParameters hrd = new HRDParameters();

            hrd.cpb_cnt_minus1        = CAVLCReader.readUE(inb, "SPS: cpb_cnt_minus1");
            hrd.bit_rate_scale        = (int)CAVLCReader.readNBit(inb, 4, "HRD: bit_rate_scale");
            hrd.cpb_size_scale        = (int)CAVLCReader.readNBit(inb, 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] = CAVLCReader.readUE(inb, "HRD: bit_rate_value_minus1");
                hrd.cpb_size_value_minus1[SchedSelIdx] = CAVLCReader.readUE(inb, "HRD: cpb_size_value_minus1");
                hrd.cbr_flag[SchedSelIdx] = CAVLCReader.readBool(inb, "HRD: cbr_flag");
            }
            hrd.initial_cpb_removal_delay_length_minus1 = (int)CAVLCReader.readNBit(inb, 5,
                                                                                    "HRD: initial_cpb_removal_delay_length_minus1");
            hrd.cpb_removal_delay_length_minus1 = (int)CAVLCReader.readNBit(inb, 5, "HRD: cpb_removal_delay_length_minus1");
            hrd.dpb_output_delay_length_minus1  = (int)CAVLCReader.readNBit(inb, 5, "HRD: dpb_output_delay_length_minus1");
            hrd.time_offset_length = (int)CAVLCReader.readNBit(inb, 5, "HRD: time_offset_length");
            return(hrd);
        }