Enable Codec2
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Bug: 128456533
Change-Id: Ibe051f4b19c2dbb0a208e751a3b7a332a329b447
diff --git a/device.mk b/device.mk
index 67d2dc4..1bedad6 100755
--- a/device.mk
+++ b/device.mk
@@ -567,6 +567,23 @@
frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
$(LOCAL_PATH)/media_profiles_V1_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
+# Codec2 modules
+PRODUCT_PACKAGES += \
+ com.android.media.swcodec \
+ libsfplugin_ccodec \
+
+# Codec2 files
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/media_codecs_c2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_c2.xml \
+ $(LOCAL_PATH)/media_codecs_performance_c2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_c2.xml \
+ frameworks/av/media/libstagefright/data/media_codecs_google_c2_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_audio.xml \
+ frameworks/av/media/libstagefright/data/media_codecs_google_c2_telephony.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_telephony.xml \
+ frameworks/av/media/libstagefright/data/media_codecs_google_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_video.xml \
+
+# Codec2 switch
+PRODUCT_PROPERTY_OVERRIDES += \
+ debug.media.codec2=2 \
+
PRODUCT_PROPERTY_OVERRIDES += \
audio.snd_card.open.retries=50
diff --git a/framework_manifest.xml b/framework_manifest.xml
index c82d51c..c270eb5 100644
--- a/framework_manifest.xml
+++ b/framework_manifest.xml
@@ -1,5 +1,14 @@
<manifest version="1.0" type="framework">
<hal format="hidl">
+ <name>android.hardware.media.c2</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IComponentStore</name>
+ <instance>software</instance>
+ </interface>
+ </hal>
+ <hal format="hidl">
<name>vendor.qti.atcmdfwd</name>
<transport>hwbinder</transport>
<version>1.0</version>
diff --git a/media_codecs_c2.xml b/media_codecs_c2.xml
new file mode 100644
index 0000000..6839306
--- /dev/null
+++ b/media_codecs_c2.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+<!DOCTYPE MediaCodecs [
+<!ELEMENT Include EMPTY>
+<!ATTLIST Include href CDATA #REQUIRED>
+<!ELEMENT MediaCodecs (Decoders|Encoders|Include)*>
+<!ELEMENT Decoders (MediaCodec|Include)*>
+<!ELEMENT Encoders (MediaCodec|Include)*>
+<!ELEMENT MediaCodec (Type|Quirk|Include)*>
+<!ATTLIST MediaCodec name CDATA #REQUIRED>
+<!ATTLIST MediaCodec type CDATA>
+<!ELEMENT Type EMPTY>
+<!ATTLIST Type name CDATA #REQUIRED>
+<!ELEMENT Quirk EMPTY>
+<!ATTLIST Quirk name CDATA #REQUIRED>
+]>
+
+There's a simple and a complex syntax to declare the availability of a
+media codec:
+
+A codec that properly follows the OpenMax spec and therefore doesn't have any
+quirks and that only supports a single content type can be declared like so:
+
+ <MediaCodec name="OMX.foo.bar" type="something/interesting" />
+
+If a codec has quirks OR supports multiple content types, the following syntax
+can be used:
+
+ <MediaCodec name="OMX.foo.bar" >
+ <Type name="something/interesting" />
+ <Type name="something/else" />
+ ...
+ <Quirk name="requires-allocate-on-input-ports" />
+ <Quirk name="requires-allocate-on-output-ports" />
+ <Quirk name="output-buffers-are-unreadable" />
+ </MediaCodec>
+
+Only the three quirks included above are recognized at this point:
+
+"requires-allocate-on-input-ports"
+ must be advertised if the component does not properly support specification
+ of input buffers using the OMX_UseBuffer(...) API but instead requires
+ OMX_AllocateBuffer to be used.
+
+"requires-allocate-on-output-ports"
+ must be advertised if the component does not properly support specification
+ of output buffers using the OMX_UseBuffer(...) API but instead requires
+ OMX_AllocateBuffer to be used.
+
+"output-buffers-are-unreadable"
+ must be advertised if the emitted output buffers of a decoder component
+ are not readable, i.e. use a custom format even though abusing one of
+ the official OMX colorspace constants.
+ Clients of such decoders will not be able to access the decoded data,
+ naturally making the component much less useful. The only use for
+ a component with this quirk is to render the output to the screen.
+ Audio decoders MUST NOT advertise this quirk.
+ Video decoders that advertise this quirk must be accompanied by a
+ corresponding color space converter for thumbnail extraction,
+ matching surfaceflinger support that can render the custom format to
+ a texture and possibly other code, so just DON'T USE THIS QUIRK.
+
+
+-->
+
+<!--
+ 8996 Decoder capabilities
+ __________________________________________________________________
+ | Codec | W H fps Mbps MB/s | Secure-dec |
+ |__________|_________________________________________|____________|
+ | h264 | 3840 2160 60 100 1958400 | Y |
+ | | (4096) (2160) (56) (100) | |
+ | hevc | 3840 2160 60 100 1958400 | Y |
+ | | (4096) (2160) (56) (100) | |
+ | mpeg4 | 1920 1088 60 60 489600 | N |
+ | vp8 | 3840 2160 30 20 979200 | N |
+ | vp9 | 3840 2160 30 20 979200 | Y |
+ | h263 | 864 480 30 2 48600 | N |
+ |__________|_________________________________________|____________|
+
+
+ 8996 Encoder capabilities
+ ______________________________________________________
+ | Codec | W H fps Mbps MB/s |
+ |__________|_________________________________________|
+ | h264 | 3840 2160 30 100 979200 |
+ | hevc | 3840 2160 30 100 979200 |
+ | mpeg4 | 1920 1088 60 60 489600 |
+ | vp8 | 3840 2160 30 20 979200 |
+ | h263 | 864 480 30 2 48600 |
+ |__________|_________________________________________|
+-->
+
+<MediaCodecs>
+ <Include href="media_codecs_google_c2_audio.xml" />
+ <Include href="media_codecs_google_c2_telephony.xml" />
+ <Include href="media_codecs_google_c2_video.xml" />
+</MediaCodecs>
diff --git a/media_codecs_performance_c2.xml b/media_codecs_performance_c2.xml
new file mode 100644
index 0000000..5916caa
--- /dev/null
+++ b/media_codecs_performance_c2.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Generated file for wahoo using measurements between PPR1.180405.004 and PPR1.180514.002 -->
+<MediaCodecs>
+ <Encoders>
+ <MediaCodec name="c2.android.h263.encoder" type="video/3gpp" update="true">
+ <Limit name="measured-frame-rate-176x144" range="300-478" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.avc.encoder" type="video/avc" update="true">
+ <Limit name="measured-frame-rate-320x240" range="155-277" />
+ <Limit name="measured-frame-rate-720x480" range="90-94" />
+ <Limit name="measured-frame-rate-1280x720" range="25-54" />
+ <Limit name="measured-frame-rate-1920x1080" range="24-27" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es" update="true">
+ <Limit name="measured-frame-rate-176x144" range="253-531" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
+ <Limit name="measured-frame-rate-320x180" range="57-75" />
+ <Limit name="measured-frame-rate-640x360" range="43-43" />
+ <Limit name="measured-frame-rate-1280x720" range="17-17" />
+ <Limit name="measured-frame-rate-1920x1080" range="12-12" />
+ </MediaCodec>
+ </Encoders>
+ <Decoders>
+ <MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
+ <Limit name="measured-frame-rate-176x144" range="155-341" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.avc.decoder" type="video/avc" update="true">
+ <Limit name="measured-frame-rate-320x240" range="170-373" />
+ <Limit name="measured-frame-rate-720x480" range="50-77" />
+ <Limit name="measured-frame-rate-1280x720" range="28-38" />
+ <Limit name="measured-frame-rate-1920x1080" range="15-15" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.hevc.decoder" type="video/hevc" update="true">
+ <Limit name="measured-frame-rate-352x288" range="625-626" />
+ <Limit name="measured-frame-rate-640x360" range="289-289" />
+ <Limit name="measured-frame-rate-720x480" range="227-227" />
+ <Limit name="measured-frame-rate-1280x720" range="84-84" />
+ <Limit name="measured-frame-rate-1920x1080" range="46-46" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
+ <Limit name="measured-frame-rate-176x144" range="187-411" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
+ <Limit name="measured-frame-rate-320x180" range="579-754" />
+ <Limit name="measured-frame-rate-640x360" range="402-402" />
+ <Limit name="measured-frame-rate-1920x1080" range="36-36" />
+ </MediaCodec>
+ <MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
+ <Limit name="measured-frame-rate-320x180" range="855-855" />
+ <Limit name="measured-frame-rate-640x360" range="321-333" />
+ <Limit name="measured-frame-rate-1280x720" range="121-121" />
+ <Limit name="measured-frame-rate-1920x1080" range="67-67" />
+ </MediaCodec>
+ </Decoders>
+</MediaCodecs>