华为海思3559A上编译libyuv源码操作步骤

简星 2020-07-27 16:05:14 3563

1. 下载libyuv源代码,执行:

git clone https://chromium.googlesource.com/libyuv/libyuv
  • 1

2. 通过CMakeLists.txt编译生成库,build.sh脚本内容如下:

cmake \ 
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_C_COMPILER=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc \
-DCMAKE_CXX_COMPILER=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++ \
-DCMAKE_INSTALL_PREFIX=./install \
..
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

3. 在libyuv根目录下,依次执行如下命令,执行完后会将生成的文件和库存放在build/install目录下,如下图所示:

mkdir build
cd build
cp ../build.sh .
./builld.sh
make -j8
make install
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

*4. 也可以通过.mk生成,拷贝原linux.mk为hi3559a.mk并修改hi3559a.mk内容,修改后的内容如下:**

# This is a generic makefile for libyuv for gcc.
# make -f linux.mk CXX=clang++ 

CC=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc
CFLAGS?=-O2 -fomit-frame-pointer -fPIC -DLIBYUV_NEON
CFLAGS+=-Iinclude/ 

CXX=/opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-g++
CXXFLAGS?=-O2 -fomit-frame-pointer -fPIC -DLIBYUV_NEON
CXXFLAGS+=-Iinclude/ 

LOCAL_OBJ_FILES := \
source/compare.o           \
source/compare_common.o    \
source/compare_gcc.o       \
source/compare_mmi.o       \
source/compare_msa.o       \
source/compare_neon64.o    \
source/compare_neon.o      \
source/compare_win.o       \
source/convert_argb.o      \
source/convert.o           \
source/convert_from_argb.o \
source/convert_from.o      \
source/convert_jpeg.o      \
source/convert_to_argb.o   \
source/convert_to_i420.o   \
source/cpu_id.o            \
source/mjpeg_decoder.o     \
source/mjpeg_validate.o    \
source/planar_functions.o  \
source/rotate_any.o        \
source/rotate_argb.o       \
source/rotate.o            \
source/rotate_common.o     \
source/rotate_gcc.o        \
source/rotate_mmi.o        \
source/rotate_msa.o        \
source/rotate_neon64.o     \
source/rotate_neon.o       \
source/rotate_win.o        \
source/row_any.o           \
source/row_common.o        \
source/row_gcc.o           \
source/row_mmi.o           \
source/row_msa.o           \
source/row_neon64.o        \
source/row_neon.o          \
source/row_win.o           \
source/scale_any.o         \
source/scale_argb.o        \
source/scale.o             \
source/scale_common.o      \
source/scale_gcc.o         \
source/scale_mmi.o         \
source/scale_msa.o         \
source/scale_neon64.o      \
source/scale_neon.o        \
source/scale_win.o         \
source/video_common.o 

.cc.o:
$(CXX) -c $(CXXFLAGS) $*.cc -o $*.o 

.c.o:
$(CC) -c $(CFLAGS) $*.c -o $*.o

all: libyuv.a yuvconvert cpuid psnr 

libyuv.a: $(LOCAL_OBJ_FILES)
$(AR) $(ARFLAGS) $@ $(LOCAL_OBJ_FILES) 

# A C++ test utility that uses libyuv conversion.
yuvconvert: util/yuvconvert.cc libyuv.a
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/yuvconvert.cc libyuv.a 

# A standalone test utility
psnr: util/psnr.cc
$(CXX) $(CXXFLAGS) -Iutil/ -o $@ util/psnr.cc util/psnr_main.cc util/ssim.cc 

# 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
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
<

5. 执行以下命令后同样可以生成libyuv.a静态库:

make -f hi3559a.mk
  • 1

注:如果需要在libyuv中调用mjpegtoyuv相关的接口还需要依赖libjpeg库,并且需要在脚本中定义HAVE_JPEG。

原文链接:https://blog.csdn.net/fengbingchun/article/details/96576996

声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
简星
红包 点赞 收藏 评论 打赏
评论
0个
内容存在敏感词
手气红包
    易百纳技术社区暂无数据
相关专栏
置顶时间设置
结束时间
删除原因
  • 广告/SPAM
  • 恶意灌水
  • 违规内容
  • 文不对题
  • 重复发帖
打赏作者
易百纳技术社区
简星
您的支持将鼓励我继续创作!
打赏金额:
¥1易百纳技术社区
¥5易百纳技术社区
¥10易百纳技术社区
¥50易百纳技术社区
¥100易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
拼手气红包 红包规则
祝福语
恭喜发财,大吉大利!
红包金额
红包最小金额不能低于5元
红包数量
红包数量范围10~50个
余额支付
当前余额:
可前往问答、专栏板块获取收益 去获取
取 消 确 定

小包子的红包

恭喜发财,大吉大利

已领取20/40,共1.6元 红包规则

    易百纳技术社区