mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 08:46:47 +08:00
i444tonv12_eg example program
Bug: libyuv:858 Change-Id: I1b970f57a6ff6288afc8f60b2244e51bf6d30e78 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2169341 Reviewed-by: richard winterton <rrwinterton@gmail.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
bed9292f2c
commit
eed202f1f3
@ -105,6 +105,15 @@ cc_test {
|
||||
static_libs: ["libyuv"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "i444tonv12_eg",
|
||||
gtest: false,
|
||||
srcs: [
|
||||
"util/i444tonv12_eg.cc",
|
||||
],
|
||||
static_libs: ["libyuv"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "cpuid",
|
||||
gtest: false,
|
||||
|
||||
20
Android.mk
20
Android.mk
@ -11,41 +11,45 @@ LOCAL_SRC_FILES := \
|
||||
source/compare_gcc.cc \
|
||||
source/compare_mmi.cc \
|
||||
source/compare_msa.cc \
|
||||
source/compare_neon.cc \
|
||||
source/compare_neon64.cc \
|
||||
source/convert.cc \
|
||||
source/compare_neon.cc \
|
||||
source/compare_win.cc \
|
||||
source/convert_argb.cc \
|
||||
source/convert_from.cc \
|
||||
source/convert.cc \
|
||||
source/convert_from_argb.cc \
|
||||
source/convert_from.cc \
|
||||
source/convert_to_argb.cc \
|
||||
source/convert_to_i420.cc \
|
||||
source/cpu_id.cc \
|
||||
source/planar_functions.cc \
|
||||
source/rotate.cc \
|
||||
source/rotate_any.cc \
|
||||
source/rotate_argb.cc \
|
||||
source/rotate.cc \
|
||||
source/rotate_common.cc \
|
||||
source/rotate_gcc.cc \
|
||||
source/rotate_mmi.cc \
|
||||
source/rotate_msa.cc \
|
||||
source/rotate_neon.cc \
|
||||
source/rotate_neon64.cc \
|
||||
source/rotate_neon.cc \
|
||||
source/rotate_win.cc \
|
||||
source/row_any.cc \
|
||||
source/row_common.cc \
|
||||
source/row_gcc.cc \
|
||||
source/row_mmi.cc \
|
||||
source/row_msa.cc \
|
||||
source/row_neon.cc \
|
||||
source/row_neon64.cc \
|
||||
source/scale.cc \
|
||||
source/row_neon.cc \
|
||||
source/row_win.cc \
|
||||
source/scale_any.cc \
|
||||
source/scale_argb.cc \
|
||||
source/scale.cc \
|
||||
source/scale_common.cc \
|
||||
source/scale_gcc.cc \
|
||||
source/scale_mmi.cc \
|
||||
source/scale_msa.cc \
|
||||
source/scale_neon.cc \
|
||||
source/scale_neon64.cc \
|
||||
source/scale_neon.cc \
|
||||
source/scale_win.cc \
|
||||
source/video_common.cc
|
||||
|
||||
common_CFLAGS := -Wall -fexceptions
|
||||
|
||||
11
BUILD.gn
11
BUILD.gn
@ -39,6 +39,7 @@ group("default") {
|
||||
deps += [
|
||||
":compare",
|
||||
":cpuid",
|
||||
":i444tonv12_eg",
|
||||
":libyuv_unittest",
|
||||
":psnr",
|
||||
":yuvconvert",
|
||||
@ -389,6 +390,16 @@ if (libyuv_include_tests) {
|
||||
}
|
||||
}
|
||||
|
||||
executable("i444tonv12_eg") {
|
||||
sources = [
|
||||
# sources
|
||||
"util/i444tonv12_eg.cc",
|
||||
]
|
||||
deps = [
|
||||
":libyuv",
|
||||
]
|
||||
}
|
||||
|
||||
executable("cpuid") {
|
||||
sources = [
|
||||
# sources
|
||||
|
||||
8
linux.mk
8
linux.mk
@ -65,7 +65,7 @@ LOCAL_OBJ_FILES := \
|
||||
.c.o:
|
||||
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
||||
|
||||
all: libyuv.a yuvconvert cpuid psnr
|
||||
all: libyuv.a i444tonv12_eg yuvconvert cpuid psnr
|
||||
|
||||
libyuv.a: $(LOCAL_OBJ_FILES)
|
||||
$(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES)
|
||||
@ -78,6 +78,10 @@ yuvconvert: util/yuvconvert.cc libyuv.a
|
||||
psnr: util/psnr.cc
|
||||
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/psnr.cc util/psnr_main.cc util/ssim.cc
|
||||
|
||||
# A simple conversion example.
|
||||
i444tonv12_eg: util/i444tonv12_eg.cc libyuv.a
|
||||
$(CC) $(CFLAGS) -o $@ util/i444tonv12_eg.cc libyuv.a
|
||||
|
||||
# A C test utility that uses libyuv conversion from C.
|
||||
# gcc 4.4 and older require -fno-exceptions to avoid link error on __gxx_personality_v0
|
||||
# CC=gcc-4.4 CXXFLAGS=-fno-exceptions CXX=g++-4.4 make -f linux.mk
|
||||
@ -85,4 +89,4 @@ cpuid: util/cpuid.c libyuv.a
|
||||
$(CC) $(CFLAGS) -o $@ util/cpuid.c libyuv.a
|
||||
|
||||
clean:
|
||||
/bin/rm -f source/*.o *.ii *.s libyuv.a yuvconvert cpuid psnr
|
||||
/bin/rm -f source/*.o *.ii *.s libyuv.a i444tonv12_eg yuvconvert cpuid psnr
|
||||
|
||||
28
util/i444tonv12_eg.cc
Normal file
28
util/i444tonv12_eg.cc
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;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user