MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / GetQueryResult

Method GetQueryResult

libraries/ntc-utils/src/GraphicsImageDifferencePass.cpp:163–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163bool GraphicsImageDifferencePass::GetQueryResult(uint32_t queryIndex, float outPerChannelMSE[4],
164 float* outOverallMSE, float* outOverallPSNR, int channels, float maxSignalValue)
165{
166 if (queryIndex >= m_maxQueries)
167 return false;
168
169 // Check that ReadResults() has been called after executing queries, to avoid returning garbage.
170 // We can't really check if the comparison command list has been executed by the caller,
171 // but this is better than nothing.
172 if (!m_resultsRead)
173 return false;
174
175 float overallMSE = 0.f;
176 for (int ch = 0; ch < channels; ++ch)
177 {
178 float const mse = m_mseValues[queryIndex * ChannelsPerQuery + ch];
179 overallMSE += mse / float(channels);
180
181 if (outPerChannelMSE)
182 outPerChannelMSE[ch] = mse;
183 }
184
185 if (outOverallMSE)
186 *outOverallMSE = overallMSE;
187
188 if (outOverallPSNR)
189 *outOverallPSNR = ntc::LossToPSNR(overallMSE / (maxSignalValue * maxSignalValue));
190
191 return true;
192}
193

Callers 5

CompareTwoImagesFunction · 0.80
CompressWithNtcFunction · 0.80
CompressWithNvttFunction · 0.80

Calls

no outgoing calls

Tested by 3

CompareTwoImagesFunction · 0.64
CompressWithNtcFunction · 0.64
CompressWithNvttFunction · 0.64