| 43 | using namespace parser::reader; |
| 44 | |
| 45 | void alf_data::parse(SubByteReaderLogging &reader, adaptation_parameter_set_rbsp *aps) |
| 46 | { |
| 47 | SubByteReaderLoggingSubLevel subLevel(reader, "alf_data"); |
| 48 | |
| 49 | this->alf_luma_filter_signal_flag = reader.readFlag("alf_luma_filter_signal_flag"); |
| 50 | if (aps->aps_chroma_present_flag) |
| 51 | { |
| 52 | this->alf_chroma_filter_signal_flag = reader.readFlag("alf_chroma_filter_signal_flag"); |
| 53 | this->alf_cc_cb_filter_signal_flag = reader.readFlag("alf_cc_cb_filter_signal_flag"); |
| 54 | this->alf_cc_cr_filter_signal_flag = reader.readFlag("alf_cc_cr_filter_signal_flag"); |
| 55 | } |
| 56 | if (this->alf_luma_filter_signal_flag) |
| 57 | { |
| 58 | this->alf_luma_clip_flag = reader.readFlag("alf_luma_clip_flag"); |
| 59 | this->alf_luma_num_filters_signalled_minus1 = |
| 60 | reader.readUEV("alf_luma_num_filters_signalled_minus1"); |
| 61 | if (this->alf_luma_num_filters_signalled_minus1 > 0) |
| 62 | { |
| 63 | auto NumAlfFilters = 25u; |
| 64 | for (unsigned filtIdx = 0; filtIdx < NumAlfFilters; filtIdx++) |
| 65 | { |
| 66 | auto nrBits = std::ceil(std::log2(alf_luma_num_filters_signalled_minus1 + 1)); |
| 67 | this->alf_luma_coeff_delta_idx = reader.readBits( |
| 68 | formatArray("alf_luma_coeff_delta_idx", filtIdx), |
| 69 | nrBits, |
| 70 | Options().withCheckRange({0, this->alf_luma_num_filters_signalled_minus1})); |
| 71 | } |
| 72 | } |
| 73 | for (unsigned sfIdx = 0; sfIdx <= alf_luma_num_filters_signalled_minus1; sfIdx++) |
| 74 | { |
| 75 | this->alf_luma_coeff_abs.push_back({}); |
| 76 | this->alf_luma_coeff_sign.push_back({}); |
| 77 | for (unsigned j = 0; j < 12; j++) |
| 78 | { |
| 79 | this->alf_luma_coeff_abs[sfIdx].push_back( |
| 80 | reader.readUEV(formatArray("alf_luma_coeff_abs", sfIdx, j))); |
| 81 | if (this->alf_luma_coeff_abs[sfIdx][j]) |
| 82 | { |
| 83 | this->alf_luma_coeff_sign[sfIdx].push_back( |
| 84 | reader.readFlag(formatArray("alf_luma_coeff_sign", sfIdx, j))); |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | this->alf_luma_coeff_sign[sfIdx].push_back(0); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | if (this->alf_luma_clip_flag) |
| 93 | { |
| 94 | for (unsigned sfIdx = 0; sfIdx <= alf_luma_num_filters_signalled_minus1; sfIdx++) |
| 95 | { |
| 96 | this->alf_luma_clip_idx.push_back({}); |
| 97 | for (unsigned j = 0; j < 12; j++) |
| 98 | { |
| 99 | this->alf_luma_clip_idx[sfIdx].push_back( |
| 100 | reader.readBits(formatArray("alf_luma_clip_idx", sfIdx, j), 2)); |
| 101 | } |
| 102 | } |
no test coverage detected