Jetson Linux API Reference

32.7.4 Release

Detailed Description

Utility functions for reading video frames from a file to the buffer structure and for writing from the buffer structure to a file.

Functions

int read_video_frame (std::ifstream *stream, NvBuffer &buffer)
 Reads a video frame from a file to the buffer structure. More...
 
int write_video_frame (std::ofstream *stream, NvBuffer &buffer)
 Writes a video frame from the buffer structure to a file. More...
 
int read_dmabuf (int dmabuf_fd, unsigned int plane, std::ifstream *stream)
 Reads a plane of data from a file to the buffer. More...
 
int dump_dmabuf (int dmabuf_fd, unsigned int plane, std::ofstream *stream)
 Writes a plane of data from the buffer to a file. More...
 
int parse_csv_recon_file (std::ifstream *stream, std::string *recon_params)
 Parses the reference recon file to write the Y, U and V checksums. More...
 

Function Documentation

◆ dump_dmabuf()

int dump_dmabuf ( int  dmabuf_fd,
unsigned int  plane,
std::ofstream *  stream 
)

Writes a plane of data from the buffer to a file.

Parameters
[in]dmabuf_fdThe DMABUF file descriptor of the buffer.
[in]planeIndex of the video frame plane.
[in]streamA pointer to the output file stream.
Returns
0 if successful, or -1 otherwise.

◆ parse_csv_recon_file()

int parse_csv_recon_file ( std::ifstream *  stream,
std::string *  recon_params 
)

Parses the reference recon file to write the Y, U and V checksums.

This function parses Y, U and V checksums from the reference recon file.

Parameters
[in]streamA pointer to the input recon file stream.
[in]recon_paramsA pointer to an array in which to store the parsed Y, U and V strings.
Returns
0 for success, -1 otherwise.

◆ read_dmabuf()

int read_dmabuf ( int  dmabuf_fd,
unsigned int  plane,
std::ifstream *  stream 
)

Reads a plane of data from a file to the buffer.

Parameters
[in]dmabuf_fdThe DMABUF file descriptor of the buffer.
[in]planeIndex of the video frame plane.
[in]streamA pointer to the intput file stream.
Returns
0 if successful, or -1 otherwise.

◆ read_video_frame()

int read_video_frame ( std::ifstream *  stream,
NvBuffer buffer 
)

Reads a video frame from a file to the buffer structure.

This function reads data from the file into the buffer, one data plane at a time. For each data plane, the number of bytes read is:

stride * height

or

width * height * bytes_per_pixel
Parameters
[in]streamA pointer to the input file stream.
[in]bufferA reference to the buffer object into which data is read.
Returns
0 if successful, or -1 otherwise.

◆ write_video_frame()

int write_video_frame ( std::ofstream *  stream,
NvBuffer buffer 
)

Writes a video frame from the buffer structure to a file.

This function writes data to the file from the buffer, one plane at a time. For each data plane, the number of bytes written is:

stride * height

or

width * height * bytes_per_pixel
Parameters
[in]streamA pointer to the output file stream.
[in]bufferA reference to the buffer object from which data is written.
Returns
0 if successful, or -1 otherwise.