Size
VideoEncodeCallBack
功能
用于定义视频编码输入的回调函数。
请勿在回调函数内实现过于复杂的操作,而是单纯用用户自定义“userData”来接收视频编码回调结果,否则回调线程会发生卡住的现象,导致视频编码速度变慢。
结构定义
typedef APP_ERROR (*VideoEncodeCallBack)(std::shared_ptr<uint8_t>& outDataPtr, uint32_t& outDataSize,
uint32_t& channelId, uint32_t& frameId, void* userData);
参数说明
| 参数名 | 说明 |
|---|---|
| outDataPtr | 编码后输出视频帧数据的内存地址。 |
| outDataSize | 编码后输出视频帧数据的内存大小。 |
| channelId | 视频流索引,由VideoEncoder类的构造函数来设置。 |
| frameId | 视频帧索引,由VideoEncoder类的Encode函数来设置。 |
| userData | 用户自定义回调输入的数据类型(主要用来获取编码数据)。 |
父主题: 通用数据结构
Rect
功能
矩形框结构体(抠图贴图),用来保存一个矩形框的左上角坐标和右下角坐标(图像的左上角坐标和右下角坐标)。
结构定义
struct Rect {
Rect()
: x0(0), y0(0), x1(0), y1(0) {};
Rect(const uint32_t leftTopX, const uint32_t leftTopY,
const uint32_t rightBottomX, const uint32_t rightBottomY)
: x0(leftTopX), y0(leftTopY), x1(rightBottomX), y1(rightBottomY) {};
Rect(const Point leftTop, const Point rightBottom)
: x0(leftTop.x), y0(leftTop.y), x1(rightBottom.x), y1(rightBottom.y) {};
uint32_t x0 = 0;
uint32_t y0 = 0;
uint32_t x1 = 0;
uint32_t y1 = 0;
};
参数说明
| 参数名 | 说明 |
|---|---|
| x0,leftTopX | 矩形框左上角坐标的横坐标(以图像左上角为原点)。 |
| y0,leftTopY | 矩形框左上角坐标的纵坐标(以图像左上角为原点)。 |
| x1,rightBottomX | 矩形框右下角坐标的横坐标(以图像左上角为原点)。 |
| y1,rightBottomY | 矩形框右下角坐标的纵坐标(以图像左上角为原点)。 |
| leftTop | 矩形框左上角坐标点(Point 结构体)。 |
| rightBottom | 矩形框右下角坐标点(Point 结构体)。 |
父主题: 通用数据结构
Size
功能
图像大小结构体(缩放),用来保存一个图像的高和宽。
结构定义
struct Size {
Size()
: width(0), height(0) {};
Size(const uint32_t inputWidth, const uint32_t inputHeight)
: width(inputWidth), height(inputHeight) {};
uint32_t width = 0;
uint32_t height = 0;
};
参数说明
| 参数名 | 说明 |
|---|---|
| width,inputWidth | 图像宽。 |
| height,inputHeight | 图像高。 |
父主题: 通用数据结构
Point
功能
坐标点,用于保存图像像素点位置的结构体。
结构定义
struct Point {
Point()
: x(0), y(0) {};
Point(const uint32_t inputX, const uint32_t inputY)
: x(inputX), y(inputY) {};
uint32_t x = 0;
uint32_t y = 0;
};
参数说明
| 参数名 | 说明 |
|---|---|
| x,inputX | 横坐标(以图像左上角为原点)。 |
| y,inputY | 纵坐标(以图像左上角为原点)。 |
父主题: 通用数据结构
Color
功能
色彩值,用于图像处理补边功能,描述三通道色彩的结构体。
结构定义
struct Color {
Color()
: channel_zero(0), channel_one(0), channel_two(0) {};
Color(const uint32_t inputRed, const uint32_t inputGreen, const uint32_t inputBlue)
: channel_zero(inputRed), channel_one(inputGreen), channel_two(inputBlue) {};
uint32_t channel_zero;
uint32_t channel_one;
uint32_t channel_two;
};
参数说明
| 参数名 | 说明 |
|---|---|
| channel_zero,inputRed | 0号通道取值,范围[0, 255]。 例如:对于RGB_888格式图像,该通道为R;对于YUV格式图像,该通道为Y。 |
| channel_one,inputGreen | 1号通道取值,范围[0, 255]。 例如:对于RGB_888格式图像,该通道为G;对于YUV格式图像,该通道为U。 |
| channel_two,inputBlue | 2号通道取值,范围[0, 255]。 例如:对于RGB_888格式图像,该通道为B;对于YUV格式图像,该通道为V。 |
父主题: 通用数据结构
Dim
功能
补边值,用于图像处理“ImageProcessor”的补边功能,描述左、右、上、下四个方向补边的像素个数。
结构定义
struct Dim {
Dim()
: left(0), right(0), top(0), bottom(0) {};
Dim(const uint32_t inputDim)
: left(inputDim), right(inputDim), top(inputDim), bottom(inputDim) {};
Dim(const uint32_t inputLeft, const uint32_t inputRight, const uint32_t inputTop, const uint32_t inputBottom)
: left(inputLeft), right(inputRight), top(inputTop), bottom(inputBottom) {};
uint32_t left;
uint32_t right;
uint32_t top;
uint32_t bottom;
};
参数说明
| 参数名 | 说明 |
|---|---|
| left,inputLeft | 左侧补边像素数量。 |
| right,inputRight | 右侧补边像素数量。 |
| top,inputTop | 上方补边像素数量。 |
| bottom,inputBottom | 下方补边像素数量。 |
| inputDim | 左、右、上、下补边像素数量。 仅在使用**Dim(const uint32_t inputDim)**构造函数时,将左、右、上、下补边像素数量设为与inputDim相同的值。 |
父主题: 通用数据结构
在线提单