Skip to main content

singe_npp/
types_descriptors.rs

1use super::*;
2
3#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq)]
4pub struct HistogramOfGradientsConfig {
5    pub cell_size: i32,
6    pub histogram_block_size: i32,
7    pub histogram_bins: i32,
8    pub detection_window_size: Size,
9}
10
11impl Default for HistogramOfGradientsConfig {
12    fn default() -> Self {
13        Self {
14            cell_size: 0,
15            histogram_block_size: 0,
16            histogram_bins: 0,
17            detection_window_size: Size::from_raw_parts(0, 0),
18        }
19    }
20}
21
22impl From<HistogramOfGradientsConfig> for sys::NppiHOGConfig {
23    fn from(value: HistogramOfGradientsConfig) -> Self {
24        Self {
25            cellSize: value.cell_size,
26            histogramBlockSize: value.histogram_block_size,
27            nHistogramBins: value.histogram_bins,
28            detectionWindowSize: value.detection_window_size.into(),
29        }
30    }
31}
32
33impl From<sys::NppiHOGConfig> for HistogramOfGradientsConfig {
34    fn from(value: sys::NppiHOGConfig) -> Self {
35        Self {
36            cell_size: value.cellSize,
37            histogram_block_size: value.histogramBlockSize,
38            histogram_bins: value.nHistogramBins,
39            detection_window_size: value.detectionWindowSize.into(),
40        }
41    }
42}
43
44#[non_exhaustive]
45#[repr(C)]
46#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
47/// Non-owning NPP Haar classifier descriptor.
48///
49/// Raw pointer fields must reference device memory that remains valid for the
50/// full NPP call that consumes this descriptor. The descriptor does not own or
51/// free those pointers.
52pub struct HaarClassifier32f {
53    pub classifier_count: i32,
54    pub classifiers: *mut i32,
55    pub classifier_step: usize,
56    pub classifier_size: Size,
57    pub device_counter: *mut i32,
58}
59
60impl From<HaarClassifier32f> for sys::NppiHaarClassifier_32f {
61    fn from(value: HaarClassifier32f) -> Self {
62        Self {
63            numClassifiers: value.classifier_count,
64            classifiers: value.classifiers,
65            classifierStep: value.classifier_step as _,
66            classifierSize: value.classifier_size.into(),
67            counterDevice: value.device_counter,
68        }
69    }
70}
71
72impl From<sys::NppiHaarClassifier_32f> for HaarClassifier32f {
73    fn from(value: sys::NppiHaarClassifier_32f) -> Self {
74        Self {
75            classifier_count: value.numClassifiers,
76            classifiers: value.classifiers,
77            classifier_step: value.classifierStep as _,
78            classifier_size: value.classifierSize.into(),
79            device_counter: value.counterDevice,
80        }
81    }
82}
83
84#[non_exhaustive]
85#[repr(C)]
86#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
87/// Non-owning NPP Haar buffer descriptor.
88///
89/// `buffer` must reference device memory that remains valid for the full NPP
90/// call that consumes this descriptor. The descriptor does not own or free the
91/// pointer.
92pub struct HaarBuffer {
93    pub size: i32,
94    pub buffer: *mut i32,
95}
96
97impl From<HaarBuffer> for sys::NppiHaarBuffer {
98    fn from(value: HaarBuffer) -> Self {
99        Self {
100            haarBufferSize: value.size,
101            haarBuffer: value.buffer,
102        }
103    }
104}
105
106impl From<sys::NppiHaarBuffer> for HaarBuffer {
107    fn from(value: sys::NppiHaarBuffer) -> Self {
108        Self {
109            size: value.haarBufferSize,
110            buffer: value.haarBuffer,
111        }
112    }
113}
114
115#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
116pub struct ConnectedRegion {
117    pub bounding_box: Rectangle,
118    pub connected_pixel_count: u32,
119    pub seed_pixel_value: [u32; 3],
120}
121
122impl From<ConnectedRegion> for sys::NppiConnectedRegion {
123    fn from(value: ConnectedRegion) -> Self {
124        Self {
125            oBoundingBox: value.bounding_box.into(),
126            nConnectedPixelCount: value.connected_pixel_count,
127            aSeedPixelValue: value.seed_pixel_value,
128        }
129    }
130}
131
132impl From<sys::NppiConnectedRegion> for ConnectedRegion {
133    fn from(value: sys::NppiConnectedRegion) -> Self {
134        Self {
135            bounding_box: value.oBoundingBox.into(),
136            connected_pixel_count: value.nConnectedPixelCount,
137            seed_pixel_value: value.aSeedPixelValue,
138        }
139    }
140}
141
142#[non_exhaustive]
143#[repr(C)]
144#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
145/// Non-owning NPP image descriptor.
146///
147/// `data` must reference image memory that remains valid for the full NPP call
148/// that consumes this descriptor. The descriptor does not own or free the
149/// pointer.
150pub struct ImageDescriptor {
151    pub data: *mut (),
152    pub step: i32,
153    pub size: Size,
154}
155
156impl From<ImageDescriptor> for sys::NppiImageDescriptor {
157    fn from(value: ImageDescriptor) -> Self {
158        Self {
159            pData: value.data as _,
160            nStep: value.step,
161            oSize: value.size.into(),
162        }
163    }
164}
165
166impl From<sys::NppiImageDescriptor> for ImageDescriptor {
167    fn from(value: sys::NppiImageDescriptor) -> Self {
168        Self {
169            data: value.pData as _,
170            step: value.nStep,
171            size: value.oSize.into(),
172        }
173    }
174}
175
176#[non_exhaustive]
177#[repr(C)]
178#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
179/// Non-owning NPP scratch/data buffer descriptor.
180///
181/// `data` must reference memory that remains valid for the full NPP call that
182/// consumes this descriptor. The descriptor does not own or free the pointer.
183pub struct BufferDescriptor {
184    pub data: *mut (),
185    pub size: i32,
186}
187
188impl From<BufferDescriptor> for sys::NppiBufferDescriptor {
189    fn from(value: BufferDescriptor) -> Self {
190        Self {
191            pData: value.data as _,
192            nBufferSize: value.size,
193        }
194    }
195}
196
197impl From<sys::NppiBufferDescriptor> for BufferDescriptor {
198    fn from(value: sys::NppiBufferDescriptor) -> Self {
199        Self {
200            data: value.pData as _,
201            size: value.nBufferSize,
202        }
203    }
204}
205
206#[repr(C)]
207#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
208pub struct CompressedMarkerLabelsInfo {
209    pub marker_label_pixel_count: u32,
210    pub contour_pixel_count: u32,
211    pub contour_pixels_found: u32,
212    pub contour_first_pixel_location: Point,
213    pub marker_label_bounding_box: Rectangle,
214}
215
216impl From<CompressedMarkerLabelsInfo> for sys::NppiCompressedMarkerLabelsInfo {
217    fn from(value: CompressedMarkerLabelsInfo) -> Self {
218        Self {
219            nMarkerLabelPixelCount: value.marker_label_pixel_count,
220            nContourPixelCount: value.contour_pixel_count,
221            nContourPixelsFound: value.contour_pixels_found,
222            oContourFirstPixelLocation: value.contour_first_pixel_location.into(),
223            oMarkerLabelBoundingBox: value.marker_label_bounding_box.into(),
224        }
225    }
226}
227
228impl From<sys::NppiCompressedMarkerLabelsInfo> for CompressedMarkerLabelsInfo {
229    fn from(value: sys::NppiCompressedMarkerLabelsInfo) -> Self {
230        Self {
231            marker_label_pixel_count: value.nMarkerLabelPixelCount,
232            contour_pixel_count: value.nContourPixelCount,
233            contour_pixels_found: value.nContourPixelsFound,
234            contour_first_pixel_location: value.oContourFirstPixelLocation.into(),
235            marker_label_bounding_box: value.oMarkerLabelBoundingBox.into(),
236        }
237    }
238}
239
240#[repr(C)]
241#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
242pub struct ContourBlockSegment {
243    pub marker_label_id: u32,
244    pub contour_pixel_count: u32,
245    pub contour_starting_pixel_offset: u32,
246    pub segment_number: u32,
247}
248
249impl From<ContourBlockSegment> for sys::NppiContourBlockSegment {
250    fn from(value: ContourBlockSegment) -> Self {
251        Self {
252            nMarkerLabelID: value.marker_label_id,
253            nContourPixelCount: value.contour_pixel_count,
254            nContourStartingPixelOffset: value.contour_starting_pixel_offset,
255            nSegmentNum: value.segment_number,
256        }
257    }
258}
259
260impl From<sys::NppiContourBlockSegment> for ContourBlockSegment {
261    fn from(value: sys::NppiContourBlockSegment) -> Self {
262        Self {
263            marker_label_id: value.nMarkerLabelID,
264            contour_pixel_count: value.nContourPixelCount,
265            contour_starting_pixel_offset: value.nContourStartingPixelOffset,
266            segment_number: value.nSegmentNum,
267        }
268    }
269}
270
271#[repr(C)]
272#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
273pub struct ContourPixelGeometryInfo {
274    pub contour_ordered_geometry_location: Point,
275    pub previous_contour_pixel_location: Point,
276    pub contour_center_pixel_location: Point,
277    pub next_contour_pixel_location: Point,
278    pub order_index: i32,
279    pub reverse_order_index: i32,
280    pub first_index: u32,
281    pub last_index: u32,
282    pub next_contour_pixel_index: u32,
283    pub previous_contour_pixel_index: u32,
284    pub pixel_already_used: u8,
285    pub already_linked: u8,
286    pub already_output: u8,
287    pub contour_interior_direction: u8,
288}
289
290impl From<ContourPixelGeometryInfo> for sys::NppiContourPixelGeometryInfo {
291    fn from(value: ContourPixelGeometryInfo) -> Self {
292        Self {
293            oContourOrderedGeometryLocation: value.contour_ordered_geometry_location.into(),
294            oContourPrevPixelLocation: value.previous_contour_pixel_location.into(),
295            oContourCenterPixelLocation: value.contour_center_pixel_location.into(),
296            oContourNextPixelLocation: value.next_contour_pixel_location.into(),
297            nOrderIndex: value.order_index,
298            nReverseOrderIndex: value.reverse_order_index,
299            nFirstIndex: value.first_index,
300            nLastIndex: value.last_index,
301            nNextContourPixelIndex: value.next_contour_pixel_index,
302            nPrevContourPixelIndex: value.previous_contour_pixel_index,
303            nPixelAlreadyUsed: value.pixel_already_used,
304            nAlreadyLinked: value.already_linked,
305            nAlreadyOutput: value.already_output,
306            nContourInteriorDirection: value.contour_interior_direction,
307        }
308    }
309}
310
311impl From<sys::NppiContourPixelGeometryInfo> for ContourPixelGeometryInfo {
312    fn from(value: sys::NppiContourPixelGeometryInfo) -> Self {
313        Self {
314            contour_ordered_geometry_location: value.oContourOrderedGeometryLocation.into(),
315            previous_contour_pixel_location: value.oContourPrevPixelLocation.into(),
316            contour_center_pixel_location: value.oContourCenterPixelLocation.into(),
317            next_contour_pixel_location: value.oContourNextPixelLocation.into(),
318            order_index: value.nOrderIndex,
319            reverse_order_index: value.nReverseOrderIndex,
320            first_index: value.nFirstIndex,
321            last_index: value.nLastIndex,
322            next_contour_pixel_index: value.nNextContourPixelIndex,
323            previous_contour_pixel_index: value.nPrevContourPixelIndex,
324            pixel_already_used: value.nPixelAlreadyUsed,
325            already_linked: value.nAlreadyLinked,
326            already_output: value.nAlreadyOutput,
327            contour_interior_direction: value.nContourInteriorDirection,
328        }
329    }
330}
331
332#[repr(C)]
333#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
334pub struct ContourPixelDirectionInfo {
335    pub marker_label_id: u32,
336    pub contour_direction_center_pixel: u8,
337    pub contour_interior_direction_center_pixel: u8,
338    pub connected: u8,
339    pub geometry_info_is_valid: u8,
340    pub contour_pixel_geometry_info: ContourPixelGeometryInfo,
341    pub east: Point,
342    pub north_east: Point,
343    pub north: Point,
344    pub north_west: Point,
345    pub west: Point,
346    pub south_west: Point,
347    pub south: Point,
348    pub south_east: Point,
349    pub east_connected: u8,
350    pub north_east_connected: u8,
351    pub north_connected: u8,
352    pub north_west_connected: u8,
353    pub west_connected: u8,
354    pub south_west_connected: u8,
355    pub south_connected: u8,
356    pub south_east_connected: u8,
357}
358
359impl From<ContourPixelDirectionInfo> for sys::NppiContourPixelDirectionInfo {
360    fn from(value: ContourPixelDirectionInfo) -> Self {
361        Self {
362            nMarkerLabelID: value.marker_label_id,
363            nContourDirectionCenterPixel: value.contour_direction_center_pixel,
364            nContourInteriorDirectionCenterPixel: value.contour_interior_direction_center_pixel,
365            nConnected: value.connected,
366            nGeometryInfoIsValid: value.geometry_info_is_valid,
367            oContourPixelGeometryInfo: value.contour_pixel_geometry_info.into(),
368            nEast1: value.east.into(),
369            nNorthEast1: value.north_east.into(),
370            nNorth1: value.north.into(),
371            nNorthWest1: value.north_west.into(),
372            nWest1: value.west.into(),
373            nSouthWest1: value.south_west.into(),
374            nSouth1: value.south.into(),
375            nSouthEast1: value.south_east.into(),
376            nTest1EastConnected: value.east_connected,
377            nTest1NorthEastConnected: value.north_east_connected,
378            nTest1NorthConnected: value.north_connected,
379            nTest1NorthWestConnected: value.north_west_connected,
380            nTest1WestConnected: value.west_connected,
381            nTest1SouthWestConnected: value.south_west_connected,
382            nTest1SouthConnected: value.south_connected,
383            nTest1SouthEastConnected: value.south_east_connected,
384        }
385    }
386}
387
388impl From<sys::NppiContourPixelDirectionInfo> for ContourPixelDirectionInfo {
389    fn from(value: sys::NppiContourPixelDirectionInfo) -> Self {
390        Self {
391            marker_label_id: value.nMarkerLabelID,
392            contour_direction_center_pixel: value.nContourDirectionCenterPixel,
393            contour_interior_direction_center_pixel: value.nContourInteriorDirectionCenterPixel,
394            connected: value.nConnected,
395            geometry_info_is_valid: value.nGeometryInfoIsValid,
396            contour_pixel_geometry_info: value.oContourPixelGeometryInfo.into(),
397            east: value.nEast1.into(),
398            north_east: value.nNorthEast1.into(),
399            north: value.nNorth1.into(),
400            north_west: value.nNorthWest1.into(),
401            west: value.nWest1.into(),
402            south_west: value.nSouthWest1.into(),
403            south: value.nSouth1.into(),
404            south_east: value.nSouthEast1.into(),
405            east_connected: value.nTest1EastConnected,
406            north_east_connected: value.nTest1NorthEastConnected,
407            north_connected: value.nTest1NorthConnected,
408            north_west_connected: value.nTest1NorthWestConnected,
409            west_connected: value.nTest1WestConnected,
410            south_west_connected: value.nTest1SouthWestConnected,
411            south_connected: value.nTest1SouthConnected,
412            south_east_connected: value.nTest1SouthEastConnected,
413        }
414    }
415}
416
417#[repr(C)]
418#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
419pub struct ContourTotalsInfo {
420    pub total_image_pixel_contour_count: u32,
421    pub longest_image_contour_pixel_count: u32,
422}
423
424impl From<ContourTotalsInfo> for sys::NppiContourTotalsInfo {
425    fn from(value: ContourTotalsInfo) -> Self {
426        Self {
427            nTotalImagePixelContourCount: value.total_image_pixel_contour_count,
428            nLongestImageContourPixelCount: value.longest_image_contour_pixel_count,
429        }
430    }
431}
432
433impl From<sys::NppiContourTotalsInfo> for ContourTotalsInfo {
434    fn from(value: sys::NppiContourTotalsInfo) -> Self {
435        Self {
436            total_image_pixel_contour_count: value.nTotalImagePixelContourCount,
437            longest_image_contour_pixel_count: value.nLongestImageContourPixelCount,
438        }
439    }
440}
441
442#[non_exhaustive]
443#[repr(C)]
444#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
445/// Non-owning NPP resize batch descriptor.
446///
447/// `source` and `destination` must remain valid for the full NPP call that
448/// consumes this descriptor. The descriptor does not own or free either
449/// pointer.
450pub struct ResizeBatchDescriptor {
451    pub source: *const (),
452    pub source_step: i32,
453    pub destination: *mut (),
454    pub destination_step: i32,
455}
456
457impl From<ResizeBatchDescriptor> for sys::NppiResizeBatchCXR {
458    fn from(value: ResizeBatchDescriptor) -> Self {
459        Self {
460            pSrc: value.source as _,
461            nSrcStep: value.source_step,
462            pDst: value.destination as _,
463            nDstStep: value.destination_step,
464        }
465    }
466}
467
468impl From<sys::NppiResizeBatchCXR> for ResizeBatchDescriptor {
469    fn from(value: sys::NppiResizeBatchCXR) -> Self {
470        Self {
471            source: value.pSrc as _,
472            source_step: value.nSrcStep,
473            destination: value.pDst as _,
474            destination_step: value.nDstStep,
475        }
476    }
477}
478
479#[derive(Debug, Clone, Copy, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
480pub struct ResizeBatchRoiAdvanced {
481    pub source_roi: Rectangle,
482    pub destination_roi: Rectangle,
483}
484
485impl From<ResizeBatchRoiAdvanced> for sys::NppiResizeBatchROI_Advanced {
486    fn from(value: ResizeBatchRoiAdvanced) -> Self {
487        Self {
488            oSrcRectROI: value.source_roi.into(),
489            oDstRectROI: value.destination_roi.into(),
490        }
491    }
492}
493
494impl From<sys::NppiResizeBatchROI_Advanced> for ResizeBatchRoiAdvanced {
495    fn from(value: sys::NppiResizeBatchROI_Advanced) -> Self {
496        Self {
497            source_roi: value.oSrcRectROI.into(),
498            destination_roi: value.oDstRectROI.into(),
499        }
500    }
501}
502
503#[non_exhaustive]
504#[repr(C)]
505#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
506/// Non-owning NPP mirror batch descriptor.
507///
508/// `source` and `destination` must remain valid for the full NPP call that
509/// consumes this descriptor. The descriptor does not own or free either
510/// pointer.
511pub struct MirrorBatchDescriptor {
512    pub source: *const (),
513    pub source_step: i32,
514    pub destination: *mut (),
515    pub destination_step: i32,
516}
517
518impl From<MirrorBatchDescriptor> for sys::NppiMirrorBatchCXR {
519    fn from(value: MirrorBatchDescriptor) -> Self {
520        Self {
521            pSrc: value.source as _,
522            nSrcStep: value.source_step,
523            pDst: value.destination as _,
524            nDstStep: value.destination_step,
525        }
526    }
527}
528
529impl From<sys::NppiMirrorBatchCXR> for MirrorBatchDescriptor {
530    fn from(value: sys::NppiMirrorBatchCXR) -> Self {
531        Self {
532            source: value.pSrc as _,
533            source_step: value.nSrcStep,
534            destination: value.pDst as _,
535            destination_step: value.nDstStep,
536        }
537    }
538}
539
540#[non_exhaustive]
541#[repr(C)]
542#[derive(Debug, PartialOrd, PartialEq)]
543/// Non-owning NPP affine-warp batch descriptor.
544///
545/// Raw pointer fields must remain valid for the full NPP call that consumes
546/// this descriptor. The descriptor does not own or free those pointers.
547pub struct WarpAffineBatchDescriptor {
548    pub source: *const (),
549    pub source_step: i32,
550    pub destination: *mut (),
551    pub destination_step: i32,
552    pub coefficients: *mut f64,
553    pub transformed_coefficients: [[f64; 3]; 2],
554}
555
556impl From<WarpAffineBatchDescriptor> for sys::NppiWarpAffineBatchCXR {
557    fn from(value: WarpAffineBatchDescriptor) -> Self {
558        Self {
559            pSrc: value.source as _,
560            nSrcStep: value.source_step,
561            pDst: value.destination as _,
562            nDstStep: value.destination_step,
563            pCoeffs: value.coefficients,
564            aTransformedCoeffs: value.transformed_coefficients,
565        }
566    }
567}
568
569impl From<sys::NppiWarpAffineBatchCXR> for WarpAffineBatchDescriptor {
570    fn from(value: sys::NppiWarpAffineBatchCXR) -> Self {
571        Self {
572            source: value.pSrc as _,
573            source_step: value.nSrcStep,
574            destination: value.pDst as _,
575            destination_step: value.nDstStep,
576            coefficients: value.pCoeffs,
577            transformed_coefficients: value.aTransformedCoeffs,
578        }
579    }
580}
581
582#[non_exhaustive]
583#[repr(C)]
584#[derive(Debug, PartialOrd, PartialEq)]
585/// Non-owning NPP perspective-warp batch descriptor.
586///
587/// Raw pointer fields must remain valid for the full NPP call that consumes
588/// this descriptor. The descriptor does not own or free those pointers.
589pub struct WarpPerspectiveBatchDescriptor {
590    pub source: *const (),
591    pub source_step: i32,
592    pub destination: *mut (),
593    pub destination_step: i32,
594    pub coefficients: *mut f64,
595    pub transformed_coefficients: [[f64; 3]; 3],
596}
597
598impl From<WarpPerspectiveBatchDescriptor> for sys::NppiWarpPerspectiveBatchCXR {
599    fn from(value: WarpPerspectiveBatchDescriptor) -> Self {
600        Self {
601            pSrc: value.source as _,
602            nSrcStep: value.source_step,
603            pDst: value.destination as _,
604            nDstStep: value.destination_step,
605            pCoeffs: value.coefficients,
606            aTransformedCoeffs: value.transformed_coefficients,
607        }
608    }
609}
610
611impl From<sys::NppiWarpPerspectiveBatchCXR> for WarpPerspectiveBatchDescriptor {
612    fn from(value: sys::NppiWarpPerspectiveBatchCXR) -> Self {
613        Self {
614            source: value.pSrc as _,
615            source_step: value.nSrcStep,
616            destination: value.pDst as _,
617            destination_step: value.nDstStep,
618            coefficients: value.pCoeffs,
619            transformed_coefficients: value.aTransformedCoeffs,
620        }
621    }
622}
623
624#[non_exhaustive]
625#[repr(C)]
626#[derive(Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
627/// Non-owning NPP color-twist batch descriptor.
628///
629/// Raw pointer fields must remain valid for the full NPP call that consumes
630/// this descriptor. The descriptor does not own or free those pointers.
631pub struct ColorTwistBatchDescriptor {
632    pub source: *const (),
633    pub source_step: i32,
634    pub destination: *mut (),
635    pub destination_step: i32,
636    pub twist: *mut f32,
637}
638
639impl From<ColorTwistBatchDescriptor> for sys::NppiColorTwistBatchCXR {
640    fn from(value: ColorTwistBatchDescriptor) -> Self {
641        Self {
642            pSrc: value.source as _,
643            nSrcStep: value.source_step,
644            pDst: value.destination as _,
645            nDstStep: value.destination_step,
646            pTwist: value.twist,
647        }
648    }
649}
650
651impl From<sys::NppiColorTwistBatchCXR> for ColorTwistBatchDescriptor {
652    fn from(value: sys::NppiColorTwistBatchCXR) -> Self {
653        Self {
654            source: value.pSrc as _,
655            source_step: value.nSrcStep,
656            destination: value.pDst as _,
657            destination_step: value.nDstStep,
658            twist: value.pTwist,
659        }
660    }
661}
662
663#[derive(Debug, Clone, Copy, PartialOrd, PartialEq, Default)]
664pub struct ProfileData {
665    pub pixels: i32,
666    pub mean_intensity: f32,
667    pub standard_deviation_intensity: f32,
668}
669
670impl From<ProfileData> for sys::NppiProfileData {
671    fn from(value: ProfileData) -> Self {
672        Self {
673            nPixels: value.pixels,
674            nMeanIntensity: value.mean_intensity,
675            nStdDevIntensity: value.standard_deviation_intensity,
676        }
677    }
678}
679
680impl From<sys::NppiProfileData> for ProfileData {
681    fn from(value: sys::NppiProfileData) -> Self {
682        Self {
683            pixels: value.nPixels,
684            mean_intensity: value.nMeanIntensity,
685            standard_deviation_intensity: value.nStdDevIntensity,
686        }
687    }
688}