MCPcopy Create free account
hub / github.com/IENT/YUView / parse

Method parse

YUViewLib/src/parser/HEVC/st_ref_pic_set.cpp:51–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49using namespace reader;
50
51void st_ref_pic_set::parse(SubByteReaderLogging &reader, unsigned stRpsIdx, unsigned num_short_term_ref_pic_sets)
52{
53 SubByteReaderLoggingSubLevel subLevel(reader, "st_ref_pic_set()");
54
55 if (stRpsIdx > 64)
56 throw std::logic_error("Error while parsing short term ref pic set. The stRpsIdx must be in the range [0..64].");
57
58 this->inter_ref_pic_set_prediction_flag = false;
59 if(stRpsIdx != 0)
60 this->inter_ref_pic_set_prediction_flag = reader.readFlag("inter_ref_pic_set_prediction_flag");
61
62 if (this->inter_ref_pic_set_prediction_flag)
63 {
64 this->delta_idx_minus1 = 0;
65 if (stRpsIdx == num_short_term_ref_pic_sets)
66 this->delta_idx_minus1 = reader.readUEV("delta_idx_minus1");
67 this->delta_rps_sign = reader.readFlag("delta_rps_sign");
68 this->abs_delta_rps_minus1 = reader.readUEV("abs_delta_rps_minus1");
69
70 int RefRpsIdx = stRpsIdx - (this->delta_idx_minus1 + 1); // Rec. ITU-T H.265 v3 (04/2015) (7-57)
71 int deltaRps = (1 - 2 * this->delta_rps_sign) * (this->abs_delta_rps_minus1 + 1); // Rec. ITU-T H.265 v3 (04/2015) (7-58)
72 reader.logCalculatedValue("RefRpsIdx", RefRpsIdx);
73 reader.logCalculatedValue("deltaRps", deltaRps);
74
75 for(unsigned j=0; j<=NumDeltaPocs[RefRpsIdx]; j++)
76 {
77 this->used_by_curr_pic_flag.push_back(reader.readFlag(formatArray("used_by_curr_pic_flag", j)));
78 if(!this->used_by_curr_pic_flag.back())
79 this->use_delta_flag.push_back(reader.readFlag(formatArray("use_delta_flag", j)));
80 else
81 this->use_delta_flag.push_back(true);
82 }
83
84 // Derive NumNegativePics Rec. ITU-T H.265 v3 (04/2015) (7-59)
85 unsigned i = 0;
86 for(int j=int(NumPositivePics[RefRpsIdx]) - 1; j >= 0; j--)
87 {
88 int dPoc = DeltaPocS1[RefRpsIdx][j] + deltaRps;
89 if(dPoc < 0 && this->use_delta_flag[NumNegativePics[RefRpsIdx] + j])
90 {
91 DeltaPocS0[stRpsIdx][i] = dPoc;
92 reader.logArbitrary(formatArray("DeltaPocS0", stRpsIdx, i), std::to_string(dPoc));
93 UsedByCurrPicS0[stRpsIdx][i++] = this->used_by_curr_pic_flag[NumNegativePics[RefRpsIdx] + j];
94 }
95 }
96 if(deltaRps < 0 && this->use_delta_flag[NumDeltaPocs[RefRpsIdx]])
97 {
98 DeltaPocS0[stRpsIdx][i] = deltaRps;
99 reader.logArbitrary(formatArray("DeltaPocS0", stRpsIdx, i), std::to_string(deltaRps));
100 UsedByCurrPicS0[stRpsIdx][i++] = this->used_by_curr_pic_flag[NumDeltaPocs[RefRpsIdx]];
101 }
102 for(unsigned int j=0; j<NumNegativePics[RefRpsIdx]; j++)
103 {
104 int dPoc = DeltaPocS0[RefRpsIdx][j] + deltaRps;
105 if(dPoc < 0 && this->use_delta_flag[j])
106 {
107 DeltaPocS0[stRpsIdx][i] = dPoc;
108 reader.logArbitrary(formatArray("DeltaPocS0", stRpsIdx, i), std::to_string(dPoc));

Callers

nothing calls this directly

Calls 6

formatArrayFunction · 0.85
readFlagMethod · 0.80
readUEVMethod · 0.80
logCalculatedValueMethod · 0.80
logArbitraryMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected