mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 12:45:35 +08:00
1.Use libyuv instead of ffmpeg to do nv12<->yuv420p convertion;2.Use local package to build libyuv(branch stable 2021.4.28 commit eb6e7bb63738e29efd82ea3cf2a115238a89fa51)
This commit is contained in:
28
thirdparty/libyuv/util/i444tonv12_eg.cc
vendored
Normal file
28
thirdparty/libyuv/util/i444tonv12_eg.cc
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#include "libyuv/convert.h"
|
||||
|
||||
#include <stdio.h> // for printf
|
||||
#include <string.h> // for memset
|
||||
|
||||
int main(int, char**) {
|
||||
unsigned char src_i444[640 * 400 * 3];
|
||||
unsigned char dst_nv12[640 * 400 * 3 / 2];
|
||||
|
||||
for (size_t i = 0; i < sizeof(src_i444); ++i) {
|
||||
src_i444[i] = i & 255;
|
||||
}
|
||||
memset(dst_nv12, 0, sizeof(dst_nv12));
|
||||
libyuv::I444ToNV12(&src_i444[0], 640, // source Y
|
||||
&src_i444[640 * 400], 640, // source U
|
||||
&src_i444[640 * 400 * 2], 640, // source V
|
||||
&dst_nv12[0], 640, // dest Y
|
||||
&dst_nv12[640 * 400], 640, // dest UV
|
||||
640, 400); // width and height
|
||||
|
||||
int checksum = 0;
|
||||
for (size_t i = 0; i < sizeof(dst_nv12); ++i) {
|
||||
checksum += dst_nv12[i];
|
||||
}
|
||||
printf("checksum %x %s\n", checksum, checksum == 0x2ec0c00 ? "PASS" : "FAIL");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user