media: Added MPEG2 profile/levels and tests
Bug: 20852831 Change-Id: I172f2f08c30d12bf684f32a52db64823cc286d35
This commit is contained in:
committed by
Lajos Molnar
parent
def4c0c49a
commit
34265cd94f
@@ -15608,6 +15608,16 @@ package android.media {
|
||||
field public static final int HEVCMainTierLevel62 = 16777216; // 0x1000000
|
||||
field public static final int HEVCProfileMain = 1; // 0x1
|
||||
field public static final int HEVCProfileMain10 = 2; // 0x2
|
||||
field public static final int MPEG2LevelH14 = 2; // 0x2
|
||||
field public static final int MPEG2LevelHL = 3; // 0x3
|
||||
field public static final int MPEG2LevelLL = 0; // 0x0
|
||||
field public static final int MPEG2LevelML = 1; // 0x1
|
||||
field public static final int MPEG2Profile422 = 2; // 0x2
|
||||
field public static final int MPEG2ProfileHigh = 5; // 0x5
|
||||
field public static final int MPEG2ProfileMain = 1; // 0x1
|
||||
field public static final int MPEG2ProfileSNR = 3; // 0x3
|
||||
field public static final int MPEG2ProfileSimple = 0; // 0x0
|
||||
field public static final int MPEG2ProfileSpatial = 4; // 0x4
|
||||
field public static final int MPEG4Level0 = 1; // 0x1
|
||||
field public static final int MPEG4Level0b = 2; // 0x2
|
||||
field public static final int MPEG4Level1 = 4; // 0x4
|
||||
|
||||
@@ -16830,6 +16830,16 @@ package android.media {
|
||||
field public static final int HEVCMainTierLevel62 = 16777216; // 0x1000000
|
||||
field public static final int HEVCProfileMain = 1; // 0x1
|
||||
field public static final int HEVCProfileMain10 = 2; // 0x2
|
||||
field public static final int MPEG2LevelH14 = 2; // 0x2
|
||||
field public static final int MPEG2LevelHL = 3; // 0x3
|
||||
field public static final int MPEG2LevelLL = 0; // 0x0
|
||||
field public static final int MPEG2LevelML = 1; // 0x1
|
||||
field public static final int MPEG2Profile422 = 2; // 0x2
|
||||
field public static final int MPEG2ProfileHigh = 5; // 0x5
|
||||
field public static final int MPEG2ProfileMain = 1; // 0x1
|
||||
field public static final int MPEG2ProfileSNR = 3; // 0x3
|
||||
field public static final int MPEG2ProfileSimple = 0; // 0x0
|
||||
field public static final int MPEG2ProfileSpatial = 4; // 0x4
|
||||
field public static final int MPEG4Level0 = 1; // 0x1
|
||||
field public static final int MPEG4Level0b = 2; // 0x2
|
||||
field public static final int MPEG4Level1 = 4; // 0x4
|
||||
|
||||
@@ -1733,6 +1733,72 @@ public final class MediaCodecInfo {
|
||||
maxBlocks, maxBlocksPerSecond,
|
||||
16 /* blockWidth */, 16 /* blockHeight */,
|
||||
1 /* widthAlignment */, 1 /* heightAlignment */);
|
||||
} else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_MPEG2)) {
|
||||
int maxWidth = 11, maxHeight = 9, maxRate = 15;
|
||||
maxBlocks = 99;
|
||||
maxBlocksPerSecond = 1485;
|
||||
maxBps = 64000;
|
||||
for (CodecProfileLevel profileLevel: profileLevels) {
|
||||
int MBPS = 0, FS = 0, BR = 0, FR = 0, W = 0, H = 0;
|
||||
boolean supported = true;
|
||||
switch (profileLevel.profile) {
|
||||
case CodecProfileLevel.MPEG2ProfileSimple:
|
||||
switch (profileLevel.level) {
|
||||
case CodecProfileLevel.MPEG2LevelML:
|
||||
FR = 30; W = 45; H = 36; MBPS = 48600; FS = 1620; BR = 15000; break;
|
||||
default:
|
||||
Log.w(TAG, "Unrecognized profile/level "
|
||||
+ profileLevel.profile + "/"
|
||||
+ profileLevel.level + " for " + mime);
|
||||
errors |= ERROR_UNRECOGNIZED;
|
||||
}
|
||||
break;
|
||||
case CodecProfileLevel.MPEG2ProfileMain:
|
||||
switch (profileLevel.level) {
|
||||
case CodecProfileLevel.MPEG2LevelLL:
|
||||
FR = 30; W = 22; H = 18; MBPS = 11880; FS = 396; BR = 4000; break;
|
||||
case CodecProfileLevel.MPEG2LevelML:
|
||||
FR = 30; W = 45; H = 36; MBPS = 48600; FS = 1620; BR = 15000; break;
|
||||
case CodecProfileLevel.MPEG2LevelH14:
|
||||
FR = 60; W = 90; H = 68; MBPS = 367200; FS = 6120; BR = 60000; break;
|
||||
case CodecProfileLevel.MPEG2LevelHL:
|
||||
FR = 60; W = 120; H = 68; MBPS = 489600; FS = 8160; BR = 80000; break;
|
||||
default:
|
||||
Log.w(TAG, "Unrecognized profile/level "
|
||||
+ profileLevel.profile + "/"
|
||||
+ profileLevel.level + " for " + mime);
|
||||
errors |= ERROR_UNRECOGNIZED;
|
||||
}
|
||||
break;
|
||||
case CodecProfileLevel.MPEG2Profile422:
|
||||
case CodecProfileLevel.MPEG2ProfileSNR:
|
||||
case CodecProfileLevel.MPEG2ProfileSpatial:
|
||||
case CodecProfileLevel.MPEG2ProfileHigh:
|
||||
Log.i(TAG, "Unsupported profile "
|
||||
+ profileLevel.profile + " for " + mime);
|
||||
errors |= ERROR_UNSUPPORTED;
|
||||
supported = false;
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Unrecognized profile "
|
||||
+ profileLevel.profile + " for " + mime);
|
||||
errors |= ERROR_UNRECOGNIZED;
|
||||
}
|
||||
if (supported) {
|
||||
errors &= ~ERROR_NONE_SUPPORTED;
|
||||
}
|
||||
maxBlocksPerSecond = Math.max(MBPS, maxBlocksPerSecond);
|
||||
maxBlocks = Math.max(FS, maxBlocks);
|
||||
maxBps = Math.max(BR * 1000, maxBps);
|
||||
maxWidth = Math.max(W, maxWidth);
|
||||
maxHeight = Math.max(H, maxHeight);
|
||||
maxRate = Math.max(FR, maxRate);
|
||||
}
|
||||
applyMacroBlockLimits(maxWidth, maxHeight,
|
||||
maxBlocks, maxBlocksPerSecond,
|
||||
16 /* blockWidth */, 16 /* blockHeight */,
|
||||
1 /* widthAlignment */, 1 /* heightAlignment */);
|
||||
mFrameRateRange = mFrameRateRange.intersect(12, maxRate);
|
||||
} else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_MPEG4)) {
|
||||
int maxWidth = 11, maxHeight = 9, maxRate = 15;
|
||||
maxBlocks = 99;
|
||||
@@ -2343,6 +2409,20 @@ public final class MediaCodecInfo {
|
||||
public static final int MPEG4Level4a = 0x40;
|
||||
public static final int MPEG4Level5 = 0x80;
|
||||
|
||||
// from OMX_VIDEO_MPEG2PROFILETYPE
|
||||
public static final int MPEG2ProfileSimple = 0x00;
|
||||
public static final int MPEG2ProfileMain = 0x01;
|
||||
public static final int MPEG2Profile422 = 0x02;
|
||||
public static final int MPEG2ProfileSNR = 0x03;
|
||||
public static final int MPEG2ProfileSpatial = 0x04;
|
||||
public static final int MPEG2ProfileHigh = 0x05;
|
||||
|
||||
// from OMX_VIDEO_MPEG2LEVELTYPE
|
||||
public static final int MPEG2LevelLL = 0x00;
|
||||
public static final int MPEG2LevelML = 0x01;
|
||||
public static final int MPEG2LevelH14 = 0x02;
|
||||
public static final int MPEG2LevelHL = 0x03;
|
||||
|
||||
// from OMX_AUDIO_AACPROFILETYPE
|
||||
public static final int AACObjectMain = 1;
|
||||
public static final int AACObjectLC = 2;
|
||||
|
||||
@@ -60,6 +60,7 @@ public class MediaNames {
|
||||
public static final String VIDEO_H264_AAC = "/sdcard/media_api/video/H264_320_AAC_64.3gp";
|
||||
public static final String VIDEO_H264_AMR = "/sdcard/media_api/video/H264_320_AMRNB_6.3gp";
|
||||
public static final String VIDEO_HEVC_AAC = "/sdcard/media_api/video/HEVC_320_AAC_128.mp4";
|
||||
public static final String VIDEO_MPEG2_AAC = "/sdcard/media_api/video/MPEG2_1500_AAC_128.mp4";
|
||||
public static final String VIDEO_HIGHRES_H263 = "/sdcard/media_api/video/H263_500_AMRNB_12.3gp";
|
||||
public static final String VIDEO_HIGHRES_MP4 = "/sdcard/media_api/video/H264_500_AAC_128.3gp";
|
||||
public static final String VIDEO_WEBM = "/sdcard/media_api/video/big-buck-bunny_trailer.webm";
|
||||
|
||||
@@ -432,7 +432,22 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
assertTrue("HEVC playback memory test", memoryResult);
|
||||
}
|
||||
|
||||
// Test case 4: Capture the memory usage after every 20 video only recorded
|
||||
// Test case 4: Capture the memory usage after every 20 mpeg2 playback
|
||||
@LargeTest
|
||||
public void testMPEG2VideoPlaybackMemoryUsage() throws Exception {
|
||||
boolean memoryResult = false;
|
||||
|
||||
mStartPid = getMediaserverPid();
|
||||
for (int i = 0; i < NUM_STRESS_LOOP; i++) {
|
||||
mediaStressPlayback(MediaNames.VIDEO_MPEG2_AAC);
|
||||
getMemoryWriteToLog(i);
|
||||
writeProcmemInfo();
|
||||
}
|
||||
memoryResult = validateMemoryResult(mStartPid, mStartMemory, DECODER_LIMIT);
|
||||
assertTrue("MPEG2 playback memory test", memoryResult);
|
||||
}
|
||||
|
||||
// Test case 5: Capture the memory usage after every 20 video only recorded
|
||||
@LargeTest
|
||||
public void testH263RecordVideoOnlyMemoryUsage() throws Exception {
|
||||
if (mCamcorderProfile != null) {
|
||||
@@ -453,7 +468,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
}
|
||||
}
|
||||
|
||||
// Test case 5: Capture the memory usage after every 20 video only recorded
|
||||
// Test case 6: Capture the memory usage after every 20 video only recorded
|
||||
@LargeTest
|
||||
public void testMpeg4RecordVideoOnlyMemoryUsage() throws Exception {
|
||||
if (mCamcorderProfile != null) {
|
||||
@@ -474,7 +489,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
}
|
||||
}
|
||||
|
||||
// Test case 6: Capture the memory usage after every 20 video and audio
|
||||
// Test case 7: Capture the memory usage after every 20 video and audio
|
||||
// recorded
|
||||
@LargeTest
|
||||
public void testRecordVideoAudioMemoryUsage() throws Exception {
|
||||
@@ -496,7 +511,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
}
|
||||
}
|
||||
|
||||
// Test case 7: Capture the memory usage after every 20 audio only recorded
|
||||
// Test case 8: Capture the memory usage after every 20 audio only recorded
|
||||
@LargeTest
|
||||
public void testRecordAudioOnlyMemoryUsage() throws Exception {
|
||||
boolean memoryResult = false;
|
||||
@@ -511,7 +526,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med
|
||||
assertTrue("audio record only memory test", memoryResult);
|
||||
}
|
||||
|
||||
// Test case 8: Capture the memory usage after every 20 camera preview
|
||||
// Test case 9: Capture the memory usage after every 20 camera preview
|
||||
@LargeTest
|
||||
public void testCameraPreviewMemoryUsage() throws Exception {
|
||||
boolean memoryResult = false;
|
||||
|
||||
BIN
media/tests/contents/media_api/video/MPEG2_1500_AAC_128.mp4
Normal file
BIN
media/tests/contents/media_api/video/MPEG2_1500_AAC_128.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user