| 40 | using namespace reader; |
| 41 | |
| 42 | void sub_layer_hrd_parameters::parse(SubByteReaderLogging &reader, |
| 43 | int CpbCnt, |
| 44 | bool sub_pic_hrd_params_present_flag, |
| 45 | bool SubPicHrdFlag, |
| 46 | unsigned int bit_rate_scale, |
| 47 | unsigned int cpb_size_scale, |
| 48 | unsigned int cpb_size_du_scale) |
| 49 | { |
| 50 | SubByteReaderLoggingSubLevel subevel(reader, "sub_layer_hrd_parameters()"); |
| 51 | |
| 52 | if (CpbCnt >= 32) |
| 53 | throw std::logic_error("The value of CpbCnt must be in the range of 0 to 31"); |
| 54 | |
| 55 | for (int i = 0; i <= CpbCnt; i++) |
| 56 | { |
| 57 | this->bit_rate_value_minus1.push_back(reader.readUEV( |
| 58 | "bit_rate_value_minus1", |
| 59 | Options() |
| 60 | .withMeaning("(together with bit_rate_scale) specifies the maximum) input bit rate for " |
| 61 | "the i-th CPB when the CPB operates at the access unit level.") |
| 62 | .withCheckRange({0, 4294967294}))); |
| 63 | if (i > 0 && this->bit_rate_value_minus1[i] <= this->bit_rate_value_minus1[i - 1]) |
| 64 | throw std::logic_error("For any i > 0, bit_rate_value_minus1[i] shall be greater than " |
| 65 | "bit_rate_value_minus1[i-1]."); |
| 66 | if (!SubPicHrdFlag) |
| 67 | { |
| 68 | auto value = (this->bit_rate_value_minus1[i] + 1) * (1 << (6 + bit_rate_scale)); |
| 69 | this->BitRate.push_back(value); |
| 70 | reader.logCalculatedValue(formatArray("BitRate", i), value); |
| 71 | } |
| 72 | |
| 73 | this->cpb_size_value_minus1.push_back( |
| 74 | reader.readUEV("cpb_size_value_minus1", |
| 75 | Options() |
| 76 | .withMeaning("Is used together with cpb_size_scale to specify) the i-th " |
| 77 | "CPB size when the CPB operates at the access unit level.") |
| 78 | .withCheckRange({0, 4294967294}))); |
| 79 | if (i > 0 && this->cpb_size_value_minus1[i] > this->cpb_size_value_minus1[i - 1]) |
| 80 | throw std::logic_error("For any i greater than 0, cpb_size_value_minus1[i] shall be less " |
| 81 | "than or equal to cpb_size_value_minus1[i-1]."); |
| 82 | if (!SubPicHrdFlag) |
| 83 | { |
| 84 | auto value = (this->cpb_size_value_minus1[i] + 1) * (1 << (4 + cpb_size_scale)); |
| 85 | CpbSize.push_back(value); |
| 86 | reader.logCalculatedValue(formatArray("CpbSize", i), value); |
| 87 | } |
| 88 | |
| 89 | if (sub_pic_hrd_params_present_flag) |
| 90 | { |
| 91 | this->cpb_size_du_value_minus1.push_back(reader.readUEV( |
| 92 | "cpb_size_du_value_minus1", |
| 93 | Options() |
| 94 | .withMeaning("Is used together with cpb_size_du_scale to specify) the i-th CPB size " |
| 95 | "when the CPB operates at sub-picture level.") |
| 96 | .withCheckRange({0, 4294967294}))); |
| 97 | if (i > 0 && cpb_size_du_value_minus1[i] > cpb_size_du_value_minus1[i - 1]) |
| 98 | throw std::logic_error("For any i greater than 0, cpb_size_du_value_minus1[i] shall be " |
| 99 | "less than or equal to cpb_size_du_value_minus1[i-1]."); |
nothing calls this directly
no test coverage detected