Program Listing for File ImageData.h

Return to documentation for file (nvcv_types/include/nvcv/ImageData.h)

/*
 * SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef NVCV_IMAGEDATA_H
#define NVCV_IMAGEDATA_H

#include "detail/CudaFwd.h"

#include <nvcv/DataType.h>
#include <nvcv/ImageFormat.h>
#include <stdint.h>

typedef struct NVCVImagePlaneStridedRec
{
    int32_t width;

    int32_t height;

    int32_t rowStride;

    NVCVByte *basePtr;
} NVCVImagePlaneStrided;

#define NVCV_MAX_PLANE_COUNT (6)

typedef struct NVCVImageBufferStridedRec
{
    int32_t numPlanes;

    NVCVImagePlaneStrided planes[NVCV_MAX_PLANE_COUNT];
} NVCVImageBufferStrided;

typedef struct NVCVImageBufferCudaArrayRec
{
    int32_t numPlanes;

    cudaArray_t planes[NVCV_MAX_PLANE_COUNT];
} NVCVImageBufferCudaArray;

typedef enum
{
    NVCV_IMAGE_BUFFER_NONE = 0,

    NVCV_IMAGE_BUFFER_STRIDED_CUDA,

    NVCV_IMAGE_BUFFER_STRIDED_HOST,

    NVCV_IMAGE_BUFFER_CUDA_ARRAY,
} NVCVImageBufferType;

typedef union NVCVImageBufferRec
{
    NVCVImageBufferStrided strided;

    NVCVImageBufferCudaArray cudaarray;
} NVCVImageBuffer;

typedef struct NVCVImageDataRec
{
    NVCVImageFormat format;

    NVCVImageBufferType bufferType;

    NVCVImageBuffer buffer;
} NVCVImageData;

#endif // NVCV_IMAGEDATA_H