
Definition in file nv2_common.h.
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for nv2_common.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | nv2_image_patch |
| Represents an image patch, with image data stored in row-major fashion. More... | |
| struct | nv2_patch_label |
| Represents a label for an image patch. More... | |
Defines | |
| #define | NV2_EXTERN_C |
| #define | NV2_PATCH_PROTOCOL_VERSION ((uint32_t) 1004) |
| Represents the current version of struct nv2_image_patch. | |
| #define | NV2_IMAGE_PATCH_HEADER_SIZE (sizeof(struct nv2_image_patch) - sizeof(unsigned char*)) |
| #define | NV2_LABEL_PROTOCOL_VERSION ((uint32_t) 2004) |
| Represents the current version of struct nv2_patch_label. | |
| #define | NV2_MAX_LABEL_CONFIDENCE 10000u |
| The scaling factor used to represent confidence levels in nv2_patch_label. | |
| #define | nv2_fatal(what) nv2_fatal_impl(__FILE__, __LINE__, __FUNCTION__, what) |
| Print an error message to stderr and exit. | |
| #define | nv2_warn(what) nv2_warn_impl(__FILE__, __LINE__, __FUNCTION__, what) |
| Print a warning message to stderr. | |
| #define | NV2_PATCH_READER_PORT 9930 |
| Default tcp port number for the patch reader. | |
| #define | NV2_LABEL_READER_PORT 9931 |
| Default tcp port number for the label reader. | |
Enumerations | |
| enum | nv2_pixel_type { NV2_PIXEL_TYPE_NONE = 5000, NV2_PIXEL_TYPE_GRAY8 = 5001, NV2_PIXEL_TYPE_RGB24 = 5002 } |
| Different pixel types that can be stored in an nv2_image_patch. More... | |
Functions | |
| uint32_t | nv2_pixel_type_bytes_per_pixel (enum nv2_pixel_type typ) |
| Get the number of bytes used per pixel of a given type. | |
| NV2_EXTERN_C void | nv2_image_patch_init_empty (struct nv2_image_patch *p) |
| Initialize with the current protocol version, and zeros elsewhere. | |
| NV2_EXTERN_C void | nv2_image_patch_destroy (struct nv2_image_patch *p) |
| Free the data array associated with p, and reinitialize to an empty state. | |
| NV2_EXTERN_C void | nv2_image_patch_set_training_label (struct nv2_image_patch *p, const char *label) |
| Copy a training label into the image patch. | |
| NV2_EXTERN_C void | nv2_image_patch_set_remote_command (struct nv2_image_patch *p, const char *command) |
| Copy a remote command into the image patch. | |
| NV2_EXTERN_C void | nv2_patch_label_init_empty (struct nv2_patch_label *l) |
| Initialize with the current protocol version, and zeros elsewhere. | |
| NV2_EXTERN_C void | nv2_fatal_impl (const char *file, int line, const char *function, const char *what) |
| Helper for nv2_fatal. | |
| NV2_EXTERN_C void | nv2_warn_impl (const char *file, int line, const char *function, const char *what) |
| Helper for nv2_warn. | |
| size_t | nv2_robust_write (int fd, const void *data, size_t nbytes) |
| Keep doing write() calls until either all the bytes are written or an error occurs. | |
| size_t | nv2_robust_read (int fd, void *buf, size_t nbytes, int *nchunks) |
| Keep doing read() calls until either all the bytes are read or an error occurs. | |
|
|
Print an error message to stderr and exit.
Definition at line 150 of file nv2_common.h. Referenced by nv2_label_reader_create(), nv2_label_reader_destroy(), nv2_label_reader_send_patch_sync(), nv2_label_server_create(), nv2_label_server_destroy(), nv2_label_server_send_label(), nv2_pixel_type_bytes_per_pixel(), run_label_reader(), and run_patch_reader(). |
|
|
Represents the current version of struct nv2_patch_label. Be sure to assign the proper protocol_version before sending any nv2_patch_label objects across the network, and be sure to check the protocol_version field of any nv2_patch_label objects received from the network before using any of the other data fields. Definition at line 118 of file nv2_common.h. Referenced by main(), nv2_patch_label_init_empty(), and run_label_reader(). |
|
|
Default tcp port number for the label reader.
Definition at line 181 of file nv2_common.h. Referenced by EnvInferoTemporal::initReaders(), and main(). |
|
|
The scaling factor used to represent confidence levels in nv2_patch_label. A raw confidence value in [0,1] should be encoded as uint32_t(0.5 + raw*NV2_MAX_LABEL_CONFIDENCE) Definition at line 138 of file nv2_common.h. Referenced by Nv2LabelReader::getLastConfidence(), Nv2LabelReader::getNextLabeledImage(), and main(). |
|
|
Represents the current version of struct nv2_image_patch. Make sure that any struct nv2_image_patch objects to be sent across the network have this value assigned to their protocol_version field, and make sure that any struct nv2_image_patch objects received from the network have the proper protocol_version before using the other data fields. Definition at line 68 of file nv2_common.h. Referenced by main(), nv2_image_patch_init_empty(), run_patch_reader(), and Nv2LabelReader::sendPatch(). |
|
|
Default tcp port number for the patch reader.
Definition at line 178 of file nv2_common.h. Referenced by main(). |
|
|
Print a warning message to stderr.
Definition at line 158 of file nv2_common.h. Referenced by nv2_label_reader_send_patch_sync(), nv2_label_server_send_label(), run_label_reader(), run_patch_reader(), and run_patch_sender(). |
|
|
Different pixel types that can be stored in an nv2_image_patch.
Definition at line 51 of file nv2_common.h. |
|
||||||||||||||||||||
|
Helper for nv2_fatal.
Definition at line 113 of file nv2_common.c. |
|
|
Free the data array associated with p, and reinitialize to an empty state.
Definition at line 77 of file nv2_common.c. References nv2_image_patch::data, and nv2_image_patch_init_empty(). Referenced by main(), nv2_label_reader_destroy(), nv2_label_reader_send_patch(), nv2_label_reader_send_patch_sync(), nv2_label_server_destroy(), run_patch_reader(), and run_patch_sender(). |
|
|
Initialize with the current protocol version, and zeros elsewhere. This function does NOT free any data associated with p->data; it is up to the caller to do that (if necessary) before calling this function. Definition at line 64 of file nv2_common.c. References nv2_image_patch::data, nv2_image_patch::height, nv2_image_patch::id, nv2_image_patch::is_training_image, NV2_PATCH_PROTOCOL_VERSION, nv2_image_patch::protocol_version, nv2_image_patch::remote_command, nv2_image_patch::training_label, nv2_image_patch::type, and nv2_image_patch::width. Referenced by nv2_image_patch_destroy(), nv2_label_reader_create(), nv2_label_reader_send_patch(), nv2_label_reader_send_patch_sync(), nv2_label_server_create(), nv2_label_server_get_current_patch(), run_patch_reader(), and run_patch_sender(). |
|
||||||||||||
|
Copy a remote command into the image patch.
Definition at line 94 of file nv2_common.c. References nv2_image_patch::remote_command. Referenced by Nv2LabelReader::sendPatch(). |
|
||||||||||||
|
Copy a training label into the image patch.
Definition at line 85 of file nv2_common.c. References nv2_image_patch::training_label. Referenced by Nv2LabelReader::sendPatch(). |
|
|
Initialize with the current protocol version, and zeros elsewhere.
Definition at line 103 of file nv2_common.c. References nv2_patch_label::confidence, nv2_patch_label::extra_info, nv2_patch_label::name, NV2_LABEL_PROTOCOL_VERSION, nv2_patch_label::patch_id, nv2_patch_label::protocol_version, and nv2_patch_label::source. Referenced by nv2_label_reader_create(), and nv2_label_reader_get_current_label(). |
|
|
Get the number of bytes used per pixel of a given type.
Definition at line 49 of file nv2_common.c. References nv2_fatal. Referenced by nv2_label_reader_send_patch_sync(), and run_patch_reader(). |
|
||||||||||||||||||||
|
Keep doing read() calls until either all the bytes are read or an error occurs. Returns the number of bytes read; if this number is less than the number of requested bytes (nbytes), then it means that some error occurred
Definition at line 170 of file nv2_common.c. References n. Referenced by run_label_reader(), and run_patch_reader(). |
|
||||||||||||||||
|
Keep doing write() calls until either all the bytes are written or an error occurs. Returns the number of bytes written; if this number is less than the number of requested bytes (nbytes), then it means that some error occurred Definition at line 136 of file nv2_common.c. References n. Referenced by nv2_label_reader_send_patch_sync(), and nv2_label_server_send_label(). |
|
||||||||||||||||||||
|
Helper for nv2_warn.
Definition at line 125 of file nv2_common.c. |
1.4.4