upipe/ubuf_pic_common.h header reference
Upipe useful common definitions for picture managers More
Header inclusion
Members
Types
- struct ubuf_pic_common
- struct ubuf_pic_common_mgr
- struct ubuf_pic_common_mgr_plane
- struct ubuf_pic_common_plane
Functions
- int ubuf_pic_common_check_size(struct ubuf_mgr *mgr, int hsize, int vsize)
- int ubuf_pic_common_check_skip(struct ubuf_mgr *mgr, int hskip, int vskip)
- void ubuf_pic_common_clean(struct ubuf *ubuf)
- int ubuf_pic_common_dup(struct ubuf *ubuf, struct ubuf *new_ubuf)
- void ubuf_pic_common_init(struct ubuf *ubuf, size_t hmprepend, size_t hmappend, size_t hmsize, size_t vprepend, size_t vappend, size_t vsize)
- int ubuf_pic_common_mgr_add_plane(struct ubuf_mgr *mgr, const char *chroma, uint8_t hsub, uint8_t vsub, uint8_t macropixel_size)
- void ubuf_pic_common_mgr_clean(struct ubuf_mgr *mgr)
- void ubuf_pic_common_mgr_init(struct ubuf_mgr *mgr, uint8_t macropixel)
- void ubuf_pic_common_plane_clean(struct ubuf *ubuf, uint8_t plane)
- int ubuf_pic_common_plane_dup(struct ubuf *ubuf, struct ubuf *new_ubuf, uint8_t plane)
- void ubuf_pic_common_plane_init(struct ubuf *ubuf, uint8_t plane, uint8_t *buffer, size_t stride)
- int ubuf_pic_common_plane_iterate(struct ubuf *ubuf, const char **chroma_p)
- int ubuf_pic_common_plane_map(struct ubuf *ubuf, const char *chroma, int hoffset, int voffset, int hsize, int vsize, uint8_t **buffer_p)
- int ubuf_pic_common_plane_size(struct ubuf *ubuf, const char *chroma, size_t *stride_p, uint8_t *hsub_p, uint8_t *vsub_p, uint8_t *macropixel_size_p)
- int ubuf_pic_common_resize(struct ubuf *ubuf, int hskip, int vskip, int new_hsize, int new_vsize)
- int ubuf_pic_common_size(struct ubuf *ubuf, size_t *hsize_p, size_t *vsize_p, uint8_t *macropixel_p)
- size_t ubuf_pic_common_sizeof(struct ubuf_mgr *mgr)
Description
Upipe useful common definitions for picture managers
Members detail
This macro is declared in upipe/ubuf_pic_common.h source file, line 31.
This struct is declared in upipe/ubuf_pic_common.h source file, line 59.
This struct is a proposed common section of picture ubuf, allowing to window data. In an opaque area you would typically store a pointer to shared buffer space.
Since it features a flexible array member, it must be placed at the end of another structure.
Field | Description |
---|---|
size_t hmprepend; | extra macropixels added before lines |
size_t hmappend; | extra macropixels added after lines |
size_t hmsize; | requested horizontal number of macropixels |
size_t vprepend; | extra lines added before buffer |
size_t vappend; | extra lines added after buffer |
size_t vsize; | requested vertical number of lines |
struct ubuf ubuf; | common structure |
struct ubuf_pic_common_plane planes[]; | planes buffers |
This function is declared in upipe/ubuf_pic_common.h source file, line 210.
This function checks whether the requested picture size can be allocated with the manager.
Parameter list:
- mgr: common management structure
- hsize: horizontal size in pixels
- vsize: vertical size in lines
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 310.
This function checks whether the requested picture resize can be performed with this manager.
Parameter list:
- mgr: common management structure
- hskip: number of pixels to skip at the beginning of each line (if < 0, extend the picture leftwards)
- vskip: number of lines to skip at the beginning of the picture (if < 0, extend the picture upwards)
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 173.
This function cleans up the common fields of a picture ubuf (currently no-op).
Parameter list:
- ubuf: pointer to ubuf
This function is declared in upipe/ubuf_pic_common.h source file, line 218.
This function duplicates the content of the common structure for picture ubuf.
Parameter list:
- ubuf: pointer to ubuf
- new_ubuf: pointer to ubuf to overwrite
The return value is an error code
void ubuf_pic_common_init(struct ubuf *ubuf, size_t hmprepend, size_t hmappend, size_t hmsize, size_t vprepend, size_t vappend, size_t vsize)
This function is declared in upipe/ubuf_pic_common.h source file, line 157.
This function initializes the common fields of a picture ubuf.
Parameter list:
- ubuf: pointer to ubuf
- hmprepend: extra macropixels added before each line
- hmappend: extra macropixels added after each line
- hmsize: number of macropixels in a line, excluding hmprepend and hmappend
- vprepend: extra lines added before the first line
- vappend: extra lines added after the first line
- vsize: number of lines, excluding vprepend and vappend
This struct is declared in upipe/ubuf_pic_common.h source file, line 95.
This struct is a super-set of the ubuf_mgr structure with additional local members, common to picture managers.
Field | Description |
---|---|
uint8_t macropixel; | number of pixels in a macropixel |
uint8_t nb_planes; | number of planes to allocate |
struct ubuf_pic_common_mgr_plane ** planes; | planes description |
struct ubuf_mgr mgr; | common management structure |
int ubuf_pic_common_mgr_add_plane(struct ubuf_mgr *mgr, const char *chroma, uint8_t hsub, uint8_t vsub, uint8_t macropixel_size)
This function is declared in upipe/ubuf_pic_common.h source file, line 354.
This function adds a new plane to a ubuf manager for picture formats.
Parameter list:
- mgr: pointer to a ubuf_mgr structure contained in a ubuf_pic_common_mgr
- chroma: chroma type (see chroma reference)
- hsub: horizontal subsamping
- vsub: vertical subsamping
- macropixel_size: size of a macropixel in octets
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 334.
This function frees memory allocated by ubuf_pic_common_mgr_init and ubuf_pic_common_mgr_add_plane.
Parameter list:
- mgr: pointer to a ubuf_mgr structure contained in a ubuf_pic_common_mgr
This function is declared in upipe/ubuf_pic_common.h source file, line 341.
This function allocates a new instance of the ubuf manager for picture formats.
Parameter list:
- mgr: pointer to a ubuf_mgr structure contained in a ubuf_pic_common_mgr
- macropixel: number of pixels in a macropixel (typically 1)
This struct is declared in upipe/ubuf_pic_common.h source file, line 82.
This struct is a sub-structure of struct ubuf_pic_common_mgr, describing the allocation of individual planes.
Field | Description |
---|---|
char * chroma; | chroma type |
uint8_t hsub; | horizontal subsampling |
uint8_t vsub; | vertical subsampling |
uint8_t macropixel_size; | macropixel size |
This struct is declared in upipe/ubuf_pic_common.h source file, line 46.
This struct is a sub-structure of struct ubuf_pic_common, pointing to the buffer space of individual planes. It is only needed to allocate and init it if you plan to use ubuf_pic_common_plane_map.
This function is declared in upipe/ubuf_pic_common.h source file, line 199.
This function cleans up a plane sub-structure of a picture ubuf (currently no-op).
Parameter list:
- ubuf: pointer to ubuf
- plane: index of the plane
This function is declared in upipe/ubuf_pic_common.h source file, line 230.
This function duplicates the content of the plane sub-structure for picture ubuf. It is only necessary to call this function if you plan to use ubuf_pic_common_plane_map.
Parameter list:
- ubuf: pointer to ubuf
- new_ubuf: pointer to ubuf to overwrite
- plane: index of the plane
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 187.
This function initializes a plane sub-structure of a picture ubuf. It is only necessary to call this function if you plan to use ubuf_pic_common_plane_map.
Parameter list:
- ubuf: pointer to ubuf
- plane: index of the plane
- buffer: pointer to memory buffer (in front of vprepend and hmprepend)
- stride: line stride
This function is declared in upipe/ubuf_pic_common.h source file, line 255.
This function iterates on picture planes chroma types. Start by initializing *chroma_p to NULL. If *chroma_p is NULL after running this function, there are no more planes in this picture. Otherwise the string pointed to by *chroma_p remains valid until the ubuf picture manager is deallocated.
Parameter list:
- ubuf: pointer to ubuf
- chroma_p: reference written with chroma type of the next plane
The return value is an error code
int ubuf_pic_common_plane_map(struct ubuf *ubuf, const char *chroma, int hoffset, int voffset, int hsize, int vsize, uint8_t **buffer_p)
This function is declared in upipe/ubuf_pic_common.h source file, line 298.
This function returns a pointer to the buffer space of a plane.
To use this function, struct ubuf_pic_common_plane must be allocated and correctly filled in.
Parameter list:
- ubuf: pointer to ubuf
- chroma: chroma type (see chroma reference)
- hoffset: horizontal offset of the picture area wanted in the whole picture, negative values start from the end of lines, in pixels (before dividing by macropixel and hsub)
- voffset: vertical offset of the picture area wanted in the whole picture, negative values start from the last line, in lines (before dividing by vsub)
- hsize: number of pixels wanted per line, or -1 for until the end of the line
- vsize: number of lines wanted in the picture area, or -1 for until the last line
- buffer_p: reference written with a pointer to buffer space if not NULL
The return value is an error code
int ubuf_pic_common_plane_size(struct ubuf *ubuf, const char *chroma, size_t *stride_p, uint8_t *hsub_p, uint8_t *vsub_p, uint8_t *macropixel_size_p)
This function is declared in upipe/ubuf_pic_common.h source file, line 274.
This function returns the sizes of a plane of the picture ubuf.
Parameter list:
- ubuf: pointer to ubuf
- chroma: chroma type (see chroma reference)
- stride_p: reference written with the offset between lines, in octets, if not NULL
- hsub_p: reference written with the horizontal subsamping for this plane if not NULL
- vsub_p: reference written with the vertical subsamping for this plane if not NULL
- macropixel_size_p: reference written with the size of a macropixel in octets for this plane if not NULL
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 327.
This function resizes a picture ubuf, if the ubuf has enough space, and it is not shared.
Parameter list:
- ubuf: pointer to ubuf
- hskip: number of pixels to skip at the beginning of each line (if < 0, extend the picture leftwards)
- vskip: number of lines to skip at the beginning of the picture (if < 0, extend the picture upwards)
- new_hsize: final horizontal size of the buffer, in pixels (if set to -1, keep same line ends)
- new_vsize: final vertical size of the buffer, in lines (if set to -1, keep same last line)
The return value is an error code
int ubuf_pic_common_size(struct ubuf *ubuf, size_t *hsize_p, size_t *vsize_p, uint8_t *macropixel_p)
This function is declared in upipe/ubuf_pic_common.h source file, line 244.
This function returns the sizes of the picture ubuf.
Parameter list:
- ubuf: pointer to ubuf
- hsize_p: reference written with the horizontal size of the picture if not NULL
- vsize_p: reference written with the vertical size of the picture if not NULL
- macropixel_p: reference written with the number of pixels in a macropixel if not NULL
The return value is an error code
This function is declared in upipe/ubuf_pic_common.h source file, line 135.
This function returns the number of extra octets needed when allocating a picture ubuf. It is only necessary to allocate them if you plan to use ubuf_pic_common_plane_map.
Parameter list:
- mgr: description structure of the ubuf manager
The return value is number of extra octets needed
struct ubuf_pic_common * ubuf_pic_common_from_ubuf(struct ubuf *sub)
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/ubuf_pic_common.h source file, line 107.
This function returns a pointer to ubuf.
Parameter list:
- sub: pointer to struct ubuf
The return value is pointer to struct ubuf_pic_common
struct ubuf_pic_common_mgr * ubuf_pic_common_mgr_from_ubuf_mgr(struct ubuf_mgr *sub)
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/ubuf_pic_common.h source file, line 108.
This function returns a pointer to ubuf_mgr.
Parameter list:
- sub: pointer to struct ubuf_mgr
The return value is pointer to struct ubuf_pic_common_mgr
struct ubuf_mgr * ubuf_pic_common_mgr_to_ubuf_mgr(struct ubuf_pic_common_mgr *s)
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/ubuf_pic_common.h source file, line 108.
This function returns a pointer to ubuf_mgr.
Parameter list:
- ubuf_pic_common_mgr: pointer to struct ubuf_pic_common_mgr
The return value is pointer to struct ubuf_mgr
This function is for internal use only.
This function is declared in upipe/ubuf_pic_common.h source file, line 118.
This function returns the plane number corresponding to a chroma.
Parameter list:
- mgr: common management structure
- chroma: chroma type
The return value is number of the plane, or -1 if not found
struct ubuf * ubuf_pic_common_to_ubuf(struct ubuf_pic_common *s)
This function is for internal use only.
This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/ubuf_pic_common.h source file, line 107.
This function returns a pointer to ubuf.
Parameter list:
- ubuf_pic_common: pointer to struct ubuf_pic_common
The return value is pointer to struct ubuf