MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / computeHistogramStatic

Function computeHistogramStatic

Engine/HistogramCPU.cpp:301–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299
300
301static void
302computeHistogramStatic(const HistogramRequest & request,
303 FinishedHistogramPtr ret,
304 int histogramIndex)
305{
306 const int upscale = 5;
307 std::vector<float> *histo = 0;
308
309 switch (histogramIndex) {
310 case 1:
311 histo = &ret->histogram1;
312 break;
313 case 2:
314 histo = &ret->histogram2;
315 break;
316 case 3:
317 histo = &ret->histogram3;
318 break;
319 default:
320 break;
321 }
322 assert(histo);
323 if (!histo) {
324 return;
325 }
326
327 /// keep the mode parameter in sync with Histogram::DisplayModeEnum
328
329 int mode = request.mode;
330
331 ///if the mode is RGB, adjust the mode to either R,G or B depending on the histogram index
332 if (mode == 0) {
333 mode = histogramIndex + 2;
334 }
335
336 ret->pixelsCount = request.rect.area();
337 // a histogram with upscale more bins
338 std::vector<float> histo_upscaled;
339 switch (mode) {
340 case 1: //< A
341 computeHisto<&pix_alpha::val>(request, upscale, &histo_upscaled);
342 break;
343 case 2: //<Y
344 computeHisto<&pix_lum::val>(request, upscale, &histo_upscaled);
345 break;
346 case 3: //< R
347 computeHisto<&pix_red::val>(request, upscale, &histo_upscaled);
348 break;
349 case 4: //< G
350 computeHisto<&pix_green::val>(request, upscale, &histo_upscaled);
351 break;
352 case 5: //< B
353 computeHisto<&pix_blue::val>(request, upscale, &histo_upscaled);
354 break;
355
356 default:
357 assert(false);
358 break;

Callers 1

runMethod · 0.85

Calls 6

iir_gaussianFilter1DFunction · 0.85
areaMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected