X265-Android
H.265的压缩率早有耳闻,我想在我们的项目中使用它,于是花了几个小时的时间来预言X265是否适合在Android上使用,结论是不适合,因为CPU占用率过高,帧率很低。于是在qcom上看了几款CPU目前都是支持硬解软编,但是我们目前对编码的需求大于解码,所以目前只能放弃H.265。
Linux测试
- 测试的CPU
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz
Stepping: 3
CPU MHz: 3593.250
CPU max MHz: 3600.0000
CPU min MHz: 800.0000
BogoMIPS: 6400.21
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
- ubuntu下安装X265
apt-get install x265
- 测试参数
这里采用ultrafast
模式、去B帧、码率4MB、分辨率1080P、帧率50(这个不会影响编码性能)
x265 -p ultrafast --bframes 0 --bitrate 4000 --input-res 1920x1080 --fps 50 i420_1920x1080_50.yuv -o out.h265
- 测试分析
- X265使用了X86汇编加速(using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2)
- 在i5-4570上的平均编码帧率也就才16.64 fps,要知道手机的H.264的硬编码可以轻松上60 fps。
- CPU占用率奇高,跑它以后啥都别干了。
yuv [info]: 1920x1080 fps 50000/1000 i420p8 frames 0 - 500 of 501
x265 [info]: HEVC encoder version 1.5
x265 [info]: build info [Linux][GCC 4.9.2][64 bit] 8bpp
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x265 [info]: Main profile, Level-4.1 (Main tier)
x265 [info]: WPP streams / frame threads / pool : 34 / 2 / 4
x265 [info]: CTU size / RQT depth inter / intra : 32 / 1 / 1
x265 [info]: ME / range / subpel / merge : dia / 25 / 0 / 2
x265 [info]: Keyframe min / max / scenecut : 25 / 250 / 0
x265 [info]: Lookahead / bframes / badapt : 10 / 0 / 0
x265 [info]: b-pyramid / weightp / weightb / refs: 0 / 0 / 0 / 1
x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-4000 kbps / 0.0 / 0
x265 [info]: tools: rd=2 psy-rd=0.30 early-skip deblock fast-intra tmvp
x265 [info]: frame I: 3, Avg QP:34.18 kb/s: 16426.80
x265 [info]: frame P: 498, Avg QP:34.74 kb/s: 3945.84
x265 [info]: global : 501, Avg QP:34.74 kb/s: 4020.58
x265 [info]: consecutive B-frames: 100.0% encoded 501 frames in 30.10s (16.64 fps), 4020.58 kb/s
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
12164 liu 20 0 764752 282116 4840 S 346.3 3.5 1:28.37 x265
Android测试
并没有死心,继续在Android上测试。测试的手机型号为:SM-G9009W,CPU为Qcom的8974。
- 8974的codec能力
所以为啥H.265目前普及不开是有原因的。
8974 Encoder capabilities______________________________________________________| Codec | W H fps Mbps MB/s ||__________|_________________________________________|| h264 | 3840 2160 30 100 972000 || | 4096 2160 24 100 829440 || mpeg4 | 1920 1088 30 40 244800 || vp8 | 1920 1088 30 20 244800 || h263 | 864 480 30 2 48600 ||__________|_________________________________________|8974 Decoder capabilities______________________________________________________| Codec | W H fps Mbps MB/s ||__________|_________________________________________|| h264 | 3840 2160 30 100 972000 || | 4096 2160 24 100 829440 || hevc | 1920 1088 30 6 244800 || mpeg4 | 1920 1088 60 60 489600 || vc1 | 1920 1088 60 60 489600 || vp8 | 3820 2160 30 20 972000 || divx3 | 720 480 30 2 40500 || div4/5/6 | 1920 1088 30 10 244800 || h263 | 864 480 30 2 48600 || mpeg2 | 1920 1088 30 40 244800 ||__________|_________________________________________|
- 测试的CPU
Processor : ARMv7 Processor rev 1 (v7l)
processor : 0
BogoMIPS : 38.40processor : 1
BogoMIPS : 38.40processor : 2
BogoMIPS : 38.40processor : 3
BogoMIPS : 38.40Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x2
CPU part : 0x06f
CPU revision : 1Hardware : Qualcomm MSM8974PRO-AC
Revision : 000a
Serial : 0000083000009994
- 测试参数
由于手机上本身就已经有一个832x480分辨的yuv文件,所以我就直接拿它进行测试,码率降为500KB,其他参数保持和linux一样
./x265 -p ultrafast --bframes 0 --bitrate 500 --input-res 832x480 --fps 30 832_480.i420 -o out.h265
测试分析
- 虽然
using cpu capabilities: none
不过确实使用了neon
加速的,为什么不显示neon
呢,因为仅仅支持x86的显示,请看x265_report_simd这个函数。 - 832x480的分辨率帧率既然才有9 fps
- CPU占用率奇高,跑它以后啥都别干了
- 虽然
mes 0 --bitrate 500 --input-res 832x480 --fps 30 832_480.i420 -o out.h265 <
yuv [info]: 832x480 fps 30000/1000 i420p8 frames 0 - 500 of 501
raw [info]: output file: out.h265
x265 [info]: HEVC encoder version X265_VERSION
x265 [info]: build info [Linux][GCC 4.9.0][32 bit][noasm] 8bit
x265 [info]: using cpu capabilities: none!
x265 [info]: Main profile, Level-3 (Main tier)
x265 [info]: Thread pool created using 4 threads
x265 [info]: frame threads / pool features : 2 / wpp(15 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size, min CU size : 32 / 16
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : dia / 57 / 0 / 2
x265 [info]: Keyframe min / max / scenecut : 25 / 250 / 0
x265 [info]: Lookahead / bframes / badapt : 5 / 0 / 0
x265 [info]: b-pyramid / weightp / weightb : 0 / 0 / 0
x265 [info]: References / ref-limit cu / depth : 1 / off / off
x265 [info]: AQ: mode / str / qg-size / cu-tree : 1 / 0.0 / 32 / 1
x265 [info]: Rate Control / qCompress : ABR-500 kbps / 0.60
x265 [info]: tools: rd=2 psy-rd=2.00 early-skip rskip tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing deblock
x265 [info]: frame I: 3, Avg QP:34.72 kb/s: 6350.88
x265 [info]: frame P: 498, Avg QP:37.60 kb/s: 491.82
x265 [info]: consecutive B-frames: 100.0% encoded 501 frames in 55.63s (9.01 fps), 526.91 kb/s, Avg QP:37.58
31580 2 96% S 8 67568K 40544K shell ./x265
Android上X265的编译
- 下载
hg clone https://bitbucket.org/multicoreware/x265
- Android.mk
LOCAL_PATH := $(call my-dir)#---------- static module ----------#COMMON_CPP_SRCS := \common/cpu.cpp \common/ipfilter.cpp \common/threadpool.cpp \common/param.cpp \common/picyuv.cpp \common/framedata.cpp \common/bitstream.cpp \common/pixel.cpp \common/predict.cpp \common/quant.cpp \common/constants.cpp \common/md5.cpp \common/dct.cpp \common/loopfilter.cpp \common/primitives.cpp \common/scalinglist.cpp \common/piclist.cpp \common/frame.cpp \common/slice.cpp \common/common.cpp \common/threading.cpp \common/lowres.cpp \common/intrapred.cpp \common/wavefront.cpp \common/winxp.cpp \common/shortyuv.cpp \common/yuv.cpp \common/deblock.cpp \common/cudata.cpp \common/version.cppCOMMON_ARM_SRCS := \common/arm/asm-primitives.cpp \common/arm/asm.S \common/arm/blockcopy8.S \common/arm/cpu-a.S \common/arm/dct-a.S \common/arm/ipfilter8.S \common/arm/mc-a.S \common/arm/pixel-util.S \common/arm/sad-a.S \common/arm/ssd-a.SCOMMON_X86_SRCS := \common/x86/blockcopy8.asm \common/x86/const-a.asm \common/x86/cpu-a.asm \common/x86/dct8.asm \common/x86/intrapred16.asm \common/x86/intrapred8_allangs.asm \common/x86/intrapred8.asm \common/x86/ipfilter16.asm \common/x86/ipfilter8.asm \common/x86/loopfilter.asm \common/x86/mc-a2.asm \common/x86/mc-a.asm \common/x86/pixel-32.asm \common/x86/pixel-a.asm \common/x86/pixeladd8.asm \common/x86/pixel-util8.asm \common/x86/sad16-a.asm \common/x86/sad-a.asm \common/x86/ssd-a.asm \common/x86/x86inc.asm \common/x86/x86util.asmENCODER_CPP_SRCS := \encoder/analysis.cpp \encoder/api.cpp \encoder/bitcost.cpp \encoder/dpb.cpp \encoder/encoder.cpp \encoder/entropy.cpp \encoder/frameencoder.cpp \encoder/framefilter.cpp \encoder/level.cpp \encoder/motion.cpp \encoder/nal.cpp \encoder/ratecontrol.cpp \encoder/reference.cpp \encoder/sao.cpp \encoder/search.cpp \encoder/sei.cpp \encoder/slicetype.cpp \encoder/weightPrediction.cpp \include $(CLEAR_VARS)
LOCAL_MODULE := common
LOCAL_ARM_MODULE := armLOCAL_CFLAGS := -Wall -Wextra -Wshadow -std=gnu++98 -fPIC -Wno-array-bounds -ffast-math -fno-exceptions -fpermissive -frtti -Wno-maybe-uninitialized
LOCAL_CFLAGS += -DEXPORT_C_API=1 -DHAVE_INT_TYPES_H=1 -DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8 -DX265_NS=x265 -D__STDC_LIMIT_MACROS=1 -DHAVE_STRTOK_R
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)LOCAL_SRC_FILES := $(COMMON_CPP_SRCS)$(info arm = $(TARGET_ARCH_ABI))
ifneq (, $(findstring $(TARGET_ARCH_ABI),armeabi armeabi-v7a))LOCAL_CFLAGS += -DHAVE_NEON -DX265_ARCH_ARMLOCAL_SRC_FILES += $(COMMON_ARM_SRCS)
endififeq ($(TARGET_ARCH_ABI),x86)LOCAL_CFLAGS += -UX86_64 -DX265_ARCH_X86LOCAL_SRC_FILES += $(COMMON_X86_SRCS)
endifLOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/common $(LOCAL_PATH)/encoder
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
include $(BUILD_STATIC_LIBRARY)#---------- static module ----------#include $(CLEAR_VARS)
LOCAL_MODULE := encoder
LOCAL_ARM_MODULE := arm
LOCAL_SRC_FILES := $(ENCODER_CPP_SRCS)
LOCAL_STATIC_LIBRARIES := common
include $(BUILD_STATIC_LIBRARY)#---------- static module ----------#include $(CLEAR_VARS)
LOCAL_MODULE := input
LOCAL_ARM_MODULE := arm
LOCAL_SRC_FILES := \input/input.cpp \input/y4m.cpp \input/yuv.cppLOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_STATIC_LIBRARIES := common
include $(BUILD_STATIC_LIBRARY)#---------- static module ----------#include $(CLEAR_VARS)
LOCAL_MODULE := output
LOCAL_ARM_MODULE := armLOCAL_SRC_FILES := \output/reconplay.cpp \output/raw.cpp \output/y4m.cpp \output/yuv.cpp \output/output.cppLOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_STATIC_LIBRARIES := common
include $(BUILD_STATIC_LIBRARY)include $(CLEAR_VARS)
LOCAL_MODULE := x265
LOCAL_ARM_MODULE := arm
LOCAL_WHOLE_STATIC_LIBRARIES := encoder input output
include $(BUILD_SHARED_LIBRARY)
#---------- binary module ----------#include $(CLEAR_VARS)
LOCAL_MODULE := x265_test
LOCAL_ARM_MODULE := arm
LOCAL_SRC_FILES := x265-extras.cpp x265.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_STATIC_LIBRARIES := encoder input output
include $(BUILD_EXECUTABLE)
- 编译结果
libx265.so
在Android上可用的动态库x265_test
我在上面用到的测试程序
[armeabi-v7a] SharedLibrary : libx265.so
[armeabi-v7a] Install : libx265.so => out/libs/armeabi-v7a/libx265.so
[armeabi-v7a] Compile++ thumb: x265_test <= x265-extras.cpp
[armeabi-v7a] Compile++ thumb: x265_test <= x265.cpp
[armeabi-v7a] Executable : x265_test
[armeabi-v7a] Install : x265_test => out/libs/armeabi-v7a/x265_test
X265-Android相关推荐
- android硬解码x265,Android 设置硬解码 h265 失败
在demo中开启硬件解码,同时设置h265开关 ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacode ...
- 蔡砚刚:uAVS3对标x265 veryslow将节省30%码率
在高清+5G的大潮下,由于其技术难度进一步提升,伴随了行业升级,也将有一批技术公司脱颖而出.蔡砚刚和他的团队就是其中之一. 文 / 蔡砚刚 策划 / LiveVideoStack LiveVideoS ...
- FFmpeg 集成 x265 编译及解码
x265 是一个免费的软件库和应用程序,用于将视频流编码为 H.265/MPEG-H HEVC 压缩格式,并在 GNU GPL 条款下发布. FFmpeg 为了支持 H.265 编.解码可以集成 x2 ...
- x265 1.8版本更新
0. 2015.10.8 更新1.8版本(git时间不对居然提早了16天,骗子) 支持12位 avx2指令集 优化 熵编码优化 添加一些新工具 x265 version 1.8 ...
- R3300L Android相关的记录
在寻找高版本Android固件的过程中遇到一个Android6.0的固件, 刷上去之后发现没有Root. 因为原发布者设置了收费的QQ群, 固件开机图上就是QQ群号, 满以为交了钱之后应该能有Root ...
- x265工程简介、编译、调试测试
目录 1. x265工程项目 2. 编译 2.1 Linux/MaxOS 2.2 Android 3. 测试 3.1 序列准备 3.2 编码命令 1. x265工程项目 https://x265. ...
- ffmpeg编译android平台-(ubuntu+ndkr16b+ffmpeg3.4.12)
一.环境配置 1.下载NDK,NDK老版本 1.1. ubuntu下载 wget https://dl.google.com/android/repository/android-ndk-r16b-l ...
- 视频压缩 x264和x265
多媒体领域 H.264 编解码的过程 H.264 码流的结构 预测编码,帧内预测,帧间预测,运动补偿,运动估计,运动矢量,变换编码,离散余弦变换,量化参数,熵编码,哈夫曼编码.算数编码. 预测编码 ...
- 音视频标准:MEPG阵营(x264,x265等)和Google阵营(vp8,vp9等),中国标准(XAVS2)
视频标准:MEPG阵营和Google开源阵营. MPEG-2,VC1,H.263,H.264/AVC,H.265/HEVC,VP9,AV1--所有这些标准都建立在基于块的混合视频编码结构上. ...
最新文章
- 李飞飞团队从动物身上get AI新思路,提出RL计算框架,让机器在复杂环境学习和进化...
- 在JSP客户端限制表单重复提交
- 关于字符串属性的几道面试题目
- 循环神经网络的数据预处理
- 利用jqueryRotare实现抽奖转盘
- Fiori Elements - list report.xml layout and fragment xml load
- 【react】 react---项目的-----------简单路由配置
- 同步计数 Java_Java之同步计数器CyclicBarrier
- 阿里巴巴招聘操作系统研发专家
- 开源知识管理系统_开源MrDoc,一个适合个人和小型团队的文档、知识、笔记在线管理系统...
- java策略模式使用场景,Java设计模式—策略模式
- gateway+vue实现防接口重放、防篡改
- 1.《SQL必知必会》第五版 附录A样例表的添加
- 一张图看清国内程序员的分布数量
- [知乎]老狼:深入PCI与PCIe之二:软件篇
- openstack连通性检查显示验证失败_SLEEP:睡眠周期和年龄中的EEG连通性
- flowchar.js使用指南
- 【RoboMaster】我是这样搞定第一次单目相机测距的
- 气体润滑轴承matlab分析,轴承润滑常见的7种方式及其优缺点
- 读书笔记:《德鲁克管理思想精要》- 7
热门文章
- 2018美团点评校招-K的倍数
- 2019 小米校招笔试题 小米大礼包
- python爬取歌曲_python爬取网易云音乐热歌榜实例代码
- 这4类人去创业和自由职业会死得很惨
- oracle当查询没有输出返回0,[数据库] Oracle单表查询总数及百分比和数据横向纵向连接...
- 11月24日学习笔记_map/reduct的应用于使用
- maya导入arnold代理ass文件后,无法修改ass内贴图路径问题的解决方法
- vue2.0 使用 swiper 实现PC端卡片左右虚拟slides滑动
- c语言iota函数,C++ iota函数用法详解
- 幂级数和函数经典例题_幂级数的和函数怎么求,做题有什么方法吗?