和你一起终身学习,这里是程序员Android
经典好文推荐,通过阅读本文,您将收获以下知识点:
一、硬件功耗
二、相机软件功耗
三、参考文档
一、硬件功耗
1.1 硬件信息
以下硬件信息最好提前获取到
模块 | 备注 |
---|---|
平台 | MTK or Qcom or sprd |
CPU频率 | 大中小核 |
L2 Cache size | CPU缓存 |
DDR | DRAM 类型,品牌 |
屏幕 | 类型,品牌 |
相机Sensor | 型号,出图size,帧率,几M |
1.2 硬件功耗拆解
硬件电流一般需要使用功耗拆解板测试,使用功耗拆解版软件+工具 可以拆解详细硬件模块的功耗,数据格式如下:
模块 | 备注 |
---|---|
0_BAT | |
1_BB | CPU 功耗 |
2_MEMORY | 内存 |
3_LCM | 屏 |
4_AUDIO | 多媒体 |
5_CAMERA | 相机 |
6_RF | 射频 |
7_WIFI | wifi |
8_SENSOR | 传感器 |
9_SIM | SIM 卡 |
10_USB | USB |
11_PMU | 电源管理单元 |
12_FLASH_LED | 闪光灯 |
二、相机软件功耗
2.1 影响相机功耗的点
1.CPU 差异(MIPS百万指令每秒:可以准确的表现当时CPU的运算量)
2.Camera 模组差异
3.Camera APP 差异
4.Camera HAL 差异
5.Camera算法差异
6.PDAF差异
7.Camera Feature、SensorSize、RRZO Size、Camera FPS、P2 display size 、p2 preview callback size ,预览拍照 size 等差异
2.2 MTK 相机功耗拆解模板
2.3 Feature 确认
2.4 MTK Log 关键字
2.4.1 开启MTK 更多log的方法
C:\Users\platform-tools>adb shell setprop persist.vendor.debug.camera.log 3
C:\Users\platform-tools>adb shell pkill camera*
C:\Users\platform-tools>adb logcat -c
2.4.2 SensorSize、SensorMode、FPS、RRZO、IMGO、相机API
log 关键字:
P1NodeImp.*check_config|select size|connect call|imgoDefaultRequest |P1::ENQ
01-01 08:29:27.088299 12026 12034 I CameraService: connect call (PID -1 "com.android.camera", camera ID 0) and Camera API version 2
01-01 08:29:27.262593 12029 12029 I mtkcam-SensorSettingPolicy4cell: select size(4080x3072)@30 sensorMode:0 hdrSensorMode:0 hdrHalMode:0 HfpsMode:0 staggerScenarios:0
01-01 08:29:27.291538 12029 13095 I MtkCam/P1NodeImp: [check_config] [Cam::0] - AppMeta[8] [TAG:0x10011 _0 #1]={ 0 } [TAG:0x800B000A _0 #1]={ 1 } [TAG:0x800B0012 _0 #1]={ 2 } [TAG:0x800B001D _1 #1]={ 1 } [TAG:0x800B0020 _1 #1]={ 1 } [TAG:0x800D0000 _1 #1]={ 1 } [TAG:0x900200B1 _0 #17]={ 99 111 109 46 111 112 108 117 115 46 99 97 109 101 114 97 0 } [TAG:0x900200B2 _0 #5]={ 78 85 76 76 0 } - HalMeta[6] [TAG:0xC000001C _7 #1]={ 0x0 } [TAG:0xC003000A _1 #1]={ 0 } [TAG:0xC003001A _1 #1]={ 1 } [TAG:0xC003001C _1 #1]={ 0 } [TAG:0xC003001E _1 #1]={ 0 } [TAG:0xC0090004 _1 #1]={ 0 }
01-01 08:29:27.291555 12029 13095 I MtkCam/P1NodeImp: [check_config] [Cam::0] Cam::0 Param[N:m0,p1,c3,q0,t0,b0,a0,i4,r0,w1,g0,s0,v10001000_B:p0,b0,t1,h0,u0,e1,l1,r1,f0,d0,q0,c0,f0,v0,s0,LL0,SSC0,SE0,ST0,SB0x0,O:0,OI:0] S(0,30,2,0,x2,4080x3072) R(0x2201-5104-15679488,1-0-1,1-0x2) D(b0,t1,h0) E(e1,l1,r1,u0,d0,q0,c0,f0,s0,p0,a0) M(m0x0,p0x1,c0x3,q0,t0,b1,a1,u1,d1,r0,i4,g0,s0,k0,v10001000,f0) Dm(1) Rc(0xb400006f895d61c0) Sh(0x0) SenCfg(1,0,1) Pool(IMG0x0,RRZ0x0,LCS0x0,RSS0x0,YUV0x0,CRZ10x0,CRZ20x0) MetaInAPP_0:0x80000000 MetaInHAL_1:0x100000018 MetaOutAPP_2:0x100000024 MetaOutHAL_3:0x10000001b ImgOutIMG_5:0x100000001(4080x3072)[0x2201] ImgOutIMGAP_6:0x2(4080x3072)[0x2201] ImgOutRRZ_7:0x100000003(1280x976)[0x2205] ImgOutLCS_8:0x100000004(680x510)[0x2401] ImgOutLCESHO_9:0x100000004(1548x1)[0x2401] ImgOutRSS_10:0x100000005(288x512)[0x2400] ImgOutYUVR1_14:0x100000014(640x488)[0x14] Meta(APP:8=8,HAL:6=6) RR(6) AA(0,0-4080x3072) TS(1)
01-01 08:29:27.417072 12029 12100 I MtkCam/P1NodeImp: [setupAction] [Cam::0 R4 S4 E1 D0 O0 #4] [P1::ENQ][Num Q:1 M:1 F:0 R:0 @0][Type:1 Out:x110115 Rec:x0 Raw:1 Cap:0 Exe:1 Flush:x0] [Exp:0ns] [MetaCtrl][SCALER_CROP(1) (0,0_4080x3072) ][SENSOR_CROP(0)][RESIZER_SET(0)][RRZ:0-0%01_3](0xb400006f46df3100)(Buf)(1280x976)(S:2400:2342400 P:0x2ff5a3000 V:0x6f787ba000 F:0x2205)(x0)(Crop)(0,0-4080x3072)(1280x976) [LCS:2-0%01_3](0xb400006f4ab79500)(Buf)(680x510)(S:1360:693600 P:0x2faa13000 V:0x6f7870f000 F:0x2401)(x0) [IMG:4-0%01_3](0xb400006f4ab79400)(Buf)(4080x3072)(S:5104:15679488 P:0x2f7d81000 V:0x6f4b426000 F:0x2201)(x1)(Crop)(0,0-4080x3072)(4080x3072) [RSS:8-0%01_3](0xb400006f4ab79600)(Buf)(288x512)(S:288:147456 P:0x2ff7df000 V:0x6fd8529000 F:0x2400)(x0) [CRZ1:16-0%01_3](0xb400006f4ab79700)(Buf)(640x488)(S:1280:624640 P:0x2fa4e6000 V:0x6f78676000 F:0x14)(x0)(Crop)(0,0-4080x3072)(640x488) [LCESHO:20-0%01_3](0xb400006f4ab79800)(Buf)(1548x1)(S:3096:3096 P:0x2faabc560 V:0x6f787b8560 F:0x2401)(x0) [LMV](P:0x2ff203100 V:0x7063922100)
2.4.3 ZSL 是否支持
log 关键字:
MtkCam/ppl_context.*dump|ZslProc
能搜索到 ZslProc,或者image stream中看到provide 就标准支持zsl
01-01 08:29:27.268390 12029 12029 I MtkCam/ZslProc: [ZslProcessor] mTimeSource(1) mFakeShutterNs(1522451160782)
01-01 08:29:27.268910 12029 12029 I MtkCam/ZslProc: [configure] mCustomLibHandle(0x0) mpCustomSelector(0x0)
01-01 08:29:27.275592 12029 12029 I MtkCam/ppl_context: [dump] <image streams>
01-01 08:29:27.275647 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-APP-PROVIDER]0 960x720 OUT ImgFormat:0x1000(NV12) BufPlanes(strides/sizeInBytes):[ 960/691200 960/345600 ] startOffset:0 bufStep:0 t:0/r:0 maxBuffers:12 d/s:0x08c20000(V0_JFIF|STANDARD_BT601_625|TRANSFER_SMPTE_170M|RANGE_FULL) s0:d0:App:NV12:0|SW_READ_OFTEN|HW_TEXTURE AllocImgFormat:0x1000(NV12) AllocBufPlanes(strides/sizeInBytes):[ 960/691200 960/345600 ] Real:0x1000(NV12) Request:0x23(YCbCr_420_888) Override:0x23(YCbCr_420_888) Hal-Client-usage:0x103(0|SW_READ_OFTEN|HW_TEXTURE) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 0xb40000705fc4f480 phy:-1
01-01 08:29:27.275684 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-APP-PROVIDER]0x1 4080x3072 OUT ImgFormat:0x11(NV21) BufPlanes(strides/sizeInBytes):[ 4096/12582912 4096/6297600 ] startOffset:0 bufStep:0 t:0/r:0 maxBuffers:12 d/s:0x08c20000(V0_JFIF|STANDARD_BT601_625|TRANSFER_SMPTE_170M|RANGE_FULL) s1:d0:App:YCrCb_420_SP:0|SW_READ_OFTEN AllocImgFormat:0x11(NV21) AllocBufPlanes(strides/sizeInBytes):[ 4096/12582912 4096/6297600 ] Real:0x11(YCrCb_420_SP) Request:0x23(YCbCr_420_888) Override:0x23(YCbCr_420_888) Hal-Client-usage:0x3(0|SW_READ_OFTEN) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 0xb40000705fc4f2c0 phy:-1
01-01 08:29:27.275719 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-APP-PROVIDER]0x2 4080x3072 OUT ImgFormat:0x2201(BAYER10) BufPlanes(strides/sizeInBytes):[ 5120/15728640 ] startOffset:0 bufStep:0 t:0/r:0 maxBuffers:8 d/s:0x00000001(ARBITRARY) s2:d0:App:RAW10:0|SW_READ_OFTEN AllocImgFormat:0x21(BLOB) AllocBufPlanes(strides/sizeInBytes):[ 15728640/15728640 ] Real:0x25(RAW10) Request:0x25(RAW10) Override:0x25(RAW10) Hal-Client-usage:0x3(0|SW_READ_OFTEN) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 0xb40000705fc4f100 phy:-1
01-01 08:29:27.275759 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-APP-PROVIDER]0x3 1280x720 OUT ImgFormat:0x32315659(YV12) BufPlanes(strides/sizeInBytes):[ 1280/921600 640/230400 640/263040 ] startOffset:0 bufStep:0 t:0/r:0 maxBuffers:12 d/s:0x08c20000(V0_JFIF|STANDARD_BT601_625|TRANSFER_SMPTE_170M|RANGE_FULL) s3:d0:App:YV12:0|SW_READ_OFTEN AllocImgFormat:0x32315659(YV12) AllocBufPlanes(strides/sizeInBytes):[ 1280/921600 640/230400 640/263040 ] Real:0x32315659(YV12) Request:0x32315659(YV12) Override:0x32315659(YV12) Hal-Client-usage:0x3(0|SW_READ_OFTEN) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 0xb40000705fc4ca80 phy:-1
01-01 08:29:27.275797 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-APP-PROVIDER]0x4 2560x1920 OUT ImgFormat:0x32315659(YV12) BufPlanes(strides/sizeInBytes):[ 2560/4915200 1280/1228800 1280/1232640 ] startOffset:0 bufStep:0 t:0/r:0 maxBuffers:12 d/s:0x08c20000(V0_JFIF|STANDARD_BT601_625|TRANSFER_SMPTE_170M|RANGE_FULL) s4:d0:App:YV12:0|SW_READ_OFTEN AllocImgFormat:0x32315659(YV12) AllocBufPlanes(strides/sizeInBytes):[ 2560/4915200 1280/1228800 1280/1232640 ] Real:0x32315659(YV12) Request:0x32315659(YV12) Override:0x32315659(YV12) Hal-Client-usage:0x3(0|SW_READ_OFTEN) Hal-usage:0x20033(0|SW_READ_OFTEN|SW_WRITE_OFTEN|HW_CAMERA_WRITE) HalStream::(consumer/producer)Usage:0/0x20033 0xb40000705fc4c700 phy:-1
01-01 08:29:27.275831 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-HAL-POOL ]0x100000001 4080x3072 ImgFormat:0x2201(BAYER10) BufPlanes(strides/sizeInBytes):[ 5104/15679488 ] startOffset:0 bufStep:0 t:0 maxBufNum:10 minInitBufNum:0 Hal:Image:P1:Fullraw_main1 AllocImgFormat:0x21(BLOB) AllocBufPlanes(strides/sizeInBytes):[ 15679488/15679488 ] Private{exist?0 id:0}
01-01 08:29:27.275855 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-HAL-POOL ]0x100000003 1280x976 ImgFormat:0x2205(FG_BAYER10) BufPlanes(strides/sizeInBytes):[ 2400/2342400 ] startOffset:0 bufStep:0 t:0 maxBufNum:12 minInitBufNum:0 Hal:Image:P1:Resizeraw_main1 AllocImgFormat:0x2205(FG_BAYER10) AllocBufPlanes(strides/sizeInBytes):[ 2400/2342400 ] Private{exist?0 id:0}
01-01 08:29:27.275879 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-HAL-POOL ]0x100000004 696696x1 ImgFormat:0x21(BLOB) BufPlanes(strides/sizeInBytes):[ 696696/696696 ] startOffset:0 bufStep:0 t:0 maxBufNum:12 minInitBufNum:1 Hal:Image:STT_main1 AllocImgFormat:0x21(BLOB) AllocBufPlanes(strides/sizeInBytes):[ 696696/696696 ] Private{exist?1 id:2}
01-01 08:29:27.275903 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-HAL-POOL ]0x100000005 288x512 ImgFormat:0x2400(STA_BYTE) BufPlanes(strides/sizeInBytes):[ 288/147456 ] startOffset:0 bufStep:0 t:0 maxBufNum:7 minInitBufNum:1 Hal:Image:RSSO_main1 AllocImgFormat:0x2400(STA_BYTE) AllocBufPlanes(strides/sizeInBytes):[ 288/147456 ] Private{exist?0 id:0}
01-01 08:29:27.275927 12029 12029 I MtkCam/ppl_context: [dump] [IMAGE-HAL-POOL ]0x100000014 640x488 ImgFormat:0x14(YUY2) BufPlanes(strides/sizeInBytes):[ 1280/624640 ] startOffset:0 bufStep:0 t:0 maxBufNum:5 minInitBufNum:1 Hal:Image:P1FDYuv_main1 AllocImgFormat:0x14(YUY2) AllocBufPlanes(strides/sizeInBytes):[ 1280/624640 ] Private{exist?0 id:0}
2.4.4 P2-MDP output size
log 关键字:
prepareIORequest
行 19713: 01-01 08:29:27.544387 12029 13124 D MtkCam/StreamingPipe/Pipe: [prepareIORequest]P2S cam 0 MWFrame:#1 MWReq:#1, frame 2-2 master/slave/fd(0/-1/0) ReqNo(2), feature=0x6008(TPI_ASYNC+3DNR+RSC), cycle(33), fps(n/a)=(30/30), ZoomROI((1280.000000x972.000000)@(0.000000,2.000000)) SFPIOMgr:[sID(0)--IMG(0x0/0),RRZ(0xb400006f46df3100/1),LCS(0xb400006f3c672300/1),LCSH(0xb400006f3c672400/1),pRSS(0xb400006f3c672600/1),cRSS(0xb400006f3c672500/1),RSSR2(0x0/0),FYuv(0x0/0),RYuv1(0x0/0),RYuv2(0x0/0),mAIYuv(0x0/0),HalI(0xb400006f3083a380),AppI(0xb400006f895cb1e8),AppDI(0xb400006f3083a3e0),AppOver(0x0)]{path(GEN),halO(0xb400006f2fb2b620),appO(0xb400006f2fb2aba0),Outs--[buf(0xb400006f3c672700/1)(960x720),tran(0),type(1), tar(disp), prof(0), crop(0.000000,2.000000,1280.000000x972.000000), flag(0x3)]Tuning--id(0)--[flag(37)]}
2.4.5 Camera HAL fps
log关键字
MtkCam/StreamingPipe/Timer.*Frame timer|connect call
01-01 08:29:27.088299 12026 12034 I CameraService: connect call (PID -1 "com.android.camera", camera ID 0) and Camera API version 2
01-01 08:29:27.543389 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 1/ 0][t 50][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 23/ 3/ 20][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 25/ 0/ 16][e 0][r 0/ 0][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps0.00/0.00/ 5/ 30]
01-01 08:29:27.710407 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 2/ 0][t 100][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 31/ 2/ 28][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 44/ 0/ 42][e 0][r 22/ 23][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps9.43/9.43/ 5/ 30]
01-01 08:29:27.710509 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 3/ 0][t 110][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 37/ 4/ 33][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 27/ 2/ 13][e 0][r 40/ 39][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps16.13/16.13/ 5/ 30]
01-01 08:29:27.770982 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 5/ 0][t 114][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 36/ 2/ 32][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 23/ 2/ 20][e 0][r 23/ 23][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps20.51/20.51/ 5/ 30]
01-01 08:29:27.780941 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 6/ 0][t 99][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 30/ 10/ 20][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 36/ 1/ 24][e 0][r 21/ 21][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps22.52/22.52/ 5/ 30]
01-01 08:29:27.800470 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 7/ 0][t 89][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 33/ 4/ 28][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 9/ 2/ 6][e 0][r 22/ 22][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps24.79/24.79/ 5/ 30]
01-01 08:29:27.801143 12029 13123 D MtkCam/StreamingPipe/Timer: [print]Frame timer [# 8/ 0][t 76][io 0][tof 0/ 0][d 0/ 0][mss 0/ 0/ 0/ 0][a 27/ 5/ 22][tun 0/ 0][msf 0/ 0][vnr 0/ 0/ 0][am 0][b 0/ 0][tpi( 0/ 0)/( 0/ 0)/( 0/ 0)][vmdp_A 0/ 0 vmdp_B 0/ 0][h 19/ 1/ 16][e 0][r 22/ 22][w_A 0/ 0/ 0/ 0 w_B 0/ 0/ 0/ 0][x 0][disp 0/ 0][async 0/ 0][p2sm 0/ 0/ 0][fps26.82/26.82/ 5/ 30]
三、参考文档
MTK相机功耗优化
【腾讯文档】Camera学习知识库
https://docs.qq.com/doc/DSWZ6dUlNemtUWndv
友情推荐:
Android 开发干货集锦
至此,本篇已结束。转载网络的文章,小编觉得很优秀,欢迎点击阅读原文,支持原创作者,如有侵权,恳请联系小编删除,欢迎您的建议与指正。同时期待您的关注,感谢您的阅读,谢谢!
点击阅读原文,为大佬点赞!