Merge "conf_files: lito: Remove MPEGH encoder/decoder from Media codec list"
diff --git a/conf_files/bengal/bengal.mk b/conf_files/bengal/bengal.mk
index d927f4f..b691556 100644
--- a/conf_files/bengal/bengal.mk
+++ b/conf_files/bengal/bengal.mk
@@ -6,8 +6,6 @@
     $(CONFIG_PATH)/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
     $(CONFIG_PATH)/media_codecs_vendor.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_vendor.xml \
     $(CONFIG_PATH)/media_codecs_vendor_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_vendor_audio.xml \
-	$(CONFIG_PATH)/media_codecs_vendor_v1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_vendor_v1.xml \
-	$(CONFIG_PATH)/media_codecs_performance_v1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_v1.xml \
     $(CONFIG_PATH)/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml \
     $(CONFIG_PATH)/mediacodec-seccomp.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
     $(CONFIG_PATH)/system_properties.xml:$(TARGET_COPY_OUT_VENDOR)/etc/system_properties.xml
diff --git a/conf_files/bengal/media_codecs.xml b/conf_files/bengal/media_codecs.xml
index 62cc8c3..972e215 100644
--- a/conf_files/bengal/media_codecs.xml
+++ b/conf_files/bengal/media_codecs.xml
@@ -83,37 +83,25 @@
  Non-Secure decoder capabilities
  (MB is defined as 16x16)
 
-  ______________________________________________________
- | Codec       | W       H       fps     Mbps    MB/s    |
+  _______________________________________________________
+ | Codec       |  W        H    fps     Mbps     MB/s    |
  |_____________|_________________________________________|
- | h264        | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | hevc        | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | mpeg4-sw    | 1920    1088    30      40      244800  |
- | vp8         | 4096    2160    30      120     1036800 |
- |             | (4096)  (2304)  (24)    (120)           |
- | vp9         | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | vc1         | 1920    1088    30      20      244800  |
- | div4/5/6-sw | 1920    1088    30      10      244800  |
- | h263-sw     | 864     480     30      16       48600   |
- | mpeg2       | 1920    1088    30      40      244800  |
+ | h264        | 1920    1088    60      60     489600   |
+ | hevc        | 1920    1080    60      60     489600   |
+ | mpeg4-sw    | 1920    1088    30      40     244800   |
+ | vc1         | 1920    1088    30      20     244800   |
+ | div4/5/6-sw | 1920    1088    30      10     244800   |
+ | h263-sw     | 864     480     30      16      48600   |
  |_____________|_________________________________________|
 
  Secure decoder capabilities
  (MB is defined as 16x16)
 
- ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
+ _____________________________________________________
+ | Codec    |   W      H     fps     Mbps      MB/s   |
  |__________|_________________________________________|
- | h264     | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | vp9      | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | hevc     | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | mpeg2    | 1920    1088    30      40      244800  |
+ | h264     | 1920    1088    60      35      489600  |
+ | hevc     | 1920    1088    60      35      489600  |
  |__________|_________________________________________|
 
 
@@ -121,15 +109,11 @@
  (MB is defined as 16x16)
 
  ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
+ | Codec    | W       H      fps     Mbps     MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    60      120     2073600 |
- |          | (4096)  (2304)  (30)    (120)           |
- | hevc     | 4096    2160    60      120     2073600 |
- |          | (4096)  (2304)  (30)    (120)           |
- | mpeg4-sw | 1280     720    30      4       108000  |
- | vp8      | 4096    2160    30      120     1036800 |
- |          | (4096)  (2304)  (24)    (120)           |
+ | h264     | 1920    1088    60      40     489600   |
+ | hevc     | 1920    1088    60      40     489600   |
+ | mpeg4-sw | 1280     720    30      4      108000   |
  | h263-sw  | 864     480     30      2       48600   |
  |__________|_________________________________________|
 -->
@@ -146,39 +130,38 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-240" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Limit name="concurrent-instances" max="16" />
             <Limit name="quality" range="0-100" default="80" />
-            <Feature name="bitrate-modes" value="VBR,CBR,CQ" />
+            <Feature name="bitrate-modes" value="VBR,CBR" />
+        </MediaCodec>
+        <MediaCodec name="OMX.qcom.video.encoder.heic" type="image/vnd.android.heic" >
+            <Quirk name="requires-allocate-on-input-ports" />
+            <Quirk name="requires-allocate-on-input-ports" />
+            <Quirk name="requires-allocate-on-output-ports" />
+            <Quirk name="requires-loaded-to-idle-after-allocation" />
+            <Limit name="size" min="512x512" max="8192x8192" />
+            <Limit name="frame-rate" range="1-20" />
+            <Limit name="concurrent-instances" max="6" />
+            <Limit name="quality" range="0-100" default="80" />
+            <Feature name="bitrate-modes" value="CQ" />
         </MediaCodec>
         <!-- Video Software -->
         <MediaCodec name="OMX.qcom.video.encoder.h263sw" type="video/3gpp" >
@@ -211,85 +194,23 @@
         <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.avc.secure" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-60" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
             <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2.secure" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-240" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="6" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9.secure" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-35000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
@@ -298,23 +219,23 @@
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-35000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
diff --git a/conf_files/bengal/media_codecs_performance_v1.xml b/conf_files/bengal/media_codecs_performance_v1.xml
deleted file mode 100644
index fb6d95a..0000000
--- a/conf_files/bengal/media_codecs_performance_v1.xml
+++ /dev/null
@@ -1,145 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!--
-Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
-
-Not a Contribution.
-
-Copyright 2015 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.
-u 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.
--->
-
-<MediaCodecs>
-    <Encoders>
-        <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="238-238" />
-            <Limit name="measured-frame-rate-720x480" range="123-123" />
-            <Limit name="measured-frame-rate-1280x720" range="50-50" />
-            <Limit name="measured-frame-rate-1920x1080" range="16-40" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="226-226" />
-            <Limit name="measured-frame-rate-720x480" range="121-121" />
-            <Limit name="measured-frame-rate-1280x720" range="49-49" />
-            <Limit name="measured-frame-rate-1920x1080" range="55-65" />
-            <Limit name="measured-frame-rate-3840x2160" range="18-25" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.h263sw" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="66-80" />
-            <Limit name="measured-frame-rate-352x288" range="40-85" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.mpeg4sw" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="125-135" />
-            <Limit name="measured-frame-rate-352x288" range="68-85" />
-            <Limit name="measured-frame-rate-640x480" range="47-52" />
-            <Limit name="measured-frame-rate-1280x720" range="30-50" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="266-266" />
-            <Limit name="measured-frame-rate-640x360" range="165-165" />
-            <Limit name="measured-frame-rate-1280x720" range="49-49" />
-            <Limit name="measured-frame-rate-1920x1080" range="16-40" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h264.encoder" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="215-215" />
-            <Limit name="measured-frame-rate-720x480" range="100-100" />
-            <Limit name="measured-frame-rate-1280x720" range="56-56" />
-            <Limit name="measured-frame-rate-1920x1080" range="30-30" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h263.encoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="345-418" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="250-320" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="70-75" />
-            <Limit name="measured-frame-rate-640x360" range="32-32" />
-            <Limit name="measured-frame-rate-1280x720" range="17-24" />
-            <Limit name="measured-frame-rate-1920x1080" range="8-12" />
-        </MediaCodec>
-    </Encoders>
-    <Decoders>
-        <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="550-660" />
-            <Limit name="measured-frame-rate-720x480" range="300-500" />
-            <Limit name="measured-frame-rate-1280x720" range="220-255" />
-            <Limit name="measured-frame-rate-1920x1088" range="71-71" />
-        </MediaCodec>
-            <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="540-600" />
-            <Limit name="measured-frame-rate-720x480" range="350-550" />
-            <Limit name="measured-frame-rate-1280x720" range="180-340" />
-            <Limit name="measured-frame-rate-1920x1080" range="150-185" />
-            <Limit name="measured-frame-rate-3840x2160" range="40-50" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.h263sw" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="356-356" />
-            <Limit name="measured-frame-rate-352x288" range="292-292" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.mpeg4sw" type="video/mp4v-es" update="true">
-            <Limit name="measured-frame-rate-176x144" range="270-295" />
-            <Limit name="measured-frame-rate-480x360" range="245-265" />
-            <Limit name="measured-frame-rate-1280x720" range="95-110" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x240" range="337-337" />
-            <Limit name="measured-frame-rate-640x360" range="337-337" />
-            <Limit name="measured-frame-rate-1280x720" range="337-337" />
-            <Limit name="measured-frame-rate-1920x1080" range="248-248" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x240" range="377-377" />
-            <Limit name="measured-frame-rate-640x360" range="323-323" />
-            <Limit name="measured-frame-rate-1280x720" range="262-262" />
-            <Limit name="measured-frame-rate-1920x1080" range="220-220" />
-            <Limit name="measured-frame-rate-3840x2160" range="51-51" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
-            <Limit name="measured-frame-rate-320x240" range="270-310" />
-            <Limit name="measured-frame-rate-720x480" range="68-68" />
-            <Limit name="measured-frame-rate-1280x720" range="32-32" />
-            <Limit name="measured-frame-rate-1920x1080" range="6-10" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="104-279" />
-            <Limit name="measured-frame-rate-352x288" range="200-200" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.hevc.decoder" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="250-330" />
-            <Limit name="measured-frame-rate-640x360" range="145-190" />
-            <Limit name="measured-frame-rate-720x480" range="225-240" />
-            <Limit name="measured-frame-rate-1280x720" range="88-100" />
-            <Limit name="measured-frame-rate-1920x1080" range="48-52" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.mpeg4.decoder" update="true">
-            <Type name="video/mp4v-es">
-                <Limit name="measured-frame-rate-176x144" range="430-450" />
-            </Type>
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
-            <Limit name="measured-frame-rate-320x180" range="800-850" />
-            <Limit name="measured-frame-rate-320x240" range="330-381" />
-            <Limit name="measured-frame-rate-640x360" range="370-405" />
-            <Limit name="measured-frame-rate-1280x720" range="22-38" />
-            <Limit name="measured-frame-rate-1920x1080" range="30-35" />
-        </MediaCodec>
-        <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
-            <Limit name="measured-frame-rate-320x180" range="640-700" />
-            <Limit name="measured-frame-rate-320x240" range="200-230" />
-            <Limit name="measured-frame-rate-640x360" range="81-90" />
-            <Limit name="measured-frame-rate-1280x720" range="32-40" />
-            <Limit name="measured-frame-rate-1920x1080" range="19-23" />
-        </MediaCodec>
-    </Decoders>
-</MediaCodecs>
diff --git a/conf_files/bengal/media_codecs_vendor.xml b/conf_files/bengal/media_codecs_vendor.xml
index 3568034..746923b 100644
--- a/conf_files/bengal/media_codecs_vendor.xml
+++ b/conf_files/bengal/media_codecs_vendor.xml
@@ -83,37 +83,25 @@
  Non-Secure decoder capabilities
  (MB is defined as 16x16)
 
-  ______________________________________________________
- | Codec       | W       H       fps     Mbps    MB/s    |
+  _______________________________________________________
+ | Codec       |  W        H    fps     Mbps     MB/s    |
  |_____________|_________________________________________|
- | h264        | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | hevc        | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | mpeg4-sw    | 1920    1088    30      40      244800  |
- | vp8         | 4096    2160    30      120     1036800 |
- |             | (4096)  (2304)  (24)    (120)           |
- | vp9         | 4096    2160    60      120     2073600 |
- |             | (4096)  (2304)  (30)    (120)           |
- | vc1         | 1920    1088    30      20      244800  |
- | div4/5/6-sw | 1920    1088    30      10      244800  |
- | h263-sw     | 864     480     30      16       48600   |
- | mpeg2       | 1920    1088    30      40      244800  |
+ | h264        | 1920    1088    60      60     489600   |
+ | hevc        | 1920    1080    60      60     489600   |
+ | mpeg4-sw    | 1920    1088    30      40     244800   |
+ | vc1         | 1920    1088    30      20     244800   |
+ | div4/5/6-sw | 1920    1088    30      10     244800   |
+ | h263-sw     | 864     480     30      16      48600   |
  |_____________|_________________________________________|
 
  Secure decoder capabilities
  (MB is defined as 16x16)
 
- ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
+ _____________________________________________________
+ | Codec    |   W      H     fps     Mbps      MB/s   |
  |__________|_________________________________________|
- | h264     | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | vp9      | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | hevc     | 4096    2160    60      40      2073600 |
- |          | (4096)  (2304)  (30)    (40)            |
- | mpeg2    | 1920    1088    30      40      244800  |
+ | h264     | 1920    1088    60      35      489600  |
+ | hevc     | 1920    1088    60      35      489600  |
  |__________|_________________________________________|
 
 
@@ -121,15 +109,11 @@
  (MB is defined as 16x16)
 
  ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
+ | Codec    | W       H      fps     Mbps     MB/s    |
  |__________|_________________________________________|
- | h264     | 4096    2160    60      120     2073600 |
- |          | (4096)  (2304)  (30)    (120)           |
- | hevc     | 4096    2160    60      120     2073600 |
- |          | (4096)  (2304)  (30)    (120)           |
- | mpeg4-sw | 1280     720    30      4       108000  |
- | vp8      | 4096    2160    30      120     1036800 |
- |          | (4096)  (2304)  (24)    (120)           |
+ | h264     | 1920    1088    60      60     489600   |
+ | hevc     | 1920    1088    60      60     489600   |
+ | mpeg4-sw | 1280     720    30      4      108000   |
  | h263-sw  | 864     480     30      2       48600   |
  |__________|_________________________________________|
 -->
@@ -147,36 +131,24 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-240" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Limit name="concurrent-instances" max="16" />
             <Limit name="quality" range="0-100" default="80" />
             <Feature name="bitrate-modes" value="VBR,CBR" />
@@ -223,85 +195,23 @@
         <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.avc.secure" type="video/avc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-60" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
             <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2.secure" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-240" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="6" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9.secure" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-35000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
@@ -310,23 +220,23 @@
         <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-60000000" />
+            <Limit name="frame-rate" range="1-120" />
             <Feature name="adaptive-playback" />
             <Limit name="concurrent-instances" max="16" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
+            <Limit name="size" min="96x96" max="1920x1088" />
             <Limit name="alignment" value="2x2" />
             <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="2073600" />
-            <Limit name="bitrate" range="1-40000000" />
+            <Limit name="blocks-per-second" min="36" max="489600" />
+            <Limit name="bitrate" range="1-35000000" />
             <Limit name="frame-rate" range="1-60" />
             <Feature name="adaptive-playback" />
             <Feature name="secure-playback" required="true" />
diff --git a/conf_files/bengal/media_codecs_vendor_v1.xml b/conf_files/bengal/media_codecs_vendor_v1.xml
deleted file mode 100644
index 01c5286..0000000
--- a/conf_files/bengal/media_codecs_vendor_v1.xml
+++ /dev/null
@@ -1,380 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012-2019 The Linux Foundation. All rights reserved.
-     Not a contribution.
-     Copyright (C) 2012-2013 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.
-
-
--->
-<!--
- Non-Secure decoder capabilities
- (MB is defined as 16x16)
-
-  ______________________________________________________
- | Codec       | W       H       fps     Mbps    MB/s    |
- |_____________|_________________________________________|
- | h264        | 4096    2160    30      100     1036800 |
- |             | (4096)  (2304)  (24)    (100)           |
- | hevc        | 4096    2160    30      100     1036800 |
- |             | (4096)  (2304)  (24)    (100)           |
- | mpeg4-sw    | 1920    1088    30      40      244800  |
- | vp8         | 1920    1088    60      100     489600  |
- | vp9         | 4096    2160    30      100     1036800 |
- |             | (4096)  (2304)  (24)    (100)           |
- | vc1         | 1920    1088    30      20      244800  |
- | div4/5/6-sw | 1920    1088    30      10      244800  |
- | h263-sw     | 864     480     30      16       48600  |
- | mpeg2       | 1920    1088    30      40      244800  |
- |_____________|_________________________________________|
-
- Secure decoder capabilities
- (MB is defined as 16x16)
-
- ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
- |__________|_________________________________________|
- | h264     | 4096    2160    30      40      1036800 |
- |          | (4096)  (2304)  (24)    (40)           |
- | vp9      | 4096    2160    30      40      1036800 |
- |          | (4096)  (2304)  (24)    (40)           |
- | hevc     | 4096    2160    30      40      1036800 |
- |          | (4096)  (2304)  (24)    (40)           |
- | mpeg2    | 1920    1088    30      40      244800  |
- |__________|_________________________________________|
-
-
- Non-Secure encoder capabilities (Secure not supported)
- (MB is defined as 16x16)
-
- ______________________________________________________
- | Codec    | W       H       fps     Mbps    MB/s    |
- |__________|_________________________________________|
- | h264     | 4096    2160    30      100     1036800 |
- |          | (4096)  (2304)  (24)    (100)           |
- | hevc     | 4096    2160    30      100     1036800 |
- |          | (4096)  (2304)  (24)    (100)           |
- | mpeg4-sw | 1280     720    30      4       108000  |
- | vp8      | 1920    1088    60      40      489600  |
- | h263-sw  | 864     480     30      2       48600   |
- |__________|_________________________________________|
--->
-
-<MediaCodecs>
-    <Include href="media_codecs_vendor_audio.xml" />
-    <Include href="media_codecs_google_telephony.xml" />
-    <Settings>
-        <Setting name="max-video-encoder-input-buffers" value="11" />
-    </Settings>
-    <Encoders>
-        <!-- Video Hardware  -->
-        <MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-100000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="489600" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-120" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.hevc" type="video/hevc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-100000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Limit name="concurrent-instances" max="16" />
-            <Limit name="quality" range="0-100" default="80" />
-            <Feature name="bitrate-modes" value="VBR,CBR" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.heic" type="image/vnd.android.heic" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="512x512" max="8192x8192" />
-            <Limit name="frame-rate" range="1-20" />
-            <Limit name="concurrent-instances" max="6" />
-            <Limit name="quality" range="0-100" default="80" />
-            <Feature name="bitrate-modes" value="CQ" />
-        </MediaCodec>
-        <!-- Video Software -->
-        <MediaCodec name="OMX.qcom.video.encoder.h263sw" type="video/3gpp" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="128x128" max="864x480" />
-            <Limit name="alignment" value="4x4" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="64" max="48600" />
-            <Limit name="bitrate" range="1-2000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.encoder.mpeg4sw" type="video/mp4v-es" >
-             <Quirk name="requires-allocate-on-input-ports" />
-             <Quirk name="requires-allocate-on-output-ports" />
-             <Quirk name="requires-loaded-to-idle-after-allocation" />
-             <Limit name="size" min="128x128" max="1280x720" />
-             <Limit name="alignment" value="2x2" />
-             <Limit name="block-size" value="16x16" />
-             <Limit name="blocks-per-second" min="64" max="108000" />
-             <Limit name="bitrate" range="1-4000000" />
-             <Limit name="frame-rate" range="1-30" />
-             <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-    </Encoders>
-    <Decoders>
-       <!-- Video Hardware  -->
-        <MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-100000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.avc.secure" type="video/avc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-60" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.mpeg2.secure" type="video/mpeg2" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="244800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-30" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="489600" />
-            <Limit name="bitrate" range="1-100000000" />
-            <Limit name="frame-rate" range="1-120" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-100000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="6" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.vp9.secure" type="video/x-vnd.on2.vp9" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-60" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.hevc" type="video/hevc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-120000000" />
-            <Limit name="frame-rate" range="1-480" />
-            <Feature name="adaptive-playback" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qcom.video.decoder.hevc.secure" type="video/hevc" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="96x96" max="4096x2304" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="36" max="1036800" />
-            <Limit name="bitrate" range="1-40000000" />
-            <Limit name="frame-rate" range="1-60" />
-            <Feature name="adaptive-playback" />
-            <Feature name="secure-playback" required="true" />
-            <Limit name="concurrent-instances" max="3" />
-        </MediaCodec>
-        <!-- Video Software -->
-        <MediaCodec name="OMX.qti.video.decoder.h263sw" type="video/3gpp" >
-             <Quirk name="requires-allocate-on-input-ports" />
-             <Quirk name="requires-allocate-on-output-ports" />
-             <Limit name="size" min="128x128" max="864x480" />
-             <Limit name="alignment" value="4x4" />
-             <Limit name="block-size" value="16x16" />
-             <Limit name="blocks-per-second" min="64" max="48600" />
-             <Limit name="bitrate" range="1-16000000" />
-             <Limit name="frame-rate" range="1-30" />
-             <Feature name="adaptive-playback" />
-             <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.mpeg4sw" type="video/mp4v-es">
-             <Quirk name="requires-allocate-on-input-ports" />
-             <Quirk name="requires-allocate-on-output-ports" />
-             <Limit name="size" min="128x128" max="1920x1088" />
-             <Limit name="alignment" value="2x2" />
-             <Limit name="block-size" value="16x16" />
-             <Limit name="blocks-per-second" min="64" max="244800" />
-             <Limit name="bitrate" range="1-40000000" />
-             <Limit name="frame-rate" range="1-30" />
-             <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.divxsw" type="video/divx" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="128x128" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="64" max="244800" />
-            <Limit name="frame-rate" range="1-30" />
-            <Limit name="bitrate" range="1-10000000" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-        <MediaCodec name="OMX.qti.video.decoder.divx4sw" type="video/divx4" >
-            <Quirk name="requires-allocate-on-input-ports" />
-            <Quirk name="requires-allocate-on-output-ports" />
-            <Limit name="size" min="128x128" max="1920x1088" />
-            <Limit name="alignment" value="2x2" />
-            <Limit name="block-size" value="16x16" />
-            <Limit name="blocks-per-second" min="64" max="244800" />
-            <Limit name="frame-rate" range="1-30" />
-            <Limit name="bitrate" range="1-10000000" />
-            <Limit name="concurrent-instances" max="16" />
-        </MediaCodec>
-    </Decoders>
-    <Include href="media_codecs_google_video.xml" />
-</MediaCodecs>
diff --git a/conf_files/bengal/system_properties.xml b/conf_files/bengal/system_properties.xml
index 4b76dab..e93fefc 100644
--- a/conf_files/bengal/system_properties.xml
+++ b/conf_files/bengal/system_properties.xml
@@ -34,9 +34,6 @@
         <property name="vidc_enc_log_in" value="0"/>
         <property name="vidc_enc_log_out" value="0"/>
         <property name="vidc_enc_csc_custom_matrix" value="0"/>
-        <!-- Buffer size : internal : 30 MB (30 X 1), output : 50 MB (3.125 X 16) -->
-        <property name="vidc_dec_sec_prefetch_size_internal" value="31457280"/>
-        <property name="vidc_dec_sec_prefetch_size_output" value="3276800"/>
         <!-- Bitmask for arb mode: 1: AVC, 2: HEVC, 4: MPEG2 -->
         <property name="vidc_dec_arb_mode_override" value="7"/>
 </configs>
diff --git a/conf_files/kona/media_codecs_performance.xml b/conf_files/kona/media_codecs_performance.xml
index 795dd6f..e7fc6f4 100644
--- a/conf_files/kona/media_codecs_performance.xml
+++ b/conf_files/kona/media_codecs_performance.xml
@@ -113,11 +113,11 @@
         </MediaCodec>
         <MediaCodec name="OMX.qti.video.decoder.h263sw" type="video/3gpp" update="true">
             <Limit name="measured-frame-rate-176x144" range="530-650" />
-            <Limit name="measured-frame-rate-352x288" range="292-292" />
+            <Limit name="measured-frame-rate-352x288" range="380-920" />
         </MediaCodec>
         <MediaCodec name="OMX.qti.video.decoder.mpeg4sw" type="video/mp4v-es" update="true">
             <Limit name="measured-frame-rate-176x144" range="381-767" />
-            <Limit name="measured-frame-rate-480x360" range="436-524" />
+            <Limit name="measured-frame-rate-480x360" range="695-915" />
             <Limit name="measured-frame-rate-1280x720" range="240-292" />
         </MediaCodec>
         <MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" update="true">
@@ -129,8 +129,8 @@
         <MediaCodec name="OMX.qcom.video.decoder.vp9" type="video/x-vnd.on2.vp9" update="true">
             <Limit name="measured-frame-rate-320x240" range="806-1245" />
             <Limit name="measured-frame-rate-640x360" range="499-695" />
-            <Limit name="measured-frame-rate-1280x720" range="238-253" />
-            <Limit name="measured-frame-rate-1920x1080" range="175-225" />
+            <Limit name="measured-frame-rate-1280x720" range="485-600" />
+            <Limit name="measured-frame-rate-1920x1080" range="435-495" />
             <Limit name="measured-frame-rate-3840x2160" range="83-98" />
         </MediaCodec>
         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" update="true">
@@ -176,7 +176,7 @@
             <Limit name="measured-frame-rate-1920x1080" range="12-17" />
         </MediaCodec>
         <MediaCodec name="c2.android.hevc.decoder" type="video/hevc" update="true">
-            <Limit name="measured-frame-rate-352x288" range="179-245" />
+            <Limit name="measured-frame-rate-352x288" range="355-960" />
             <Limit name="measured-frame-rate-640x360" range="120-164" />
             <Limit name="measured-frame-rate-720x480" range="111-152" />
             <Limit name="measured-frame-rate-1280x720" range="61-83" />
@@ -186,7 +186,7 @@
             <Limit name="measured-frame-rate-176x144" range="550-1200" />
         </MediaCodec>
         <MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="483-663" />
+            <Limit name="measured-frame-rate-176x144" range="950-1450" />
             <Limit name="measured-frame-rate-352x288" range="324-769" />
         </MediaCodec>
         <MediaCodec name="c2.android.vp9.decoder" type="video/x-vnd.on2.vp9" update="true">
diff --git a/conf_files/lito/media_codecs_performance.xml b/conf_files/lito/media_codecs_performance.xml
index 3d8222e..7281b95 100644
--- a/conf_files/lito/media_codecs_performance.xml
+++ b/conf_files/lito/media_codecs_performance.xml
@@ -175,8 +175,8 @@
             <Limit name="measured-frame-rate-1920x1080" range="29-43" />
         </MediaCodec>
         <MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
-            <Limit name="measured-frame-rate-176x144" range="284-386" />
-            <Limit name="measured-frame-rate-352x288" range="197-284" />
+            <Limit name="measured-frame-rate-176x144" range="450-850" />
+            <Limit name="measured-frame-rate-352x288" range="650-780" />
         </MediaCodec>
         <MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
             <Limit name="measured-frame-rate-176x144" range="374-542" />
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
index ab2bbc4..a1a95b3 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -8662,8 +8662,13 @@
 {
     bool status = true;
     pthread_mutex_lock(&omx->c_lock);
+     /* Whenever port mode is set to kPortModeDynamicANWBuffer, Video Frameworks
+        always uses VideoNativeMetadata and OMX recives buffer type as
+        grallocsource via storeMetaDataInBuffers_l API. The buffer_size
+        will be communicated to frameworks via IndexParamPortdefinition. */
     if (!enabled)
-        buffer_size = omx->drv_ctx.op_buf.buffer_size;
+        buffer_size = omx->dynamic_buf_mode ? sizeof(struct VideoNativeMetadata) :
+                      omx->drv_ctx.op_buf.buffer_size;
     else {
         buffer_size = c2dcc.getBuffSize(C2D_OUTPUT);
     }
@@ -8674,8 +8679,8 @@
 OMX_ERRORTYPE omx_vdec::allocate_color_convert_buf::set_buffer_req(
         OMX_U32 buffer_size, OMX_U32 actual_count)
 {
-    OMX_U32 expectedSize = enabled ? buffer_size_req : omx->drv_ctx.op_buf.buffer_size;
-
+    OMX_U32 expectedSize = enabled ? buffer_size_req : omx->dynamic_buf_mode ?
+            sizeof(struct VideoDecoderOutputMetaData) : omx->drv_ctx.op_buf.buffer_size;
     if (buffer_size < expectedSize) {
         DEBUG_PRINT_ERROR("OP Requirements: Client size(%u) insufficient v/s requested(%u)",
                 buffer_size, expectedSize);
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index 122d22e..48b5845 100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -280,6 +280,12 @@
         | RC_CBR_VFR | RC_CBR_CFR | RC_MBR_CFR | RC_MBR_VFR | RC_CQ)
 };
 
+enum roi_type {
+    ROI_NONE = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_NONE,
+    ROI_2BIT = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BIT,
+    ROI_2BYTE = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE_2BYTE,
+};
+
 class venc_dev
 {
     public:
@@ -370,7 +376,6 @@
         bool is_csc_custom_matrix_enabled;
         bool is_auto_blur_disabled;
         bool csc_enable;
-        OMX_U32 fd_list[64];
         unsigned long get_media_colorformat(unsigned long);
 
     private:
@@ -440,7 +445,6 @@
         bool venc_set_peak_bitrate(OMX_U32 nPeakBitrate);
         bool venc_set_vpx_error_resilience(OMX_BOOL enable);
         bool venc_set_batch_size(OMX_U32 size);
-        bool venc_get_index_from_fd(OMX_U32 buffer_fd, OMX_U32 *index);
         bool venc_set_hierp_layers(OMX_U32 hierp_layers);
         bool venc_set_baselayerid(OMX_U32 baseid);
         bool venc_set_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp,OMX_U32 b_frame_qp, OMX_U32 enable);
@@ -489,6 +493,7 @@
             OMX_QTI_VIDEO_CONFIG_ROIINFO info;
         };
         bool m_roi_enabled;
+        roi_type m_roi_type;
         pthread_mutex_t m_roilock;
         std::list<roidata> m_roilist;
         void get_roi_for_timestamp(struct roidata &roi, OMX_TICKS timestamp);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index 0967944..83cf11e 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -343,14 +343,8 @@
 
     OMX_INIT_STRUCT(&m_sIntraperiod, QOMX_VIDEO_INTRAPERIODTYPE);
     m_sIntraperiod.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
-    m_sIntraperiod.nPFrames = (m_sConfigFramerate.xEncodeFramerate * 2) - 1;
-    /* Consider a scenario where client does get of this and does not modify this
-       and does a set. Then if by default if this is 0 we assume that client is explicitly
-       requesting disabling of B-Frames and our logic to automatically enable bFrames will
-       fail(We do not enable bframes if there is a set of this param with 0 value). We do
-       not want this to happen(also all our default values support auto enabling of B-Frames).
-       We always take care of scenarios where bframes need to be disabled */
-    m_sIntraperiod.nBFrames = 1;
+    m_sIntraperiod.nPFrames = ((m_sConfigFramerate.xEncodeFramerate >> 16) * 2) - 1;
+    m_sIntraperiod.nBFrames = 0;
 
 
     OMX_INIT_STRUCT(&m_sErrorCorrection, OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE);
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 0e080ba..8cbb4fe 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -119,6 +119,7 @@
     hw_overload = false;
     mBatchSize = 0;
     m_roi_enabled = false;
+    m_roi_type = ROI_NONE;
     m_cvp_meta_enabled = false;
     m_cvp_first_metadata = false;
     low_latency_mode = false;
@@ -152,7 +153,6 @@
     memset(&voptimecfg, 0, sizeof(voptimecfg));
     memset(&capability, 0, sizeof(capability));
     memset(&m_debug,0,sizeof(m_debug));
-    memset(&fd_list, 0, sizeof(fd_list));
     sess_priority.priority = 1;
     operating_rate = 30;
     memset(&color_space, 0x0, sizeof(color_space));
@@ -645,7 +645,7 @@
 bool venc_dev::handle_input_extradata(struct v4l2_buffer buf)
 {
     unsigned int filled_len = 0;
-    unsigned int index = 0;
+    unsigned int index = buf.index;
     int height = m_sVenc_cfg.input_height;
     int width = m_sVenc_cfg.input_width;
     OMX_TICKS nTimeStamp = static_cast<OMX_TICKS>(buf.timestamp.tv_sec) * 1000000 + buf.timestamp.tv_usec;
@@ -662,11 +662,6 @@
         return true;
     }
 
-    if (!venc_get_index_from_fd(fd, &index)) {
-        DEBUG_PRINT_LOW("Index not found for fd %d", fd);
-        return false;
-    }
-
     if (!input_extradata_info.ion[index].uaddr) {
         DEBUG_PRINT_ERROR("Extradata buffers not allocated\n");
         return true;
@@ -1137,14 +1132,15 @@
         return OMX_ErrorNone;
     }
 
-    if (!extradata_info->buffer_size) {
-        DEBUG_PRINT_ERROR("Invalid extradata buffer size for port %d", extradata_info->port_index);
+    if (!extradata_info->buffer_size || !extradata_info->count) {
+        DEBUG_PRINT_ERROR("Invalid extradata buffer size(%lu) or count(%d) for port %d",
+            extradata_info->buffer_size, extradata_info->count, extradata_info->port_index);
         return OMX_ErrorUndefined;
     }
 
 #ifdef USE_ION
 
-    for (int i = 0; i < VIDEO_MAX_FRAME; i++) {
+    for (int i = 0; i < extradata_info->count; i++) {
         if (extradata_info->ion[i].data_fd != -1) {
             venc_handle->ion_unmap(extradata_info->ion[i].data_fd,
                     (void *)extradata_info->ion[i].uaddr, extradata_info->buffer_size);
@@ -1189,7 +1185,7 @@
         return;
     }
 
-    for (int i = 0; i < VIDEO_MAX_FRAME; i++) {
+    for (int i = 0; i < extradata_info->count; i++) {
         if (extradata_info->ion[i].uaddr) {
             venc_handle->ion_unmap(extradata_info->ion[i].data_fd,
                     (void *)extradata_info->ion[i].uaddr, extradata_info->buffer_size);
@@ -1872,7 +1868,7 @@
             return false;
         }
         input_extradata_info.buffer_size =  ALIGN(extra_data_size, SZ_4K);
-        input_extradata_info.count = MAX_V4L2_BUFS;
+        input_extradata_info.count = m_sInput_buff_property.actualcount;
         venc_handle->m_client_in_extradata_info.set_extradata_info(input_extradata_info.buffer_size,m_sInput_buff_property.actualcount);
     } else {
         unsigned int extra_idx = 0;
@@ -2284,10 +2280,6 @@
     struct v4l2_encoder_cmd enc;
     DEBUG_PRINT_LOW("in %s", __func__);
 
-    for (unsigned int i = 0; i < (sizeof(fd_list)/sizeof(fd_list[0])); i++) {
-        fd_list[i] = 0;
-    }
-
     enc.cmd = V4L2_CMD_FLUSH;
     enc.flags = V4L2_CMD_FLUSH_OUTPUT | V4L2_CMD_FLUSH_CAPTURE;
 
@@ -2464,8 +2456,7 @@
     struct v4l2_buffer buf;
     struct v4l2_requestbuffers bufreq;
     struct v4l2_plane plane[VIDEO_MAX_PLANES];
-    int rc = 0, extra_idx;
-    OMX_U32 extradata_index;
+    int rc = 0, extra_idx, c2d_enabled = 0;
     bool interlace_flag = false;
     struct OMX_BUFFERHEADERTYPE *bufhdr;
     LEGACY_CAM_METADATA_TYPE * meta_buf = NULL;
@@ -2847,6 +2838,7 @@
                 // color_format == 1 ==> RGBA to YUV Color-converted buffer
                 // Buffers color-converted via C2D have 601 color
                 if (!streaming[OUTPUT_PORT]) {
+                    c2d_enabled = 1;
                     DEBUG_PRINT_HIGH("Setting colorspace 601 for Color-converted buffer");
                     venc_set_colorspace(MSM_VIDC_BT601_6_625, color_space.range,
                             MSM_VIDC_TRANSFER_601_6_525, MSM_VIDC_MATRIX_601_6_525);
@@ -2878,6 +2870,18 @@
         buf_type=V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
         int ret;
 
+        // Some 3rd APPs use NativeRecorder to implement their applications
+        // like screenrecorder, implicitly enable B-frame may cause issues.
+        // So disallow implicit B-frame when input format is non-UBWC or RGBA(c2d enabled).
+        if ((m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_TP10_UBWC &&
+             m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_UBWC) || c2d_enabled) {
+            DEBUG_PRINT_HIGH("Disallow implicitly enable B-frames");
+            if (!set_native_recoder(OMX_FALSE)) {
+                DEBUG_PRINT_ERROR("Failed to set Native Recorder");
+                return false;
+            }
+        }
+
         if (!downscalar_enabled) {
             OMX_U32 inp_width = 0, inp_height = 0, out_width = 0, out_height = 0;
 
@@ -2914,16 +2918,11 @@
     extra_idx = EXTRADATA_IDX(num_input_planes);
 
     if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
-        if (!venc_get_index_from_fd(fd, &extradata_index)) {
-            DEBUG_PRINT_ERROR("Extradata index not found for fd: %d\n", fd);
-            return false;
-        }
-
         plane[extra_idx].bytesused = input_extradata_info.buffer_size;
         plane[extra_idx].length = input_extradata_info.buffer_size;
-        plane[extra_idx].m.userptr = (unsigned long)input_extradata_info.ion[extradata_index].uaddr;
+        plane[extra_idx].m.userptr = (unsigned long)input_extradata_info.ion[index].uaddr;
 #ifdef USE_ION
-        plane[extra_idx].reserved[MSM_VIDC_BUFFER_FD] = input_extradata_info.ion[extradata_index].data_fd;
+        plane[extra_idx].reserved[MSM_VIDC_BUFFER_FD] = input_extradata_info.ion[index].data_fd;
 #endif
         plane[extra_idx].reserved[MSM_VIDC_DATA_OFFSET] = 0;
         plane[extra_idx].data_offset = 0;
@@ -2967,8 +2966,8 @@
     }
     if (m_debug.extradata_log && extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
         DEBUG_PRINT_ERROR("Extradata Addr 0x%llx, Buffer Addr = 0x%x",
-            (OMX_U64)input_extradata_info.ion[extradata_index].uaddr, (unsigned int)plane[extra_idx].m.userptr);
-        venc_extradata_log_buffers((char *)plane[extra_idx].m.userptr, extradata_index, true);
+            (OMX_U64)input_extradata_info.ion[index].uaddr, (unsigned int)plane[index].m.userptr);
+        venc_extradata_log_buffers((char *)plane[extra_idx].m.userptr, index, true);
     }
     rc = ioctl(m_nDriver_fd, VIDIOC_QBUF, &buf);
 
@@ -3094,17 +3093,10 @@
             extra_idx = EXTRADATA_IDX(num_input_planes);
 
             if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
-                int fd = plane[0].reserved[MSM_VIDC_BUFFER_FD];
-                OMX_U32 extradata_index;
-                if (!venc_get_index_from_fd(fd, &extradata_index)) {
-                    DEBUG_PRINT_ERROR("Extradata index not found for fd: %d\n", fd);
-                    return false;
-                }
-
                 plane[extra_idx].bytesused = input_extradata_info.buffer_size;
                 plane[extra_idx].length = input_extradata_info.buffer_size;
-                plane[extra_idx].m.userptr = (unsigned long)input_extradata_info.ion[extradata_index].uaddr;
-                plane[extra_idx].reserved[MSM_VIDC_BUFFER_FD] = input_extradata_info.ion[extradata_index].data_fd;
+                plane[extra_idx].m.userptr = (unsigned long)input_extradata_info.ion[v4l2Id].uaddr;
+                plane[extra_idx].reserved[MSM_VIDC_BUFFER_FD] = input_extradata_info.ion[v4l2Id].data_fd;
                 plane[extra_idx].reserved[MSM_VIDC_DATA_OFFSET] = 0;
                 plane[extra_idx].data_offset = 0;
             } else if (extra_idx >= VIDEO_MAX_PLANES) {
@@ -3259,28 +3251,6 @@
     return true;
 }
 
-bool venc_dev::venc_get_index_from_fd(OMX_U32 buffer_fd, OMX_U32 *index)
-{
-    for (unsigned int i = 0; i < (sizeof(fd_list)/sizeof(fd_list[0])); i++) {
-        if (fd_list[i] == buffer_fd) {
-            DEBUG_PRINT_HIGH("FD : %d found at index = %d", buffer_fd, i);
-            *index = i;
-            return true;
-        }
-    }
-
-    for (unsigned int i = 0; i < (sizeof(fd_list)/sizeof(fd_list[0])); i++) {
-        if (fd_list[i] == 0) {
-            DEBUG_PRINT_HIGH("FD : %d added at index = %d", buffer_fd, i);
-            fd_list[i] = buffer_fd;
-            *index = i;
-            return true;
-        }
-    }
-    DEBUG_PRINT_ERROR("Couldn't get index from fd : %d",buffer_fd);
-    return false;
-}
-
 bool venc_dev::venc_set_colorspace(OMX_U32 primaries, OMX_U32 range,
     OMX_U32 transfer_chars, OMX_U32 matrix_coeffs)
 {
@@ -4605,8 +4575,9 @@
 *==================================================================================*/
 bool venc_dev::venc_set_roi_region_qp_info(OMX_QTI_VIDEO_CONFIG_ROI_RECT_REGION_INFO *roiRegionInfo)
 {
-    if (!m_roi_enabled) {
-        DEBUG_PRINT_ERROR("ROI-Region: roi info not enabled");
+    if (!m_roi_enabled || m_roi_type == ROI_NONE) {
+        DEBUG_PRINT_ERROR("ROI-Region: roi info not enabled (%d) or unknown roi type (%u)",
+            m_roi_enabled, m_roi_type);
         return false;
     }
     if (!roiRegionInfo) {
@@ -4676,53 +4647,124 @@
     DEBUG_PRINT_LOW("ROI-Region: clip(%ux%u: %s), mb(%ux%u), region(num:%u, ts:%lld)",
             width, height, isHevc ? "hevc" : "avc", mbRow, mbCol, regionInfo.nRegionNum,
             regionInfo.nTimeStamp);
-    OMX_U32 mbRowAligned = ALIGN(mbRow, 8);
-    numBytes = mbRowAligned * mbCol * 2;
-    OMX_U32 numBytesAligned = ALIGN(numBytes, 4);
 
-    data->nDataSize = ALIGN(sizeof(struct msm_vidc_roi_deltaqp_payload), 256)
-                        + numBytesAligned;
-    data->nSize = ALIGN(sizeof(OMX_OTHER_EXTRADATATYPE) + data->nDataSize, 4);
-    if (data->nSize > freeSize) {
-        DEBUG_PRINT_ERROR("ROI-Region: Buffer size(%u) is less than ROI extradata size(%u)",
-                 freeSize, data->nSize);
-        data->nDataSize = 0;
-        data->nSize = 0;
-        return 0;
-    }
+    if (m_roi_type == ROI_2BYTE) {
+        OMX_U32 mbRowAligned = ALIGN(mbRow, 8);
+        numBytes = mbRowAligned * mbCol * 2;
+        OMX_U32 numBytesAligned = ALIGN(numBytes, 4);
 
-    data->nVersion.nVersion = OMX_SPEC_VERSION;
-    data->nPortIndex = 0;
-    data->eType = (OMX_EXTRADATATYPE)MSM_VIDC_EXTRADATA_ROI_QP;
-    struct msm_vidc_roi_deltaqp_payload *roiData =
-            (struct msm_vidc_roi_deltaqp_payload *)(data->data);
-    roiData->b_roi_info = true;
-    roiData->mbi_info_size = numBytesAligned;
-    roiData->data[0] = (unsigned int)(ALIGN(&roiData->data[1], 256)
-            - (unsigned long)roiData->data);
-    OMX_U16* exDataBuf = (OMX_U16*)((OMX_U8*)roiData->data + roiData->data[0]);
-    OMX_U32 mb = 0;
-    OMX_U16 *pData = NULL;
-
-    for (OMX_U8 i = 0; i < regionInfo.nRegionNum; i++) {
-        mbLeft = regionInfo.nRegions[i].nLeft >> mbBit;
-        mbTop = regionInfo.nRegions[i].nTop >> mbBit;
-        mbRight = regionInfo.nRegions[i].nRight >> mbBit;
-        mbBottom = regionInfo.nRegions[i].nBottom >> mbBit;
-        deltaQP = regionInfo.nRegions[i].nDeltaQP;
-        if (mbLeft >= mbRow || mbRight >= mbRow
-                || mbTop >= mbCol || mbBottom >= mbCol) {
-            continue;
+        data->nDataSize = ALIGN(sizeof(struct msm_vidc_roi_deltaqp_payload), 256)
+                            + numBytesAligned;
+        data->nSize = ALIGN(sizeof(OMX_OTHER_EXTRADATATYPE) + data->nDataSize, 4);
+        if (data->nSize > freeSize) {
+            DEBUG_PRINT_ERROR("ROI-Region: Buffer size(%u) is less than ROI extradata size(%u)",
+                     freeSize, data->nSize);
+            data->nDataSize = 0;
+            data->nSize = 0;
+            return 0;
         }
-        for (OMX_U32 row = mbTop; row <= mbBottom; row++) {
-            for (OMX_U32 col = mbLeft; col <= mbRight; col++) {
-                mb = row * mbRowAligned + col;
-                pData = exDataBuf + mb;
-               *pData = (1 << 11) | ((deltaQP & 0x3F) << 4);
+
+        data->nVersion.nVersion = OMX_SPEC_VERSION;
+        data->nPortIndex = 0;
+        data->eType = (OMX_EXTRADATATYPE)MSM_VIDC_EXTRADATA_ROI_QP;
+        struct msm_vidc_roi_deltaqp_payload *roiData =
+                (struct msm_vidc_roi_deltaqp_payload *)(data->data);
+        roiData->b_roi_info = true;
+        roiData->mbi_info_size = numBytesAligned;
+        roiData->data[0] = (unsigned int)(ALIGN(&roiData->data[1], 256)
+                - (unsigned long)roiData->data);
+        OMX_U16* exDataBuf = (OMX_U16*)((OMX_U8*)roiData->data + roiData->data[0]);
+        OMX_U32 mb = 0;
+        OMX_U16 *pData = NULL;
+
+        for (OMX_U8 i = 0; i < regionInfo.nRegionNum; i++) {
+            mbLeft = regionInfo.nRegions[i].nLeft >> mbBit;
+            mbTop = regionInfo.nRegions[i].nTop >> mbBit;
+            mbRight = regionInfo.nRegions[i].nRight >> mbBit;
+            mbBottom = regionInfo.nRegions[i].nBottom >> mbBit;
+            deltaQP = regionInfo.nRegions[i].nDeltaQP;
+            if (mbLeft >= mbRow || mbRight >= mbRow
+                    || mbTop >= mbCol || mbBottom >= mbCol) {
+                continue;
+            }
+            for (OMX_U32 row = mbTop; row <= mbBottom; row++) {
+                for (OMX_U32 col = mbLeft; col <= mbRight; col++) {
+                    mb = row * mbRowAligned + col;
+                    pData = exDataBuf + mb;
+                   *pData = (1 << 11) | ((deltaQP & 0x3F) << 4);
+                }
             }
         }
+        DEBUG_PRINT_LOW("ROI-Region(2Byte): set roi: raw size: %u", numBytesAligned);
+    } else if (m_roi_type == ROI_2BIT) {
+        numBytes = (mbRow * mbCol * 2 + 7) >> 3;
+        data->nDataSize = sizeof(struct msm_vidc_roi_qp_payload) + numBytes;
+        data->nSize = ALIGN(sizeof(OMX_OTHER_EXTRADATATYPE) + data->nDataSize, 4);
+
+        if (data->nSize > freeSize) {
+            DEBUG_PRINT_ERROR("ROI-Region: Buffer size(%u) is less than ROI extradata size(%u)",
+                    freeSize, data->nSize);
+            data->nDataSize = 0;
+            data->nSize = 0;
+            return 0;
+        }
+
+        data->nVersion.nVersion = OMX_SPEC_VERSION;
+        data->nPortIndex = 0;
+        data->eType = (OMX_EXTRADATATYPE)MSM_VIDC_EXTRADATA_ROI_QP;
+        struct msm_vidc_roi_qp_payload *roiData =
+                (struct msm_vidc_roi_qp_payload *)(data->data);
+        roiData->b_roi_info = true;
+        roiData->mbi_info_size = numBytes;
+        roiData->lower_qp_offset = 0;
+        roiData->upper_qp_offset = 0;
+        OMX_U8 flag = 0x1;
+        OMX_U32 mb, mb_byte = 0;
+        OMX_U8 mb_bit = 0;
+        OMX_U8 *pData = NULL;
+
+        for (OMX_U8 i = 0; i < regionInfo.nRegionNum; i++) {
+            mbLeft = regionInfo.nRegions[i].nLeft >> mbBit;
+            mbTop = regionInfo.nRegions[i].nTop >> mbBit;
+            mbRight = regionInfo.nRegions[i].nRight >> mbBit;
+            mbBottom = regionInfo.nRegions[i].nBottom >> mbBit;
+            deltaQP = regionInfo.nRegions[i].nDeltaQP;
+            if (mbLeft >= mbRow || mbRight >= mbRow
+                    || mbTop >= mbCol || mbBottom >= mbCol
+                    || deltaQP == 0) {
+                continue;
+            }
+            // choose the minimum absolute value for lower and upper offset
+            if (deltaQP < 0) {
+                if (roiData->lower_qp_offset == 0) {
+                    roiData->lower_qp_offset = deltaQP;
+                } else if (roiData->lower_qp_offset < deltaQP) {
+                    roiData->lower_qp_offset = deltaQP;
+                }
+                flag = 0x1;
+            } else {
+                if (roiData->upper_qp_offset == 0) {
+                    roiData->upper_qp_offset = deltaQP;
+                } else if (roiData->upper_qp_offset > deltaQP) {
+                    roiData->upper_qp_offset = deltaQP;
+                }
+                flag = 0x2;
+            }
+            for (OMX_U32 row = mbTop; row <= mbBottom; row++) {
+                for (OMX_U32 col = mbLeft; col <= mbRight; col++) {
+                    mb = row * mbRow + col;
+                    mb_byte = mb >> 2;
+                    mb_bit = (3 - (mb & 0x3)) << 1;
+                    pData = (OMX_U8 *)roiData->data + mb_byte;
+                    *pData |= (flag << mb_bit);
+                }
+            }
+        }
+        DEBUG_PRINT_LOW("ROI-Region(2Bit):set roi low:%d,up:%d", roiData->lower_qp_offset, roiData->upper_qp_offset);
+    } else {
+        DEBUG_PRINT_ERROR("Invalied roi type : %u", m_roi_type);
+        return 0;
     }
-    DEBUG_PRINT_LOW("ROI-Region: set roi: raw size: %u", numBytesAligned);
     return data->nSize;
 }
 
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
index 0ddc8ce..1b892f2 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2_params.cpp
@@ -567,8 +567,10 @@
                             return false;
                         }
 
-                        if (num_input_planes > 1)
-                            input_extradata_info.count = m_sInput_buff_property.actualcount + 1;
+                        if (num_input_planes > 1) {
+                            input_extradata_info.count = m_sInput_buff_property.actualcount;
+                            venc_handle->m_client_in_extradata_info.set_extradata_info(input_extradata_info.buffer_size, input_extradata_info.count);
+                        }
 
                         if (!downscalar_enabled) {
                             m_sVenc_cfg.dvs_height = portDefn->format.video.nFrameHeight;
@@ -648,8 +650,10 @@
                             return false;
                         }
 
-                        if (num_output_planes > 1)
+                        if (num_output_planes > 1) {
                             output_extradata_info.count = m_sOutput_buff_property.actualcount;
+                            venc_handle->m_client_out_extradata_info.set_extradata_info(output_extradata_info.buffer_size, output_extradata_info.count);
+                        }
                     } else {
                         DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamPortDefinition: parameters not changed on port %d",
                             portDefn->nPortIndex);
@@ -929,8 +933,25 @@
                     return false;
                 }
 
-                if (pParam->nIndex == (OMX_INDEXTYPE)OMX_QTI_ExtraDataCategory_Enc_ROI && pParam->bEnabled)
+                if (pParam->nIndex == (OMX_INDEXTYPE)OMX_QTI_ExtraDataCategory_Enc_ROI && pParam->bEnabled) {
                     m_roi_enabled = true;
+                    struct v4l2_control control;
+                    control.id = V4L2_CID_MPEG_VIDC_VIDEO_ROI_TYPE;
+                    control.value = ROI_NONE;
+                    if (ioctl(m_nDriver_fd, VIDIOC_G_CTRL, &control)) {
+                        DEBUG_PRINT_ERROR("ERROR: failed to query supported ROI type");
+                        m_roi_type = ROI_NONE;
+                    } else {
+                        auto type = static_cast<roi_type>(control.value);
+                        if (type != ROI_2BIT && type != ROI_2BYTE) {
+                            DEBUG_PRINT_LOW("invalid ROI type : %u", m_roi_type);
+                            m_roi_type = ROI_NONE;
+                        } else {
+                            m_roi_type = type;
+                            DEBUG_PRINT_LOW("queried ROI type : %u", m_roi_type);
+                        }
+                    }
+                }
 
                 break;
             }