| 43 | using namespace parser::reader; |
| 44 | |
| 45 | void pred_weight_table::parse(SubByteReaderLogging & reader, |
| 46 | std::shared_ptr<seq_parameter_set_rbsp> sps, |
| 47 | std::shared_ptr<pic_parameter_set_rbsp> pps, |
| 48 | std::shared_ptr<slice_layer_rbsp> sl, |
| 49 | std::shared_ptr<ref_pic_lists> rpl) |
| 50 | { |
| 51 | SubByteReaderLoggingSubLevel subLevel(reader, "pred_weight_table"); |
| 52 | |
| 53 | this->luma_log2_weight_denom = |
| 54 | reader.readUEV("luma_log2_weight_denom", Options().withCheckRange({0, 7})); |
| 55 | if (sps->sps_chroma_format_idc != 0) |
| 56 | { |
| 57 | this->delta_chroma_log2_weight_denom = reader.readSEV("delta_chroma_log2_weight_denom"); |
| 58 | } |
| 59 | if (pps->pps_wp_info_in_ph_flag) |
| 60 | { |
| 61 | this->num_l0_weights = reader.readUEV("num_l0_weights"); |
| 62 | } |
| 63 | unsigned NumWeightsL0; |
| 64 | if (pps->pps_wp_info_in_ph_flag) |
| 65 | NumWeightsL0 = num_l0_weights; |
| 66 | else |
| 67 | NumWeightsL0 = sl->slice_header_instance.NumRefIdxActive[0]; |
| 68 | for (unsigned i = 0; i < NumWeightsL0; i++) |
| 69 | { |
| 70 | this->luma_weight_l0_flag.push_back(reader.readFlag("luma_weight_l0_flag")); |
| 71 | } |
| 72 | if (sps->sps_chroma_format_idc != 0) |
| 73 | { |
| 74 | for (unsigned i = 0; i < NumWeightsL0; i++) |
| 75 | { |
| 76 | this->chroma_weight_l0_flag.push_back(reader.readFlag("chroma_weight_l0_flag")); |
| 77 | } |
| 78 | } |
| 79 | for (unsigned i = 0; i < NumWeightsL0; i++) |
| 80 | { |
| 81 | if (this->luma_weight_l0_flag[i]) |
| 82 | { |
| 83 | this->delta_luma_weight_l0.push_back(reader.readSEV("delta_luma_weight_l0")); |
| 84 | this->luma_offset_l0.push_back(reader.readSEV("luma_offset_l0")); |
| 85 | } |
| 86 | if (this->chroma_weight_l0_flag[i]) |
| 87 | { |
| 88 | for (unsigned j = 0; j < 2; j++) |
| 89 | { |
| 90 | this->delta_chroma_weight_l0[i][j] = reader.readSEV("delta_chroma_weight_l0"); |
| 91 | this->delta_chroma_offset_l0[i][j] = reader.readSEV("delta_chroma_offset_l0"); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | if (pps->pps_weighted_bipred_flag && pps->pps_wp_info_in_ph_flag && |
| 96 | rpl->getActiveRefPixList(sps, 1).num_ref_entries > 0) |
| 97 | { |
| 98 | this->num_l1_weights = |
| 99 | reader.readUEV("num_l1_weights", |
| 100 | Options().withCheckRange( |
| 101 | {0, std::min(15u, rpl->getActiveRefPixList(sps, 1).num_ref_entries)})); |
| 102 | } |
nothing calls this directly
no test coverage detected