Binder RPC数据以及Binder IPC数据的处理过程

BinderRPC数据的处理过程

ref: 《Android框架揭秘》 p.305

Android JNI 优化

在类加载时获取域和方法的ID

JAVA端:

public class MyClass {
	static {
		System.loadLibrary("mylib");
		/*在加载库的时候一次性获取需要访问的域和方法的ID*/
		getIds();
	}

	public static int someInteger = 0;
	public static native void sayHelloToJNI();
	public static void helloFromJNI() {
		Log.i("MyClass", "Greetings! someInteger = " + someInteger);
	}

	private static native void getId();
}

C/C++端:

static jfieldID someIntegerId;
static jfieldID helloFromJNIId;

void JNOCALL Java_com_apress_proandroid_MyClass_sayHelloJNI(JNIEnv *env, jclass clazz) {
	/*这里不在需要获取ID*/

	jint value = (*env)->GetStaticIniField(env, clazz, someIntegerId);
	(*env)->SetStaticIntField(env, clazz, value + 1);

	(*env)->CallStaticVoidMethod(env, clazz, helloFrmoJNIId);
}

/*获取JAVA端的ID*/
void JNICALL Java_com_apress_proandroid_MyClass_getIds(JNIEnv *env, jclass clazz) {
	someIntegerId = (*env)->GetStaticFieldID(env, clazz, "someInteger", "I");
	helloFromJNIId = (*env)->GetStaticMethodID(env, clazz, "helloFromJNI", "()V");
}

ref: 《Android应用性能优化》 p.51

System Service 与 Service Manager的关系

SystemService与ServiceManager的关系

H264 Profiles

Baseline Profile (BP)

Primarily for lower-cost applications with limited computing resources, this profile is used widely in videoconferencing and mobile applications.

Main Profile (MP)

Originally intended as the mainstream consumer profile for broadcast and storage applications, the importance of this profile faded when the High profile was developed for those applications.

Extended Profile (XP)

Intended as the streaming video profile, this profile has relatively high compression capability and some extra tricks for robustness to data losses and server stream switching.

High Profile (HiP)

The primary profile for broadcast and disc storage applications, particularly for high-definition television applications (this is the profile adopted into HD DVD and Blu-ray Disc, for example).

High 10 Profile (Hi10P)

Going beyond today’s mainstream consumer product capabilities, this profile builds on top of the High Profile—adding support for up to 10 bits per sample of decoded picture precision.

High 4:2:2 Profile (Hi422P)

Primarily targeting professional applications that use interlaced video, this profile builds on top of the High 10 Profile—adding support for the 4:2:2 chroma subsampling format while using up to 10 bits per sample of decoded picture precision.

High 4:4:4 Predictive Profile (Hi444PP)

This profile builds on top of the High 4:2:2 Profile—supporting up to 4:4:4 chroma sampling, up to 14 bits per sample, and additionally supporting efficient lossless region coding and the coding of each picture as three separate color planes.

H.264 Levels

Levelnumber Max macroblocksper second Max frame size (macroblocks) Max video bit rate (VCL)for Baseline,Extended and Main Profiles Max video bit rate (VCL)for High Profile Max video bit rate (VCL) for High 10 Profile Max video bit rate(VCL)for High 4:2:2 and High 4:4:4 Predictive Profiles Examples for high resolution @frame rate(max stored frames)in Level
1 1485 99 64 kbit/s 80 kbit/s 192 kbit/s 256 kbit/s 128×[email protected] (8)176×[email protected] (4)
1b 1485 99 128 kbit/s 160 kbit/s 384 kbit/s 512 kbit/s 128×[email protected] (8)176×[email protected] (4)
1.1 3000 396 192 kbit/s 240 kbit/s 576 kbit/s 768 kbit/s 176×[email protected] (9)320×[email protected] (3)352×[email protected] (2)
1.2 6000 396 384 kbit/s 480 kbit/s 1152 kbit/s 1536 kbit/s 320×[email protected] (7)352×[email protected] (6)
1.3 11880 396 768 kbit/s 960 kbit/s 2304 kbit/s 3072 kbit/s 320×[email protected] (7)352×[email protected] (6)
2 11880 396 2 Mbit/s 2.5 Mbit/s 6 Mbit/s 8 Mbit/s 320×[email protected] (7)352×[email protected] (6)
2.1 19800 792 4 Mbit/s 5 Mbit/s 12 Mbit/s 16 Mbit/s 352×[email protected] (7)352×[email protected] (6)
2.2 20250 1620 4 Mbit/s 5 Mbit/s 12 Mbit/s 16 Mbit/s 352×[email protected](10)352×[email protected] (7)720×[email protected] (6)720×[email protected] (5)
3 40500 1620 10 Mbit/s 12.5 Mbit/s 30 Mbit/s 40 Mbit/s 352×[email protected](12)352×[email protected] (10)720×[email protected] (6)720×[email protected] (5)
3.1 108000 3600 14 Mbit/s 17.5 Mbit/s 42 Mbit/s 56 Mbit/s 720×[email protected](13)720×[email protected](11)1280×[email protected](5)
3.2 216000 5120 20 Mbit/s 25 Mbit/s 60 Mbit/s 80 Mbit/s 1280×[email protected](5)1280×[email protected](4)
4 245760 8192 20 Mbit/s 25 Mbit/s 60 Mbit/s 80 Mbit/s 1280×[email protected](9)1920×[email protected](4)2048×[email protected](4)
4.1 245760 8192 50 Mbit/s 50 Mbit/s 150 Mbit/s 200 Mbit/s 1280×[email protected](9)1920×[email protected](4)2048×[email protected](4)
4.2 522240 8704 50 Mbit/s 50 Mbit/s 150 Mbit/s 200 Mbit/s 1920×[email protected](4)2048×[email protected](4)
5 589824 22080 135 Mbit/s 168.75 Mbit/s 405 Mbit/s 540 Mbit/s 1920×[email protected](13)2048×[email protected](13)2048×[email protected](12)2560×[email protected](5)3680×1536/26.7 (5)
5.1 983040 36864 240 Mbit/s 300 Mbit/s 720 Mbit/s 960 Mbit/s 1920×[email protected](16)4096×[email protected](5)4096×[email protected](5)

MBP vs RMBP

1

2

3

4

5

6

7

8

9

10

11

12

13

结论:

  • rmbp和mbp基本不属于同一个时代的东西
  • rmbp轻、薄、质感
  • rmbp的屏幕细腻,非常舒服
  • i7 + 512GB SSD + 16GB MEM 的结果就是各种快~~
  • 感谢“土豪”兄弟提供的“豪配版rmbp” ^_^