| 1 |
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. |
| 2 |
* |
| 3 |
* Redistribution and use in source and binary forms, with or without |
| 4 |
* modification, are permitted provided that the following conditions |
| 5 |
* are met: |
| 6 |
* * Redistributions of source code must retain the above copyright |
| 7 |
* notice, this list of conditions and the following disclaimer. |
| 8 |
* * Redistributions in binary form must reproduce the above copyright |
| 9 |
* notice, this list of conditions and the following disclaimer in the |
| 10 |
* documentation and/or other materials provided with the distribution. |
| 11 |
* * Neither the name of NVIDIA CORPORATION nor the names of its |
| 12 |
* contributors may be used to endorse or promote products derived |
| 13 |
* from this software without specific prior written permission. |
| 14 |
* |
| 15 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY |
| 16 |
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 19 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 22 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 23 |
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
#ifndef _NVMEDIA_2D_CMD_LINE_H_ |
| 30 |
#define _NVMEDIA_2D_CMD_LINE_H_ |
| 31 |
|
| 32 |
/* Include header containing NvMedia2D declarations */ |
| 33 |
#include "nvmedia_2d.h" |
| 34 |
|
| 35 |
/* Maximum length of the path including file name */ |
| 36 |
#define FILE_NAME_SIZE 1024 |
| 37 |
|
| 38 |
/* TestArgs contains all arguments required to run the 2D test */ |
| 39 |
typedef struct _TestArgs { |
| 40 |
char inputFileName[FILE_NAME_SIZE]; |
| 41 |
|
| 42 |
NvMediaSurfAllocAttr srcSurfAllocAttrs[NVM_SURF_ALLOC_ATTR_MAX]; |
| 43 |
NvMediaSurfAllocAttr dstSurfAllocAttrs[NVM_SURF_ALLOC_ATTR_MAX]; |
| 44 |
uint32_t numSurfAllocAttrs; |
| 45 |
|
| 46 |
NvMediaSurfFormatAttr srcSurfFormatAttrs[NVM_SURF_FMT_ATTR_MAX]; |
| 47 |
NvMediaSurfFormatAttr dstSurfFormatAttrs[NVM_SURF_FMT_ATTR_MAX]; |
| 48 |
|
| 49 |
NvMediaRect srcRect; |
| 50 |
NvMediaRect dstRect; |
| 51 |
NvMedia2DBlitParameters blitParams; |
| 52 |
size_t iterations; |
| 53 |
} TestArgs; |
| 54 |
|
| 55 |
typedef struct { |
| 56 |
NvMediaDevice *device; |
| 57 |
/* I2D for 2D blit processing */ |
| 58 |
NvMedia2D *i2d; |
| 59 |
NvMediaImage *srcImage; |
| 60 |
NvMediaImage *dstImage; |
| 61 |
NvMediaRect *srcRect; |
| 62 |
NvMediaRect *dstRect; |
| 63 |
uint8_t **dstBuff; |
| 64 |
uint32_t *dstBuffPitches; |
| 65 |
uint8_t *dstBuffer; |
| 66 |
uint32_t numSurfaces; |
| 67 |
uint32_t bytesPerPixel; |
| 68 |
uint32_t heightSurface; |
| 69 |
uint32_t widthSurface; |
| 70 |
float *xScalePtr; |
| 71 |
float *yScalePtr; |
| 72 |
|
| 73 |
} Blit2DTest; |
| 74 |
|
| 75 |
/* Prints application usage options */ |
| 76 |
void PrintUsage (void); |
| 77 |
|
| 78 |
/* Parses command line arguments. |
| 79 |
* Also parses any configuration files supplied in the command line arguments. |
| 80 |
* Arguments: |
| 81 |
* argc |
| 82 |
* (in) Number of tokens in the command line |
| 83 |
* argv |
| 84 |
* (in) Command line tokens |
| 85 |
* args |
| 86 |
* (out) Pointer to test arguments structure |
| 87 |
*/ |
| 88 |
int ParseArgs(int argc, char **argv, TestArgs *args); |
| 89 |
|
| 90 |
#endif /* _NVMEDIA_2D_CMD_LINE_H_ */ |