我通过以下方式接收NV21格式的预览数据:
public void onPreviewFrame(byte[] data, Camera camera)我想通过data将I420格式转换为利比夫格式。NV21ToI420或ConvertToI420 in include/libyuv/convert.h似乎是我所需要的。
// Convert NV21 to I420.
LIBYUV_API
int NV21ToI420(const uint8* src_y, int src_stride_y,
const uint8* src_vu, int src_stride_vu,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height);
// Convert camera sample to I420 with cropping, rotation and vertical flip.
LIBYUV_API
int ConvertToI420(const uint8* src_frame, size_t src_size,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int crop_x, int crop_y,
int src_width, int src_height,
int dst_width, int dst_height,
enum RotationMode rotation,
uint32 format);有什么例子可以做到吗?
发布于 2015-10-06 08:10:56
最后,我找到了一个演示:
https://github.com/zenith22/libyuvDemo.git
希望能帮上忙!
更新:
我增加了一个项目:
https://github.com/jpxiong/NV21CameraPreviewToI420Demo.git
更多细节,请阅读README.md
https://stackoverflow.com/questions/32963581
复制相似问题