目录
c++ RGBToNV21:
void RGBToNV21(const uint8_t* rgbdata, int width, int height,
uint8_t* yuvdata) {
// 计算对齐后的行字节数
int src_stride_rgb = width * 4; // 每个像素4字节 (ARGB)
int dst_stride_y = width;
int dst_stride_uv = width;
// 转换RGB到NV21
libyuv::ARGBToNV21(rgbdata,src_stride_rgb,yuvdata,dst_stride_y,yuvdata + width * height, dst_stride_uv,width, height);
}
Android c++ 调用:
#include <chrono>
int width = rgb.cols;
int height = rgb.rows;
auto start = std::chrono::high_r

这篇博客介绍了如何使用C++的libyuv库进行RGB到NV21的视频帧转换。作者分享了在Android环境下调用C++代码的方法,以及1920*1080大图转换的性能测试,平均耗时6毫秒。还提供了libyuv在Windows上的预编译动态库下载链接,并指导了如何添加库引用及设置ABI为arm64-v8a。
订阅专栏 解锁全文
1226

被折叠的 条评论
为什么被折叠?



