1,Camera nv12格式数据实现镜像旋转
该操作即实现图像的左右翻转
步骤:
1.1根据width和height来计算stride跨距,和内存空间大小。
1.2NV12格式转换成I420格式,即分离出u和v plane。
1.3将I420格式数据镜像旋转。
1.4镜像旋转后,在转换格式为NV12即可。
代码示例
void HdmiRxStreamBuffer::LibyuvMirror_NV12(int buffer_width, int buffer_height, char* src_y_frame, char* src_uv_frame){
//y stride
int plane1_stride = buffer_width;
//uv stride
int plane2_stride = buffer_width;
//y height
int plane1_height = buffer_height;
//uv height
int plane2_height = buffer_height / 2;
//y_size
int32_t plane1_size = plane1_stride * plane1_height;
//uv_size
int32_t plane2_size = plane2_stride * plane2_height;
//yuv_size(内存空间)
int32_t frame_size = plane1_size + plane2_size;
// 1.NV12转换为I420
// 开辟buffer_frame大小的内存空间用于存放转换好的i420数据
uint8_t* buffer_y = (unsigned char *)malloc(frame_