Program Listing for File ImageBatch.h

Return to documentation for file (nvcv_types/include/nvcv/ImageBatch.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_IMAGEBATCH_H
#define NVCV_IMAGEBATCH_H

#include "Export.h"
#include "Fwd.h"
#include "Image.h"
#include "ImageBatchData.h"
#include "Status.h"
#include "alloc/Allocator.h"
#include "alloc/Requirements.h"
#include "detail/CudaFwd.h"

#include <nvcv/ImageFormat.h>

#ifdef __cplusplus
extern "C"
{
#endif

typedef enum
{
    NVCV_TYPE_IMAGEBATCH_VARSHAPE,
    NVCV_TYPE_IMAGEBATCH_TENSOR,
    NVCV_TYPE_IMAGEBATCH_TENSOR_WRAPDATA,
} NVCVTypeImageBatch;

typedef struct NVCVImageBatch *NVCVImageBatchHandle;

typedef void (*NVCVImageBatchDataCleanupFunc)(void *ctx, const NVCVImageBatchData *data);

typedef struct NVCVImageBatchVarShapeRequirementsRec
{
    int32_t capacity; /*< Maximum number of images stored. */

    int32_t          alignBytes; /*< Alignment/block size in bytes */
    NVCVRequirements mem;        /*< Image batch resource requirements. */
} NVCVImageBatchVarShapeRequirements;

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeCalcRequirements(int32_t                             capacity,
                                                              NVCVImageBatchVarShapeRequirements *reqs);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeConstruct(const NVCVImageBatchVarShapeRequirements *reqs,
                                                       NVCVAllocatorHandle alloc, NVCVImageBatchHandle *handle);

NVCV_PUBLIC NVCVStatus nvcvImageBatchDecRef(NVCVImageBatchHandle handle, int *newRefCount);

NVCV_PUBLIC NVCVStatus nvcvImageBatchIncRef(NVCVImageBatchHandle handle, int *newRefCount);

NVCV_PUBLIC NVCVStatus nvcvImageBatchRefCount(NVCVImageBatchHandle handle, int *newRefCount);

NVCV_PUBLIC NVCVStatus nvcvImageBatchSetUserPointer(NVCVImageBatchHandle handle, void *userPtr);

NVCV_PUBLIC NVCVStatus nvcvImageBatchGetUserPointer(NVCVImageBatchHandle handle, void **outUserPtr);

NVCV_PUBLIC NVCVStatus nvcvImageBatchGetType(NVCVImageBatchHandle handle, NVCVTypeImageBatch *type);

NVCV_PUBLIC NVCVStatus nvcvImageBatchGetCapacity(NVCVImageBatchHandle handle, int32_t *capacity);

NVCV_PUBLIC NVCVStatus nvcvImageBatchGetAllocator(NVCVImageBatchHandle handle, NVCVAllocatorHandle *alloc);

NVCV_PUBLIC NVCVStatus nvcvImageBatchGetNumImages(NVCVImageBatchHandle handle, int32_t *numImages);

NVCV_PUBLIC NVCVStatus nvcvImageBatchExportData(NVCVImageBatchHandle handle, CUstream stream, NVCVImageBatchData *data);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeGetMaxSize(NVCVImageBatchHandle handle, int32_t *maxWidth,
                                                        int32_t *maxHeight);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeGetUniqueFormat(NVCVImageBatchHandle handle, NVCVImageFormat *format);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapePushImages(NVCVImageBatchHandle handle, const NVCVImageHandle *images,
                                                        int32_t numImages);

typedef NVCVImageHandle (*NVCVPushImageFunc)(void *ctx);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapePushImagesCallback(NVCVImageBatchHandle handle,
                                                                NVCVPushImageFunc cbPushImage, void *ctxCallback);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapePopImages(NVCVImageBatchHandle handle, int32_t numImages);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeClear(NVCVImageBatchHandle handle);

NVCV_PUBLIC NVCVStatus nvcvImageBatchVarShapeGetImages(NVCVImageBatchHandle handle, int32_t begIndex,
                                                       NVCVImageHandle *outImages, int32_t numImages);

#ifdef __cplusplus
}
#endif

#endif // NVCV_IMAGEBATCH_H