这两天在论坛里看到有人在问WinCE6.0下绘图较慢的问题。现象很奇怪,同一个程序在WinCE5.0下运行得很好,但到某些WinCE6.0的平台上却很慢,而在另外一些6.0的平台上似乎又没有问题。看起来,应该跟硬件平台或者系统有关系。在我们的平台上也存在类似的问题,界面有点慢。这是为什么呢?又应该如何解决?是24位色导致系统变慢?使用DirectDraw能否有效的提高速度?为了寻找答案,今天利用TCPMP在我们的平台上做了一个详细的检测,希望能从中找到一些线索。
测试的方法如下,采用同一个MP4文件,分别在16位色和24位的系统上进行BenchMark,ZOOM都选定为100%,渲染方式分别为GDI、Direct、DDraw-RGB和DDraw-YUY2。
先看看16位色下的四组数据。
16位色GDI渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3504097
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 28.760
7 Bench. Frame Rate 67.21
8 Bench. Sample Rate 121835
9 Bench. Data Rate 3.2 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output GDI 解码 80 0x480 16bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
16位色Direct渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3504350
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 25.803
7 Bench. Frame Rate 74.91
8 Bench. Sample Rate 135813
9 Bench. Data Rate 3.6 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output Direct 80 0x480 16bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
16位色DDraw-RGB渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3504501
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 26.009
7 Bench. Frame Rate 74.32
8 Bench. Sample Rate 134739
9 Bench. Data Rate 3.6 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output DirectDraw 80 0x480 16bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
16位色DDraw-YUY2渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3512737
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 21.261
7 Bench. Frame Rate 90.91
8 Bench. Sample Rate 165215
9 Bench. Data Rate 4.4 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output DirectDraw 80 0x480 16bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
从上面可以看出,在16位色的WinCE6.0系统上,使用GDI渲染最慢,Direct和DDraw-RGB相差不多,都比GDI要好一点,DDraw-YUY2效果最好。
24位色下的四组数据如下。
24位色GDI渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3501248
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 41.464
7 Bench. Frame Rate 46.62
8 Bench. Sample Rate 84440
9 Bench. Data Rate 2.3 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output GDI 解码 80 0x480 32bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
24位色Direct渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3507276
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 25.864
7 Bench. Frame Rate 74.73
8 Bench. Sample Rate 135607
9 Bench. Data Rate 3.6 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output Direct 80 0x480 32bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
24位色DDraw-RGB渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3504242
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 26.200
7 Bench. Frame Rate 73.78
8 Bench. Sample Rate 133749
9 Bench. Data Rate 3.6 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 480 Mhz
22 Video output DirectDraw 80 0x480 32bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
24位色DDraw-YUY2渲染时的报告结果:
2 Video Frames 1933
3 Audio Samples 3513320
4 Amount of Data 11401 KB
5
6 Bench. Time 0 : 21.558
7 Bench. Frame Rate 89.66
8 Bench. Sample Rate 162971
9 Bench. Data Rate 4.3 Mbit / s
10
11 Original Time 1 : 17.319
12 Original Frame Rate 25.00
13 Original Sample Rate 44100
14 Original Data Rate 1.2 Mbit / s
15
16 URL \NAND\ 123 .avi
17 Size 11675460
18 Platform PLATFORM_TYPE
19 OS Version 6.00
20 OEM Info PLATFORM_OEM
21 Clock speed 482 Mhz
22 Video output DirectDraw 80 0x480 32bits Lookup
23 Video zoom 32 0x240 -> 32 0x240
24 Audio output Wave Output 44100Hz 16Bits 2Ch.
可以看到,在24位色模式下,GDI依然是最慢的,Direct和DDraw-RGB还是不相上下,但比使用GDI高了很多,DDraw-YUY2依旧傲视群雄,几乎是GDI的2倍。
再看16位色和24位色,虽然同是使用GDI渲染,但24位色的系统显然慢了很多。而位色深度似乎对Direct和DDraw影响很小,几组值都相差无几。
最后再看看DDraw内部的差别,使用RGB和YUY2显然效果大不一样,几乎提高了20%。这可能主要是因为使用YUY2解码时不需要做颜色转换,从而省了很多时间。对于界面开发来说,我们大概可以使用Direct或者DDraw-RGB来提高绘制的效率。具体采用哪一种看具体情况,简单方便易实现是宗旨。
以上列举的这些应该可以说明一些问题,但不能以偏概全,最后的答案还得继续寻找。
为啥WinCE6.0有时那么慢?