File: PixelFilter.cpp

package info (click to toggle)
ospray 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,048 kB
  • sloc: cpp: 80,569; ansic: 951; sh: 805; makefile: 170; python: 69
file content (71 lines) | stat: -rw-r--r-- 1,897 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

// ospray
#include "PixelFilter.h"
#include "ISPCDevice.h"
#include "ISPCDeviceObject.h"
#include "math/Distribution2D.h"
#ifndef OSPRAY_TARGET_SYCL
#include "pf/LUTPixelFilter_ispc.h"
#else
namespace ispc {
void LUTPixelFilter_buildLUT(void *self);
}
#endif

namespace ospray {

PixelFilter::PixelFilter(api::ISPCDevice &device)
    : AddStructShared(device.getDRTDevice(), device)
{}

LUTPixelFilter::LUTPixelFilter(const float size,
    ispc::LUTPixelFilterType lutFilterType,
    api::ISPCDevice &device)
    : AddStructShared(device.getDRTDevice(), device)
{
  getSh()->super.width = size;
  getSh()->super.type = ispc::PIXEL_FILTER_TYPE_LUT;

  const vec2i lutSize = vec2i(std::ceil(size)) * LUTPIXELFILTER_PER_PIXEL_BINS;
  distribution = new Distribution2D(lutSize, device);
  // Remove local ref
  distribution->refDec();

  getSh()->distribution = distribution->getSh();
  getSh()->lutFilterType = lutFilterType;

  ispc::LUTPixelFilter_buildLUT(getSh());
}

PointPixelFilter::PointPixelFilter(api::ISPCDevice &device)
    : PixelFilter(device)
{
  getSh()->type = ispc::PIXEL_FILTER_TYPE_POINT;
  getSh()->width = 0.f;
}

BoxPixelFilter::BoxPixelFilter(api::ISPCDevice &device) : PixelFilter(device)
{
  getSh()->type = ispc::PIXEL_FILTER_TYPE_BOX;
  getSh()->width = 1.f;
}

GaussianLUTPixelFilter::GaussianLUTPixelFilter(api::ISPCDevice &device)
    : LUTPixelFilter(3.f, ispc::LUT_PIXEL_FILTER_TYPE_GAUSSIAN, device)

{}

BlackmanHarrisLUTPixelFilter::BlackmanHarrisLUTPixelFilter(
    api::ISPCDevice &device)
    : LUTPixelFilter(3.f, ispc::LUT_PIXEL_FILTER_TYPE_BLACKMANN_HARRIS, device)
{}

MitchellNetravaliLUTPixelFilter::MitchellNetravaliLUTPixelFilter(
    api::ISPCDevice &device)
    : LUTPixelFilter(
        4.f, ispc::LUT_PIXEL_FILTER_TYPE_MITCHELL_NETRAVALI, device)
{}

} // namespace ospray