Merge \"getPrimary APIs now examine all non-duplicating output threads\" into nyc-mr1-dev
am: 3f69461e78

Change-Id: I76898dd3427d8e8b3a9d64bd01b60f137c7cb91f
diff --git a/camera/CameraUtils.cpp b/camera/CameraUtils.cpp
index 1676be1..67fc116 100644
--- a/camera/CameraUtils.cpp
+++ b/camera/CameraUtils.cpp
@@ -45,7 +45,7 @@
     }
 
     camera_metadata_ro_entry_t entryFacing = staticInfo.find(ANDROID_LENS_FACING);
-    if (entry.count == 0) {
+    if (entryFacing.count == 0) {
         ALOGE("%s: Can't find android.lens.facing in static metadata!", __FUNCTION__);
         return INVALID_OPERATION;
     }
diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp
index 0680d7c..2bf956d 100644
--- a/camera/ICamera.cpp
+++ b/camera/ICamera.cpp
@@ -60,7 +60,7 @@
 class BpCamera: public BpInterface<ICamera>
 {
 public:
-    BpCamera(const sp<IBinder>& impl)
+    explicit BpCamera(const sp<IBinder>& impl)
         : BpInterface<ICamera>(impl)
     {
     }
diff --git a/camera/ICameraClient.cpp b/camera/ICameraClient.cpp
index 68cbfb8..1b6fac4 100644
--- a/camera/ICameraClient.cpp
+++ b/camera/ICameraClient.cpp
@@ -37,7 +37,7 @@
 class BpCameraClient: public BpInterface<ICameraClient>
 {
 public:
-    BpCameraClient(const sp<IBinder>& impl)
+    explicit BpCameraClient(const sp<IBinder>& impl)
         : BpInterface<ICameraClient>(impl)
     {
     }
diff --git a/camera/ICameraRecordingProxy.cpp b/camera/ICameraRecordingProxy.cpp
index 63c4b1d..c9f8b5c 100644
--- a/camera/ICameraRecordingProxy.cpp
+++ b/camera/ICameraRecordingProxy.cpp
@@ -38,7 +38,7 @@
 class BpCameraRecordingProxy: public BpInterface<ICameraRecordingProxy>
 {
 public:
-    BpCameraRecordingProxy(const sp<IBinder>& impl)
+    explicit BpCameraRecordingProxy(const sp<IBinder>& impl)
         : BpInterface<ICameraRecordingProxy>(impl)
     {
     }
diff --git a/camera/ICameraRecordingProxyListener.cpp b/camera/ICameraRecordingProxyListener.cpp
index fa4dfd8..8529d3e 100644
--- a/camera/ICameraRecordingProxyListener.cpp
+++ b/camera/ICameraRecordingProxyListener.cpp
@@ -33,7 +33,7 @@
 class BpCameraRecordingProxyListener: public BpInterface<ICameraRecordingProxyListener>
 {
 public:
-    BpCameraRecordingProxyListener(const sp<IBinder>& impl)
+    explicit BpCameraRecordingProxyListener(const sp<IBinder>& impl)
         : BpInterface<ICameraRecordingProxyListener>(impl)
     {
     }
diff --git a/camera/ICameraServiceProxy.cpp b/camera/ICameraServiceProxy.cpp
index 694e9c3..a9d0836 100644
--- a/camera/ICameraServiceProxy.cpp
+++ b/camera/ICameraServiceProxy.cpp
@@ -26,7 +26,8 @@
 
 class BpCameraServiceProxy: public BpInterface<ICameraServiceProxy> {
 public:
-    BpCameraServiceProxy(const sp<IBinder>& impl) : BpInterface<ICameraServiceProxy>(impl) {}
+    explicit BpCameraServiceProxy(const sp<IBinder>& impl)
+        : BpInterface<ICameraServiceProxy>(impl) {}
 
     virtual void pingForUserUpdate() {
         Parcel data;
diff --git a/camera/tests/Android.mk b/camera/tests/Android.mk
index 8019999..0978a81 100644
--- a/camera/tests/Android.mk
+++ b/camera/tests/Android.mk
@@ -21,6 +21,7 @@
 	CameraBinderTests.cpp
 
 LOCAL_SHARED_LIBRARIES := \
+	liblog \
 	libutils \
 	libcutils \
 	libcamera_metadata \
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index ca68722..2bb35cb 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -401,7 +401,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct DetectSyncSource : public MediaSource {
-    DetectSyncSource(const sp<IMediaSource> &source);
+    explicit DetectSyncSource(const sp<IMediaSource> &source);
 
     virtual status_t start(MetaData *params = NULL);
     virtual status_t stop();
diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp
index bca3832..16ff39d 100644
--- a/cmds/stagefright/stream.cpp
+++ b/cmds/stagefright/stream.cpp
@@ -45,7 +45,7 @@
 
 struct MyStreamSource : public BnStreamSource {
     // Object assumes ownership of fd.
-    MyStreamSource(int fd);
+    explicit MyStreamSource(int fd);
 
     virtual void setListener(const sp<IStreamListener> &listener);
     virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
@@ -125,7 +125,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct MyConvertingStreamSource : public BnStreamSource {
-    MyConvertingStreamSource(const char *filename);
+    explicit MyConvertingStreamSource(const char *filename);
 
     virtual void setListener(const sp<IStreamListener> &listener);
     virtual void setBuffers(const Vector<sp<IMemory> > &buffers);
diff --git a/drm/common/Android.mk b/drm/common/Android.mk
index db67534..ca3d2cd 100644
--- a/drm/common/Android.mk
+++ b/drm/common/Android.mk
@@ -31,6 +31,8 @@
     DrmInfoEvent.cpp \
     ReadWriteUtils.cpp
 
+LOCAL_STATIC_LIBRARIES := libbinder
+
 LOCAL_C_INCLUDES := \
     $(TOP)/frameworks/av/include \
     $(TOP)/frameworks/av/drm/libdrmframework/include \
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index caae75f..44f98dd 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -33,7 +33,7 @@
 
 #include "IDrmManagerService.h"
 
-#define INVALID_BUFFER_LENGTH -1
+#define INVALID_BUFFER_LENGTH (-1)
 #define MAX_BINDER_TRANSACTION_SIZE ((1*1024*1024)-(4096*2))
 
 using namespace android;
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index d696f16..16b5b34 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -30,7 +30,7 @@
 
 using namespace android;
 
-#define FAILURE -1
+#define FAILURE (-1)
 
 String8 ReadWriteUtils::readBytes(const String8& filePath) {
     FILE* file = NULL;
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index e168ba2..c27561b 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -33,7 +33,7 @@
 #include "DrmManager.h"
 #include "ReadWriteUtils.h"
 
-#define DECRYPT_FILE_ERROR -1
+#define DECRYPT_FILE_ERROR (-1)
 
 using namespace android;
 
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index cbd013e..c047eb1 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -28,7 +28,7 @@
 
 using namespace android;
 
-#define INVALID_VALUE -1
+#define INVALID_VALUE (-1)
 
 Mutex DrmManagerClientImpl::sMutex;
 sp<IDrmManagerService> DrmManagerClientImpl::sDrmManagerService;
diff --git a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
index 4bd1adb..3b1566f 100644
--- a/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
+++ b/drm/libdrmframework/plugins/common/util/src/MimeTypeUtil.cpp
@@ -115,7 +115,7 @@
  * replacement mimetype otherwise the original mimetype
  * is returned.
  *
- * If the mimetype is of unsupported group i.e. application / *
+ * If the mimetype is of unsupported group i.e. application/...
  * then "unsupported/drm.mimetype" will be returned.
  *
  * @param mimeType - mimetype in lower case to convert.
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index 084e323..7f5b0ec 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -52,12 +52,12 @@
 
 }
 
-DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int uniqueId, const String8* path) {
+DrmMetadata* DrmPassthruPlugIn::onGetMetadata(int /*uniqueId*/, const String8* /*path*/) {
     return NULL;
 }
 
 DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
-        int uniqueId, const String8* path, int action) {
+        int uniqueId, const String8* /*path*/, int /*action*/) {
     ALOGV("DrmPassthruPlugIn::onGetConstraints From Path: %d", uniqueId);
     DrmConstraints* drmConstraints = new DrmConstraints();
 
@@ -108,7 +108,7 @@
 }
 
 status_t DrmPassthruPlugIn::onSetOnInfoListener(
-            int uniqueId, const IDrmEngine::OnInfoListener* infoListener) {
+            int uniqueId, const IDrmEngine::OnInfoListener* /*infoListener*/) {
     ALOGV("DrmPassthruPlugIn::onSetOnInfoListener : %d", uniqueId);
     return DRM_NO_ERROR;
 }
@@ -135,8 +135,8 @@
     return drmSupportInfo;
 }
 
-status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& drmRights,
-            const String8& rightsPath, const String8& contentPath) {
+status_t DrmPassthruPlugIn::onSaveRights(int uniqueId, const DrmRights& /*drmRights*/,
+            const String8& /*rightsPath*/, const String8& /*contentPath*/) {
     ALOGV("DrmPassthruPlugIn::onSaveRights : %d", uniqueId);
     return DRM_NO_ERROR;
 }
@@ -157,49 +157,50 @@
     return drmInfo;
 }
 
-bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
+bool DrmPassthruPlugIn::onCanHandle(int /*uniqueId*/, const String8& path) {
     ALOGV("DrmPassthruPlugIn::canHandle: %s ", path.string());
     String8 extension = path.getPathExtension();
     extension.toLower();
     return (String8(".passthru") == extension);
 }
 
-String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId, const String8& path, int fd) {
+String8 DrmPassthruPlugIn::onGetOriginalMimeType(int uniqueId,
+            const String8& /*path*/, int /*fd*/) {
     ALOGV("DrmPassthruPlugIn::onGetOriginalMimeType() : %d", uniqueId);
     return String8("video/passthru");
 }
 
 int DrmPassthruPlugIn::onGetDrmObjectType(
-            int uniqueId, const String8& path, const String8& mimeType) {
+            int uniqueId, const String8& /*path*/, const String8& /*mimeType*/) {
     ALOGV("DrmPassthruPlugIn::onGetDrmObjectType() : %d", uniqueId);
     return DrmObjectType::UNKNOWN;
 }
 
-int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& path, int action) {
+int DrmPassthruPlugIn::onCheckRightsStatus(int uniqueId, const String8& /*path*/, int /*action*/) {
     ALOGV("DrmPassthruPlugIn::onCheckRightsStatus() : %d", uniqueId);
     int rightsStatus = RightsStatus::RIGHTS_VALID;
     return rightsStatus;
 }
 
-status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId, DecryptHandle* decryptHandle,
-            int action, bool reserve) {
+status_t DrmPassthruPlugIn::onConsumeRights(int uniqueId,
+            DecryptHandle* /*decryptHandle*/, int /*action*/, bool /*reserve*/) {
     ALOGV("DrmPassthruPlugIn::onConsumeRights() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
-status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId, DecryptHandle* decryptHandle,
-            int playbackStatus, int64_t position) {
+status_t DrmPassthruPlugIn::onSetPlaybackStatus(int uniqueId,
+            DecryptHandle* /*decryptHandle*/, int /*playbackStatus*/, int64_t /*position*/) {
     ALOGV("DrmPassthruPlugIn::onSetPlaybackStatus() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
-bool DrmPassthruPlugIn::onValidateAction(int uniqueId, const String8& path,
-            int action, const ActionDescription& description) {
+bool DrmPassthruPlugIn::onValidateAction(int uniqueId,
+            const String8& /*path*/, int /*action*/, const ActionDescription& /*description*/) {
     ALOGV("DrmPassthruPlugIn::onValidateAction() : %d", uniqueId);
     return true;
 }
 
-status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& path) {
+status_t DrmPassthruPlugIn::onRemoveRights(int uniqueId, const String8& /*path*/) {
     ALOGV("DrmPassthruPlugIn::onRemoveRights() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
@@ -209,13 +210,13 @@
     return DRM_NO_ERROR;
 }
 
-status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int convertId) {
+status_t DrmPassthruPlugIn::onOpenConvertSession(int uniqueId, int /*convertId*/) {
     ALOGV("DrmPassthruPlugIn::onOpenConvertSession() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
 DrmConvertedStatus* DrmPassthruPlugIn::onConvertData(
-            int uniqueId, int convertId, const DrmBuffer* inputData) {
+            int uniqueId, int /*convertId*/, const DrmBuffer* inputData) {
     ALOGV("DrmPassthruPlugIn::onConvertData() : %d", uniqueId);
     DrmBuffer* convertedData = NULL;
 
@@ -229,13 +230,13 @@
     return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, convertedData, 0 /*offset*/);
 }
 
-DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int convertId) {
+DrmConvertedStatus* DrmPassthruPlugIn::onCloseConvertSession(int uniqueId, int /*convertId*/) {
     ALOGV("DrmPassthruPlugIn::onCloseConvertSession() : %d", uniqueId);
     return new DrmConvertedStatus(DrmConvertedStatus::STATUS_OK, NULL, 0 /*offset*/);
 }
 
 status_t DrmPassthruPlugIn::onOpenDecryptSession(
-            int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
+            int uniqueId, DecryptHandle* decryptHandle, int /*fd*/, off64_t /*offset*/, off64_t /*length*/) {
     ALOGV("DrmPassthruPlugIn::onOpenDecryptSession() : %d", uniqueId);
 
 #ifdef ENABLE_PASSTHRU_DECRYPTION
@@ -250,7 +251,7 @@
 }
 
 status_t DrmPassthruPlugIn::onOpenDecryptSession(
-            int uniqueId, DecryptHandle* decryptHandle, const char* uri) {
+            int /*uniqueId*/, DecryptHandle* /*decryptHandle*/, const char* /*uri*/) {
     return DRM_ERROR_CANNOT_HANDLE;
 }
 
@@ -265,14 +266,14 @@
     return DRM_NO_ERROR;
 }
 
-status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* decryptHandle,
-            int decryptUnitId, const DrmBuffer* headerInfo) {
+status_t DrmPassthruPlugIn::onInitializeDecryptUnit(int uniqueId, DecryptHandle* /*decryptHandle*/,
+            int /*decryptUnitId*/, const DrmBuffer* /*headerInfo*/) {
     ALOGV("DrmPassthruPlugIn::onInitializeDecryptUnit() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
-status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* decryptHandle,
-            int decryptUnitId, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
+status_t DrmPassthruPlugIn::onDecrypt(int uniqueId, DecryptHandle* /*decryptHandle*/,
+            int /*decryptUnitId*/, const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* /*IV*/) {
     ALOGV("DrmPassthruPlugIn::onDecrypt() : %d", uniqueId);
     /**
      * As a workaround implementation passthru would copy the given
@@ -293,13 +294,13 @@
 }
 
 status_t DrmPassthruPlugIn::onFinalizeDecryptUnit(
-            int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
+            int uniqueId, DecryptHandle* /*decryptHandle*/, int /*decryptUnitId*/) {
     ALOGV("DrmPassthruPlugIn::onFinalizeDecryptUnit() : %d", uniqueId);
     return DRM_NO_ERROR;
 }
 
-ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* decryptHandle,
-            void* buffer, ssize_t numBytes, off64_t offset) {
+ssize_t DrmPassthruPlugIn::onPread(int uniqueId, DecryptHandle* /*decryptHandle*/,
+            void* /*buffer*/, ssize_t /*numBytes*/, off64_t /*offset*/) {
     ALOGV("DrmPassthruPlugIn::onPread() : %d", uniqueId);
     return 0;
 }
diff --git a/include/drm/drm_framework_common.h b/include/drm/drm_framework_common.h
index 637409c..0750406 100644
--- a/include/drm/drm_framework_common.h
+++ b/include/drm/drm_framework_common.h
@@ -23,7 +23,7 @@
 #include <utils/String8.h>
 #include <utils/Errors.h>
 
-#define INVALID_VALUE -1
+#define INVALID_VALUE (-1)
 
 namespace android {
 
diff --git a/include/media/AudioPolicy.h b/include/media/AudioPolicy.h
index 8528c7a..8da0069 100644
--- a/include/media/AudioPolicy.h
+++ b/include/media/AudioPolicy.h
@@ -36,7 +36,7 @@
                                       (RULE_EXCLUSION_MASK|RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET)
 #define RULE_EXCLUDE_UID              (RULE_EXCLUSION_MASK|RULE_MATCH_UID)
 
-#define MIX_TYPE_INVALID -1
+#define MIX_TYPE_INVALID (-1)
 #define MIX_TYPE_PLAYERS 0
 #define MIX_TYPE_RECORDERS 1
 
@@ -45,7 +45,7 @@
 // keep in sync with AudioSystem.java
 #define DYNAMIC_POLICY_EVENT_MIX_STATE_UPDATE 0
 
-#define MIX_STATE_DISABLED -1
+#define MIX_STATE_DISABLED (-1)
 #define MIX_STATE_IDLE 0
 #define MIX_STATE_MIXING 1
 
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index f4d0acd..c41d0f0 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -238,6 +238,7 @@
     sp<IdleToLoadedState> mIdleToLoadedState;
     sp<FlushingState> mFlushingState;
     sp<SkipCutBuffer> mSkipCutBuffer;
+    int32_t mSampleRate;
 
     AString mComponentName;
     uint32_t mFlags;
diff --git a/include/media/stagefright/Utils.h b/include/media/stagefright/Utils.h
index 01b3e3f..7db74ec 100644
--- a/include/media/stagefright/Utils.h
+++ b/include/media/stagefright/Utils.h
@@ -28,7 +28,7 @@
 namespace android {
 
 #define FOURCC(c1, c2, c3, c4) \
-    (c1 << 24 | c2 << 16 | c3 << 8 | c4)
+    ((c1) << 24 | (c2) << 16 | (c3) << 8 | (c4))
 
 uint16_t U16_AT(const uint8_t *ptr);
 uint32_t U32_AT(const uint8_t *ptr);
diff --git a/include/media/stagefright/foundation/ABase.h b/include/media/stagefright/foundation/ABase.h
index ef1e010..76a787e 100644
--- a/include/media/stagefright/foundation/ABase.h
+++ b/include/media/stagefright/foundation/ABase.h
@@ -24,7 +24,7 @@
 
 #define DISALLOW_EVIL_CONSTRUCTORS(name) \
     name(const name &); \
-    name &operator=(const name &)
+    name &operator=(const name &) /* NOLINT */
 
 /* Returns true if the size parameter is safe for new array allocation (32-bit)
  *
diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp
index 19b7d6e..f1f1fca 100644
--- a/media/common_time/ICommonClock.cpp
+++ b/media/common_time/ICommonClock.cpp
@@ -48,7 +48,7 @@
 class BpCommonClock : public BpInterface<ICommonClock>
 {
   public:
-    BpCommonClock(const sp<IBinder>& impl)
+    explicit BpCommonClock(const sp<IBinder>& impl)
         : BpInterface<ICommonClock>(impl) {}
 
     virtual status_t isCommonTimeValid(bool* valid, uint32_t* timelineID) {
@@ -401,7 +401,7 @@
 class BpCommonClockListener : public BpInterface<ICommonClockListener>
 {
   public:
-    BpCommonClockListener(const sp<IBinder>& impl)
+    explicit BpCommonClockListener(const sp<IBinder>& impl)
         : BpInterface<ICommonClockListener>(impl) {}
 
     virtual void onTimelineChanged(uint64_t timelineID) {
diff --git a/media/common_time/ICommonTimeConfig.cpp b/media/common_time/ICommonTimeConfig.cpp
index 67167b0..e587b39 100644
--- a/media/common_time/ICommonTimeConfig.cpp
+++ b/media/common_time/ICommonTimeConfig.cpp
@@ -50,7 +50,7 @@
 class BpCommonTimeConfig : public BpInterface<ICommonTimeConfig>
 {
   public:
-    BpCommonTimeConfig(const sp<IBinder>& impl)
+    explicit BpCommonTimeConfig(const sp<IBinder>& impl)
         : BpInterface<ICommonTimeConfig>(impl) {}
 
     virtual status_t getMasterElectionPriority(uint8_t *priority) {
diff --git a/media/common_time/cc_helper.cpp b/media/common_time/cc_helper.cpp
index 8d8556c..6a7de74 100644
--- a/media/common_time/cc_helper.cpp
+++ b/media/common_time/cc_helper.cpp
@@ -80,7 +80,7 @@
     }
 }
 
-void CCHelper::CommonClockListener::onTimelineChanged(uint64_t timelineID) {
+void CCHelper::CommonClockListener::onTimelineChanged(uint64_t /*timelineID*/) {
     // do nothing; listener is only really used as a token so the server can
     // find out when clients die.
 }
diff --git a/media/img_utils/include/img_utils/TiffHelpers.h b/media/img_utils/include/img_utils/TiffHelpers.h
index 0969e4d..3e5f863 100644
--- a/media/img_utils/include/img_utils/TiffHelpers.h
+++ b/media/img_utils/include/img_utils/TiffHelpers.h
@@ -25,7 +25,7 @@
 const uint8_t ZERO_WORD[] = {0, 0, 0, 0};
 
 #define BAIL_ON_FAIL(x, flag) \
-    if ((flag = (x)) != OK) return flag;
+    if (((flag) = (x)) != OK) return flag;
 
 #define BYTES_TILL_WORD(index) \
     ((TIFF_WORD_SIZE - ((index) % TIFF_WORD_SIZE)) % TIFF_WORD_SIZE)
diff --git a/media/img_utils/src/Android.mk b/media/img_utils/src/Android.mk
index 4074849..c1f64ca 100644
--- a/media/img_utils/src/Android.mk
+++ b/media/img_utils/src/Android.mk
@@ -34,6 +34,7 @@
   StripSource.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
+  liblog \
   libexpat \
   libutils \
   libcutils \
diff --git a/media/img_utils/src/TiffWriter.cpp b/media/img_utils/src/TiffWriter.cpp
index a6f9218..564474f 100644
--- a/media/img_utils/src/TiffWriter.cpp
+++ b/media/img_utils/src/TiffWriter.cpp
@@ -40,7 +40,7 @@
 }
 
 #define ARRAY_SIZE(array) \
-    (sizeof(array) / sizeof(array[0]))
+    (sizeof(array) / sizeof((array)[0]))
 
 KeyedVector<uint16_t, const TagDefinition_t*> TiffWriter::sTagMaps[] = {
     buildTagMap(TIFF_EP_TAG_DEFINITIONS, ARRAY_SIZE(TIFF_EP_TAG_DEFINITIONS)),
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
index 94a7869..b1ebadf 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
@@ -36,190 +36,190 @@
 
  /* Coefficients for centre frequency 55Hz */
 #define HPF_Fs8000_Fc55_A0                         1029556328         /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_A1                        -2059112655         /* Floating point value -1.917698 */
+#define HPF_Fs8000_Fc55_A1                       (-2059112655)        /* Floating point value -1.917698 */
 #define HPF_Fs8000_Fc55_A2                         1029556328         /* Floating point value 0.958849 */
-#define HPF_Fs8000_Fc55_B1                        -2081986375         /* Floating point value -1.939001 */
+#define HPF_Fs8000_Fc55_B1                       (-2081986375)        /* Floating point value -1.939001 */
 #define HPF_Fs8000_Fc55_B2                         1010183914         /* Floating point value 0.940807 */
 #define HPF_Fs11025_Fc55_A0                        1038210831         /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_A1                       -2076421662         /* Floating point value -1.933818 */
+#define HPF_Fs11025_Fc55_A1                      (-2076421662)        /* Floating point value -1.933818 */
 #define HPF_Fs11025_Fc55_A2                        1038210831         /* Floating point value 0.966909 */
-#define HPF_Fs11025_Fc55_B1                       -2099950710         /* Floating point value -1.955732 */
+#define HPF_Fs11025_Fc55_B1                      (-2099950710)        /* Floating point value -1.955732 */
 #define HPF_Fs11025_Fc55_B2                        1027238450         /* Floating point value 0.956690 */
 #define HPF_Fs12000_Fc55_A0                        1040079943         /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_A1                       -2080159885         /* Floating point value -1.937300 */
+#define HPF_Fs12000_Fc55_A1                      (-2080159885)        /* Floating point value -1.937300 */
 #define HPF_Fs12000_Fc55_A2                        1040079943         /* Floating point value 0.968650 */
-#define HPF_Fs12000_Fc55_B1                       -2103811702         /* Floating point value -1.959327 */
+#define HPF_Fs12000_Fc55_B1                      (-2103811702)        /* Floating point value -1.959327 */
 #define HPF_Fs12000_Fc55_B2                        1030940477         /* Floating point value 0.960138 */
 #define HPF_Fs16000_Fc55_A0                        1045381988         /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_A1                       -2090763976         /* Floating point value -1.947176 */
+#define HPF_Fs16000_Fc55_A1                      (-2090763976)        /* Floating point value -1.947176 */
 #define HPF_Fs16000_Fc55_A2                        1045381988         /* Floating point value 0.973588 */
-#define HPF_Fs16000_Fc55_B1                       -2114727793         /* Floating point value -1.969494 */
+#define HPF_Fs16000_Fc55_B1                      (-2114727793)        /* Floating point value -1.969494 */
 #define HPF_Fs16000_Fc55_B2                        1041478147         /* Floating point value 0.969952 */
 #define HPF_Fs22050_Fc55_A0                        1049766523         /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_A1                       -2099533046         /* Floating point value -1.955343 */
+#define HPF_Fs22050_Fc55_A1                      (-2099533046)        /* Floating point value -1.955343 */
 #define HPF_Fs22050_Fc55_A2                        1049766523         /* Floating point value 0.977671 */
-#define HPF_Fs22050_Fc55_B1                       -2123714381         /* Floating point value -1.977863 */
+#define HPF_Fs22050_Fc55_B1                      (-2123714381)        /* Floating point value -1.977863 */
 #define HPF_Fs22050_Fc55_B2                        1050232780         /* Floating point value 0.978105 */
 #define HPF_Fs24000_Fc55_A0                        1050711051         /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_A1                       -2101422103         /* Floating point value -1.957102 */
+#define HPF_Fs24000_Fc55_A1                      (-2101422103)        /* Floating point value -1.957102 */
 #define HPF_Fs24000_Fc55_A2                        1050711051         /* Floating point value 0.978551 */
-#define HPF_Fs24000_Fc55_B1                       -2125645498         /* Floating point value -1.979662 */
+#define HPF_Fs24000_Fc55_B1                      (-2125645498)        /* Floating point value -1.979662 */
 #define HPF_Fs24000_Fc55_B2                        1052123526         /* Floating point value 0.979866 */
 #define HPF_Fs32000_Fc55_A0                        1053385759         /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_A1                       -2106771519         /* Floating point value -1.962084 */
+#define HPF_Fs32000_Fc55_A1                      (-2106771519)        /* Floating point value -1.962084 */
 #define HPF_Fs32000_Fc55_A2                        1053385759         /* Floating point value 0.981042 */
-#define HPF_Fs32000_Fc55_B1                       -2131104794         /* Floating point value -1.984746 */
+#define HPF_Fs32000_Fc55_B1                      (-2131104794)        /* Floating point value -1.984746 */
 #define HPF_Fs32000_Fc55_B2                        1057486949         /* Floating point value 0.984861 */
 #define HPF_Fs44100_Fc55_A0                        1055592498         /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_A1                       -2111184995         /* Floating point value -1.966194 */
+#define HPF_Fs44100_Fc55_A1                      (-2111184995)        /* Floating point value -1.966194 */
 #define HPF_Fs44100_Fc55_A2                        1055592498         /* Floating point value 0.983097 */
-#define HPF_Fs44100_Fc55_B1                       -2135598658         /* Floating point value -1.988931 */
+#define HPF_Fs44100_Fc55_B1                      (-2135598658)        /* Floating point value -1.988931 */
 #define HPF_Fs44100_Fc55_B2                        1061922249         /* Floating point value 0.988992 */
 #define HPF_Fs48000_Fc55_A0                        1056067276         /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_A1                       -2112134551         /* Floating point value -1.967079 */
+#define HPF_Fs48000_Fc55_A1                      (-2112134551)        /* Floating point value -1.967079 */
 #define HPF_Fs48000_Fc55_A2                        1056067276         /* Floating point value 0.983539 */
-#define HPF_Fs48000_Fc55_B1                       -2136564296         /* Floating point value -1.989831 */
+#define HPF_Fs48000_Fc55_B1                      (-2136564296)        /* Floating point value -1.989831 */
 #define HPF_Fs48000_Fc55_B2                        1062877714         /* Floating point value 0.989882 */
 
  /* Coefficients for centre frequency 66Hz */
 #define HPF_Fs8000_Fc66_A0                         1023293271         /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_A1                        -2046586542         /* Floating point value -1.906032 */
+#define HPF_Fs8000_Fc66_A1                       (-2046586542)        /* Floating point value -1.906032 */
 #define HPF_Fs8000_Fc66_A2                         1023293271         /* Floating point value 0.953016 */
-#define HPF_Fs8000_Fc66_B1                        -2068896860         /* Floating point value -1.926810 */
+#define HPF_Fs8000_Fc66_B1                       (-2068896860)        /* Floating point value -1.926810 */
 #define HPF_Fs8000_Fc66_B2                          997931110         /* Floating point value 0.929396 */
 #define HPF_Fs11025_Fc66_A0                        1033624228         /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_A1                       -2067248455         /* Floating point value -1.925275 */
+#define HPF_Fs11025_Fc66_A1                      (-2067248455)        /* Floating point value -1.925275 */
 #define HPF_Fs11025_Fc66_A2                        1033624228         /* Floating point value 0.962638 */
-#define HPF_Fs11025_Fc66_B1                       -2090448000         /* Floating point value -1.946881 */
+#define HPF_Fs11025_Fc66_B1                      (-2090448000)        /* Floating point value -1.946881 */
 #define HPF_Fs11025_Fc66_B2                        1018182305         /* Floating point value 0.948256 */
 #define HPF_Fs12000_Fc66_A0                        1035857662         /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_A1                       -2071715325         /* Floating point value -1.929435 */
+#define HPF_Fs12000_Fc66_A1                      (-2071715325)        /* Floating point value -1.929435 */
 #define HPF_Fs12000_Fc66_A2                        1035857662         /* Floating point value 0.964718 */
-#define HPF_Fs12000_Fc66_B1                       -2095080333         /* Floating point value -1.951196 */
+#define HPF_Fs12000_Fc66_B1                      (-2095080333)        /* Floating point value -1.951196 */
 #define HPF_Fs12000_Fc66_B2                        1022587158         /* Floating point value 0.952359 */
 #define HPF_Fs16000_Fc66_A0                        1042197528         /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_A1                       -2084395056         /* Floating point value -1.941244 */
+#define HPF_Fs16000_Fc66_A1                      (-2084395056)        /* Floating point value -1.941244 */
 #define HPF_Fs16000_Fc66_A2                        1042197528         /* Floating point value 0.970622 */
-#define HPF_Fs16000_Fc66_B1                       -2108177912         /* Floating point value -1.963394 */
+#define HPF_Fs16000_Fc66_B1                      (-2108177912)        /* Floating point value -1.963394 */
 #define HPF_Fs16000_Fc66_B2                        1035142690         /* Floating point value 0.964052 */
 #define HPF_Fs22050_Fc66_A0                        1047445145         /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_A1                       -2094890289         /* Floating point value -1.951019 */
+#define HPF_Fs22050_Fc66_A1                      (-2094890289)        /* Floating point value -1.951019 */
 #define HPF_Fs22050_Fc66_A2                        1047445145         /* Floating point value 0.975509 */
-#define HPF_Fs22050_Fc66_B1                       -2118961025         /* Floating point value -1.973436 */
+#define HPF_Fs22050_Fc66_B1                      (-2118961025)        /* Floating point value -1.973436 */
 #define HPF_Fs22050_Fc66_B2                        1045593102         /* Floating point value 0.973784 */
 #define HPF_Fs24000_Fc66_A0                        1048576175         /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_A1                       -2097152349         /* Floating point value -1.953125 */
+#define HPF_Fs24000_Fc66_A1                      (-2097152349)        /* Floating point value -1.953125 */
 #define HPF_Fs24000_Fc66_A2                        1048576175         /* Floating point value 0.976563 */
-#define HPF_Fs24000_Fc66_B1                       -2121278255         /* Floating point value -1.975594 */
+#define HPF_Fs24000_Fc66_B1                      (-2121278255)        /* Floating point value -1.975594 */
 #define HPF_Fs24000_Fc66_B2                        1047852379         /* Floating point value 0.975889 */
 #define HPF_Fs32000_Fc66_A0                        1051780119         /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_A1                       -2103560237         /* Floating point value -1.959093 */
+#define HPF_Fs32000_Fc66_A1                      (-2103560237)        /* Floating point value -1.959093 */
 #define HPF_Fs32000_Fc66_A2                        1051780119         /* Floating point value 0.979547 */
-#define HPF_Fs32000_Fc66_B1                       -2127829187         /* Floating point value -1.981695 */
+#define HPF_Fs32000_Fc66_B1                      (-2127829187)        /* Floating point value -1.981695 */
 #define HPF_Fs32000_Fc66_B2                        1054265623         /* Floating point value 0.981861 */
 #define HPF_Fs44100_Fc66_A0                        1054424722         /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_A1                       -2108849444         /* Floating point value -1.964019 */
+#define HPF_Fs44100_Fc66_A1                      (-2108849444)        /* Floating point value -1.964019 */
 #define HPF_Fs44100_Fc66_A2                        1054424722         /* Floating point value 0.982010 */
-#define HPF_Fs44100_Fc66_B1                       -2133221723         /* Floating point value -1.986718 */
+#define HPF_Fs44100_Fc66_B1                      (-2133221723)        /* Floating point value -1.986718 */
 #define HPF_Fs44100_Fc66_B2                        1059573993         /* Floating point value 0.986805 */
 #define HPF_Fs48000_Fc66_A0                        1054993851         /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_A1                       -2109987702         /* Floating point value -1.965079 */
+#define HPF_Fs48000_Fc66_A1                      (-2109987702)        /* Floating point value -1.965079 */
 #define HPF_Fs48000_Fc66_A2                        1054993851         /* Floating point value 0.982540 */
-#define HPF_Fs48000_Fc66_B1                       -2134380475         /* Floating point value -1.987797 */
+#define HPF_Fs48000_Fc66_B1                      (-2134380475)        /* Floating point value -1.987797 */
 #define HPF_Fs48000_Fc66_B2                        1060718118         /* Floating point value 0.987871 */
 
  /* Coefficients for centre frequency 78Hz */
 #define HPF_Fs8000_Fc78_A0                         1016504203         /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_A1                        -2033008405         /* Floating point value -1.893387 */
+#define HPF_Fs8000_Fc78_A1                       (-2033008405)        /* Floating point value -1.893387 */
 #define HPF_Fs8000_Fc78_A2                         1016504203         /* Floating point value 0.946693 */
-#define HPF_Fs8000_Fc78_B1                        -2054623390         /* Floating point value -1.913517 */
+#define HPF_Fs8000_Fc78_B1                       (-2054623390)        /* Floating point value -1.913517 */
 #define HPF_Fs8000_Fc78_B2                          984733853         /* Floating point value 0.917105 */
 #define HPF_Fs11025_Fc78_A0                        1028643741         /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_A1                       -2057287482         /* Floating point value -1.915998 */
+#define HPF_Fs11025_Fc78_A1                      (-2057287482)        /* Floating point value -1.915998 */
 #define HPF_Fs11025_Fc78_A2                        1028643741         /* Floating point value 0.957999 */
-#define HPF_Fs11025_Fc78_B1                       -2080083769         /* Floating point value -1.937229 */
+#define HPF_Fs11025_Fc78_B1                      (-2080083769)        /* Floating point value -1.937229 */
 #define HPF_Fs11025_Fc78_B2                        1008393904         /* Floating point value 0.939140 */
 #define HPF_Fs12000_Fc78_A0                        1031271067         /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_A1                       -2062542133         /* Floating point value -1.920892 */
+#define HPF_Fs12000_Fc78_A1                      (-2062542133)        /* Floating point value -1.920892 */
 #define HPF_Fs12000_Fc78_A2                        1031271067         /* Floating point value 0.960446 */
-#define HPF_Fs12000_Fc78_B1                       -2085557048         /* Floating point value -1.942326 */
+#define HPF_Fs12000_Fc78_B1                      (-2085557048)        /* Floating point value -1.942326 */
 #define HPF_Fs12000_Fc78_B2                        1013551620         /* Floating point value 0.943944 */
 #define HPF_Fs16000_Fc78_A0                        1038734628         /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_A1                       -2077469256         /* Floating point value -1.934794 */
+#define HPF_Fs16000_Fc78_A1                      (-2077469256)        /* Floating point value -1.934794 */
 #define HPF_Fs16000_Fc78_A2                        1038734628         /* Floating point value 0.967397 */
-#define HPF_Fs16000_Fc78_B1                       -2101033380         /* Floating point value -1.956740 */
+#define HPF_Fs16000_Fc78_B1                      (-2101033380)        /* Floating point value -1.956740 */
 #define HPF_Fs16000_Fc78_B2                        1028275228         /* Floating point value 0.957656 */
 #define HPF_Fs22050_Fc78_A0                        1044918584         /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_A1                       -2089837169         /* Floating point value -1.946313 */
+#define HPF_Fs22050_Fc78_A1                      (-2089837169)        /* Floating point value -1.946313 */
 #define HPF_Fs22050_Fc78_A2                        1044918584         /* Floating point value 0.973156 */
-#define HPF_Fs22050_Fc78_B1                       -2113775854         /* Floating point value -1.968607 */
+#define HPF_Fs22050_Fc78_B1                      (-2113775854)        /* Floating point value -1.968607 */
 #define HPF_Fs22050_Fc78_B2                        1040555007         /* Floating point value 0.969092 */
 #define HPF_Fs24000_Fc78_A0                        1046252164         /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_A1                       -2092504328         /* Floating point value -1.948797 */
+#define HPF_Fs24000_Fc78_A1                      (-2092504328)        /* Floating point value -1.948797 */
 #define HPF_Fs24000_Fc78_A2                        1046252164         /* Floating point value 0.974398 */
-#define HPF_Fs24000_Fc78_B1                       -2116514229         /* Floating point value -1.971157 */
+#define HPF_Fs24000_Fc78_B1                      (-2116514229)        /* Floating point value -1.971157 */
 #define HPF_Fs24000_Fc78_B2                        1043212719         /* Floating point value 0.971568 */
 #define HPF_Fs32000_Fc78_A0                        1050031301         /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_A1                       -2100062603         /* Floating point value -1.955836 */
+#define HPF_Fs32000_Fc78_A1                      (-2100062603)        /* Floating point value -1.955836 */
 #define HPF_Fs32000_Fc78_A2                        1050031301         /* Floating point value 0.977918 */
-#define HPF_Fs32000_Fc78_B1                       -2124255900         /* Floating point value -1.978367 */
+#define HPF_Fs32000_Fc78_B1                      (-2124255900)        /* Floating point value -1.978367 */
 #define HPF_Fs32000_Fc78_B2                        1050762639         /* Floating point value 0.978599 */
 #define HPF_Fs44100_Fc78_A0                        1053152258         /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_A1                       -2106304516         /* Floating point value -1.961649 */
+#define HPF_Fs44100_Fc78_A1                      (-2106304516)        /* Floating point value -1.961649 */
 #define HPF_Fs44100_Fc78_A2                        1053152258         /* Floating point value 0.980824 */
-#define HPF_Fs44100_Fc78_B1                       -2130628742         /* Floating point value -1.984303 */
+#define HPF_Fs44100_Fc78_B1                      (-2130628742)        /* Floating point value -1.984303 */
 #define HPF_Fs44100_Fc78_B2                        1057018180         /* Floating point value 0.984425 */
 #define HPF_Fs48000_Fc78_A0                        1053824087         /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_A1                       -2107648173         /* Floating point value -1.962900 */
+#define HPF_Fs48000_Fc78_A1                      (-2107648173)        /* Floating point value -1.962900 */
 #define HPF_Fs48000_Fc78_A2                        1053824087         /* Floating point value 0.981450 */
-#define HPF_Fs48000_Fc78_B1                       -2131998154         /* Floating point value -1.985578 */
+#define HPF_Fs48000_Fc78_B1                      (-2131998154)        /* Floating point value -1.985578 */
 #define HPF_Fs48000_Fc78_B2                        1058367200         /* Floating point value 0.985681 */
 
  /* Coefficients for centre frequency 90Hz */
 #define HPF_Fs8000_Fc90_A0                         1009760053         /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_A1                        -2019520105         /* Floating point value -1.880825 */
+#define HPF_Fs8000_Fc90_A1                       (-2019520105)        /* Floating point value -1.880825 */
 #define HPF_Fs8000_Fc90_A2                         1009760053         /* Floating point value 0.940412 */
-#define HPF_Fs8000_Fc90_B1                        -2040357139         /* Floating point value -1.900231 */
+#define HPF_Fs8000_Fc90_B1                       (-2040357139)        /* Floating point value -1.900231 */
 #define HPF_Fs8000_Fc90_B2                          971711129         /* Floating point value 0.904977 */
 #define HPF_Fs11025_Fc90_A0                        1023687217         /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_A1                       -2047374434         /* Floating point value -1.906766 */
+#define HPF_Fs11025_Fc90_A1                      (-2047374434)        /* Floating point value -1.906766 */
 #define HPF_Fs11025_Fc90_A2                        1023687217         /* Floating point value 0.953383 */
-#define HPF_Fs11025_Fc90_B1                       -2069722397         /* Floating point value -1.927579 */
+#define HPF_Fs11025_Fc90_B1                      (-2069722397)        /* Floating point value -1.927579 */
 #define HPF_Fs11025_Fc90_B2                         998699604         /* Floating point value 0.930111 */
 #define HPF_Fs12000_Fc90_A0                        1026704754         /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_A1                       -2053409508         /* Floating point value -1.912387 */
+#define HPF_Fs12000_Fc90_A1                      (-2053409508)        /* Floating point value -1.912387 */
 #define HPF_Fs12000_Fc90_A2                        1026704754         /* Floating point value 0.956193 */
-#define HPF_Fs12000_Fc90_B1                       -2076035996         /* Floating point value -1.933459 */
+#define HPF_Fs12000_Fc90_B1                      (-2076035996)        /* Floating point value -1.933459 */
 #define HPF_Fs12000_Fc90_B2                        1004595918         /* Floating point value 0.935603 */
 #define HPF_Fs16000_Fc90_A0                        1035283225         /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_A1                       -2070566451         /* Floating point value -1.928365 */
+#define HPF_Fs16000_Fc90_A1                      (-2070566451)        /* Floating point value -1.928365 */
 #define HPF_Fs16000_Fc90_A2                        1035283225         /* Floating point value 0.964183 */
-#define HPF_Fs16000_Fc90_B1                       -2093889811         /* Floating point value -1.950087 */
+#define HPF_Fs16000_Fc90_B1                      (-2093889811)        /* Floating point value -1.950087 */
 #define HPF_Fs16000_Fc90_B2                        1021453326         /* Floating point value 0.951303 */
 #define HPF_Fs22050_Fc90_A0                        1042398116         /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_A1                       -2084796232         /* Floating point value -1.941618 */
+#define HPF_Fs22050_Fc90_A1                      (-2084796232)        /* Floating point value -1.941618 */
 #define HPF_Fs22050_Fc90_A2                        1042398116         /* Floating point value 0.970809 */
-#define HPF_Fs22050_Fc90_B1                       -2108591057         /* Floating point value -1.963778 */
+#define HPF_Fs22050_Fc90_B1                      (-2108591057)        /* Floating point value -1.963778 */
 #define HPF_Fs22050_Fc90_B2                        1035541188         /* Floating point value 0.964423 */
 #define HPF_Fs24000_Fc90_A0                        1043933302         /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_A1                       -2087866604         /* Floating point value -1.944477 */
+#define HPF_Fs24000_Fc90_A1                      (-2087866604)        /* Floating point value -1.944477 */
 #define HPF_Fs24000_Fc90_A2                        1043933302         /* Floating point value 0.972239 */
-#define HPF_Fs24000_Fc90_B1                       -2111750495         /* Floating point value -1.966721 */
+#define HPF_Fs24000_Fc90_B1                      (-2111750495)        /* Floating point value -1.966721 */
 #define HPF_Fs24000_Fc90_B2                        1038593601         /* Floating point value 0.967266 */
 #define HPF_Fs32000_Fc90_A0                        1048285391         /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_A1                       -2096570783         /* Floating point value -1.952584 */
+#define HPF_Fs32000_Fc90_A1                      (-2096570783)        /* Floating point value -1.952584 */
 #define HPF_Fs32000_Fc90_A2                        1048285391         /* Floating point value 0.976292 */
-#define HPF_Fs32000_Fc90_B1                       -2120682737         /* Floating point value -1.975040 */
+#define HPF_Fs32000_Fc90_B1                      (-2120682737)        /* Floating point value -1.975040 */
 #define HPF_Fs32000_Fc90_B2                        1047271295         /* Floating point value 0.975347 */
 #define HPF_Fs44100_Fc90_A0                        1051881330         /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_A1                       -2103762660         /* Floating point value -1.959282 */
+#define HPF_Fs44100_Fc90_A1                      (-2103762660)        /* Floating point value -1.959282 */
 #define HPF_Fs44100_Fc90_A2                        1051881330         /* Floating point value 0.979641 */
-#define HPF_Fs44100_Fc90_B1                       -2128035809         /* Floating point value -1.981888 */
+#define HPF_Fs44100_Fc90_B1                      (-2128035809)        /* Floating point value -1.981888 */
 #define HPF_Fs44100_Fc90_B2                        1054468533         /* Floating point value 0.982050 */
 #define HPF_Fs48000_Fc90_A0                        1052655619         /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_A1                       -2105311238         /* Floating point value -1.960724 */
+#define HPF_Fs48000_Fc90_A1                      (-2105311238)        /* Floating point value -1.960724 */
 #define HPF_Fs48000_Fc90_A2                        1052655619         /* Floating point value 0.980362 */
-#define HPF_Fs48000_Fc90_B1                       -2129615871         /* Floating point value -1.983359 */
+#define HPF_Fs48000_Fc90_B1                      (-2129615871)        /* Floating point value -1.983359 */
 #define HPF_Fs48000_Fc90_B2                        1056021492         /* Floating point value 0.983497 */
 
 
@@ -232,189 +232,189 @@
  /* Coefficients for centre frequency 55Hz */
 #define BPF_Fs8000_Fc55_A0                            9875247         /* Floating point value 0.009197 */
 #define BPF_Fs8000_Fc55_A1                                  0         /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc55_A2                           -9875247         /* Floating point value -0.009197 */
-#define BPF_Fs8000_Fc55_B1                        -2125519830         /* Floating point value -1.979545 */
+#define BPF_Fs8000_Fc55_A2                          (-9875247)        /* Floating point value -0.009197 */
+#define BPF_Fs8000_Fc55_B1                       (-2125519830)        /* Floating point value -1.979545 */
 #define BPF_Fs8000_Fc55_B2                         1053762629         /* Floating point value 0.981393 */
 #define BPF_Fs11025_Fc55_A0                           7183952         /* Floating point value 0.006691 */
 #define BPF_Fs11025_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc55_A2                          -7183952         /* Floating point value -0.006691 */
-#define BPF_Fs11025_Fc55_B1                       -2131901658         /* Floating point value -1.985488 */
+#define BPF_Fs11025_Fc55_A2                         (-7183952)        /* Floating point value -0.006691 */
+#define BPF_Fs11025_Fc55_B1                      (-2131901658)        /* Floating point value -1.985488 */
 #define BPF_Fs11025_Fc55_B2                        1059207548         /* Floating point value 0.986464 */
 #define BPF_Fs12000_Fc55_A0                           6603871         /* Floating point value 0.006150 */
 #define BPF_Fs12000_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc55_A2                          -6603871         /* Floating point value -0.006150 */
-#define BPF_Fs12000_Fc55_B1                       -2133238092         /* Floating point value -1.986733 */
+#define BPF_Fs12000_Fc55_A2                         (-6603871)        /* Floating point value -0.006150 */
+#define BPF_Fs12000_Fc55_B1                      (-2133238092)        /* Floating point value -1.986733 */
 #define BPF_Fs12000_Fc55_B2                        1060381143         /* Floating point value 0.987557 */
 #define BPF_Fs16000_Fc55_A0                           4960591         /* Floating point value 0.004620 */
 #define BPF_Fs16000_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc55_A2                          -4960591         /* Floating point value -0.004620 */
-#define BPF_Fs16000_Fc55_B1                       -2136949052         /* Floating point value -1.990189 */
+#define BPF_Fs16000_Fc55_A2                         (-4960591)        /* Floating point value -0.004620 */
+#define BPF_Fs16000_Fc55_B1                      (-2136949052)        /* Floating point value -1.990189 */
 #define BPF_Fs16000_Fc55_B2                        1063705760         /* Floating point value 0.990653 */
 #define BPF_Fs22050_Fc55_A0                           3604131         /* Floating point value 0.003357 */
 #define BPF_Fs22050_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc55_A2                          -3604131         /* Floating point value -0.003357 */
-#define BPF_Fs22050_Fc55_B1                       -2139929085         /* Floating point value -1.992964 */
+#define BPF_Fs22050_Fc55_A2                         (-3604131)        /* Floating point value -0.003357 */
+#define BPF_Fs22050_Fc55_B1                      (-2139929085)        /* Floating point value -1.992964 */
 #define BPF_Fs22050_Fc55_B2                        1066450095         /* Floating point value 0.993209 */
 #define BPF_Fs24000_Fc55_A0                           3312207         /* Floating point value 0.003085 */
 #define BPF_Fs24000_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc55_A2                          -3312207         /* Floating point value -0.003085 */
-#define BPF_Fs24000_Fc55_B1                       -2140560606         /* Floating point value -1.993552 */
+#define BPF_Fs24000_Fc55_A2                         (-3312207)        /* Floating point value -0.003085 */
+#define BPF_Fs24000_Fc55_B1                      (-2140560606)        /* Floating point value -1.993552 */
 #define BPF_Fs24000_Fc55_B2                        1067040703         /* Floating point value 0.993759 */
 #define BPF_Fs32000_Fc55_A0                           2486091         /* Floating point value 0.002315 */
 #define BPF_Fs32000_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc55_A2                          -2486091         /* Floating point value -0.002315 */
-#define BPF_Fs32000_Fc55_B1                       -2142328962         /* Floating point value -1.995199 */
+#define BPF_Fs32000_Fc55_A2                         (-2486091)        /* Floating point value -0.002315 */
+#define BPF_Fs32000_Fc55_B1                      (-2142328962)        /* Floating point value -1.995199 */
 #define BPF_Fs32000_Fc55_B2                        1068712067         /* Floating point value 0.995316 */
 #define BPF_Fs44100_Fc55_A0                           1805125         /* Floating point value 0.001681 */
 #define BPF_Fs44100_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc55_A2                          -1805125         /* Floating point value -0.001681 */
-#define BPF_Fs44100_Fc55_B1                       -2143765772         /* Floating point value -1.996537 */
+#define BPF_Fs44100_Fc55_A2                         (-1805125)        /* Floating point value -0.001681 */
+#define BPF_Fs44100_Fc55_B1                      (-2143765772)        /* Floating point value -1.996537 */
 #define BPF_Fs44100_Fc55_B2                        1070089770         /* Floating point value 0.996599 */
 #define BPF_Fs48000_Fc55_A0                           1658687         /* Floating point value 0.001545 */
 #define BPF_Fs48000_Fc55_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc55_A2                          -1658687         /* Floating point value -0.001545 */
-#define BPF_Fs48000_Fc55_B1                       -2144072292         /* Floating point value -1.996823 */
+#define BPF_Fs48000_Fc55_A2                         (-1658687)        /* Floating point value -0.001545 */
+#define BPF_Fs48000_Fc55_B1                      (-2144072292)        /* Floating point value -1.996823 */
 #define BPF_Fs48000_Fc55_B2                        1070386036         /* Floating point value 0.996875 */
 
  /* Coefficients for centre frequency 66Hz */
 #define BPF_Fs8000_Fc66_A0                           13580189         /* Floating point value 0.012648 */
 #define BPF_Fs8000_Fc66_A1                                  0         /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc66_A2                          -13580189         /* Floating point value -0.012648 */
-#define BPF_Fs8000_Fc66_B1                        -2117161175         /* Floating point value -1.971760 */
+#define BPF_Fs8000_Fc66_A2                         (-13580189)        /* Floating point value -0.012648 */
+#define BPF_Fs8000_Fc66_B1                       (-2117161175)        /* Floating point value -1.971760 */
 #define BPF_Fs8000_Fc66_B2                         1046266945         /* Floating point value 0.974412 */
 #define BPF_Fs11025_Fc66_A0                           9888559         /* Floating point value 0.009209 */
 #define BPF_Fs11025_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc66_A2                          -9888559         /* Floating point value -0.009209 */
-#define BPF_Fs11025_Fc66_B1                       -2125972738         /* Floating point value -1.979966 */
+#define BPF_Fs11025_Fc66_A2                         (-9888559)        /* Floating point value -0.009209 */
+#define BPF_Fs11025_Fc66_B1                      (-2125972738)        /* Floating point value -1.979966 */
 #define BPF_Fs11025_Fc66_B2                        1053735698         /* Floating point value 0.981368 */
 #define BPF_Fs12000_Fc66_A0                           9091954         /* Floating point value 0.008468 */
 #define BPF_Fs12000_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc66_A2                          -9091954         /* Floating point value -0.008468 */
-#define BPF_Fs12000_Fc66_B1                       -2127818004         /* Floating point value -1.981685 */
+#define BPF_Fs12000_Fc66_A2                         (-9091954)        /* Floating point value -0.008468 */
+#define BPF_Fs12000_Fc66_B1                      (-2127818004)        /* Floating point value -1.981685 */
 #define BPF_Fs12000_Fc66_B2                        1055347356         /* Floating point value 0.982869 */
 #define BPF_Fs16000_Fc66_A0                           6833525         /* Floating point value 0.006364 */
 #define BPF_Fs16000_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc66_A2                          -6833525         /* Floating point value -0.006364 */
-#define BPF_Fs16000_Fc66_B1                       -2132941739         /* Floating point value -1.986457 */
+#define BPF_Fs16000_Fc66_A2                         (-6833525)        /* Floating point value -0.006364 */
+#define BPF_Fs16000_Fc66_B1                      (-2132941739)        /* Floating point value -1.986457 */
 #define BPF_Fs16000_Fc66_B2                        1059916517         /* Floating point value 0.987124 */
 #define BPF_Fs22050_Fc66_A0                           4967309         /* Floating point value 0.004626 */
 #define BPF_Fs22050_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc66_A2                          -4967309         /* Floating point value -0.004626 */
-#define BPF_Fs22050_Fc66_B1                       -2137056003         /* Floating point value -1.990288 */
+#define BPF_Fs22050_Fc66_A2                         (-4967309)        /* Floating point value -0.004626 */
+#define BPF_Fs22050_Fc66_B1                      (-2137056003)        /* Floating point value -1.990288 */
 #define BPF_Fs22050_Fc66_B2                        1063692170         /* Floating point value 0.990641 */
 #define BPF_Fs24000_Fc66_A0                           4565445         /* Floating point value 0.004252 */
 #define BPF_Fs24000_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc66_A2                          -4565445         /* Floating point value -0.004252 */
-#define BPF_Fs24000_Fc66_B1                       -2137927842         /* Floating point value -1.991100 */
+#define BPF_Fs24000_Fc66_A2                         (-4565445)        /* Floating point value -0.004252 */
+#define BPF_Fs24000_Fc66_B1                      (-2137927842)        /* Floating point value -1.991100 */
 #define BPF_Fs24000_Fc66_B2                        1064505202         /* Floating point value 0.991398 */
 #define BPF_Fs32000_Fc66_A0                           3427761         /* Floating point value 0.003192 */
 #define BPF_Fs32000_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc66_A2                          -3427761         /* Floating point value -0.003192 */
-#define BPF_Fs32000_Fc66_B1                       -2140369007         /* Floating point value -1.993374 */
+#define BPF_Fs32000_Fc66_A2                         (-3427761)        /* Floating point value -0.003192 */
+#define BPF_Fs32000_Fc66_B1                      (-2140369007)        /* Floating point value -1.993374 */
 #define BPF_Fs32000_Fc66_B2                        1066806920         /* Floating point value 0.993541 */
 #define BPF_Fs44100_Fc66_A0                           2489466         /* Floating point value 0.002318 */
 #define BPF_Fs44100_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc66_A2                          -2489466         /* Floating point value -0.002318 */
-#define BPF_Fs44100_Fc66_B1                       -2142352342         /* Floating point value -1.995221 */
+#define BPF_Fs44100_Fc66_A2                         (-2489466)        /* Floating point value -0.002318 */
+#define BPF_Fs44100_Fc66_B1                      (-2142352342)        /* Floating point value -1.995221 */
 #define BPF_Fs44100_Fc66_B2                        1068705240         /* Floating point value 0.995309 */
 #define BPF_Fs48000_Fc66_A0                           2287632         /* Floating point value 0.002131 */
 #define BPF_Fs48000_Fc66_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc66_A2                          -2287632         /* Floating point value -0.002131 */
-#define BPF_Fs48000_Fc66_B1                       -2142775436         /* Floating point value -1.995615 */
+#define BPF_Fs48000_Fc66_A2                         (-2287632)        /* Floating point value -0.002131 */
+#define BPF_Fs48000_Fc66_B1                      (-2142775436)        /* Floating point value -1.995615 */
 #define BPF_Fs48000_Fc66_B2                        1069113581         /* Floating point value 0.995690 */
 
  /* Coefficients for centre frequency 78Hz */
 #define BPF_Fs8000_Fc78_A0                           19941180         /* Floating point value 0.018572 */
 #define BPF_Fs8000_Fc78_A1                                  0         /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc78_A2                          -19941180         /* Floating point value -0.018572 */
-#define BPF_Fs8000_Fc78_B1                        -2103186749         /* Floating point value -1.958745 */
+#define BPF_Fs8000_Fc78_A2                         (-19941180)        /* Floating point value -0.018572 */
+#define BPF_Fs8000_Fc78_B1                       (-2103186749)        /* Floating point value -1.958745 */
 #define BPF_Fs8000_Fc78_B2                         1033397648         /* Floating point value 0.962427 */
 #define BPF_Fs11025_Fc78_A0                          14543934         /* Floating point value 0.013545 */
 #define BPF_Fs11025_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc78_A2                         -14543934         /* Floating point value -0.013545 */
-#define BPF_Fs11025_Fc78_B1                       -2115966638         /* Floating point value -1.970647 */
+#define BPF_Fs11025_Fc78_A2                        (-14543934)        /* Floating point value -0.013545 */
+#define BPF_Fs11025_Fc78_B1                      (-2115966638)        /* Floating point value -1.970647 */
 #define BPF_Fs11025_Fc78_B2                        1044317135         /* Floating point value 0.972596 */
 #define BPF_Fs12000_Fc78_A0                          13376999         /* Floating point value 0.012458 */
 #define BPF_Fs12000_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc78_A2                         -13376999         /* Floating point value -0.012458 */
-#define BPF_Fs12000_Fc78_B1                       -2118651708         /* Floating point value -1.973148 */
+#define BPF_Fs12000_Fc78_A2                        (-13376999)        /* Floating point value -0.012458 */
+#define BPF_Fs12000_Fc78_B1                      (-2118651708)        /* Floating point value -1.973148 */
 #define BPF_Fs12000_Fc78_B2                        1046678029         /* Floating point value 0.974795 */
 #define BPF_Fs16000_Fc78_A0                          10064222         /* Floating point value 0.009373 */
 #define BPF_Fs16000_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc78_A2                         -10064222         /* Floating point value -0.009373 */
-#define BPF_Fs16000_Fc78_B1                       -2126124342         /* Floating point value -1.980108 */
+#define BPF_Fs16000_Fc78_A2                        (-10064222)        /* Floating point value -0.009373 */
+#define BPF_Fs16000_Fc78_B1                      (-2126124342)        /* Floating point value -1.980108 */
 #define BPF_Fs16000_Fc78_B2                        1053380304         /* Floating point value 0.981037 */
 #define BPF_Fs22050_Fc78_A0                           7321780         /* Floating point value 0.006819 */
 #define BPF_Fs22050_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc78_A2                          -7321780         /* Floating point value -0.006819 */
-#define BPF_Fs22050_Fc78_B1                       -2132143771         /* Floating point value -1.985714 */
+#define BPF_Fs22050_Fc78_A2                         (-7321780)        /* Floating point value -0.006819 */
+#define BPF_Fs22050_Fc78_B1                      (-2132143771)        /* Floating point value -1.985714 */
 #define BPF_Fs22050_Fc78_B2                        1058928700         /* Floating point value 0.986204 */
 #define BPF_Fs24000_Fc78_A0                           6730640         /* Floating point value 0.006268 */
 #define BPF_Fs24000_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc78_A2                          -6730640         /* Floating point value -0.006268 */
-#define BPF_Fs24000_Fc78_B1                       -2133421607         /* Floating point value -1.986904 */
+#define BPF_Fs24000_Fc78_A2                         (-6730640)        /* Floating point value -0.006268 */
+#define BPF_Fs24000_Fc78_B1                      (-2133421607)        /* Floating point value -1.986904 */
 #define BPF_Fs24000_Fc78_B2                        1060124669         /* Floating point value 0.987318 */
 #define BPF_Fs32000_Fc78_A0                           5055965         /* Floating point value 0.004709 */
 #define BPF_Fs32000_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc78_A2                          -5055965         /* Floating point value -0.004709 */
-#define BPF_Fs32000_Fc78_B1                       -2137003977         /* Floating point value -1.990240 */
+#define BPF_Fs32000_Fc78_A2                         (-5055965)        /* Floating point value -0.004709 */
+#define BPF_Fs32000_Fc78_B1                      (-2137003977)        /* Floating point value -1.990240 */
 #define BPF_Fs32000_Fc78_B2                        1063512802         /* Floating point value 0.990473 */
 #define BPF_Fs44100_Fc78_A0                           3673516         /* Floating point value 0.003421 */
 #define BPF_Fs44100_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc78_A2                          -3673516         /* Floating point value -0.003421 */
-#define BPF_Fs44100_Fc78_B1                       -2139919394         /* Floating point value -1.992955 */
+#define BPF_Fs44100_Fc78_A2                         (-3673516)        /* Floating point value -0.003421 */
+#define BPF_Fs44100_Fc78_B1                      (-2139919394)        /* Floating point value -1.992955 */
 #define BPF_Fs44100_Fc78_B2                        1066309718         /* Floating point value 0.993078 */
 #define BPF_Fs48000_Fc78_A0                           3375990         /* Floating point value 0.003144 */
 #define BPF_Fs48000_Fc78_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc78_A2                          -3375990         /* Floating point value -0.003144 */
-#define BPF_Fs48000_Fc78_B1                       -2140541906         /* Floating point value -1.993535 */
+#define BPF_Fs48000_Fc78_A2                         (-3375990)        /* Floating point value -0.003144 */
+#define BPF_Fs48000_Fc78_B1                      (-2140541906)        /* Floating point value -1.993535 */
 #define BPF_Fs48000_Fc78_B2                        1066911660         /* Floating point value 0.993639 */
 
  /* Coefficients for centre frequency 90Hz */
 #define BPF_Fs8000_Fc90_A0                           24438548         /* Floating point value 0.022760 */
 #define BPF_Fs8000_Fc90_A1                                  0         /* Floating point value 0.000000 */
-#define BPF_Fs8000_Fc90_A2                          -24438548         /* Floating point value -0.022760 */
-#define BPF_Fs8000_Fc90_B1                        -2092801347         /* Floating point value -1.949073 */
+#define BPF_Fs8000_Fc90_A2                         (-24438548)        /* Floating point value -0.022760 */
+#define BPF_Fs8000_Fc90_B1                       (-2092801347)        /* Floating point value -1.949073 */
 #define BPF_Fs8000_Fc90_B2                         1024298757         /* Floating point value 0.953953 */
 #define BPF_Fs11025_Fc90_A0                          17844385         /* Floating point value 0.016619 */
 #define BPF_Fs11025_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs11025_Fc90_A2                         -17844385         /* Floating point value -0.016619 */
-#define BPF_Fs11025_Fc90_B1                       -2108604921         /* Floating point value -1.963791 */
+#define BPF_Fs11025_Fc90_A2                        (-17844385)        /* Floating point value -0.016619 */
+#define BPF_Fs11025_Fc90_B1                      (-2108604921)        /* Floating point value -1.963791 */
 #define BPF_Fs11025_Fc90_B2                        1037639797         /* Floating point value 0.966377 */
 #define BPF_Fs12000_Fc90_A0                          16416707         /* Floating point value 0.015289 */
 #define BPF_Fs12000_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs12000_Fc90_A2                         -16416707         /* Floating point value -0.015289 */
-#define BPF_Fs12000_Fc90_B1                       -2111922936         /* Floating point value -1.966882 */
+#define BPF_Fs12000_Fc90_A2                        (-16416707)        /* Floating point value -0.015289 */
+#define BPF_Fs12000_Fc90_B1                      (-2111922936)        /* Floating point value -1.966882 */
 #define BPF_Fs12000_Fc90_B2                        1040528216         /* Floating point value 0.969067 */
 #define BPF_Fs16000_Fc90_A0                          12359883         /* Floating point value 0.011511 */
 #define BPF_Fs16000_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs16000_Fc90_A2                         -12359883         /* Floating point value -0.011511 */
-#define BPF_Fs16000_Fc90_B1                       -2121152162         /* Floating point value -1.975477 */
+#define BPF_Fs16000_Fc90_A2                        (-12359883)        /* Floating point value -0.011511 */
+#define BPF_Fs16000_Fc90_B1                      (-2121152162)        /* Floating point value -1.975477 */
 #define BPF_Fs16000_Fc90_B2                        1048735817         /* Floating point value 0.976711 */
 #define BPF_Fs22050_Fc90_A0                           8997173         /* Floating point value 0.008379 */
 #define BPF_Fs22050_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs22050_Fc90_A2                          -8997173         /* Floating point value -0.008379 */
-#define BPF_Fs22050_Fc90_B1                       -2128580762         /* Floating point value -1.982395 */
+#define BPF_Fs22050_Fc90_A2                         (-8997173)        /* Floating point value -0.008379 */
+#define BPF_Fs22050_Fc90_B1                      (-2128580762)        /* Floating point value -1.982395 */
 #define BPF_Fs22050_Fc90_B2                        1055539113         /* Floating point value 0.983047 */
 #define BPF_Fs24000_Fc90_A0                           8271818         /* Floating point value 0.007704 */
 #define BPF_Fs24000_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs24000_Fc90_A2                          -8271818         /* Floating point value -0.007704 */
-#define BPF_Fs24000_Fc90_B1                       -2130157013         /* Floating point value -1.983863 */
+#define BPF_Fs24000_Fc90_A2                         (-8271818)        /* Floating point value -0.007704 */
+#define BPF_Fs24000_Fc90_B1                      (-2130157013)        /* Floating point value -1.983863 */
 #define BPF_Fs24000_Fc90_B2                        1057006621         /* Floating point value 0.984414 */
 #define BPF_Fs32000_Fc90_A0                           6215918         /* Floating point value 0.005789 */
 #define BPF_Fs32000_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs32000_Fc90_A2                          -6215918         /* Floating point value -0.005789 */
-#define BPF_Fs32000_Fc90_B1                       -2134574521         /* Floating point value -1.987977 */
+#define BPF_Fs32000_Fc90_A2                         (-6215918)        /* Floating point value -0.005789 */
+#define BPF_Fs32000_Fc90_B1                      (-2134574521)        /* Floating point value -1.987977 */
 #define BPF_Fs32000_Fc90_B2                        1061166033         /* Floating point value 0.988288 */
 #define BPF_Fs44100_Fc90_A0                           4517651         /* Floating point value 0.004207 */
 #define BPF_Fs44100_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs44100_Fc90_A2                          -4517651         /* Floating point value -0.004207 */
-#define BPF_Fs44100_Fc90_B1                       -2138167926         /* Floating point value -1.991324 */
+#define BPF_Fs44100_Fc90_A2                         (-4517651)        /* Floating point value -0.004207 */
+#define BPF_Fs44100_Fc90_B1                      (-2138167926)        /* Floating point value -1.991324 */
 #define BPF_Fs44100_Fc90_B2                        1064601898         /* Floating point value 0.991488 */
 #define BPF_Fs48000_Fc90_A0                           4152024         /* Floating point value 0.003867 */
 #define BPF_Fs48000_Fc90_A1                                 0         /* Floating point value 0.000000 */
-#define BPF_Fs48000_Fc90_A2                          -4152024         /* Floating point value -0.003867 */
-#define BPF_Fs48000_Fc90_B1                       -2138935002         /* Floating point value -1.992038 */
+#define BPF_Fs48000_Fc90_A2                         (-4152024)        /* Floating point value -0.003867 */
+#define BPF_Fs48000_Fc90_B1                      (-2138935002)        /* Floating point value -1.992038 */
 #define BPF_Fs48000_Fc90_B2                        1065341620         /* Floating point value 0.992177 */
 
 
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
index f578db9..2712b2c 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
@@ -74,63 +74,63 @@
 #define HPF_Fs22050_Gain6_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain6_Shift                             1         /* Shift value */
                                                                     /* Gain =  7.000000 dB */
-#define HPF_Fs22050_Gain7_A0                             -164         /* Floating point value -0.005002 */
+#define HPF_Fs22050_Gain7_A0                            (-164)        /* Floating point value -0.005002 */
 #define HPF_Fs22050_Gain7_A1                            11311         /* Floating point value 0.345199 */
 #define HPF_Fs22050_Gain7_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain7_B1                            12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain7_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain7_Shift                             2         /* Shift value */
                                                                     /* Gain =  8.000000 dB */
-#define HPF_Fs22050_Gain8_A0                             -864         /* Floating point value -0.026368 */
+#define HPF_Fs22050_Gain8_A0                            (-864)        /* Floating point value -0.026368 */
 #define HPF_Fs22050_Gain8_A1                            12012         /* Floating point value 0.366565 */
 #define HPF_Fs22050_Gain8_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain8_B1                            12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain8_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain8_Shift                             2         /* Shift value */
                                                                     /* Gain =  9.000000 dB */
-#define HPF_Fs22050_Gain9_A0                            -1650         /* Floating point value -0.050340 */
+#define HPF_Fs22050_Gain9_A0                           (-1650)        /* Floating point value -0.050340 */
 #define HPF_Fs22050_Gain9_A1                            12797         /* Floating point value 0.390537 */
 #define HPF_Fs22050_Gain9_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain9_B1                            12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain9_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain9_Shift                             2         /* Shift value */
                                                                     /* Gain =  10.000000 dB */
-#define HPF_Fs22050_Gain10_A0                           -2531         /* Floating point value -0.077238 */
+#define HPF_Fs22050_Gain10_A0                          (-2531)        /* Floating point value -0.077238 */
 #define HPF_Fs22050_Gain10_A1                           13679         /* Floating point value 0.417435 */
 #define HPF_Fs22050_Gain10_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain10_B1                           12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain10_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain10_Shift                            2         /* Shift value */
                                                                     /* Gain =  11.000000 dB */
-#define HPF_Fs22050_Gain11_A0                           -3520         /* Floating point value -0.107417 */
+#define HPF_Fs22050_Gain11_A0                          (-3520)        /* Floating point value -0.107417 */
 #define HPF_Fs22050_Gain11_A1                           14667         /* Floating point value 0.447615 */
 #define HPF_Fs22050_Gain11_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain11_B1                           12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain11_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain11_Shift                            2         /* Shift value */
                                                                     /* Gain =  12.000000 dB */
-#define HPF_Fs22050_Gain12_A0                           -4629         /* Floating point value -0.141279 */
+#define HPF_Fs22050_Gain12_A0                          (-4629)        /* Floating point value -0.141279 */
 #define HPF_Fs22050_Gain12_A1                           15777         /* Floating point value 0.481477 */
 #define HPF_Fs22050_Gain12_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain12_B1                           12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain12_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain12_Shift                            2         /* Shift value */
                                                                     /* Gain =  13.000000 dB */
-#define HPF_Fs22050_Gain13_A0                           -2944         /* Floating point value -0.089849 */
+#define HPF_Fs22050_Gain13_A0                          (-2944)        /* Floating point value -0.089849 */
 #define HPF_Fs22050_Gain13_A1                            8531         /* Floating point value 0.260352 */
 #define HPF_Fs22050_Gain13_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain13_B1                           12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain13_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain13_Shift                            3         /* Shift value */
                                                                     /* Gain =  14.000000 dB */
-#define HPF_Fs22050_Gain14_A0                           -3644         /* Floating point value -0.111215 */
+#define HPF_Fs22050_Gain14_A0                          (-3644)        /* Floating point value -0.111215 */
 #define HPF_Fs22050_Gain14_A1                            9231         /* Floating point value 0.281718 */
 #define HPF_Fs22050_Gain14_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain14_B1                           12125         /* Floating point value 0.370033 */
 #define HPF_Fs22050_Gain14_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain14_Shift                            3         /* Shift value */
                                                                     /* Gain =  15.000000 dB */
-#define HPF_Fs22050_Gain15_A0                           -4430         /* Floating point value -0.135187 */
+#define HPF_Fs22050_Gain15_A0                          (-4430)        /* Floating point value -0.135187 */
 #define HPF_Fs22050_Gain15_A1                           10017         /* Floating point value 0.305690 */
 #define HPF_Fs22050_Gain15_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs22050_Gain15_B1                           12125         /* Floating point value 0.370033 */
@@ -168,77 +168,77 @@
 #define HPF_Fs24000_Gain4_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain4_Shift                             1         /* Shift value */
                                                                     /* Gain =  5.000000 dB */
-#define HPF_Fs24000_Gain5_A0                             -275         /* Floating point value -0.008383 */
+#define HPF_Fs24000_Gain5_A0                            (-275)        /* Floating point value -0.008383 */
 #define HPF_Fs24000_Gain5_A1                            20860         /* Floating point value 0.636589 */
 #define HPF_Fs24000_Gain5_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain5_B1                             8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain5_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain5_Shift                             1         /* Shift value */
                                                                     /* Gain =  6.000000 dB */
-#define HPF_Fs24000_Gain6_A0                            -1564         /* Floating point value -0.047733 */
+#define HPF_Fs24000_Gain6_A0                           (-1564)        /* Floating point value -0.047733 */
 #define HPF_Fs24000_Gain6_A1                            22149         /* Floating point value 0.675938 */
 #define HPF_Fs24000_Gain6_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain6_B1                             8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain6_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain6_Shift                             1         /* Shift value */
                                                                     /* Gain =  7.000000 dB */
-#define HPF_Fs24000_Gain7_A0                            -1509         /* Floating point value -0.046051 */
+#define HPF_Fs24000_Gain7_A0                           (-1509)        /* Floating point value -0.046051 */
 #define HPF_Fs24000_Gain7_A1                            11826         /* Floating point value 0.360899 */
 #define HPF_Fs24000_Gain7_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain7_B1                             8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain7_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain7_Shift                             2         /* Shift value */
                                                                     /* Gain =  8.000000 dB */
-#define HPF_Fs24000_Gain8_A0                            -2323         /* Floating point value -0.070878 */
+#define HPF_Fs24000_Gain8_A0                           (-2323)        /* Floating point value -0.070878 */
 #define HPF_Fs24000_Gain8_A1                            12640         /* Floating point value 0.385727 */
 #define HPF_Fs24000_Gain8_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain8_B1                             8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain8_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain8_Shift                             2         /* Shift value */
                                                                     /* Gain =  9.000000 dB */
-#define HPF_Fs24000_Gain9_A0                            -3235         /* Floating point value -0.098736 */
+#define HPF_Fs24000_Gain9_A0                           (-3235)        /* Floating point value -0.098736 */
 #define HPF_Fs24000_Gain9_A1                            13552         /* Floating point value 0.413584 */
 #define HPF_Fs24000_Gain9_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain9_B1                             8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain9_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain9_Shift                             2         /* Shift value */
                                                                     /* Gain =  10.000000 dB */
-#define HPF_Fs24000_Gain10_A0                           -4260         /* Floating point value -0.129992 */
+#define HPF_Fs24000_Gain10_A0                          (-4260)        /* Floating point value -0.129992 */
 #define HPF_Fs24000_Gain10_A1                           14577         /* Floating point value 0.444841 */
 #define HPF_Fs24000_Gain10_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain10_B1                            8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain10_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain10_Shift                            2         /* Shift value */
                                                                     /* Gain =  11.000000 dB */
-#define HPF_Fs24000_Gain11_A0                           -5409         /* Floating point value -0.165062 */
+#define HPF_Fs24000_Gain11_A0                          (-5409)        /* Floating point value -0.165062 */
 #define HPF_Fs24000_Gain11_A1                           15726         /* Floating point value 0.479911 */
 #define HPF_Fs24000_Gain11_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain11_B1                            8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain11_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain11_Shift                            2         /* Shift value */
                                                                     /* Gain =  12.000000 dB */
-#define HPF_Fs24000_Gain12_A0                           -6698         /* Floating point value -0.204411 */
+#define HPF_Fs24000_Gain12_A0                          (-6698)        /* Floating point value -0.204411 */
 #define HPF_Fs24000_Gain12_A1                           17015         /* Floating point value 0.519260 */
 #define HPF_Fs24000_Gain12_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain12_B1                            8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain12_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain12_Shift                            2         /* Shift value */
                                                                     /* Gain =  13.000000 dB */
-#define HPF_Fs24000_Gain13_A0                           -4082         /* Floating point value -0.124576 */
+#define HPF_Fs24000_Gain13_A0                          (-4082)        /* Floating point value -0.124576 */
 #define HPF_Fs24000_Gain13_A1                            9253         /* Floating point value 0.282374 */
 #define HPF_Fs24000_Gain13_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain13_B1                            8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain13_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain13_Shift                            3         /* Shift value */
                                                                     /* Gain =  14.000000 dB */
-#define HPF_Fs24000_Gain14_A0                           -4896         /* Floating point value -0.149404 */
+#define HPF_Fs24000_Gain14_A0                          (-4896)        /* Floating point value -0.149404 */
 #define HPF_Fs24000_Gain14_A1                           10066         /* Floating point value 0.307202 */
 #define HPF_Fs24000_Gain14_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain14_B1                            8780         /* Floating point value 0.267949 */
 #define HPF_Fs24000_Gain14_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain14_Shift                            3         /* Shift value */
                                                                     /* Gain =  15.000000 dB */
-#define HPF_Fs24000_Gain15_A0                           -5808         /* Floating point value -0.177261 */
+#define HPF_Fs24000_Gain15_A0                          (-5808)        /* Floating point value -0.177261 */
 #define HPF_Fs24000_Gain15_A1                           10979         /* Floating point value 0.335059 */
 #define HPF_Fs24000_Gain15_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs24000_Gain15_B1                            8780         /* Floating point value 0.267949 */
@@ -249,105 +249,105 @@
 /* Coefficients for sample rate 32000Hz */
                                                                     /* Gain =  1.000000 dB */
 #define HPF_Fs32000_Gain1_A0                            17225         /* Floating point value 0.525677 */
-#define HPF_Fs32000_Gain1_A1                             -990         /* Floating point value -0.030227 */
+#define HPF_Fs32000_Gain1_A1                            (-990)        /* Floating point value -0.030227 */
 #define HPF_Fs32000_Gain1_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain1_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain1_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain1_Shift                             1         /* Shift value */
                                                                     /* Gain =  2.000000 dB */
 #define HPF_Fs32000_Gain2_A0                            18337         /* Floating point value 0.559593 */
-#define HPF_Fs32000_Gain2_A1                            -2102         /* Floating point value -0.064142 */
+#define HPF_Fs32000_Gain2_A1                           (-2102)        /* Floating point value -0.064142 */
 #define HPF_Fs32000_Gain2_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain2_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain2_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain2_Shift                             1         /* Shift value */
                                                                     /* Gain =  3.000000 dB */
 #define HPF_Fs32000_Gain3_A0                            19584         /* Floating point value 0.597646 */
-#define HPF_Fs32000_Gain3_A1                            -3349         /* Floating point value -0.102196 */
+#define HPF_Fs32000_Gain3_A1                           (-3349)        /* Floating point value -0.102196 */
 #define HPF_Fs32000_Gain3_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain3_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain3_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain3_Shift                             1         /* Shift value */
                                                                     /* Gain =  4.000000 dB */
 #define HPF_Fs32000_Gain4_A0                            20983         /* Floating point value 0.640343 */
-#define HPF_Fs32000_Gain4_A1                            -4748         /* Floating point value -0.144893 */
+#define HPF_Fs32000_Gain4_A1                           (-4748)        /* Floating point value -0.144893 */
 #define HPF_Fs32000_Gain4_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain4_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain4_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain4_Shift                             1         /* Shift value */
                                                                     /* Gain =  5.000000 dB */
 #define HPF_Fs32000_Gain5_A0                            22553         /* Floating point value 0.688250 */
-#define HPF_Fs32000_Gain5_A1                            -6318         /* Floating point value -0.192799 */
+#define HPF_Fs32000_Gain5_A1                           (-6318)        /* Floating point value -0.192799 */
 #define HPF_Fs32000_Gain5_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain5_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain5_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain5_Shift                             1         /* Shift value */
                                                                     /* Gain =  6.000000 dB */
 #define HPF_Fs32000_Gain6_A0                            24314         /* Floating point value 0.742002 */
-#define HPF_Fs32000_Gain6_A1                            -8079         /* Floating point value -0.246551 */
+#define HPF_Fs32000_Gain6_A1                           (-8079)        /* Floating point value -0.246551 */
 #define HPF_Fs32000_Gain6_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain6_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain6_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain6_Shift                             1         /* Shift value */
                                                                     /* Gain =  7.000000 dB */
 #define HPF_Fs32000_Gain7_A0                            13176         /* Floating point value 0.402109 */
-#define HPF_Fs32000_Gain7_A1                            -5040         /* Floating point value -0.153795 */
+#define HPF_Fs32000_Gain7_A1                           (-5040)        /* Floating point value -0.153795 */
 #define HPF_Fs32000_Gain7_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain7_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain7_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain7_Shift                             2         /* Shift value */
                                                                     /* Gain =  8.000000 dB */
 #define HPF_Fs32000_Gain8_A0                            14288         /* Floating point value 0.436024 */
-#define HPF_Fs32000_Gain8_A1                            -6151         /* Floating point value -0.187711 */
+#define HPF_Fs32000_Gain8_A1                           (-6151)        /* Floating point value -0.187711 */
 #define HPF_Fs32000_Gain8_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain8_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain8_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain8_Shift                             2         /* Shift value */
                                                                     /* Gain =  9.000000 dB */
 #define HPF_Fs32000_Gain9_A0                            15535         /* Floating point value 0.474078 */
-#define HPF_Fs32000_Gain9_A1                            -7398         /* Floating point value -0.225764 */
+#define HPF_Fs32000_Gain9_A1                           (-7398)        /* Floating point value -0.225764 */
 #define HPF_Fs32000_Gain9_A2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain9_B1                                0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain9_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain9_Shift                             2         /* Shift value */
                                                                     /* Gain =  10.000000 dB */
 #define HPF_Fs32000_Gain10_A0                           16934         /* Floating point value 0.516774 */
-#define HPF_Fs32000_Gain10_A1                           -8797         /* Floating point value -0.268461 */
+#define HPF_Fs32000_Gain10_A1                          (-8797)        /* Floating point value -0.268461 */
 #define HPF_Fs32000_Gain10_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain10_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain10_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain10_Shift                            2         /* Shift value */
                                                                     /* Gain =  11.000000 dB */
 #define HPF_Fs32000_Gain11_A0                           18503         /* Floating point value 0.564681 */
-#define HPF_Fs32000_Gain11_A1                          -10367         /* Floating point value -0.316368 */
+#define HPF_Fs32000_Gain11_A1                         (-10367)        /* Floating point value -0.316368 */
 #define HPF_Fs32000_Gain11_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain11_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain11_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain11_Shift                            2         /* Shift value */
                                                                     /* Gain =  12.000000 dB */
 #define HPF_Fs32000_Gain12_A0                           20265         /* Floating point value 0.618433 */
-#define HPF_Fs32000_Gain12_A1                          -12128         /* Floating point value -0.370120 */
+#define HPF_Fs32000_Gain12_A1                         (-12128)        /* Floating point value -0.370120 */
 #define HPF_Fs32000_Gain12_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain12_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain12_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain12_Shift                            2         /* Shift value */
                                                                     /* Gain =  13.000000 dB */
 #define HPF_Fs32000_Gain13_A0                           11147         /* Floating point value 0.340178 */
-#define HPF_Fs32000_Gain13_A1                           -7069         /* Floating point value -0.215726 */
+#define HPF_Fs32000_Gain13_A1                          (-7069)        /* Floating point value -0.215726 */
 #define HPF_Fs32000_Gain13_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain13_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain13_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain13_Shift                            3         /* Shift value */
                                                                     /* Gain =  14.000000 dB */
 #define HPF_Fs32000_Gain14_A0                           12258         /* Floating point value 0.374093 */
-#define HPF_Fs32000_Gain14_A1                           -8180         /* Floating point value -0.249642 */
+#define HPF_Fs32000_Gain14_A1                          (-8180)        /* Floating point value -0.249642 */
 #define HPF_Fs32000_Gain14_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain14_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain14_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain14_Shift                            3         /* Shift value */
                                                                     /* Gain =  15.000000 dB */
 #define HPF_Fs32000_Gain15_A0                           13505         /* Floating point value 0.412147 */
-#define HPF_Fs32000_Gain15_A1                           -9427         /* Floating point value -0.287695 */
+#define HPF_Fs32000_Gain15_A1                          (-9427)        /* Floating point value -0.287695 */
 #define HPF_Fs32000_Gain15_A2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs32000_Gain15_B1                               0         /* Floating point value -0.000000 */
 #define HPF_Fs32000_Gain15_B2                               0         /* Floating point value 0.000000 */
@@ -357,107 +357,107 @@
 /* Coefficients for sample rate 44100Hz */
                                                                     /* Gain =  1.000000 dB */
 #define HPF_Fs44100_Gain1_A0                            17442         /* Floating point value 0.532294 */
-#define HPF_Fs44100_Gain1_A1                            -4761         /* Floating point value -0.145294 */
+#define HPF_Fs44100_Gain1_A1                           (-4761)        /* Floating point value -0.145294 */
 #define HPF_Fs44100_Gain1_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain1_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain1_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain1_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain1_Shift                             1         /* Shift value */
                                                                     /* Gain =  2.000000 dB */
 #define HPF_Fs44100_Gain2_A0                            18797         /* Floating point value 0.573633 */
-#define HPF_Fs44100_Gain2_A1                            -6116         /* Floating point value -0.186634 */
+#define HPF_Fs44100_Gain2_A1                           (-6116)        /* Floating point value -0.186634 */
 #define HPF_Fs44100_Gain2_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain2_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain2_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain2_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain2_Shift                             1         /* Shift value */
                                                                     /* Gain =  3.000000 dB */
 #define HPF_Fs44100_Gain3_A0                            20317         /* Floating point value 0.620016 */
-#define HPF_Fs44100_Gain3_A1                            -7635         /* Floating point value -0.233017 */
+#define HPF_Fs44100_Gain3_A1                           (-7635)        /* Floating point value -0.233017 */
 #define HPF_Fs44100_Gain3_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain3_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain3_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain3_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain3_Shift                             1         /* Shift value */
                                                                     /* Gain =  4.000000 dB */
 #define HPF_Fs44100_Gain4_A0                            22022         /* Floating point value 0.672059 */
-#define HPF_Fs44100_Gain4_A1                            -9341         /* Floating point value -0.285060 */
+#define HPF_Fs44100_Gain4_A1                           (-9341)        /* Floating point value -0.285060 */
 #define HPF_Fs44100_Gain4_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain4_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain4_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain4_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain4_Shift                             1         /* Shift value */
                                                                     /* Gain =  5.000000 dB */
 #define HPF_Fs44100_Gain5_A0                            23935         /* Floating point value 0.730452 */
-#define HPF_Fs44100_Gain5_A1                           -11254         /* Floating point value -0.343453 */
+#define HPF_Fs44100_Gain5_A1                          (-11254)        /* Floating point value -0.343453 */
 #define HPF_Fs44100_Gain5_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain5_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain5_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain5_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain5_Shift                             1         /* Shift value */
                                                                     /* Gain =  6.000000 dB */
 #define HPF_Fs44100_Gain6_A0                            26082         /* Floating point value 0.795970 */
-#define HPF_Fs44100_Gain6_A1                           -13401         /* Floating point value -0.408971 */
+#define HPF_Fs44100_Gain6_A1                          (-13401)        /* Floating point value -0.408971 */
 #define HPF_Fs44100_Gain6_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain6_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain6_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain6_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain6_Shift                             1         /* Shift value */
                                                                     /* Gain =  7.000000 dB */
 #define HPF_Fs44100_Gain7_A0                            14279         /* Floating point value 0.435774 */
-#define HPF_Fs44100_Gain7_A1                            -7924         /* Floating point value -0.241815 */
+#define HPF_Fs44100_Gain7_A1                           (-7924)        /* Floating point value -0.241815 */
 #define HPF_Fs44100_Gain7_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain7_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain7_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain7_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain7_Shift                             2         /* Shift value */
                                                                     /* Gain =  8.000000 dB */
 #define HPF_Fs44100_Gain8_A0                            15634         /* Floating point value 0.477113 */
-#define HPF_Fs44100_Gain8_A1                            -9278         /* Floating point value -0.283154 */
+#define HPF_Fs44100_Gain8_A1                           (-9278)        /* Floating point value -0.283154 */
 #define HPF_Fs44100_Gain8_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain8_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain8_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain8_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain8_Shift                             2         /* Shift value */
                                                                     /* Gain =  9.000000 dB */
 #define HPF_Fs44100_Gain9_A0                            17154         /* Floating point value 0.523496 */
-#define HPF_Fs44100_Gain9_A1                           -10798         /* Floating point value -0.329537 */
+#define HPF_Fs44100_Gain9_A1                          (-10798)        /* Floating point value -0.329537 */
 #define HPF_Fs44100_Gain9_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain9_B1                            -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain9_B1                           (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain9_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain9_Shift                             2         /* Shift value */
                                                                     /* Gain =  10.000000 dB */
 #define HPF_Fs44100_Gain10_A0                           18859         /* Floating point value 0.575539 */
-#define HPF_Fs44100_Gain10_A1                          -12504         /* Floating point value -0.381580 */
+#define HPF_Fs44100_Gain10_A1                         (-12504)        /* Floating point value -0.381580 */
 #define HPF_Fs44100_Gain10_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain10_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain10_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain10_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain10_Shift                            2         /* Shift value */
                                                                     /* Gain =  11.000000 dB */
 #define HPF_Fs44100_Gain11_A0                           20773         /* Floating point value 0.633932 */
-#define HPF_Fs44100_Gain11_A1                          -14417         /* Floating point value -0.439973 */
+#define HPF_Fs44100_Gain11_A1                         (-14417)        /* Floating point value -0.439973 */
 #define HPF_Fs44100_Gain11_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain11_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain11_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain11_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain11_Shift                            2         /* Shift value */
                                                                     /* Gain =  12.000000 dB */
 #define HPF_Fs44100_Gain12_A0                           22920         /* Floating point value 0.699450 */
-#define HPF_Fs44100_Gain12_A1                          -16564         /* Floating point value -0.505491 */
+#define HPF_Fs44100_Gain12_A1                         (-16564)        /* Floating point value -0.505491 */
 #define HPF_Fs44100_Gain12_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain12_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain12_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain12_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain12_Shift                            2         /* Shift value */
                                                                     /* Gain =  13.000000 dB */
 #define HPF_Fs44100_Gain13_A0                           12694         /* Floating point value 0.387399 */
-#define HPF_Fs44100_Gain13_A1                           -9509         /* Floating point value -0.290189 */
+#define HPF_Fs44100_Gain13_A1                          (-9509)        /* Floating point value -0.290189 */
 #define HPF_Fs44100_Gain13_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain13_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain13_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain13_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain13_Shift                            3         /* Shift value */
                                                                     /* Gain =  14.000000 dB */
 #define HPF_Fs44100_Gain14_A0                           14049         /* Floating point value 0.428738 */
-#define HPF_Fs44100_Gain14_A1                          -10864         /* Floating point value -0.331528 */
+#define HPF_Fs44100_Gain14_A1                         (-10864)        /* Floating point value -0.331528 */
 #define HPF_Fs44100_Gain14_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain14_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain14_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain14_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain14_Shift                            3         /* Shift value */
                                                                     /* Gain =  15.000000 dB */
 #define HPF_Fs44100_Gain15_A0                           15569         /* Floating point value 0.475121 */
-#define HPF_Fs44100_Gain15_A1                          -12383         /* Floating point value -0.377912 */
+#define HPF_Fs44100_Gain15_A1                         (-12383)        /* Floating point value -0.377912 */
 #define HPF_Fs44100_Gain15_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs44100_Gain15_B1                           -7173         /* Floating point value -0.218894 */
+#define HPF_Fs44100_Gain15_B1                          (-7173)        /* Floating point value -0.218894 */
 #define HPF_Fs44100_Gain15_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs44100_Gain15_Shift                            3         /* Shift value */
 
@@ -465,107 +465,107 @@
 /* Coefficients for sample rate 48000Hz */
                                                                     /* Gain =  1.000000 dB */
 #define HPF_Fs48000_Gain1_A0                            17491         /* Floating point value 0.533777 */
-#define HPF_Fs48000_Gain1_A1                            -5606         /* Floating point value -0.171082 */
+#define HPF_Fs48000_Gain1_A1                           (-5606)        /* Floating point value -0.171082 */
 #define HPF_Fs48000_Gain1_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain1_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain1_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain1_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain1_Shift                             1         /* Shift value */
                                                                     /* Gain =  2.000000 dB */
 #define HPF_Fs48000_Gain2_A0                            18900         /* Floating point value 0.576779 */
-#define HPF_Fs48000_Gain2_A1                            -7015         /* Floating point value -0.214085 */
+#define HPF_Fs48000_Gain2_A1                           (-7015)        /* Floating point value -0.214085 */
 #define HPF_Fs48000_Gain2_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain2_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain2_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain2_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain2_Shift                             1         /* Shift value */
                                                                     /* Gain =  3.000000 dB */
 #define HPF_Fs48000_Gain3_A0                            20481         /* Floating point value 0.625029 */
-#define HPF_Fs48000_Gain3_A1                            -8596         /* Floating point value -0.262335 */
+#define HPF_Fs48000_Gain3_A1                           (-8596)        /* Floating point value -0.262335 */
 #define HPF_Fs48000_Gain3_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain3_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain3_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain3_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain3_Shift                             1         /* Shift value */
                                                                     /* Gain =  4.000000 dB */
 #define HPF_Fs48000_Gain4_A0                            22255         /* Floating point value 0.679167 */
-#define HPF_Fs48000_Gain4_A1                           -10370         /* Floating point value -0.316472 */
+#define HPF_Fs48000_Gain4_A1                          (-10370)        /* Floating point value -0.316472 */
 #define HPF_Fs48000_Gain4_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain4_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain4_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain4_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain4_Shift                             1         /* Shift value */
                                                                     /* Gain =  5.000000 dB */
 #define HPF_Fs48000_Gain5_A0                            24245         /* Floating point value 0.739910 */
-#define HPF_Fs48000_Gain5_A1                           -12361         /* Floating point value -0.377215 */
+#define HPF_Fs48000_Gain5_A1                          (-12361)        /* Floating point value -0.377215 */
 #define HPF_Fs48000_Gain5_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain5_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain5_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain5_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain5_Shift                             1         /* Shift value */
                                                                     /* Gain =  6.000000 dB */
 #define HPF_Fs48000_Gain6_A0                            26479         /* Floating point value 0.808065 */
-#define HPF_Fs48000_Gain6_A1                           -14594         /* Floating point value -0.445370 */
+#define HPF_Fs48000_Gain6_A1                          (-14594)        /* Floating point value -0.445370 */
 #define HPF_Fs48000_Gain6_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain6_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain6_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain6_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain6_Shift                             1         /* Shift value */
                                                                     /* Gain =  7.000000 dB */
 #define HPF_Fs48000_Gain7_A0                            14527         /* Floating point value 0.443318 */
-#define HPF_Fs48000_Gain7_A1                            -8570         /* Floating point value -0.261540 */
+#define HPF_Fs48000_Gain7_A1                           (-8570)        /* Floating point value -0.261540 */
 #define HPF_Fs48000_Gain7_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain7_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain7_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain7_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain7_Shift                             2         /* Shift value */
                                                                     /* Gain =  8.000000 dB */
 #define HPF_Fs48000_Gain8_A0                            15936         /* Floating point value 0.486321 */
-#define HPF_Fs48000_Gain8_A1                            -9979         /* Floating point value -0.304543 */
+#define HPF_Fs48000_Gain8_A1                           (-9979)        /* Floating point value -0.304543 */
 #define HPF_Fs48000_Gain8_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain8_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain8_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain8_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain8_Shift                             2         /* Shift value */
                                                                     /* Gain =  9.000000 dB */
 #define HPF_Fs48000_Gain9_A0                            17517         /* Floating point value 0.534571 */
-#define HPF_Fs48000_Gain9_A1                           -11560         /* Floating point value -0.352793 */
+#define HPF_Fs48000_Gain9_A1                          (-11560)        /* Floating point value -0.352793 */
 #define HPF_Fs48000_Gain9_A2                                0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain9_B1                            -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain9_B1                           (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain9_B2                                0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain9_Shift                             2         /* Shift value */
                                                                     /* Gain =  10.000000 dB */
 #define HPF_Fs48000_Gain10_A0                           19291         /* Floating point value 0.588708 */
-#define HPF_Fs48000_Gain10_A1                          -13334         /* Floating point value -0.406930 */
+#define HPF_Fs48000_Gain10_A1                         (-13334)        /* Floating point value -0.406930 */
 #define HPF_Fs48000_Gain10_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain10_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain10_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain10_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain10_Shift                            2         /* Shift value */
                                                                     /* Gain =  11.000000 dB */
 #define HPF_Fs48000_Gain11_A0                           21281         /* Floating point value 0.649452 */
-#define HPF_Fs48000_Gain11_A1                          -15325         /* Floating point value -0.467674 */
+#define HPF_Fs48000_Gain11_A1                         (-15325)        /* Floating point value -0.467674 */
 #define HPF_Fs48000_Gain11_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain11_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain11_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain11_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain11_Shift                            2         /* Shift value */
                                                                     /* Gain =  12.000000 dB */
 #define HPF_Fs48000_Gain12_A0                           23515         /* Floating point value 0.717607 */
-#define HPF_Fs48000_Gain12_A1                          -17558         /* Floating point value -0.535829 */
+#define HPF_Fs48000_Gain12_A1                         (-17558)        /* Floating point value -0.535829 */
 #define HPF_Fs48000_Gain12_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain12_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain12_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain12_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain12_Shift                            2         /* Shift value */
                                                                     /* Gain =  13.000000 dB */
 #define HPF_Fs48000_Gain13_A0                           13041         /* Floating point value 0.397982 */
-#define HPF_Fs48000_Gain13_A1                          -10056         /* Floating point value -0.306877 */
+#define HPF_Fs48000_Gain13_A1                         (-10056)        /* Floating point value -0.306877 */
 #define HPF_Fs48000_Gain13_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain13_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain13_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain13_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain13_Shift                            3         /* Shift value */
                                                                     /* Gain =  14.000000 dB */
 #define HPF_Fs48000_Gain14_A0                           14450         /* Floating point value 0.440984 */
-#define HPF_Fs48000_Gain14_A1                          -11465         /* Floating point value -0.349880 */
+#define HPF_Fs48000_Gain14_A1                         (-11465)        /* Floating point value -0.349880 */
 #define HPF_Fs48000_Gain14_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain14_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain14_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain14_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain14_Shift                            3         /* Shift value */
                                                                     /* Gain =  15.000000 dB */
 #define HPF_Fs48000_Gain15_A0                           16031         /* Floating point value 0.489234 */
-#define HPF_Fs48000_Gain15_A1                          -13046         /* Floating point value -0.398130 */
+#define HPF_Fs48000_Gain15_A1                         (-13046)        /* Floating point value -0.398130 */
 #define HPF_Fs48000_Gain15_A2                               0         /* Floating point value 0.000000 */
-#define HPF_Fs48000_Gain15_B1                           -8780         /* Floating point value -0.267949 */
+#define HPF_Fs48000_Gain15_B1                          (-8780)        /* Floating point value -0.267949 */
 #define HPF_Fs48000_Gain15_B2                               0         /* Floating point value 0.000000 */
 #define HPF_Fs48000_Gain15_Shift                            3         /* Shift value */
 
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
index 2d1cf42..2e85f77 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
@@ -81,7 +81,7 @@
 #define LVM_TE_MIN_EFFECTLEVEL          0         /*TE Minimum EffectLevel*/
 #define LVM_TE_MAX_EFFECTLEVEL          15        /*TE Maximum Effect level*/
 
-#define LVM_VC_MIN_EFFECTLEVEL          -96       /*VC Minimum EffectLevel*/
+#define LVM_VC_MIN_EFFECTLEVEL          (-96)     /*VC Minimum EffectLevel*/
 #define LVM_VC_MAX_EFFECTLEVEL          0         /*VC Maximum Effect level*/
 
 #define LVM_BE_MIN_EFFECTLEVEL          0         /*BE Minimum EffectLevel*/
@@ -89,7 +89,7 @@
 
 #define LVM_EQNB_MIN_BAND_FREQ          20        /*EQNB Minimum Band Frequency*/
 #define LVM_EQNB_MAX_BAND_FREQ          24000     /*EQNB Maximum Band Frequency*/
-#define LVM_EQNB_MIN_BAND_GAIN          -15       /*EQNB Minimum Band Frequency*/
+#define LVM_EQNB_MIN_BAND_GAIN          (-15)     /*EQNB Minimum Band Frequency*/
 #define LVM_EQNB_MAX_BAND_GAIN          15        /*EQNB Maximum Band Frequency*/
 #define LVM_EQNB_MIN_QFACTOR            25        /*EQNB Minimum Q Factor*/
 #define LVM_EQNB_MAX_QFACTOR            1200      /*EQNB Maximum Q Factor*/
@@ -103,7 +103,7 @@
 
 #define LVM_VC_MIXER_TIME              100       /*VC mixer time*/
 #define LVM_VC_BALANCE_MAX             96        /*VC balance max value*/
-#define LVM_VC_BALANCE_MIN             -96       /*VC balance min value*/
+#define LVM_VC_BALANCE_MIN             (-96)     /*VC balance min value*/
 
 /* Algorithm masks */
 #define LVM_CS_MASK                     1
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 0c6fb25..68c55f7 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -73,10 +73,10 @@
 #define LVM_MEM_EXTERNAL        8                   /* External (slow) access memory */
 
 /* Platform specific */
-#define LVM_PERSISTENT          LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_PERSISTENT_DATA     LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_PERSISTENT_COEF     LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
-#define LVM_SCRATCH             LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL
+#define LVM_PERSISTENT          (LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_PERSISTENT_DATA     (LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_PERSISTENT_COEF     (LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL)
+#define LVM_SCRATCH             (LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL)
 
 /****************************************************************************************/
 /*                                                                                      */
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
index 87d7145..95212f2 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Coeffs.h
@@ -27,21 +27,21 @@
 /************************************************************************************/
 
 #define LVEQNB_GAINSHIFT                                   11         /* As a power of 2 */
-#define LVEQNB_Gain_Neg15_dB                            -1684         /* Floating point value -0.822172 */
-#define LVEQNB_Gain_Neg14_dB                            -1639         /* Floating point value -0.800474 */
-#define LVEQNB_Gain_Neg13_dB                            -1590         /* Floating point value -0.776128 */
-#define LVEQNB_Gain_Neg12_dB                            -1534         /* Floating point value -0.748811 */
-#define LVEQNB_Gain_Neg11_dB                            -1471         /* Floating point value -0.718162 */
-#define LVEQNB_Gain_Neg10_dB                            -1400         /* Floating point value -0.683772 */
-#define LVEQNB_Gain_Neg9_dB                             -1321         /* Floating point value -0.645187 */
-#define LVEQNB_Gain_Neg8_dB                             -1233         /* Floating point value -0.601893 */
-#define LVEQNB_Gain_Neg7_dB                             -1133         /* Floating point value -0.553316 */
-#define LVEQNB_Gain_Neg6_dB                             -1022         /* Floating point value -0.498813 */
-#define LVEQNB_Gain_Neg5_dB                              -896         /* Floating point value -0.437659 */
-#define LVEQNB_Gain_Neg4_dB                              -756         /* Floating point value -0.369043 */
-#define LVEQNB_Gain_Neg3_dB                              -598         /* Floating point value -0.292054 */
-#define LVEQNB_Gain_Neg2_dB                              -421         /* Floating point value -0.205672 */
-#define LVEQNB_Gain_Neg1_dB                              -223         /* Floating point value -0.108749 */
+#define LVEQNB_Gain_Neg15_dB                           (-1684)        /* Floating point value -0.822172 */
+#define LVEQNB_Gain_Neg14_dB                           (-1639)        /* Floating point value -0.800474 */
+#define LVEQNB_Gain_Neg13_dB                           (-1590)        /* Floating point value -0.776128 */
+#define LVEQNB_Gain_Neg12_dB                           (-1534)        /* Floating point value -0.748811 */
+#define LVEQNB_Gain_Neg11_dB                           (-1471)        /* Floating point value -0.718162 */
+#define LVEQNB_Gain_Neg10_dB                           (-1400)        /* Floating point value -0.683772 */
+#define LVEQNB_Gain_Neg9_dB                            (-1321)        /* Floating point value -0.645187 */
+#define LVEQNB_Gain_Neg8_dB                            (-1233)        /* Floating point value -0.601893 */
+#define LVEQNB_Gain_Neg7_dB                            (-1133)        /* Floating point value -0.553316 */
+#define LVEQNB_Gain_Neg6_dB                            (-1022)        /* Floating point value -0.498813 */
+#define LVEQNB_Gain_Neg5_dB                             (-896)        /* Floating point value -0.437659 */
+#define LVEQNB_Gain_Neg4_dB                             (-756)        /* Floating point value -0.369043 */
+#define LVEQNB_Gain_Neg3_dB                             (-598)        /* Floating point value -0.292054 */
+#define LVEQNB_Gain_Neg2_dB                             (-421)        /* Floating point value -0.205672 */
+#define LVEQNB_Gain_Neg1_dB                             (-223)        /* Floating point value -0.108749 */
 #define LVEQNB_Gain_0_dB                                    0         /* Floating point value 0.000000 */
 #define LVEQNB_Gain_1_dB                                  250         /* Floating point value 0.122018 */
 #define LVEQNB_Gain_2_dB                                  530         /* Floating point value 0.258925 */
diff --git a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
index 1d8bedd..03522fb 100644
--- a/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
+++ b/media/libeffects/lvm/lib/SpectrumAnalyzer/src/LVPSA_Private.h
@@ -52,7 +52,7 @@
 #define LVPSA_NBANDSMIN                  1      /* Minimum number of frequency band                                 */
 #define LVPSA_NBANDSMAX                  30     /* Maximum number of frequency band                                 */
 #define LVPSA_MAXCENTERFREQ              20000  /* Maximum possible center frequency                                */
-#define LVPSA_MINPOSTGAIN                -15    /* Minimum possible post gain                                       */
+#define LVPSA_MINPOSTGAIN              (-15)    /* Minimum possible post gain                                       */
 #define LVPSA_MAXPOSTGAIN                15     /* Maximum possible post gain                                       */
 #define LVPSA_MINQFACTOR                 25     /* Minimum possible Q factor                                        */
 #define LVPSA_MAXQFACTOR                 1200   /* Maximum possible Q factor                                        */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
index 1d55281..3e640cb 100644
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Headphone_Coeffs.h
@@ -27,127 +27,127 @@
 
 /* Stereo Enhancer coefficients for 8000 Hz sample rate, scaled with 0.161258 */
 #define CS_MIDDLE_8000_A0                          7462         /* Floating point value 0.227720 */
-#define CS_MIDDLE_8000_A1                         -7049         /* Floating point value -0.215125 */
+#define CS_MIDDLE_8000_A1                        (-7049)        /* Floating point value -0.215125 */
 #define CS_MIDDLE_8000_A2                             0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_8000_B1                        -30209         /* Floating point value -0.921899 */
+#define CS_MIDDLE_8000_B1                       (-30209)        /* Floating point value -0.921899 */
 #define CS_MIDDLE_8000_B2                             0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_8000_SCALE                         15
 #define CS_SIDE_8000_A0                           20036         /* Floating point value 0.611441 */
-#define CS_SIDE_8000_A1                          -12463         /* Floating point value -0.380344 */
-#define CS_SIDE_8000_A2                           -7573         /* Floating point value -0.231097 */
-#define CS_SIDE_8000_B1                          -20397         /* Floating point value -0.622470 */
-#define CS_SIDE_8000_B2                           -4285         /* Floating point value -0.130759 */
+#define CS_SIDE_8000_A1                         (-12463)        /* Floating point value -0.380344 */
+#define CS_SIDE_8000_A2                          (-7573)        /* Floating point value -0.231097 */
+#define CS_SIDE_8000_B1                         (-20397)        /* Floating point value -0.622470 */
+#define CS_SIDE_8000_B2                          (-4285)        /* Floating point value -0.130759 */
 #define CS_SIDE_8000_SCALE                           15
 
 /* Stereo Enhancer coefficients for 11025Hz sample rate, scaled with 0.162943 */
 #define CS_MIDDLE_11025_A0                         7564         /* Floating point value 0.230838 */
-#define CS_MIDDLE_11025_A1                        -7260         /* Floating point value -0.221559 */
+#define CS_MIDDLE_11025_A1                       (-7260)        /* Floating point value -0.221559 */
 #define CS_MIDDLE_11025_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_11025_B1                       -30902         /* Floating point value -0.943056 */
+#define CS_MIDDLE_11025_B1                      (-30902)        /* Floating point value -0.943056 */
 #define CS_MIDDLE_11025_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_11025_SCALE                        15
 #define CS_SIDE_11025_A0                          18264         /* Floating point value 0.557372 */
-#define CS_SIDE_11025_A1                         -12828         /* Floating point value -0.391490 */
-#define CS_SIDE_11025_A2                          -5436         /* Floating point value -0.165881 */
-#define CS_SIDE_11025_B1                         -28856         /* Floating point value -0.880608 */
+#define CS_SIDE_11025_A1                        (-12828)        /* Floating point value -0.391490 */
+#define CS_SIDE_11025_A2                         (-5436)        /* Floating point value -0.165881 */
+#define CS_SIDE_11025_B1                        (-28856)        /* Floating point value -0.880608 */
 #define CS_SIDE_11025_B2                           1062         /* Floating point value 0.032397 */
 #define CS_SIDE_11025_SCALE                          15
 
 /* Stereo Enhancer coefficients for 12000Hz sample rate, scaled with 0.162191 */
 #define CS_MIDDLE_12000_A0                         7534         /* Floating point value 0.229932 */
-#define CS_MIDDLE_12000_A1                        -7256         /* Floating point value -0.221436 */
+#define CS_MIDDLE_12000_A1                       (-7256)        /* Floating point value -0.221436 */
 #define CS_MIDDLE_12000_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_12000_B1                       -31051         /* Floating point value -0.947616 */
+#define CS_MIDDLE_12000_B1                      (-31051)        /* Floating point value -0.947616 */
 #define CS_MIDDLE_12000_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_12000_SCALE                        15
 #define CS_SIDE_12000_A0                          18298         /* Floating point value 0.558398 */
-#define CS_SIDE_12000_A1                         -12852         /* Floating point value -0.392211 */
-#define CS_SIDE_12000_A2                          -5446         /* Floating point value -0.166187 */
-#define CS_SIDE_12000_B1                         -29247         /* Floating point value -0.892550 */
+#define CS_SIDE_12000_A1                        (-12852)        /* Floating point value -0.392211 */
+#define CS_SIDE_12000_A2                         (-5446)        /* Floating point value -0.166187 */
+#define CS_SIDE_12000_B1                        (-29247)        /* Floating point value -0.892550 */
 #define CS_SIDE_12000_B2                           1077         /* Floating point value 0.032856 */
 #define CS_SIDE_12000_SCALE                          15
 
 /* Stereo Enhancer coefficients for 16000Hz sample rate, scaled with 0.162371 */
 #define CS_MIDDLE_16000_A0                         7558         /* Floating point value 0.230638 */
-#define CS_MIDDLE_16000_A1                        -7348         /* Floating point value -0.224232 */
+#define CS_MIDDLE_16000_A1                       (-7348)        /* Floating point value -0.224232 */
 #define CS_MIDDLE_16000_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_16000_B1                       -31475         /* Floating point value -0.960550 */
+#define CS_MIDDLE_16000_B1                      (-31475)        /* Floating point value -0.960550 */
 #define CS_MIDDLE_16000_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_16000_SCALE                        15
 #define CS_SIDE_16000_A0                           8187         /* Floating point value 0.499695 */
-#define CS_SIDE_16000_A1                          -5825         /* Floating point value -0.355543 */
-#define CS_SIDE_16000_A2                          -2362         /* Floating point value -0.144152 */
-#define CS_SIDE_16000_B1                         -17216         /* Floating point value -1.050788 */
+#define CS_SIDE_16000_A1                         (-5825)        /* Floating point value -0.355543 */
+#define CS_SIDE_16000_A2                         (-2362)        /* Floating point value -0.144152 */
+#define CS_SIDE_16000_B1                        (-17216)        /* Floating point value -1.050788 */
 #define CS_SIDE_16000_B2                           2361         /* Floating point value 0.144104 */
 #define CS_SIDE_16000_SCALE                          14
 
 /* Stereo Enhancer coefficients for 22050Hz sample rate, scaled with 0.160781 */
 #define CS_MIDDLE_22050_A0                         7496         /* Floating point value 0.228749 */
-#define CS_MIDDLE_22050_A1                        -7344         /* Floating point value -0.224128 */
+#define CS_MIDDLE_22050_A1                       (-7344)        /* Floating point value -0.224128 */
 #define CS_MIDDLE_22050_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_22050_B1                       -31826         /* Floating point value -0.971262 */
+#define CS_MIDDLE_22050_B1                      (-31826)        /* Floating point value -0.971262 */
 #define CS_MIDDLE_22050_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_22050_SCALE                        15
 #define CS_SIDE_22050_A0                           7211         /* Floating point value 0.440112 */
-#define CS_SIDE_22050_A1                          -4278         /* Floating point value -0.261096 */
-#define CS_SIDE_22050_A2                          -2933         /* Floating point value -0.179016 */
-#define CS_SIDE_22050_B1                         -18297         /* Floating point value -1.116786 */
+#define CS_SIDE_22050_A1                         (-4278)        /* Floating point value -0.261096 */
+#define CS_SIDE_22050_A2                         (-2933)        /* Floating point value -0.179016 */
+#define CS_SIDE_22050_B1                        (-18297)        /* Floating point value -1.116786 */
 #define CS_SIDE_22050_B2                           2990         /* Floating point value 0.182507 */
 #define CS_SIDE_22050_SCALE                          14
 
 /* Stereo Enhancer coefficients for 24000Hz sample rate, scaled with 0.161882 */
 #define CS_MIDDLE_24000_A0                         7550         /* Floating point value 0.230395 */
-#define CS_MIDDLE_24000_A1                        -7409         /* Floating point value -0.226117 */
+#define CS_MIDDLE_24000_A1                       (-7409)        /* Floating point value -0.226117 */
 #define CS_MIDDLE_24000_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_24000_B1                       -31902         /* Floating point value -0.973573 */
+#define CS_MIDDLE_24000_B1                      (-31902)        /* Floating point value -0.973573 */
 #define CS_MIDDLE_24000_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_24000_SCALE                        15
 #define CS_SIDE_24000_A0                           6796         /* Floating point value 0.414770 */
-#define CS_SIDE_24000_A1                          -4705         /* Floating point value -0.287182 */
-#define CS_SIDE_24000_A2                          -2090         /* Floating point value -0.127588 */
-#define CS_SIDE_24000_B1                         -20147         /* Floating point value -1.229648 */
+#define CS_SIDE_24000_A1                         (-4705)        /* Floating point value -0.287182 */
+#define CS_SIDE_24000_A2                         (-2090)        /* Floating point value -0.127588 */
+#define CS_SIDE_24000_B1                        (-20147)        /* Floating point value -1.229648 */
 #define CS_SIDE_24000_B2                           4623         /* Floating point value 0.282177 */
 #define CS_SIDE_24000_SCALE                          14
 
 /* Stereo Enhancer coefficients for 32000Hz sample rate, scaled with 0.160322 */
 #define CS_MIDDLE_32000_A0                         7484         /* Floating point value 0.228400 */
-#define CS_MIDDLE_32000_A1                        -7380         /* Floating point value -0.225214 */
+#define CS_MIDDLE_32000_A1                       (-7380)        /* Floating point value -0.225214 */
 #define CS_MIDDLE_32000_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_32000_B1                       -32117         /* Floating point value -0.980126 */
+#define CS_MIDDLE_32000_B1                      (-32117)        /* Floating point value -0.980126 */
 #define CS_MIDDLE_32000_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_32000_SCALE                        15
 #define CS_SIDE_32000_A0                           5973         /* Floating point value 0.364579 */
-#define CS_SIDE_32000_A1                          -3397         /* Floating point value -0.207355 */
-#define CS_SIDE_32000_A2                          -2576         /* Floating point value -0.157224 */
-#define CS_SIDE_32000_B1                         -20877         /* Floating point value -1.274231 */
+#define CS_SIDE_32000_A1                         (-3397)        /* Floating point value -0.207355 */
+#define CS_SIDE_32000_A2                         (-2576)        /* Floating point value -0.157224 */
+#define CS_SIDE_32000_B1                        (-20877)        /* Floating point value -1.274231 */
 #define CS_SIDE_32000_B2                           5120         /* Floating point value 0.312495 */
 #define CS_SIDE_32000_SCALE                          14
 
 /* Stereo Enhancer coefficients for 44100Hz sample rate, scaled with 0.163834 */
 #define CS_MIDDLE_44100_A0                         7654         /* Floating point value 0.233593 */
-#define CS_MIDDLE_44100_A1                        -7577         /* Floating point value -0.231225 */
+#define CS_MIDDLE_44100_A1                       (-7577)        /* Floating point value -0.231225 */
 #define CS_MIDDLE_44100_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_44100_B1                       -32294         /* Floating point value -0.985545 */
+#define CS_MIDDLE_44100_B1                      (-32294)        /* Floating point value -0.985545 */
 #define CS_MIDDLE_44100_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_44100_SCALE                        15
 #define CS_SIDE_44100_A0                           4662         /* Floating point value 0.284573 */
-#define CS_SIDE_44100_A1                          -4242         /* Floating point value -0.258910 */
-#define CS_SIDE_44100_A2                           -420         /* Floating point value -0.025662 */
-#define CS_SIDE_44100_B1                         -25760         /* Floating point value -1.572248 */
+#define CS_SIDE_44100_A1                         (-4242)        /* Floating point value -0.258910 */
+#define CS_SIDE_44100_A2                          (-420)        /* Floating point value -0.025662 */
+#define CS_SIDE_44100_B1                        (-25760)        /* Floating point value -1.572248 */
 #define CS_SIDE_44100_B2                           9640         /* Floating point value 0.588399 */
 #define CS_SIDE_44100_SCALE                          14
 
 /* Stereo Enhancer coefficients for 48000Hz sample rate, scaled with 0.164402 */
 #define CS_MIDDLE_48000_A0                         7682         /* Floating point value 0.234445 */
-#define CS_MIDDLE_48000_A1                        -7611         /* Floating point value -0.232261 */
+#define CS_MIDDLE_48000_A1                       (-7611)        /* Floating point value -0.232261 */
 #define CS_MIDDLE_48000_A2                            0         /* Floating point value 0.000000 */
-#define CS_MIDDLE_48000_B1                       -32333         /* Floating point value -0.986713 */
+#define CS_MIDDLE_48000_B1                      (-32333)        /* Floating point value -0.986713 */
 #define CS_MIDDLE_48000_B2                            0         /* Floating point value 0.000000 */
 #define CS_MIDDLE_48000_SCALE                        15
 #define CS_SIDE_48000_A0                           4466         /* Floating point value 0.272606 */
-#define CS_SIDE_48000_A1                          -4374         /* Floating point value -0.266952 */
-#define CS_SIDE_48000_A2                            -93         /* Floating point value -0.005654 */
-#define CS_SIDE_48000_B1                         -26495         /* Floating point value -1.617141 */
+#define CS_SIDE_48000_A1                         (-4374)        /* Floating point value -0.266952 */
+#define CS_SIDE_48000_A2                           (-93)        /* Floating point value -0.005654 */
+#define CS_SIDE_48000_B1                        (-26495)        /* Floating point value -1.617141 */
 #define CS_SIDE_48000_B2                          10329         /* Floating point value 0.630405 */
 #define CS_SIDE_48000_SCALE                          14
 
@@ -171,73 +171,73 @@
 
 /* Reverb coefficients for 8000 Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_8000_A0                         21865         /* Floating point value 0.667271 */
-#define CS_REVERB_8000_A1                        -21865         /* Floating point value -0.667271 */
+#define CS_REVERB_8000_A1                       (-21865)        /* Floating point value -0.667271 */
 #define CS_REVERB_8000_A2                             0         /* Floating point value 0.000000 */
-#define CS_REVERB_8000_B1                        -21895         /* Floating point value -0.668179 */
+#define CS_REVERB_8000_B1                       (-21895)        /* Floating point value -0.668179 */
 #define CS_REVERB_8000_B2                             0         /* Floating point value 0.000000 */
 #define CS_REVERB_8000_SCALE                         15
 
 /* Reverb coefficients for 11025Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_11025_A0                        22926         /* Floating point value 0.699638 */
-#define CS_REVERB_11025_A1                       -22926         /* Floating point value -0.699638 */
+#define CS_REVERB_11025_A1                      (-22926)        /* Floating point value -0.699638 */
 #define CS_REVERB_11025_A2                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_11025_B1                       -24546         /* Floating point value -0.749096 */
+#define CS_REVERB_11025_B1                      (-24546)        /* Floating point value -0.749096 */
 #define CS_REVERB_11025_B2                            0         /* Floating point value 0.000000 */
 #define CS_REVERB_11025_SCALE                        15
 
 /* Reverb coefficients for 12000Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_12000_A0                        23165         /* Floating point value 0.706931 */
-#define CS_REVERB_12000_A1                       -23165         /* Floating point value -0.706931 */
+#define CS_REVERB_12000_A1                      (-23165)        /* Floating point value -0.706931 */
 #define CS_REVERB_12000_A2                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_12000_B1                       -25144         /* Floating point value -0.767327 */
+#define CS_REVERB_12000_B1                      (-25144)        /* Floating point value -0.767327 */
 #define CS_REVERB_12000_B2                            0         /* Floating point value 0.000000 */
 #define CS_REVERB_12000_SCALE                        15
 
 /* Reverb coefficients for 16000Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_16000_A0                        23864         /* Floating point value 0.728272 */
-#define CS_REVERB_16000_A1                       -23864         /* Floating point value -0.728272 */
+#define CS_REVERB_16000_A1                      (-23864)        /* Floating point value -0.728272 */
 #define CS_REVERB_16000_A2                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_16000_B1                       -26892         /* Floating point value -0.820679 */
+#define CS_REVERB_16000_B1                      (-26892)        /* Floating point value -0.820679 */
 #define CS_REVERB_16000_B2                            0         /* Floating point value 0.000000 */
 #define CS_REVERB_16000_SCALE                        15
 
 /* Reverb coefficients for 22050Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_22050_A0                        16921         /* Floating point value 0.516396 */
 #define CS_REVERB_22050_A1                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_22050_A2                       -16921         /* Floating point value -0.516396 */
-#define CS_REVERB_22050_B1                       -16991         /* Floating point value -0.518512 */
-#define CS_REVERB_22050_B2                        -9535         /* Floating point value -0.290990 */
+#define CS_REVERB_22050_A2                      (-16921)        /* Floating point value -0.516396 */
+#define CS_REVERB_22050_B1                      (-16991)        /* Floating point value -0.518512 */
+#define CS_REVERB_22050_B2                       (-9535)        /* Floating point value -0.290990 */
 #define CS_REVERB_22050_SCALE                        15
 
 /* Reverb coefficients for 24000Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_24000_A0                        15714         /* Floating point value 0.479565 */
 #define CS_REVERB_24000_A1                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_24000_A2                       -15714         /* Floating point value -0.479565 */
-#define CS_REVERB_24000_B1                       -20898         /* Floating point value -0.637745 */
-#define CS_REVERB_24000_B2                        -6518         /* Floating point value -0.198912 */
+#define CS_REVERB_24000_A2                      (-15714)        /* Floating point value -0.479565 */
+#define CS_REVERB_24000_B1                      (-20898)        /* Floating point value -0.637745 */
+#define CS_REVERB_24000_B2                       (-6518)        /* Floating point value -0.198912 */
 #define CS_REVERB_24000_SCALE                        15
 
 /* Reverb coefficients for 32000Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_32000_A0                        12463         /* Floating point value 0.380349 */
 #define CS_REVERB_32000_A1                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_32000_A2                       -12463         /* Floating point value -0.380349 */
-#define CS_REVERB_32000_B1                       -31158         /* Floating point value -0.950873 */
+#define CS_REVERB_32000_A2                      (-12463)        /* Floating point value -0.380349 */
+#define CS_REVERB_32000_B1                      (-31158)        /* Floating point value -0.950873 */
 #define CS_REVERB_32000_B2                         1610         /* Floating point value 0.049127 */
 #define CS_REVERB_32000_SCALE                        15
 
 /* Reverb coefficients for 44100Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_44100_A0                         4872         /* Floating point value 0.297389 */
 #define CS_REVERB_44100_A1                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_44100_A2                        -4872         /* Floating point value -0.297389 */
-#define CS_REVERB_44100_B1                       -19668         /* Floating point value -1.200423 */
+#define CS_REVERB_44100_A2                       (-4872)        /* Floating point value -0.297389 */
+#define CS_REVERB_44100_B1                      (-19668)        /* Floating point value -1.200423 */
 #define CS_REVERB_44100_B2                         4203         /* Floating point value 0.256529 */
 #define CS_REVERB_44100_SCALE                        14
 
 /* Reverb coefficients for 48000Hz sample rate, scaled with 1.038030 */
 #define CS_REVERB_48000_A0                         4566         /* Floating point value 0.278661 */
 #define CS_REVERB_48000_A1                            0         /* Floating point value 0.000000 */
-#define CS_REVERB_48000_A2                        -4566         /* Floating point value -0.278661 */
-#define CS_REVERB_48000_B1                       -20562         /* Floating point value -1.254993 */
+#define CS_REVERB_48000_A2                       (-4566)        /* Floating point value -0.278661 */
+#define CS_REVERB_48000_B1                      (-20562)        /* Floating point value -1.254993 */
 #define CS_REVERB_48000_B2                         4970         /* Floating point value 0.303347 */
 #define CS_REVERB_48000_SCALE                        14
 
@@ -257,128 +257,128 @@
 
 /* Equaliser coefficients for 8000 Hz sample rate, CS scaled with 1.038497 and CSEX scaled with 0.775480 */
 #define CS_EQUALISER_8000_A0                      20698         /* Floating point value 1.263312 */
-#define CS_EQUALISER_8000_A1                      -9859         /* Floating point value -0.601748 */
-#define CS_EQUALISER_8000_A2                      -4599         /* Floating point value -0.280681 */
-#define CS_EQUALISER_8000_B1                      -7797         /* Floating point value -0.475865 */
-#define CS_EQUALISER_8000_B2                      -6687         /* Floating point value -0.408154 */
+#define CS_EQUALISER_8000_A1                     (-9859)        /* Floating point value -0.601748 */
+#define CS_EQUALISER_8000_A2                     (-4599)        /* Floating point value -0.280681 */
+#define CS_EQUALISER_8000_B1                     (-7797)        /* Floating point value -0.475865 */
+#define CS_EQUALISER_8000_B2                     (-6687)        /* Floating point value -0.408154 */
 #define CS_EQUALISER_8000_SCALE                      14
 #define CSEX_EQUALISER_8000_A0                    30912         /* Floating point value 0.943357 */
-#define CSEX_EQUALISER_8000_A1                   -14724         /* Floating point value -0.449345 */
-#define CSEX_EQUALISER_8000_A2                    -6868         /* Floating point value -0.209594 */
-#define CSEX_EQUALISER_8000_B1                   -15593         /* Floating point value -0.475865 */
-#define CSEX_EQUALISER_8000_B2                   -13374         /* Floating point value -0.408154 */
+#define CSEX_EQUALISER_8000_A1                  (-14724)        /* Floating point value -0.449345 */
+#define CSEX_EQUALISER_8000_A2                   (-6868)        /* Floating point value -0.209594 */
+#define CSEX_EQUALISER_8000_B1                  (-15593)        /* Floating point value -0.475865 */
+#define CSEX_EQUALISER_8000_B2                  (-13374)        /* Floating point value -0.408154 */
 #define CSEX_EQUALISER_8000_SCALE                    15
 
 /* Equaliser coefficients for 11025Hz sample rate, CS scaled with 1.027761 and CSEX scaled with 0.767463 */
 #define CS_EQUALISER_11025_A0                     18041         /* Floating point value 1.101145 */
 #define CS_EQUALISER_11025_A1                      2278         /* Floating point value 0.139020 */
-#define CS_EQUALISER_11025_A2                    -14163         /* Floating point value -0.864423 */
+#define CS_EQUALISER_11025_A2                   (-14163)        /* Floating point value -0.864423 */
 #define CS_EQUALISER_11025_B1                       402         /* Floating point value 0.024541 */
-#define CS_EQUALISER_11025_B2                    -14892         /* Floating point value -0.908930 */
+#define CS_EQUALISER_11025_B2                   (-14892)        /* Floating point value -0.908930 */
 #define CS_EQUALISER_11025_SCALE                     14
 #define CSEX_EQUALISER_11025_A0                   31983         /* Floating point value 0.976058 */
-#define CSEX_EQUALISER_11025_A1                  -22784         /* Floating point value -0.695326 */
-#define CSEX_EQUALISER_11025_A2                   -2976         /* Floating point value -0.090809 */
-#define CSEX_EQUALISER_11025_B1                  -20008         /* Floating point value -0.610594 */
-#define CSEX_EQUALISER_11025_B2                  -10196         /* Floating point value -0.311149 */
+#define CSEX_EQUALISER_11025_A1                 (-22784)        /* Floating point value -0.695326 */
+#define CSEX_EQUALISER_11025_A2                  (-2976)        /* Floating point value -0.090809 */
+#define CSEX_EQUALISER_11025_B1                 (-20008)        /* Floating point value -0.610594 */
+#define CSEX_EQUALISER_11025_B2                 (-10196)        /* Floating point value -0.311149 */
 #define CSEX_EQUALISER_11025_SCALE                   15
 
 /* Equaliser coefficients for 12000Hz sample rate, CS scaled with 1.032521 and CSEX scaled with 0.771017 */
 #define CS_EQUALISER_12000_A0                     20917         /* Floating point value 1.276661 */
-#define CS_EQUALISER_12000_A1                    -16671         /* Floating point value -1.017519 */
-#define CS_EQUALISER_12000_A2                      -723         /* Floating point value -0.044128 */
-#define CS_EQUALISER_12000_B1                    -11954         /* Floating point value -0.729616 */
-#define CS_EQUALISER_12000_B2                     -3351         /* Floating point value -0.204532 */
+#define CS_EQUALISER_12000_A1                   (-16671)        /* Floating point value -1.017519 */
+#define CS_EQUALISER_12000_A2                     (-723)        /* Floating point value -0.044128 */
+#define CS_EQUALISER_12000_B1                   (-11954)        /* Floating point value -0.729616 */
+#define CS_EQUALISER_12000_B2                    (-3351)        /* Floating point value -0.204532 */
 #define CS_EQUALISER_12000_SCALE                     14
 #define CSEX_EQUALISER_12000_A0                   16500         /* Floating point value 1.007095 */
-#define CSEX_EQUALISER_12000_A1                  -14285         /* Floating point value -0.871912 */
+#define CSEX_EQUALISER_12000_A1                 (-14285)        /* Floating point value -0.871912 */
 #define CSEX_EQUALISER_12000_A2                     381         /* Floating point value 0.023232 */
-#define CSEX_EQUALISER_12000_B1                  -12220         /* Floating point value -0.745857 */
-#define CSEX_EQUALISER_12000_B2                   -3099         /* Floating point value -0.189171 */
+#define CSEX_EQUALISER_12000_B1                 (-12220)        /* Floating point value -0.745857 */
+#define CSEX_EQUALISER_12000_B2                  (-3099)        /* Floating point value -0.189171 */
 #define CSEX_EQUALISER_12000_SCALE                   14
 
 /* Equaliser coefficients for 16000Hz sample rate, CS scaled with 1.031378 and CSEX scaled with 0.770164 */
 #define CS_EQUALISER_16000_A0                     20998         /* Floating point value 1.281629 */
-#define CS_EQUALISER_16000_A1                    -17627         /* Floating point value -1.075872 */
-#define CS_EQUALISER_16000_A2                      -678         /* Floating point value -0.041365 */
-#define CS_EQUALISER_16000_B1                    -11882         /* Floating point value -0.725239 */
-#define CS_EQUALISER_16000_B2                     -3676         /* Floating point value -0.224358 */
+#define CS_EQUALISER_16000_A1                   (-17627)        /* Floating point value -1.075872 */
+#define CS_EQUALISER_16000_A2                     (-678)        /* Floating point value -0.041365 */
+#define CS_EQUALISER_16000_B1                   (-11882)        /* Floating point value -0.725239 */
+#define CS_EQUALISER_16000_B2                    (-3676)        /* Floating point value -0.224358 */
 #define CS_EQUALISER_16000_SCALE                     14
 #define CSEX_EQUALISER_16000_A0                   17713         /* Floating point value 1.081091 */
-#define CSEX_EQUALISER_16000_A1                  -14208         /* Floating point value -0.867183 */
-#define CSEX_EQUALISER_16000_A2                   -1151         /* Floating point value -0.070247 */
-#define CSEX_EQUALISER_16000_B1                   -8440         /* Floating point value -0.515121 */
-#define CSEX_EQUALISER_16000_B2                   -6978         /* Floating point value -0.425893 */
+#define CSEX_EQUALISER_16000_A1                 (-14208)        /* Floating point value -0.867183 */
+#define CSEX_EQUALISER_16000_A2                  (-1151)        /* Floating point value -0.070247 */
+#define CSEX_EQUALISER_16000_B1                  (-8440)        /* Floating point value -0.515121 */
+#define CSEX_EQUALISER_16000_B2                  (-6978)        /* Floating point value -0.425893 */
 #define CSEX_EQUALISER_16000_SCALE                   14
 
 /* Equaliser coefficients for 22050Hz sample rate, CS scaled with 1.041576 and CSEX scaled with 0.777779 */
 #define CS_EQUALISER_22050_A0                     22751         /* Floating point value 1.388605 */
-#define CS_EQUALISER_22050_A1                    -21394         /* Floating point value -1.305799 */
+#define CS_EQUALISER_22050_A1                   (-21394)        /* Floating point value -1.305799 */
 #define CS_EQUALISER_22050_A2                       654         /* Floating point value 0.039922 */
-#define CS_EQUALISER_22050_B1                    -11788         /* Floating point value -0.719494 */
-#define CS_EQUALISER_22050_B2                     -3985         /* Floating point value -0.243245 */
+#define CS_EQUALISER_22050_B1                   (-11788)        /* Floating point value -0.719494 */
+#define CS_EQUALISER_22050_B2                    (-3985)        /* Floating point value -0.243245 */
 #define CS_EQUALISER_22050_SCALE                     14
 #define CSEX_EQUALISER_22050_A0                   20855         /* Floating point value 1.272910 */
-#define CSEX_EQUALISER_22050_A1                  -21971         /* Floating point value -1.341014 */
+#define CSEX_EQUALISER_22050_A1                 (-21971)        /* Floating point value -1.341014 */
 #define CSEX_EQUALISER_22050_A2                    2744         /* Floating point value 0.167462 */
-#define CSEX_EQUALISER_22050_B1                  -10063         /* Floating point value -0.614219 */
-#define CSEX_EQUALISER_22050_B2                   -5659         /* Floating point value -0.345384 */
+#define CSEX_EQUALISER_22050_B1                 (-10063)        /* Floating point value -0.614219 */
+#define CSEX_EQUALISER_22050_B2                  (-5659)        /* Floating point value -0.345384 */
 #define CSEX_EQUALISER_22050_SCALE                   14
 
 /* Equaliser coefficients for 24000Hz sample rate, CS scaled with 1.034495 and CSEX scaled with 0.772491 */
 #define CS_EQUALISER_24000_A0                     23099         /* Floating point value 1.409832 */
-#define CS_EQUALISER_24000_A1                    -23863         /* Floating point value -1.456506 */
+#define CS_EQUALISER_24000_A1                   (-23863)        /* Floating point value -1.456506 */
 #define CS_EQUALISER_24000_A2                      2481         /* Floating point value 0.151410 */
-#define CS_EQUALISER_24000_B1                    -13176         /* Floating point value -0.804201 */
-#define CS_EQUALISER_24000_B2                     -2683         /* Floating point value -0.163783 */
+#define CS_EQUALISER_24000_B1                   (-13176)        /* Floating point value -0.804201 */
+#define CS_EQUALISER_24000_B2                    (-2683)        /* Floating point value -0.163783 */
 #define CS_EQUALISER_24000_SCALE                     14
 #define CSEX_EQUALISER_24000_A0                   21286         /* Floating point value 1.299198 */
-#define CSEX_EQUALISER_24000_A1                  -23797         /* Floating point value -1.452447 */
+#define CSEX_EQUALISER_24000_A1                 (-23797)        /* Floating point value -1.452447 */
 #define CSEX_EQUALISER_24000_A2                    3940         /* Floating point value 0.240489 */
-#define CSEX_EQUALISER_24000_B1                  -10966         /* Floating point value -0.669303 */
-#define CSEX_EQUALISER_24000_B2                   -4833         /* Floating point value -0.294984 */
+#define CSEX_EQUALISER_24000_B1                 (-10966)        /* Floating point value -0.669303 */
+#define CSEX_EQUALISER_24000_B2                  (-4833)        /* Floating point value -0.294984 */
 #define CSEX_EQUALISER_24000_SCALE                   14
 
 /* Equaliser coefficients for 32000Hz sample rate, CS scaled with 1.044559 and CSEX scaled with 0.780006 */
 #define CS_EQUALISER_32000_A0                     25575         /* Floating point value 1.560988 */
-#define CS_EQUALISER_32000_A1                    -30765         /* Floating point value -1.877724 */
+#define CS_EQUALISER_32000_A1                   (-30765)        /* Floating point value -1.877724 */
 #define CS_EQUALISER_32000_A2                      6386         /* Floating point value 0.389741 */
-#define CS_EQUALISER_32000_B1                    -14867         /* Floating point value -0.907410 */
-#define CS_EQUALISER_32000_B2                     -1155         /* Floating point value -0.070489 */
+#define CS_EQUALISER_32000_B1                   (-14867)        /* Floating point value -0.907410 */
+#define CS_EQUALISER_32000_B2                    (-1155)        /* Floating point value -0.070489 */
 #define CS_EQUALISER_32000_SCALE                     14
 #define CSEX_EQUALISER_32000_A0                   14623         /* Floating point value 1.785049 */
-#define CSEX_EQUALISER_32000_A1                  -18297         /* Floating point value -2.233497 */
+#define CSEX_EQUALISER_32000_A1                 (-18297)        /* Floating point value -2.233497 */
 #define CSEX_EQUALISER_32000_A2                    4313         /* Floating point value 0.526431 */
-#define CSEX_EQUALISER_32000_B1                   -3653         /* Floating point value -0.445939 */
-#define CSEX_EQUALISER_32000_B2                   -4280         /* Floating point value -0.522446 */
+#define CSEX_EQUALISER_32000_B1                  (-3653)        /* Floating point value -0.445939 */
+#define CSEX_EQUALISER_32000_B2                  (-4280)        /* Floating point value -0.522446 */
 #define CSEX_EQUALISER_32000_SCALE                   13
 
 /* Equaliser coefficients for 44100Hz sample rate, CS scaled with 1.022170 and CSEX scaled with 0.763288 */
 #define CS_EQUALISER_44100_A0                     13304         /* Floating point value 1.623993 */
-#define CS_EQUALISER_44100_A1                    -18602         /* Floating point value -2.270743 */
+#define CS_EQUALISER_44100_A1                   (-18602)        /* Floating point value -2.270743 */
 #define CS_EQUALISER_44100_A2                      5643         /* Floating point value 0.688829 */
-#define CS_EQUALISER_44100_B1                     -9152         /* Floating point value -1.117190 */
+#define CS_EQUALISER_44100_B1                    (-9152)        /* Floating point value -1.117190 */
 #define CS_EQUALISER_44100_B2                      1067         /* Floating point value 0.130208 */
 #define CS_EQUALISER_44100_SCALE                     13
 #define CSEX_EQUALISER_44100_A0                   16616         /* Floating point value 2.028315 */
-#define CSEX_EQUALISER_44100_A1                  -23613         /* Floating point value -2.882459 */
+#define CSEX_EQUALISER_44100_A1                 (-23613)        /* Floating point value -2.882459 */
 #define CSEX_EQUALISER_44100_A2                    7410         /* Floating point value 0.904535 */
-#define CSEX_EQUALISER_44100_B1                   -4860         /* Floating point value -0.593308 */
-#define CSEX_EQUALISER_44100_B2                   -3161         /* Floating point value -0.385816 */
+#define CSEX_EQUALISER_44100_B1                  (-4860)        /* Floating point value -0.593308 */
+#define CSEX_EQUALISER_44100_B2                  (-3161)        /* Floating point value -0.385816 */
 #define CSEX_EQUALISER_44100_SCALE                   13
 
 /* Equaliser coefficients for 48000Hz sample rate, CS scaled with 1.018635 and CSEX scaled with 0.760648 */
 #define CS_EQUALISER_48000_A0                     13445         /* Floating point value 1.641177 */
-#define CS_EQUALISER_48000_A1                    -19372         /* Floating point value -2.364687 */
+#define CS_EQUALISER_48000_A1                   (-19372)        /* Floating point value -2.364687 */
 #define CS_EQUALISER_48000_A2                      6225         /* Floating point value 0.759910 */
-#define CS_EQUALISER_48000_B1                     -9558         /* Floating point value -1.166774 */
+#define CS_EQUALISER_48000_B1                    (-9558)        /* Floating point value -1.166774 */
 #define CS_EQUALISER_48000_B2                      1459         /* Floating point value 0.178074 */
 #define CS_EQUALISER_48000_SCALE                     13
 #define CSEX_EQUALISER_48000_A0                   17200         /* Floating point value 2.099655 */
-#define CSEX_EQUALISER_48000_A1                  -25110         /* Floating point value -3.065220 */
+#define CSEX_EQUALISER_48000_A1                 (-25110)        /* Floating point value -3.065220 */
 #define CSEX_EQUALISER_48000_A2                    8277         /* Floating point value 1.010417 */
-#define CSEX_EQUALISER_48000_B1                   -5194         /* Floating point value -0.634021 */
-#define CSEX_EQUALISER_48000_B2                   -2845         /* Floating point value -0.347332 */
+#define CSEX_EQUALISER_48000_B1                  (-5194)        /* Floating point value -0.634021 */
+#define CSEX_EQUALISER_48000_B2                  (-2845)        /* Floating point value -0.347332 */
 #define CSEX_EQUALISER_48000_SCALE                   13
 
 
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index a1892e4..d7b5f65 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -16,7 +16,7 @@
  */
 
 #define LOG_TAG "Bundle"
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
 //#define LOG_NDEBUG 0
 
 #include <assert.h>
@@ -34,19 +34,19 @@
 extern "C" const struct effect_interface_s gLvmEffectInterface;
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
-        if (LvmStatus == LVM_NULLADDRESS){\
+        if ((LvmStatus) == LVM_NULLADDRESS){\
             ALOGV("\tLVM_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
-        if (LvmStatus == LVM_ALIGNMENTERROR){\
+        if ((LvmStatus) == LVM_ALIGNMENTERROR){\
             ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad alignment returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
-        if (LvmStatus == LVM_INVALIDNUMSAMPLES){\
+        if ((LvmStatus) == LVM_INVALIDNUMSAMPLES){\
             ALOGV("\tLVM_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
-        if (LvmStatus == LVM_OUTOFRANGE){\
+        if ((LvmStatus) == LVM_OUTOFRANGE){\
             ALOGV("\tLVM_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 4dc8b45..f7dcdda 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -16,7 +16,7 @@
  */
 
 #define LOG_TAG "Reverb"
-#define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
+#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array)[0])
 //#define LOG_NDEBUG 0
 
 #include <assert.h>
@@ -34,15 +34,15 @@
 extern "C" const struct effect_interface_s gReverbInterface;
 
 #define LVM_ERROR_CHECK(LvmStatus, callingFunc, calledFunc){\
-        if (LvmStatus == LVREV_NULLADDRESS){\
+        if ((LvmStatus) == LVREV_NULLADDRESS){\
             ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "null pointer returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
-        if (LvmStatus == LVREV_INVALIDNUMSAMPLES){\
+        if ((LvmStatus) == LVREV_INVALIDNUMSAMPLES){\
             ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "bad number of samples returned by %s in %s\n\n\n\n", callingFunc, calledFunc);\
         }\
-        if (LvmStatus == LVREV_OUTOFRANGE){\
+        if ((LvmStatus) == LVREV_OUTOFRANGE){\
             ALOGV("\tLVREV_ERROR : Parameter error - "\
                     "out of range returned by %s in %s\n", callingFunc, calledFunc);\
         }\
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
index 7c15b18..8165f5a 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.h
@@ -30,7 +30,7 @@
 #define LVREV_MAX_REVERB_LEVEL  2000
 #define LVREV_MAX_FRAME_SIZE    2560
 #define LVREV_CUP_LOAD_ARM9E    470    // Expressed in 0.1 MIPS
-#define LVREV_MEM_USAGE         71+(LVREV_MAX_FRAME_SIZE>>7)     // Expressed in kB
+#define LVREV_MEM_USAGE         (71+(LVREV_MAX_FRAME_SIZE>>7))     // Expressed in kB
 //#define LVM_PCM
 
 typedef struct _LPFPair_t
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 2bdfd43..1b92123 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -80,6 +80,8 @@
         libcamera_client libstagefright_foundation \
         libgui libdl libaudioutils libnbaio
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
 LOCAL_WHOLE_STATIC_LIBRARIES := libmedia_helper
 
 # for memory heap analysis
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 3961e6e..ed7b856 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -2490,7 +2490,7 @@
     // This is sometimes caused by erratic reports of the available space in the ALSA drivers.
     if (status == NO_ERROR) {
         if (previousTimestampValid) {
-#define TIME_TO_NANOS(time) ((int64_t)time.tv_sec * 1000000000 + time.tv_nsec)
+#define TIME_TO_NANOS(time) ((int64_t)(time).tv_sec * 1000000000 + (time).tv_nsec)
             const int64_t previousTimeNanos = TIME_TO_NANOS(mPreviousTimestamp.mTime);
             const int64_t currentTimeNanos = TIME_TO_NANOS(timestamp.mTime);
 #undef TIME_TO_NANOS
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index 900d418..65fdedb 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -90,7 +90,7 @@
 class BpAudioFlinger : public BpInterface<IAudioFlinger>
 {
 public:
-    BpAudioFlinger(const sp<IBinder>& impl)
+    explicit BpAudioFlinger(const sp<IBinder>& impl)
         : BpInterface<IAudioFlinger>(impl)
     {
     }
diff --git a/media/libmedia/IAudioFlingerClient.cpp b/media/libmedia/IAudioFlingerClient.cpp
index 8dca9e9..b2dbc4c 100644
--- a/media/libmedia/IAudioFlingerClient.cpp
+++ b/media/libmedia/IAudioFlingerClient.cpp
@@ -34,7 +34,7 @@
 class BpAudioFlingerClient : public BpInterface<IAudioFlingerClient>
 {
 public:
-    BpAudioFlingerClient(const sp<IBinder>& impl)
+    explicit BpAudioFlingerClient(const sp<IBinder>& impl)
         : BpInterface<IAudioFlingerClient>(impl)
     {
     }
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index 6405d6d..20d23d0 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -83,7 +83,7 @@
 class BpAudioPolicyService : public BpInterface<IAudioPolicyService>
 {
 public:
-    BpAudioPolicyService(const sp<IBinder>& impl)
+    explicit BpAudioPolicyService(const sp<IBinder>& impl)
         : BpInterface<IAudioPolicyService>(impl)
     {
     }
diff --git a/media/libmedia/IAudioPolicyServiceClient.cpp b/media/libmedia/IAudioPolicyServiceClient.cpp
index 5f931e5..98a0521 100644
--- a/media/libmedia/IAudioPolicyServiceClient.cpp
+++ b/media/libmedia/IAudioPolicyServiceClient.cpp
@@ -52,7 +52,7 @@
 class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient>
 {
 public:
-    BpAudioPolicyServiceClient(const sp<IBinder>& impl)
+    explicit BpAudioPolicyServiceClient(const sp<IBinder>& impl)
         : BpInterface<IAudioPolicyServiceClient>(impl)
     {
     }
diff --git a/media/libmedia/IAudioRecord.cpp b/media/libmedia/IAudioRecord.cpp
index ae66436..1331c0d 100644
--- a/media/libmedia/IAudioRecord.cpp
+++ b/media/libmedia/IAudioRecord.cpp
@@ -37,7 +37,7 @@
 class BpAudioRecord : public BpInterface<IAudioRecord>
 {
 public:
-    BpAudioRecord(const sp<IBinder>& impl)
+    explicit BpAudioRecord(const sp<IBinder>& impl)
         : BpInterface<IAudioRecord>(impl)
     {
     }
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 636e3bb..89e0fcc 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -44,7 +44,7 @@
 class BpAudioTrack : public BpInterface<IAudioTrack>
 {
 public:
-    BpAudioTrack(const sp<IBinder>& impl)
+    explicit BpAudioTrack(const sp<IBinder>& impl)
         : BpInterface<IAudioTrack>(impl)
     {
     }
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 26dd2c9..ee7f757 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -39,7 +39,7 @@
 };
 
 struct BpCrypto : public BpInterface<ICrypto> {
-    BpCrypto(const sp<IBinder> &impl)
+    explicit BpCrypto(const sp<IBinder> &impl)
         : BpInterface<ICrypto>(impl) {
     }
 
diff --git a/media/libmedia/IDataSource.cpp b/media/libmedia/IDataSource.cpp
index 7aeba5a..9da1a70 100644
--- a/media/libmedia/IDataSource.cpp
+++ b/media/libmedia/IDataSource.cpp
@@ -37,7 +37,8 @@
 };
 
 struct BpDataSource : public BpInterface<IDataSource> {
-    BpDataSource(const sp<IBinder>& impl) : BpInterface<IDataSource>(impl) {}
+    explicit BpDataSource(const sp<IBinder>& impl)
+        : BpInterface<IDataSource>(impl) {}
 
     virtual sp<IMemory> getIMemory() {
         Parcel data, reply;
diff --git a/media/libmedia/IDrm.cpp b/media/libmedia/IDrm.cpp
index 7f131f4..d2b3aae 100644
--- a/media/libmedia/IDrm.cpp
+++ b/media/libmedia/IDrm.cpp
@@ -59,7 +59,7 @@
 };
 
 struct BpDrm : public BpInterface<IDrm> {
-    BpDrm(const sp<IBinder> &impl)
+    explicit BpDrm(const sp<IBinder> &impl)
         : BpInterface<IDrm>(impl) {
     }
 
diff --git a/media/libmedia/IDrmClient.cpp b/media/libmedia/IDrmClient.cpp
index 490c6ed..444201f 100644
--- a/media/libmedia/IDrmClient.cpp
+++ b/media/libmedia/IDrmClient.cpp
@@ -35,7 +35,7 @@
 class BpDrmClient: public BpInterface<IDrmClient>
 {
 public:
-    BpDrmClient(const sp<IBinder>& impl)
+    explicit BpDrmClient(const sp<IBinder>& impl)
         : BpInterface<IDrmClient>(impl)
     {
     }
diff --git a/media/libmedia/IEffect.cpp b/media/libmedia/IEffect.cpp
index faf5795..115ca75 100644
--- a/media/libmedia/IEffect.cpp
+++ b/media/libmedia/IEffect.cpp
@@ -36,7 +36,7 @@
 class BpEffect: public BpInterface<IEffect>
 {
 public:
-    BpEffect(const sp<IBinder>& impl)
+    explicit BpEffect(const sp<IBinder>& impl)
         : BpInterface<IEffect>(impl)
     {
     }
diff --git a/media/libmedia/IEffectClient.cpp b/media/libmedia/IEffectClient.cpp
index 1322e72..3f2c67d 100644
--- a/media/libmedia/IEffectClient.cpp
+++ b/media/libmedia/IEffectClient.cpp
@@ -33,7 +33,7 @@
 class BpEffectClient: public BpInterface<IEffectClient>
 {
 public:
-    BpEffectClient(const sp<IBinder>& impl)
+    explicit BpEffectClient(const sp<IBinder>& impl)
         : BpInterface<IEffectClient>(impl)
     {
     }
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp
index f3a8902..21e35f6 100644
--- a/media/libmedia/IHDCP.cpp
+++ b/media/libmedia/IHDCP.cpp
@@ -37,7 +37,7 @@
 };
 
 struct BpHDCPObserver : public BpInterface<IHDCPObserver> {
-    BpHDCPObserver(const sp<IBinder> &impl)
+    explicit BpHDCPObserver(const sp<IBinder> &impl)
         : BpInterface<IHDCPObserver>(impl) {
     }
 
@@ -58,7 +58,7 @@
 IMPLEMENT_META_INTERFACE(HDCPObserver, "android.hardware.IHDCPObserver");
 
 struct BpHDCP : public BpInterface<IHDCP> {
-    BpHDCP(const sp<IBinder> &impl)
+    explicit BpHDCP(const sp<IBinder> &impl)
         : BpInterface<IHDCP>(impl) {
     }
 
diff --git a/media/libmedia/IMediaCodecList.cpp b/media/libmedia/IMediaCodecList.cpp
index 737f50c..806f46d 100644
--- a/media/libmedia/IMediaCodecList.cpp
+++ b/media/libmedia/IMediaCodecList.cpp
@@ -38,7 +38,7 @@
 class BpMediaCodecList: public BpInterface<IMediaCodecList>
 {
 public:
-    BpMediaCodecList(const sp<IBinder>& impl)
+    explicit BpMediaCodecList(const sp<IBinder>& impl)
         : BpInterface<IMediaCodecList>(impl)
     {
     }
diff --git a/media/libmedia/IMediaHTTPConnection.cpp b/media/libmedia/IMediaHTTPConnection.cpp
index 0dda0be9..e4b717b 100644
--- a/media/libmedia/IMediaHTTPConnection.cpp
+++ b/media/libmedia/IMediaHTTPConnection.cpp
@@ -38,7 +38,7 @@
 };
 
 struct BpMediaHTTPConnection : public BpInterface<IMediaHTTPConnection> {
-    BpMediaHTTPConnection(const sp<IBinder> &impl)
+    explicit BpMediaHTTPConnection(const sp<IBinder> &impl)
         : BpInterface<IMediaHTTPConnection>(impl) {
     }
 
diff --git a/media/libmedia/IMediaHTTPService.cpp b/media/libmedia/IMediaHTTPService.cpp
index 0c16a2b..062a07a 100644
--- a/media/libmedia/IMediaHTTPService.cpp
+++ b/media/libmedia/IMediaHTTPService.cpp
@@ -30,7 +30,7 @@
 };
 
 struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> {
-    BpMediaHTTPService(const sp<IBinder> &impl)
+    explicit BpMediaHTTPService(const sp<IBinder> &impl)
         : BpInterface<IMediaHTTPService>(impl) {
     }
 
diff --git a/media/libmedia/IMediaLogService.cpp b/media/libmedia/IMediaLogService.cpp
index 1536337..bc445ff 100644
--- a/media/libmedia/IMediaLogService.cpp
+++ b/media/libmedia/IMediaLogService.cpp
@@ -34,7 +34,7 @@
 class BpMediaLogService : public BpInterface<IMediaLogService>
 {
 public:
-    BpMediaLogService(const sp<IBinder>& impl)
+    explicit BpMediaLogService(const sp<IBinder>& impl)
         : BpInterface<IMediaLogService>(impl)
     {
     }
diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp
index 0bee8d3..7058ee8 100644
--- a/media/libmedia/IMediaMetadataRetriever.cpp
+++ b/media/libmedia/IMediaMetadataRetriever.cpp
@@ -75,7 +75,7 @@
 class BpMediaMetadataRetriever: public BpInterface<IMediaMetadataRetriever>
 {
 public:
-    BpMediaMetadataRetriever(const sp<IBinder>& impl)
+    explicit BpMediaMetadataRetriever(const sp<IBinder>& impl)
         : BpInterface<IMediaMetadataRetriever>(impl)
     {
     }
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 519a1fd..f8345e4 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -72,7 +72,7 @@
 class BpMediaPlayer: public BpInterface<IMediaPlayer>
 {
 public:
-    BpMediaPlayer(const sp<IBinder>& impl)
+    explicit BpMediaPlayer(const sp<IBinder>& impl)
         : BpInterface<IMediaPlayer>(impl)
     {
     }
diff --git a/media/libmedia/IMediaPlayerClient.cpp b/media/libmedia/IMediaPlayerClient.cpp
index d608386..bbf8475 100644
--- a/media/libmedia/IMediaPlayerClient.cpp
+++ b/media/libmedia/IMediaPlayerClient.cpp
@@ -30,7 +30,7 @@
 class BpMediaPlayerClient: public BpInterface<IMediaPlayerClient>
 {
 public:
-    BpMediaPlayerClient(const sp<IBinder>& impl)
+    explicit BpMediaPlayerClient(const sp<IBinder>& impl)
         : BpInterface<IMediaPlayerClient>(impl)
     {
     }
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index 7590c1b..a01852c 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -50,7 +50,7 @@
 class BpMediaPlayerService: public BpInterface<IMediaPlayerService>
 {
 public:
-    BpMediaPlayerService(const sp<IBinder>& impl)
+    explicit BpMediaPlayerService(const sp<IBinder>& impl)
         : BpInterface<IMediaPlayerService>(impl)
     {
     }
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp
index cded55c..a6860e2 100644
--- a/media/libmedia/IMediaRecorder.cpp
+++ b/media/libmedia/IMediaRecorder.cpp
@@ -63,7 +63,7 @@
 class BpMediaRecorder: public BpInterface<IMediaRecorder>
 {
 public:
-    BpMediaRecorder(const sp<IBinder>& impl)
+    explicit BpMediaRecorder(const sp<IBinder>& impl)
     : BpInterface<IMediaRecorder>(impl)
     {
     }
diff --git a/media/libmedia/IMediaRecorderClient.cpp b/media/libmedia/IMediaRecorderClient.cpp
index 6795d23..a76f934 100644
--- a/media/libmedia/IMediaRecorderClient.cpp
+++ b/media/libmedia/IMediaRecorderClient.cpp
@@ -30,7 +30,7 @@
 class BpMediaRecorderClient: public BpInterface<IMediaRecorderClient>
 {
 public:
-    BpMediaRecorderClient(const sp<IBinder>& impl)
+    explicit BpMediaRecorderClient(const sp<IBinder>& impl)
         : BpInterface<IMediaRecorderClient>(impl)
     {
     }
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index 8ebb355..6d5e7f6 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -66,7 +66,7 @@
 
 class BpOMX : public BpInterface<IOMX> {
 public:
-    BpOMX(const sp<IBinder> &impl)
+    explicit BpOMX(const sp<IBinder> &impl)
         : BpInterface<IOMX>(impl) {
     }
 
@@ -630,7 +630,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 #define CHECK_OMX_INTERFACE(interface, data, reply) \
-        do { if (!data.enforceInterface(interface::getInterfaceDescriptor())) { \
+        do { if (!(data).enforceInterface(interface::getInterfaceDescriptor())) { \
             ALOGW("Call incorrectly routed to " #interface); \
             return PERMISSION_DENIED; \
         } } while (0)
@@ -1227,7 +1227,7 @@
 
 class BpOMXObserver : public BpInterface<IOMXObserver> {
 public:
-    BpOMXObserver(const sp<IBinder> &impl)
+    explicit BpOMXObserver(const sp<IBinder> &impl)
         : BpInterface<IOMXObserver>(impl) {
     }
 
diff --git a/media/libmedia/IRemoteDisplay.cpp b/media/libmedia/IRemoteDisplay.cpp
index 869d11a..85c7bd6 100644
--- a/media/libmedia/IRemoteDisplay.cpp
+++ b/media/libmedia/IRemoteDisplay.cpp
@@ -30,7 +30,7 @@
 class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
 {
 public:
-    BpRemoteDisplay(const sp<IBinder>& impl)
+    explicit BpRemoteDisplay(const sp<IBinder>& impl)
         : BpInterface<IRemoteDisplay>(impl)
     {
     }
diff --git a/media/libmedia/IRemoteDisplayClient.cpp b/media/libmedia/IRemoteDisplayClient.cpp
index bedeb6c..ca67665 100644
--- a/media/libmedia/IRemoteDisplayClient.cpp
+++ b/media/libmedia/IRemoteDisplayClient.cpp
@@ -32,7 +32,7 @@
 class BpRemoteDisplayClient: public BpInterface<IRemoteDisplayClient>
 {
 public:
-    BpRemoteDisplayClient(const sp<IBinder>& impl)
+    explicit BpRemoteDisplayClient(const sp<IBinder>& impl)
         : BpInterface<IRemoteDisplayClient>(impl)
     {
     }
diff --git a/media/libmedia/IResourceManagerClient.cpp b/media/libmedia/IResourceManagerClient.cpp
index b3f56e8..1fea479 100644
--- a/media/libmedia/IResourceManagerClient.cpp
+++ b/media/libmedia/IResourceManagerClient.cpp
@@ -31,7 +31,7 @@
 class BpResourceManagerClient: public BpInterface<IResourceManagerClient>
 {
 public:
-    BpResourceManagerClient(const sp<IBinder> &impl)
+    explicit BpResourceManagerClient(const sp<IBinder> &impl)
         : BpInterface<IResourceManagerClient>(impl)
     {
     }
diff --git a/media/libmedia/IResourceManagerService.cpp b/media/libmedia/IResourceManagerService.cpp
index 6cb4440..95f7d2e 100644
--- a/media/libmedia/IResourceManagerService.cpp
+++ b/media/libmedia/IResourceManagerService.cpp
@@ -58,7 +58,7 @@
 class BpResourceManagerService : public BpInterface<IResourceManagerService>
 {
 public:
-    BpResourceManagerService(const sp<IBinder> &impl)
+    explicit BpResourceManagerService(const sp<IBinder> &impl)
         : BpInterface<IResourceManagerService>(impl)
     {
     }
diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp
index 8c0905c..ba0a272 100644
--- a/media/libmedia/IStreamSource.cpp
+++ b/media/libmedia/IStreamSource.cpp
@@ -51,7 +51,7 @@
 };
 
 struct BpStreamSource : public BpInterface<IStreamSource> {
-    BpStreamSource(const sp<IBinder> &impl)
+    explicit BpStreamSource(const sp<IBinder> &impl)
         : BpInterface<IStreamSource>(impl) {
     }
 
@@ -145,7 +145,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct BpStreamListener : public BpInterface<IStreamListener> {
-    BpStreamListener(const sp<IBinder> &impl)
+    explicit BpStreamListener(const sp<IBinder> &impl)
         : BpInterface<IStreamListener>(impl) {
     }
 
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 411519d..a1b81a0 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -831,11 +831,13 @@
     mProcessSize = (mSamplingRate * 20) / 1000;
 
     char value[PROPERTY_VALUE_MAX];
-    property_get("gsm.operator.iso-country", value, "");
-    if (strcmp(value,"us") == 0 ||
-        strcmp(value,"ca") == 0) {
+    if (property_get("gsm.operator.iso-country", value, "") == 0) {
+        property_get("gsm.sim.operator.iso-country", value, "");
+    }
+    if (strstr(value, "us") != NULL ||
+        strstr(value, "ca") != NULL) {
         mRegion = ANSI;
-    } else if (strcmp(value,"jp") == 0) {
+    } else if (strstr(value, "jp") != NULL) {
         mRegion = JAPAN;
     } else if (strcmp(value,"uk") == 0 ||
                strcmp(value,"uk,uk") == 0) {
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 8d86366..31a6992 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -43,6 +43,8 @@
     libstagefright_rtsp         \
     libstagefright_timedtext    \
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
 LOCAL_C_INCLUDES :=                                                 \
     $(TOP)/frameworks/av/media/libstagefright/include               \
     $(TOP)/frameworks/av/media/libstagefright/rtsp                  \
diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk
index cd20837..3ea2159 100644
--- a/media/libmediaplayerservice/nuplayer/Android.mk
+++ b/media/libmediaplayerservice/nuplayer/Android.mk
@@ -34,6 +34,8 @@
 
 LOCAL_CLANG := true
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE:= libstagefright_nuplayer
 
 LOCAL_MODULE_TAGS := eng
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index 4504b58..fc98982 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -69,7 +69,7 @@
 };
 
 struct NuPlayer::SeekAction : public Action {
-    SeekAction(int64_t seekTimeUs)
+    explicit SeekAction(int64_t seekTimeUs)
         : mSeekTimeUs(seekTimeUs) {
     }
 
@@ -84,7 +84,7 @@
 };
 
 struct NuPlayer::ResumeDecoderAction : public Action {
-    ResumeDecoderAction(bool needNotify)
+    explicit ResumeDecoderAction(bool needNotify)
         : mNeedNotify(needNotify) {
     }
 
@@ -99,7 +99,7 @@
 };
 
 struct NuPlayer::SetSurfaceAction : public Action {
-    SetSurfaceAction(const sp<Surface> &surface)
+    explicit SetSurfaceAction(const sp<Surface> &surface)
         : mSurface(surface) {
     }
 
@@ -131,7 +131,7 @@
 };
 
 struct NuPlayer::PostMessageAction : public Action {
-    PostMessageAction(const sp<AMessage> &msg)
+    explicit PostMessageAction(const sp<AMessage> &msg)
         : mMessage(msg) {
     }
 
@@ -150,7 +150,7 @@
 struct NuPlayer::SimpleAction : public Action {
     typedef void (NuPlayer::*ActionFunc)();
 
-    SimpleAction(ActionFunc func)
+    explicit SimpleAction(ActionFunc func)
         : mFunc(func) {
     }
 
@@ -1775,8 +1775,10 @@
     // Make sure we don't continue to scan sources until we finish flushing.
     ++mScanSourcesGeneration;
     if (mScanSourcesPending) {
-        mDeferredActions.push_back(
-                new SimpleAction(&NuPlayer::performScanSources));
+        if (!needShutdown) {
+            mDeferredActions.push_back(
+                    new SimpleAction(&NuPlayer::performScanSources));
+        }
         mScanSourcesPending = false;
     }
 
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
index 13716cf..978d360 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerCCDecoder.cpp
@@ -256,6 +256,12 @@
             payload_size += last_byte;
         } while (last_byte == 0xFF);
 
+        if (payload_size > SIZE_MAX / 8
+                || !br.atLeastNumBitsLeft(payload_size * 8)) {
+            ALOGV("Malformed SEI payload");
+            break;
+        }
+
         // sei_payload()
         if (payload_type == 4) {
             bool isCC = false;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index cbc28e3..07f5960 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -216,7 +216,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::BaseState : public AState {
-    BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
+    explicit BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
 
 protected:
     enum PortMode {
@@ -267,7 +267,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::DeathNotifier : public IBinder::DeathRecipient {
-    DeathNotifier(const sp<AMessage> &notify)
+    explicit DeathNotifier(const sp<AMessage> &notify)
         : mNotify(notify) {
     }
 
@@ -285,7 +285,7 @@
 };
 
 struct ACodec::UninitializedState : public ACodec::BaseState {
-    UninitializedState(ACodec *codec);
+    explicit UninitializedState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -303,7 +303,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::LoadedState : public ACodec::BaseState {
-    LoadedState(ACodec *codec);
+    explicit LoadedState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -326,7 +326,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::LoadedToIdleState : public ACodec::BaseState {
-    LoadedToIdleState(ACodec *codec);
+    explicit LoadedToIdleState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -342,7 +342,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::IdleToExecutingState : public ACodec::BaseState {
-    IdleToExecutingState(ACodec *codec);
+    explicit IdleToExecutingState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -356,7 +356,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::ExecutingState : public ACodec::BaseState {
-    ExecutingState(ACodec *codec);
+    explicit ExecutingState(ACodec *codec);
 
     void submitRegularOutputBuffers();
     void submitOutputMetaBuffers();
@@ -386,7 +386,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::OutputPortSettingsChangedState : public ACodec::BaseState {
-    OutputPortSettingsChangedState(ACodec *codec);
+    explicit OutputPortSettingsChangedState(ACodec *codec);
 
 protected:
     virtual PortMode getPortMode(OMX_U32 portIndex);
@@ -403,7 +403,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::ExecutingToIdleState : public ACodec::BaseState {
-    ExecutingToIdleState(ACodec *codec);
+    explicit ExecutingToIdleState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -425,7 +425,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::IdleToLoadedState : public ACodec::BaseState {
-    IdleToLoadedState(ACodec *codec);
+    explicit IdleToLoadedState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -440,7 +440,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct ACodec::FlushingState : public ACodec::BaseState {
-    FlushingState(ACodec *codec);
+    explicit FlushingState(ACodec *codec);
 
 protected:
     virtual bool onMessageReceived(const sp<AMessage> &msg);
@@ -494,7 +494,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 ACodec::ACodec()
-    : mQuirks(0),
+    : mSampleRate(0),
+      mQuirks(0),
       mNode(0),
       mUsingNativeWindow(false),
       mNativeWindowUsageBits(0),
@@ -2671,6 +2672,7 @@
     } else {
         ALOGW("did not set AudioAndroidAacPresentation due to error %d when setting AudioAac", res);
     }
+    mSampleRate = sampleRate;
     return res;
 }
 
@@ -5229,8 +5231,14 @@
     CHECK(mOutputFormat->findString("mime", &mime));
 
     if (mime == MEDIA_MIMETYPE_AUDIO_RAW && (mEncoderDelay || mEncoderPadding)) {
-        int32_t channelCount;
+        int32_t channelCount, sampleRate;
         CHECK(mOutputFormat->findInt32("channel-count", &channelCount));
+        CHECK(mOutputFormat->findInt32("sample-rate", &sampleRate));
+        if (mSampleRate != 0 && sampleRate != 0) {
+            mEncoderDelay = mEncoderDelay * sampleRate / mSampleRate;
+            mEncoderPadding = mEncoderPadding * sampleRate / mSampleRate;
+            mSampleRate = sampleRate;
+        }
         if (mSkipCutBuffer != NULL) {
             size_t prevbufsize = mSkipCutBuffer->size();
             if (prevbufsize != 0) {
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index 2445842..c8aa2e3 100644
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -123,6 +123,8 @@
         libdl \
         libRScpp \
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
 LOCAL_CFLAGS += -Wno-multichar -Werror -Wno-error=deprecated-declarations -Wall
 
 # enable experiments only in userdebug and eng builds
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index e087249..5fc9237 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -47,7 +47,7 @@
 static const int64_t CAMERA_SOURCE_TIMEOUT_NS = 3000000000LL;
 
 struct CameraSourceListener : public CameraListener {
-    CameraSourceListener(const sp<CameraSource> &source);
+    explicit CameraSourceListener(const sp<CameraSource> &source);
 
     virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2);
     virtual void postData(int32_t msgType, const sp<IMemory> &dataPtr,
diff --git a/media/libstagefright/DataURISource.cpp b/media/libstagefright/DataURISource.cpp
index 2a61c3a..3dc345f 100644
--- a/media/libstagefright/DataURISource.cpp
+++ b/media/libstagefright/DataURISource.cpp
@@ -28,7 +28,7 @@
         return NULL;
     }
 
-    char *commaPos = strrchr(uri, ',');
+    const char *commaPos = strrchr(uri, ',');
 
     if (commaPos == NULL) {
         return NULL;
diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp
index 13b66f3..1af7dc1 100644
--- a/media/libstagefright/FLACExtractor.cpp
+++ b/media/libstagefright/FLACExtractor.cpp
@@ -73,7 +73,7 @@
 class FLACParser : public RefBase {
 
 public:
-    FLACParser(
+    explicit FLACParser(
         const sp<DataSource> &dataSource,
         // If metadata pointers aren't provided, we don't fill them
         const sp<MetaData> &fileMetadata = 0,
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index a9e8846..931b280 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -35,7 +35,7 @@
 namespace android {
 
 struct MPEG2TSWriter::SourceInfo : public AHandler {
-    SourceInfo(const sp<IMediaSource> &source);
+    explicit SourceInfo(const sp<IMediaSource> &source);
 
     void start(const sp<AMessage> &notify);
     void stop();
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 6a67fcf..b9371d5 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -178,7 +178,7 @@
 // Each MPEG4DataSource caches the sampletable metadata for a single track.
 
 struct MPEG4DataSource : public DataSource {
-    MPEG4DataSource(const sp<DataSource> &source);
+    explicit MPEG4DataSource(const sp<DataSource> &source);
 
     virtual status_t initCheck() const;
     virtual ssize_t readAt(off64_t offset, void *data, size_t size);
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 24fb987..da10ba9 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -620,7 +620,7 @@
     if (mMaxFileDurationLimitUs != 0) {
         if (bitRate > 0) {
             int64_t size2 =
-                ((mMaxFileDurationLimitUs * bitRate * 6) / 1000 / 8000000);
+                ((mMaxFileDurationLimitUs / 1000) * bitRate * 6) / 8000000;
             if (mMaxFileSizeLimitBytes != 0 && mIsFileSizeLimitExplicitlyRequested) {
                 // When both file size and duration limits are set,
                 // we use the smaller limit of the two.
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index e8cd58a..a0162ea 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -65,7 +65,7 @@
 static const int kMaxReclaimWaitTimeInUs = 500000;  // 0.5s
 
 struct ResourceManagerClient : public BnResourceManagerClient {
-    ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
+    explicit ResourceManagerClient(MediaCodec* codec) : mMediaCodec(codec) {}
 
     virtual bool reclaimResource() {
         sp<MediaCodec> codec = mMediaCodec.promote();
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 0fb5072..08bb45d 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -182,7 +182,7 @@
 
 void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_errors) {
     // get href_base
-    char *href_base_end = strrchr(codecs_xml, '/');
+    const char *href_base_end = strrchr(codecs_xml, '/');
     if (href_base_end != NULL) {
         mHrefBase = AString(codecs_xml, href_base_end - codecs_xml + 1);
     }
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index 5039922..ff59fb1 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -47,7 +47,7 @@
 const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder
 
 struct MediaCodecSource::Puller : public AHandler {
-    Puller(const sp<MediaSource> &source);
+    explicit Puller(const sp<MediaSource> &source);
 
     void interruptSource();
     status_t start(const sp<MetaData> &meta, const sp<AMessage> &notify);
diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp
index 453db03..afd6ffb 100644
--- a/media/libstagefright/NuCachedSource2.cpp
+++ b/media/libstagefright/NuCachedSource2.cpp
@@ -31,7 +31,7 @@
 namespace android {
 
 struct PageCache {
-    PageCache(size_t pageSize);
+    explicit PageCache(size_t pageSize);
     ~PageCache();
 
     struct Page {
diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp
index 37e8e9c..0343786 100644
--- a/media/libstagefright/OggExtractor.cpp
+++ b/media/libstagefright/OggExtractor.cpp
@@ -46,7 +46,7 @@
 namespace android {
 
 struct OggSource : public MediaSource {
-    OggSource(const sp<OggExtractor> &extractor);
+    explicit OggSource(const sp<OggExtractor> &extractor);
 
     virtual sp<MetaData> getFormat();
 
@@ -164,7 +164,7 @@
 };
 
 struct MyVorbisExtractor : public MyOggExtractor {
-    MyVorbisExtractor(const sp<DataSource> &source)
+    explicit MyVorbisExtractor(const sp<DataSource> &source)
         : MyOggExtractor(source,
                 MEDIA_MIMETYPE_AUDIO_VORBIS,
                 /* numHeaders */ 3,
@@ -192,7 +192,7 @@
     static const int32_t kOpusSampleRate = 48000;
     static const int64_t kOpusSeekPreRollUs = 80000; // 80 ms
 
-    MyOpusExtractor(const sp<DataSource> &source)
+    explicit MyOpusExtractor(const sp<DataSource> &source)
         : MyOggExtractor(source, MEDIA_MIMETYPE_AUDIO_OPUS, /*numHeaders*/ 2, kOpusSeekPreRollUs),
           mChannelCount(0),
           mCodecDelay(0),
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp
index 542a06d..5df2e2e 100644
--- a/media/libstagefright/SampleTable.cpp
+++ b/media/libstagefright/SampleTable.cpp
@@ -207,6 +207,11 @@
 status_t SampleTable::setSampleToChunkParams(
         off64_t data_offset, size_t data_size) {
     if (mSampleToChunkOffset >= 0) {
+        // already set
+        return ERROR_MALFORMED;
+    }
+
+    if (data_offset < 0) {
         return ERROR_MALFORMED;
     }
 
@@ -244,7 +249,7 @@
     for (uint32_t i = 0; i < mNumSampleToChunkOffsets; ++i) {
         uint8_t buffer[12];
 
-        if ((off64_t)(SIZE_MAX - 8 - (i * 12)) < mSampleToChunkOffset) {
+        if ((SIZE_MAX - 8 - (i * 12)) < (size_t)mSampleToChunkOffset) {
             return ERROR_MALFORMED;
         }
 
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index ff76bc8..1c5e3c6 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -36,7 +36,7 @@
 #define DRC_DEFAULT_MOBILE_DRC_CUT   127 /* maximum compression of dynamic range for mobile conf */
 #define DRC_DEFAULT_MOBILE_DRC_BOOST 127 /* maximum compression of dynamic range for mobile conf */
 #define DRC_DEFAULT_MOBILE_DRC_HEAVY 1   /* switch for heavy compression for mobile conf */
-#define DRC_DEFAULT_MOBILE_ENC_LEVEL -1 /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
+#define DRC_DEFAULT_MOBILE_ENC_LEVEL (-1) /* encoder target level; -1 => the value is unknown, otherwise dB step value (e.g. 64 for -16 dB) */
 #define MAX_CHANNEL_COUNT            8  /* maximum number of audio channels that can be decoded */
 // names of properties that can be used to override the default DRC settings
 #define PROP_DRC_OVERRIDE_REF_LEVEL  "aac_drc_reference_level"
diff --git a/media/libstagefright/codecs/aacenc/Android.mk b/media/libstagefright/codecs/aacenc/Android.mk
index 266f01b..71c374b 100644
--- a/media/libstagefright/codecs/aacenc/Android.mk
+++ b/media/libstagefright/codecs/aacenc/Android.mk
@@ -64,7 +64,10 @@
 
 LOCAL_STATIC_LIBRARIES :=
 
-LOCAL_SHARED_LIBRARIES :=
+# libstagefright links this static library, so it probably isn't appropriate to
+# link libstagefright.  However, this library includes libstagefright headers,
+# and needs libbinder to be able to do so correctly.
+LOCAL_SHARED_LIBRARIES := libbinder
 
 LOCAL_C_INCLUDES := \
 	frameworks/av/include \
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
index 4fd16a1..78f032b 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.c
@@ -234,10 +234,10 @@
 }
 
 #define step(shift) \
-    if ((0x40000000l >> shift) + root <= value)       \
+    if ((0x40000000l >> (shift)) + root <= value)       \
     {                                                 \
-        value -= (0x40000000l >> shift) + root;       \
-        root = (root >> 1) | (0x40000000l >> shift);  \
+        value -= (0x40000000l >> (shift)) + root;       \
+        root = (root >> 1) | (0x40000000l >> (shift));  \
     } else {                                          \
         root = root >> 1;                             \
     }
diff --git a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
index 6059237..80d350d 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/typedefs.h
@@ -89,11 +89,11 @@
 #endif
 
 #ifndef min
-#define min(a,b) ( a < b ? a : b)
+#define min(a,b) ( (a) < (b) ? (a) : (b))
 #endif
 
 #ifndef max
-#define max(a,b) ( a > b ? a : b)
+#define max(a,b) ( (a) > (b) ? (a) : (b))
 #endif
 
 #ifdef ARM_INASM
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_const.h b/media/libstagefright/codecs/aacenc/inc/psy_const.h
index 19fb9b2..0b9f8c3 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_const.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_const.h
@@ -73,7 +73,7 @@
 #define TRANSFORM_OFFSET_LONG    0
 #define TRANSFORM_OFFSET_SHORT   448
 
-#define LOG_NORM_PCM          -15
+#define LOG_NORM_PCM          (-15)
 
 #define NUM_SAMPLE_RATES	12
 
diff --git a/media/libstagefright/codecs/aacenc/src/bit_cnt.c b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
index 9fe511c..65b035e 100644
--- a/media/libstagefright/codecs/aacenc/src/bit_cnt.c
+++ b/media/libstagefright/codecs/aacenc/src/bit_cnt.c
@@ -23,10 +23,10 @@
 #include "bit_cnt.h"
 #include "aac_rom.h"
 
-#define HI_LTAB(a) (a>>8)
-#define LO_LTAB(a) (a & 0xff)
+#define HI_LTAB(a) ((a)>>8)
+#define LO_LTAB(a) ((a) & 0xff)
 
-#define EXPAND(a)  ((((Word32)(a&0xff00)) << 8)|(Word32)(a&0xff))
+#define EXPAND(a)  ((((Word32)((a)&0xff00)) << 8)|(Word32)((a)&0xff))
 
 
 /*****************************************************************************
diff --git a/media/libstagefright/codecs/aacenc/src/transform.c b/media/libstagefright/codecs/aacenc/src/transform.c
index 0080810..5de2b96 100644
--- a/media/libstagefright/codecs/aacenc/src/transform.c
+++ b/media/libstagefright/codecs/aacenc/src/transform.c
@@ -30,8 +30,8 @@
 #define SQRT1_2 0x5a82799a	/* sqrt(1/2) in Q31 */
 #define swap2(p0,p1) \
 	t = p0; t1 = *(&(p0)+1);	\
-	p0 = p1; *(&(p0)+1) = *(&(p1)+1);	\
-	p1 = t; *(&(p1)+1) = t1
+	(p0) = p1; *(&(p0)+1) = *(&(p1)+1);	\
+	(p1) = t; *(&(p1)+1) = t1
 
 /*********************************************************************************
 *
diff --git a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
index 459c3c3..f3098f5 100644
--- a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
@@ -103,7 +103,7 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define NC   M/2                  /* M = LPC order, NC = M/2 */
+#define NC   (M/2)                  /* M = LPC order, NC = M/2 */
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp b/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
index 1c8a700..731dc52 100644
--- a/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp
@@ -69,8 +69,8 @@
 #define MEAN_ENER_MR122  783741L  /* 36/(20*log10(2)) (Q17) */
 
 /* minimum quantized energy: -14 dB */
-#define MIN_ENERGY       -14336       /* 14                 Q10 */
-#define MIN_ENERGY_MR122  -2381       /* 14 / (20*log10(2)) Q10 */
+#define MIN_ENERGY       (-14336)       /* 14                 Q10 */
+#define MIN_ENERGY_MR122  (-2381)       /* 14 / (20*log10(2)) Q10 */
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrwb/src/dtx.h b/media/libstagefright/codecs/amrwb/src/dtx.h
index a81f089..cf686a0 100644
--- a/media/libstagefright/codecs/amrwb/src/dtx.h
+++ b/media/libstagefright/codecs/amrwb/src/dtx.h
@@ -77,7 +77,7 @@
 #define DTX_HANG_CONST 7                   /* yields eight frames of SP HANGOVER  */
 #define INV_MED_THRESH 14564
 #define ISF_GAP  128                       /* 50 */
-#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
+#define ONE_MINUS_ISF_GAP (16384 - ISF_GAP)
 
 #define ISF_GAP   128
 #define ISF_DITH_GAP   448
diff --git a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
index f032a08..dde3e43 100644
--- a/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
+++ b/media/libstagefright/codecs/amrwb/src/homing_amr_wb_dec.cpp
@@ -105,15 +105,15 @@
 #define NUM_OF_SPMODES 9
 
 #define PRML 15
-#define PRMN_7k NBBITS_7k/PRML + 1
-#define PRMN_9k NBBITS_9k/PRML + 1
-#define PRMN_12k NBBITS_12k/PRML + 1
-#define PRMN_14k NBBITS_14k/PRML + 1
-#define PRMN_16k NBBITS_16k/PRML + 1
-#define PRMN_18k NBBITS_18k/PRML + 1
-#define PRMN_20k NBBITS_20k/PRML + 1
-#define PRMN_23k NBBITS_23k/PRML + 1
-#define PRMN_24k NBBITS_24k/PRML + 1
+#define PRMN_7k (NBBITS_7k/PRML + 1)
+#define PRMN_9k (NBBITS_9k/PRML + 1)
+#define PRMN_12k (NBBITS_12k/PRML + 1)
+#define PRMN_14k (NBBITS_14k/PRML + 1)
+#define PRMN_16k (NBBITS_16k/PRML + 1)
+#define PRMN_18k (NBBITS_18k/PRML + 1)
+#define PRMN_20k (NBBITS_20k/PRML + 1)
+#define PRMN_23k (NBBITS_23k/PRML + 1)
+#define PRMN_24k (NBBITS_24k/PRML + 1)
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h b/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
index 8951e5c..2143c9a 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwb_math_op.h
@@ -119,8 +119,8 @@
 #define norm_s( x)    (normalize_amr_wb(  x) - 16)
 
 
-#define extract_h( x)    (int16)(x>>16)
-#define L_deposit_h( x)    (int32)(x<<16)
+#define extract_h( x)    (int16)((x)>>16)
+#define L_deposit_h( x)    (int32)((x)<<16)
 
 
 #ifdef __cplusplus
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
index df239d2..88ff9bc 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_basic_op.h
@@ -56,8 +56,8 @@
 #define MAX_32 (int32)0x7fffffffL
 #define MIN_32 (int32)0x80000000L
 
-#define MAX_16 (int16)+32767    /* 0x7fff */
-#define MIN_16 (int16)-32768    /* 0x8000 */
+#define MAX_16 ((int16)+32767)    /* 0x7fff */
+#define MIN_16 ((int16)-32768)    /* 0x8000 */
 
 
 
diff --git a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
index ecf1bf3..3981ce3 100644
--- a/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
+++ b/media/libstagefright/codecs/amrwb/src/pvamrwbdecoder_cnst.h
@@ -130,7 +130,7 @@
 
 #define EHF_MASK (int16)0x0008            /* homing frame pattern                       */
 
-#define BIT_0     (int16)-127
+#define BIT_0     ((int16)-127)
 #define BIT_1     (int16)127
 #define BIT_0_ITU (int16)0x007F
 #define BIT_1_ITU (int16)0x0081
diff --git a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
index 8165f69..80ad7f1 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/basic_op.h
@@ -25,8 +25,8 @@
 #define MAX_32 (Word32)0x7fffffffL
 #define MIN_32 (Word32)0x80000000L
 
-#define MAX_16 (Word16)+32767   /* 0x7fff */
-#define MIN_16 (Word16)-32768   /* 0x8000 */
+#define MAX_16 ((Word16)+32767)   /* 0x7fff */
+#define MIN_16 ((Word16)-32768)   /* 0x8000 */
 
 
 #define  static_vo  static __inline
@@ -41,23 +41,23 @@
 #define L_negate(L_var1) (((L_var1) == (MIN_32)) ? (MAX_32) : (-(L_var1)))                 /* Long negate,     2*/
 
 
-#define extract_h(a)            ((Word16)(a >> 16))
-#define extract_l(x)                (Word16)((x))
-#define add1(a,b)           (a + b)
-#define vo_L_msu(a,b,c)         ( a - (( b * c ) << 1) )
+#define extract_h(a)            ((Word16)((a) >> 16))
+#define extract_l(x)            (Word16)((x))
+#define add1(a,b)               ((a) + (b))
+#define vo_L_msu(a,b,c)         ((a) - (((b) * (c)) << 1))
 #define vo_mult32(a, b)         ((a) * (b))
-#define vo_mult(a,b)            (( a * b ) >> 15 )
-#define vo_L_mult(a,b)              (((a) * (b)) << 1)
-#define vo_shr_r(var1, var2)        ((var1+((Word16)(1L<<(var2-1))))>>var2)
-#define vo_sub(a,b)         (a - b)
+#define vo_mult(a,b)            (((a) * (b)) >> 15)
+#define vo_L_mult(a,b)          (((a) * (b)) << 1)
+#define vo_shr_r(var1, var2)    (((var1)+((Word16)(1L<<((var2)-1))))>>(var2))
+#define vo_sub(a,b)             ((a) - (b))
 #define vo_L_deposit_h(a)       ((Word32)((a) << 16))
-#define vo_round(a)         ((((a) >> 15) + 1) >> 1)
+#define vo_round(a)             ((((a) >> 15) + 1) >> 1)
 #define vo_extract_l(a)         ((Word16)(a))
-#define vo_L_add(a,b)           (a + b)
-#define vo_L_sub(a,b)           (a - b)
-#define vo_mult_r(a,b)          (((( a * b ) >> 14) + 1 ) >> 1 )
-#define vo_negate(a)                (-a)
-#define vo_L_shr_r(L_var1, var2)        ((L_var1+((Word32)(1L<<(var2-1))))>>var2)
+#define vo_L_add(a,b)           ((a) + (b))
+#define vo_L_sub(a,b)           ((a) - (b))
+#define vo_mult_r(a,b)          (((( (a) * (b) ) >> 14) + 1 ) >> 1 )
+#define vo_negate(a)            (-(a))
+#define vo_L_shr_r(L_var1, var2) (((L_var1)+((Word32)(1L<<((var2)-1))))>>(var2))
 
 
 /*___________________________________________________________________________
@@ -765,7 +765,7 @@
                 break;
             }
         }
-        L_var1 <<=1 ;
+        L_var1 *= 2 ;
         L_var_out = L_var1;
     }
     return (L_var_out);
diff --git a/media/libstagefright/codecs/amrwbenc/inc/bits.h b/media/libstagefright/codecs/amrwbenc/inc/bits.h
index ff9c0c1..57e71f7 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/bits.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/bits.h
@@ -42,7 +42,7 @@
 #define NBBITS_SID    35
 #define NB_BITS_MAX   NBBITS_24k
 
-#define BIT_0     (Word16)-127
+#define BIT_0     ((Word16)-127)
 #define BIT_1     (Word16)127
 #define BIT_0_ITU (Word16)0x007F
 #define BIT_1_ITU (Word16)0x0081
diff --git a/media/libstagefright/codecs/amrwbenc/inc/dtx.h b/media/libstagefright/codecs/amrwbenc/inc/dtx.h
index 82a9bf4..7d7ebd8 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/dtx.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/dtx.h
@@ -31,7 +31,7 @@
 #define DTX_HANG_CONST 7                   /* yields eight frames of SP HANGOVER  */
 #define INV_MED_THRESH 14564
 #define ISF_GAP  128                       /* 50 */
-#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
+#define ONE_MINUS_ISF_GAP (16384 - ISF_GAP)
 #define ISF_GAP   128
 #define ISF_DITH_GAP   448
 #define ISF_FACTOR_LOW 256
diff --git a/media/libstagefright/codecs/amrwbenc/inc/homing.tab b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
index e399fb8..6408d3a 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/homing.tab
+++ b/media/libstagefright/codecs/amrwbenc/inc/homing.tab
@@ -21,15 +21,15 @@
 #define NUM_OF_SPMODES 9
 
 #define PRML 15
-#define PRMN_7k NBBITS_7k/PRML + 1
-#define PRMN_9k NBBITS_9k/PRML + 1
-#define PRMN_12k NBBITS_12k/PRML + 1
-#define PRMN_14k NBBITS_14k/PRML + 1
-#define PRMN_16k NBBITS_16k/PRML + 1
-#define PRMN_18k NBBITS_18k/PRML + 1
-#define PRMN_20k NBBITS_20k/PRML + 1
-#define PRMN_23k NBBITS_23k/PRML + 1
-#define PRMN_24k NBBITS_24k/PRML + 1
+#define PRMN_7k (NBBITS_7k/PRML + 1)
+#define PRMN_9k (NBBITS_9k/PRML + 1)
+#define PRMN_12k (NBBITS_12k/PRML + 1)
+#define PRMN_14k (NBBITS_14k/PRML + 1)
+#define PRMN_16k (NBBITS_16k/PRML + 1)
+#define PRMN_18k (NBBITS_18k/PRML + 1)
+#define PRMN_20k (NBBITS_20k/PRML + 1)
+#define PRMN_23k (NBBITS_23k/PRML + 1)
+#define PRMN_24k (NBBITS_24k/PRML + 1)
 
 static const Word16 dfh_M7k[PRMN_7k] =
 {
diff --git a/media/libstagefright/codecs/amrwbenc/inc/stream.h b/media/libstagefright/codecs/amrwbenc/inc/stream.h
index ec1a700..fbaae9e 100644
--- a/media/libstagefright/codecs/amrwbenc/inc/stream.h
+++ b/media/libstagefright/codecs/amrwbenc/inc/stream.h
@@ -26,7 +26,7 @@
 #define __STREAM_H__
 
 #include "voMem.h"
-#define Frame_Maxsize  1024 * 2  //Work Buffer 10K
+#define Frame_Maxsize  (1024 * 2)  //Work Buffer 10K
 #define Frame_MaxByte  640        //AMR_WB Encoder one frame 320 samples = 640 Bytes
 #define MIN(a,b)     ((a) < (b)? (a) : (b))
 
diff --git a/media/libstagefright/codecs/avc/enc/src/avcenc_int.h b/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
index 3fe08a1..22042a5 100644
--- a/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
+++ b/media/libstagefright/codecs/avc/enc/src/avcenc_int.h
@@ -43,7 +43,7 @@
 #define MAX_QP          51
 #define SHIFT_QP        12
 #define  LAMBDA_ACCURACY_BITS         16
-#define  LAMBDA_FACTOR(lambda)        ((int)((double)(1<<LAMBDA_ACCURACY_BITS)*lambda+0.5))
+#define  LAMBDA_FACTOR(lambda)        ((int)((double)(1<<LAMBDA_ACCURACY_BITS)*(lambda)+0.5))
 
 
 #define DISABLE_THRESHOLDING  0
@@ -55,8 +55,8 @@
 #define MAX_VALUE       999999   //!< used for start value for some variables
 
 #define  WEIGHTED_COST(factor,bits)   (((factor)*(bits))>>LAMBDA_ACCURACY_BITS)
-#define  MV_COST(f,s,cx,cy,px,py)     (WEIGHTED_COST(f,mvbits[((cx)<<(s))-px]+mvbits[((cy)<<(s))-py]))
-#define  MV_COST_S(f,cx,cy,px,py)     (WEIGHTED_COST(f,mvbits[cx-px]+mvbits[cy-py]))
+#define  MV_COST(f,s,cx,cy,px,py)     (WEIGHTED_COST(f,mvbits[((cx)<<(s))-(px)]+mvbits[((cy)<<((s)))-(py)]))
+#define  MV_COST_S(f,cx,cy,px,py)     (WEIGHTED_COST(f,mvbits[(cx)-(px)]+mvbits[(cy)-(py)]))
 
 /* for sub-pel search and interpolation */
 #define SUBPEL_PRED_BLK_SIZE 576 // 24x24
diff --git a/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp b/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
index d0bbee2..941ae5a 100644
--- a/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/findhalfpel.cpp
@@ -23,13 +23,13 @@
 
 #define PREF_16_VEC 129     /* 1MV bias versus 4MVs*/
 
-#define CLIP_RESULT(x)      if((uint)x > 0xFF){ \
-                 x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x)      if((uint)(x) > 0xFF){ \
+                 (x) = 0xFF & (~((x)>>31));}
 
-#define CLIP_UPPER16(x)     if((uint)x >= 0x20000000){ \
-        x = 0xFF0000 & (~(x>>31));} \
+#define CLIP_UPPER16(x)     if((uint)(x) >= 0x20000000){ \
+        (x) = 0xFF0000 & (~((x)>>31));} \
         else { \
-        x = (x>>5)&0xFF0000; \
+        (x) = ((x)>>5)&0xFF0000; \
         }
 
 /*=====================================================================
diff --git a/media/libstagefright/codecs/avc/enc/src/intra_est.cpp b/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
index 17e5985..e397805 100644
--- a/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/intra_est.cpp
@@ -25,8 +25,8 @@
 #define FIXED_I4_MODE   AVC_I4_Diagonal_Down_Left
 #define FIXED_INTRA_CHROMA_MODE AVC_IC_DC
 
-#define CLIP_RESULT(x)      if((uint)x > 0xFF){ \
-                 x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x)      if((uint)(x) > 0xFF){ \
+                 (x) = 0xFF & (~((x)>>31));}
 
 
 bool IntraDecisionABE(AVCEncObject *encvid, int min_cost, uint8 *curL, int picPitch)
diff --git a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
index a390f88..d19125f 100644
--- a/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
+++ b/media/libstagefright/codecs/avc/enc/src/motion_comp.cpp
@@ -19,8 +19,8 @@
 #include "avcenc_int.h"
 
 
-#define CLIP_RESULT(x)      if((uint)x > 0xFF){ \
-                 x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x)      if((uint)(x) > 0xFF){ \
+                 (x) = 0xFF & (~((x)>>31));}
 
 /* (blkwidth << 2) + (dy << 1) + dx */
 static void (*const eChromaMC_SIMD[8])(uint8 *, int , int , int , uint8 *, int, int , int) =
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.h b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
index c710c76..a73187b 100644
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.h
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
@@ -46,8 +46,8 @@
 
 /** Compute difference between start and end */
 #define TIME_DIFF(start, end, diff) \
-    diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
-            (end.tv_usec - start.tv_usec);
+    diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+            ((end).tv_usec - (start).tv_usec);
 
 struct SoftAVC : public SoftVideoDecoderOMXComponent {
     SoftAVC(const char *name, const OMX_CALLBACKTYPE *callbacks,
diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
index cf6f899..4d30ba0 100644
--- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
+++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h
@@ -111,8 +111,8 @@
 
 /** Compute difference between start and end */
 #define TIME_DIFF(start, end, diff) \
-    diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
-            (end.tv_usec - start.tv_usec);
+    diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+            ((end).tv_usec - (start).tv_usec);
 
 #define ive_aligned_malloc(alignment, size) memalign(alignment, size)
 #define ive_aligned_free(buf) free(buf)
diff --git a/media/libstagefright/codecs/common/include/voAAC.h b/media/libstagefright/codecs/common/include/voAAC.h
index 9ecb142..0a02feb 100644
--- a/media/libstagefright/codecs/common/include/voAAC.h
+++ b/media/libstagefright/codecs/common/include/voAAC.h
@@ -50,7 +50,7 @@
 
 /* AAC Param ID */
 #define VO_PID_AAC_Mdoule				0x42211000
-#define VO_PID_AAC_ENCPARAM				VO_PID_AAC_Mdoule | 0x0040  /*!< get/set AAC encoder parameter, the parameter is a pointer to AACENC_PARAM */
+#define VO_PID_AAC_ENCPARAM				(VO_PID_AAC_Mdoule | 0x0040)  /*!< get/set AAC encoder parameter, the parameter is a pointer to AACENC_PARAM */
 
 /* AAC decoder error ID */
 #define VO_ERR_AAC_Mdoule				0x82210000
diff --git a/media/libstagefright/codecs/common/include/voAudio.h b/media/libstagefright/codecs/common/include/voAudio.h
index d8628ee..98d3f44 100644
--- a/media/libstagefright/codecs/common/include/voAudio.h
+++ b/media/libstagefright/codecs/common/include/voAudio.h
@@ -38,9 +38,9 @@
 #define VO_PID_AUDIO_CHANNELMODE	(VO_PID_AUDIO_BASE | 0X0005)		/*!< The channel mode of audio */
 
 #define	VO_ERR_AUDIO_BASE			0x82000000
-#define VO_ERR_AUDIO_UNSCHANNEL		VO_ERR_AUDIO_BASE | 0x0001
-#define VO_ERR_AUDIO_UNSSAMPLERATE	VO_ERR_AUDIO_BASE | 0x0002
-#define VO_ERR_AUDIO_UNSFEATURE		VO_ERR_AUDIO_BASE | 0x0003
+#define VO_ERR_AUDIO_UNSCHANNEL		(VO_ERR_AUDIO_BASE | 0x0001)
+#define VO_ERR_AUDIO_UNSSAMPLERATE	(VO_ERR_AUDIO_BASE | 0x0002)
+#define VO_ERR_AUDIO_UNSFEATURE		(VO_ERR_AUDIO_BASE | 0x0003)
 
 
 /**
diff --git a/media/libstagefright/codecs/common/include/voIndex.h b/media/libstagefright/codecs/common/include/voIndex.h
index 320a2f8..97b21f3 100644
--- a/media/libstagefright/codecs/common/include/voIndex.h
+++ b/media/libstagefright/codecs/common/include/voIndex.h
@@ -31,26 +31,26 @@
 
 /* Define the module ID */
 #define _MAKE_SOURCE_ID(id, name) \
-VO_INDEX_SRC_##name = _VO_INDEX_SOURCE | id,
+VO_INDEX_SRC_##name = _VO_INDEX_SOURCE | (id),
 
 #define _MAKE_CODEC_ID(id, name) \
-VO_INDEX_DEC_##name = _VO_INDEX_DEC | id, \
-VO_INDEX_ENC_##name = _VO_INDEX_ENC | id,
+VO_INDEX_DEC_##name = _VO_INDEX_DEC | (id), \
+VO_INDEX_ENC_##name = _VO_INDEX_ENC | (id),
 
 #define _MAKE_EFFECT_ID(id, name) \
-VO_INDEX_EFT_##name = _VO_INDEX_EFFECT | id,
+VO_INDEX_EFT_##name = _VO_INDEX_EFFECT | (id),
 
 #define _MAKE_SINK_ID(id, name) \
-VO_INDEX_SNK_##name = _VO_INDEX_SINK | id,
+VO_INDEX_SNK_##name = _VO_INDEX_SINK | (id),
 
 #define _MAKE_FILTER_ID(id, name) \
-VO_INDEX_FLT_##name = _VO_INDEX_FILTER | id,
+VO_INDEX_FLT_##name = _VO_INDEX_FILTER | (id),
 
 #define _MAKE_OMX_ID(id, name) \
-VO_INDEX_OMX_##name = _VO_INDEX_OMX | id,
+VO_INDEX_OMX_##name = _VO_INDEX_OMX | (id),
 
 #define _MAKE_MFW_ID(id, name) \
-VO_INDEX_MFW_##name = _VO_INDEX_MFW | id,
+VO_INDEX_MFW_##name = _VO_INDEX_MFW | (id),
 
 enum
 {
diff --git a/media/libstagefright/codecs/common/include/voMem.h b/media/libstagefright/codecs/common/include/voMem.h
index 8dfb634..2b5aef1 100644
--- a/media/libstagefright/codecs/common/include/voMem.h
+++ b/media/libstagefright/codecs/common/include/voMem.h
@@ -53,8 +53,8 @@
 { \
 	VO_MEM_INFO voMemInfo; \
 	voMemInfo.Size=nSize; \
-	pMemOP->Alloc(ID, &voMemInfo); \
-	pBuff=(VO_PBYTE)voMemInfo.VBuffer; \
+	(pMemOP)->Alloc(ID, &voMemInfo); \
+	(pBuff)=(VO_PBYTE)voMemInfo.VBuffer; \
 }
 
 
diff --git a/media/libstagefright/codecs/hevcdec/SoftHEVC.h b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
index 943edfd..3c76b59 100644
--- a/media/libstagefright/codecs/hevcdec/SoftHEVC.h
+++ b/media/libstagefright/codecs/hevcdec/SoftHEVC.h
@@ -46,8 +46,8 @@
 
 /** Compute difference between start and end */
 #define TIME_DIFF(start, end, diff) \
-    diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
-            (end.tv_usec - start.tv_usec);
+    diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+            ((end).tv_usec - (start).tv_usec);
 
 struct SoftHEVC: public SoftVideoDecoderOMXComponent {
     SoftHEVC(const char *name, const OMX_CALLBACKTYPE *callbacks,
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/idct.h b/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
index 8edb654..484631b 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/idct.h
@@ -80,9 +80,9 @@
 #define W7 565                  /* 2048*sqrt(2)*cos(7*pi/16) */
 #define W1mW7 2276
 #define W1pW7 3406
-#define W5mW3 -799
-#define mW3mW5 -4017
-#define mW2mW6 -3784
+#define W5mW3 (-799)
+#define mW3mW5 (-4017)
+#define mW2mW6 (-3784)
 #define W2mW6 1568
 
 /* left shift by 11 is to maintain the accuracy of the decimal point */
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h b/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
index 0c12f20..68281ba 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/motion_comp.h
@@ -54,20 +54,20 @@
 {
 #endif
 
-#define CLIP_RESULT(x)      if(x & -256){x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x)      if((x) & -256){(x) = 0xFF & (~((x)>>31));}
 #define ADD_AND_CLIP1(x)    x += (pred_word&0xFF); CLIP_RESULT(x);
 #define ADD_AND_CLIP2(x)    x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
 #define ADD_AND_CLIP3(x)    x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
 #define ADD_AND_CLIP4(x)    x += ((pred_word>>24)&0xFF); CLIP_RESULT(x);
 
-#define ADD_AND_CLIP(x,y)    {  x9 = ~(x>>8); \
+#define ADD_AND_CLIP(x,y)    {  x9 = ~((x)>>8); \
                             if(x9!=-1){ \
                                 x9 = ((uint32)x9)>>24; \
-                                y = x9|(y<<8); \
+                                (y) = x9|((y)<<8); \
                             } \
                             else \
                             {    \
-                                y =  x|(y<<8); \
+                                (y) =  (x)|((y)<<8); \
                             } \
                             }
 
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h b/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
index 3388d89..20f458d 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/mp4def.h
@@ -47,7 +47,7 @@
 /* You don't want to use ((x>UB)?UB:(x<LB)?LB:x) for the clipping */
 /*    because it will use one extra comparison if the compiler is */
 /*    not well-optimized.    04/19/2000.                        */
-#define CLIP_THE_RANGE(x,LB,UB) if (x<LB) x = LB; else if (x>UB) x = UB
+#define CLIP_THE_RANGE(x,LB,UB) if ((x)<(LB)) (x) = (LB); else if ((x)>(UB)) (x) = (UB)
 
 #define MODE_INTRA      0x08 //01000
 #define MODE_INTRA_Q    0x09 //01001
@@ -72,7 +72,7 @@
 #define START_CODE_LENGTH       32
 
 /* 11/30/98 */
-#define NoMarkerFound -1
+#define NoMarkerFound (-1)
 #define FoundRM     1   /* Resync Marker */
 #define FoundVSC    2   /* VOP_START_CODE. */
 #define FoundGSC    3   /* GROUP_START_CODE */
@@ -153,7 +153,7 @@
 
 
 /* macro utility */
-#define  ZERO_OUT_64BYTES(x)    { *((uint32*)x) = *(((uint32*)(x))+1) =  \
+#define  ZERO_OUT_64BYTES(x)    { *((uint32*)(x)) = *(((uint32*)(x))+1) =  \
         *(((uint32*)(x))+2) = *(((uint32*)(x))+3) =  \
         *(((uint32*)(x))+4) = *(((uint32*)(x))+5) =  \
         *(((uint32*)(x))+6) = *(((uint32*)(x))+7) =  \
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h b/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
index 091fdaf..a8ab37f 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/post_proc.h
@@ -32,9 +32,9 @@
 ; DEFINES
 ; Include all pre-processor statements here.
 ----------------------------------------------------------------------------*/
-#define UPDATE_PV_MAXPV_MIN(p,max,min) if ((p) > max) max=(p); else if ((p) < min) min = (p);
+#define UPDATE_PV_MAXPV_MIN(p,max,min) if ((p) > (max)) (max)=(p); else if ((p) < (min)) (min) = (p);
 
-#define     INDEX(x,thr)    (((x)>=thr)?1:0)
+#define     INDEX(x,thr)    (((x)>=(thr))?1:0)
 #define     BLKSIZE     8
 #define     MBSIZE      16
 #define     DERING_THR  16
diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
index a804606..e242820 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
+++ b/media/libstagefright/codecs/m4v_h263/dec/src/vlc_decode.h
@@ -79,10 +79,10 @@
 #include "mp4lib_int.h"
 
 #define VLC_ERROR_DETECTED(x) ((x) < 0)
-#define VLC_IO_ERROR    -1
-#define VLC_CODE_ERROR  -2
-#define VLC_MB_STUFFING -4
-#define VLC_NO_LAST_BIT -5
+#define VLC_IO_ERROR    (-1)
+#define VLC_CODE_ERROR  (-2)
+#define VLC_MB_STUFFING (-4)
+#define VLC_NO_LAST_BIT (-5)
 
 #define VLC_ESCAPE_CODE  7167
 
diff --git a/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp b/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
index 21d7427..688effc 100644
--- a/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
+++ b/media/libstagefright/codecs/m4v_h263/enc/src/fastidct.cpp
@@ -55,7 +55,7 @@
         }
 
 
-#define CLIP_RESULT(x)      if((UInt)x > 0xFF){x = 0xFF & (~(x>>31));}
+#define CLIP_RESULT(x)      if((UInt)(x) > 0xFF){(x) = 0xFF & (~((x)>>31));}
 #define ADD_AND_CLIP1(x)    x += (pred_word&0xFF); CLIP_RESULT(x);
 #define ADD_AND_CLIP2(x)    x += ((pred_word>>8)&0xFF); CLIP_RESULT(x);
 #define ADD_AND_CLIP3(x)    x += ((pred_word>>16)&0xFF); CLIP_RESULT(x);
diff --git a/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h b/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
index ba43820..337bff0 100644
--- a/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
+++ b/media/libstagefright/codecs/mp3dec/src/pv_mp3dec_fxd_op_c_equivalent.h
@@ -44,9 +44,9 @@
 #endif
 
 #include "pvmp3_audio_type_defs.h"
-#define Qfmt_31(a)   (Int32)((float)a*0x7FFFFFFF)
+#define Qfmt_31(a)   (Int32)((float)(a)*0x7FFFFFFF)
 
-#define Qfmt15(x)   (Int16)(x*((Int32)1<<15) + (x>=0?0.5F:-0.5F))
+#define Qfmt15(x)   (Int16)((x)*((Int32)1<<15) + ((x)>=0?0.5F:-0.5F))
 
 
 
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
index 32c76c6..af738ba 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_alias_reduction.cpp
@@ -109,7 +109,7 @@
 ----------------------------------------------------------------------------*/
 #define NUM_BUTTERFLIES 8
 
-#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*(a)))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
index a71efc4..9b9ae4b 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_16.cpp
@@ -109,7 +109,7 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define Qfmt(a)   (int32)(a*((int32)1<<27))
+#define Qfmt(a)   (int32)((a)*((int32)1<<27))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
index 4c5fb03..1f8018a 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_6.cpp
@@ -79,7 +79,7 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define Qfmt30(a)   (Int32)(a*((Int32)1<<30) + (a>=0?0.5F:-0.5F))
+#define Qfmt30(a)   (Int32)((a)*((Int32)1<<30) + ((a)>=0?0.5F:-0.5F))
 
 #define cos_pi_6     Qfmt30(  0.86602540378444f)
 #define cos_2_pi_6   Qfmt30(  0.5f)
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
index ce3ec64..d30ce4a 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dct_9.cpp
@@ -77,7 +77,7 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define Qfmt31(a)   (int32)(a*(0x7FFFFFFF))
+#define Qfmt31(a)   (int32)((a)*(0x7FFFFFFF))
 
 #define cos_pi_9    Qfmt31( 0.93969262078591f)
 #define cos_2pi_9   Qfmt31( 0.76604444311898f)
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
index 6cf8e3e..2be9ab9 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dec_defs.h
@@ -53,7 +53,7 @@
 ; MACROS
 ; Define module specific macros here
 ----------------------------------------------------------------------------*/
-#define module(x, POW2)   ((x)&(POW2-1))
+#define module(x, POW2)   ((x)&((POW2)-1))
 
 /*----------------------------------------------------------------------------
 ; DEFINES
@@ -75,7 +75,7 @@
 #define MPEG_1              0
 #define MPEG_2              1
 #define MPEG_2_5            2
-#define INVALID_VERSION     -1
+#define INVALID_VERSION   (-1)
 
 /* MPEG Header Definitions - Mode Values */
 
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
index 69e1987..639df81 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_dequantize_sample.cpp
@@ -108,8 +108,8 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define Q30_fmt(a)(int32(double(0x40000000)*a))
-#define Q29_fmt(a)(int32(double(0x20000000)*a))
+#define Q30_fmt(a)(int32(double(0x40000000)*(a)))
+#define Q29_fmt(a)(int32(double(0x20000000)*(a)))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
index f4a4efb..61aef30 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_equalizer.cpp
@@ -98,7 +98,7 @@
 #define LEVEL_45__dB  0.005524271f
 #define LEVEL_60__dB  0.000976562f
 
-#define Qmf31( x)    (int32)(x*(float)0x7FFFFFFF)
+#define Qmf31( x)    (int32)((x)*(float)0x7FFFFFFF)
 
 
 /*----------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
index f1a3ff8..d4a2060 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_get_scale_factors.cpp
@@ -86,7 +86,7 @@
 ; Include all pre-processor statements here. Include conditional
 ; compile variables also.
 ----------------------------------------------------------------------------*/
-#define Qfmt_28(a)(int32(double(0x10000000)*a))
+#define Qfmt_28(a)(int32(double(0x10000000)*(a)))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
index e497aee..2f2f65c 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_18.h
@@ -59,9 +59,9 @@
 ; DEFINES
 ; Include all pre-processor statements here.
 ----------------------------------------------------------------------------*/
-#define Qfmt(a)    (Int32)(a*((Int32)1<<28) )
-#define Qfmt1(a)   (Int32)(a*((Int32)0x7FFFFFFF))
-#define Qfmt2(a)   (Int32)(a*((Int32)1<<27))
+#define Qfmt(a)    (Int32)((a)*((Int32)1<<28) )
+#define Qfmt1(a)   (Int32)((a)*((Int32)0x7FFFFFFF))
+#define Qfmt2(a)   (Int32)((a)*((Int32)1<<27))
 
 /*----------------------------------------------------------------------------
 ; EXTERNAL VARIABLES REFERENCES
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
index 6a72aad..8d80e8f 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp
@@ -81,7 +81,7 @@
 ; compile variables also.
 ----------------------------------------------------------------------------*/
 #define QFORMAT    29
-#define Qfmt29(a)   (int32)(a*((int32)1<<QFORMAT) + (a>=0?0.5F:-0.5F))
+#define Qfmt29(a)   (int32)((a)*((int32)1<<QFORMAT) + ((a)>=0?0.5F:-0.5F))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
index 6ba53d7..af4f286 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.h
@@ -59,9 +59,9 @@
 ; DEFINES
 ; Include all pre-processor statements here.
 ----------------------------------------------------------------------------*/
-#define Qfmt(a)    (Int32)(a*((Int32)1<<28) )
-#define Qfmt1(a)   (Int32)(a*((Int32)0x7FFFFFFF))
-#define Qfmt2(a)   (Int32)(a*((Int32)1<<27))
+#define Qfmt(a)    (Int32)((a)*((Int32)1<<28) )
+#define Qfmt1(a)   (Int32)((a)*((Int32)0x7FFFFFFF))
+#define Qfmt2(a)   (Int32)((a)*((Int32)1<<27))
 
 /*----------------------------------------------------------------------------
 ; EXTERNAL VARIABLES REFERENCES
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
index c79062c..a70e716 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_mpeg2_stereo_proc.cpp
@@ -123,7 +123,7 @@
 ; compile variables also.
 ----------------------------------------------------------------------------*/
 
-#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*(a)))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
index d69a46d..10edfc3 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_stereo_proc.cpp
@@ -140,7 +140,7 @@
 ----------------------------------------------------------------------------*/
 #define N31 31
 
-#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*a))
+#define Q31_fmt(a)    (int32(double(0x7FFFFFFF)*(a)))
 
 /*----------------------------------------------------------------------------
 ; LOCAL FUNCTION DEFINITIONS
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
index 90e524a..91113e3 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.cpp
@@ -136,7 +136,7 @@
 
 };
 
-#define INV_Q31( x)   (int32)(0x7FFFFFFF/(float)x - 1.0f)
+#define INV_Q31( x)   (int32)(0x7FFFFFFF/(float)(x) - 1.0f)
 
 const int32 mp3_shortwindBandWidths[9][13] =
 {
@@ -161,7 +161,7 @@
 };
 
 
-#define Q30_fmt(a)    (int32((0x40000000)*a))
+#define Q30_fmt(a)    (int32((0x40000000)*(a)))
 
 const int32 pqmfSynthWin[(HAN_SIZE/2) + 8] =
 {
diff --git a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
index b54c5bf..8f8509c 100644
--- a/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
+++ b/media/libstagefright/codecs/mp3dec/src/pvmp3_tables.h
@@ -52,7 +52,7 @@
 /*----------------------------------------------------------------------------
 ; DEFINES AND SIMPLE TYPEDEF'S
 ----------------------------------------------------------------------------*/
-#define Qfmt_28(a) (int32(double(0x10000000)*a))
+#define Qfmt_28(a) (int32(double(0x10000000)*(a)))
 
 /*----------------------------------------------------------------------------
 ; SIMPLE TYPEDEF'S
diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
index 025e9a0..9d82c6d 100644
--- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
+++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.h
@@ -49,8 +49,8 @@
 
 /** Compute difference between start and end */
 #define TIME_DIFF(start, end, diff) \
-    diff = ((end.tv_sec - start.tv_sec) * 1000000) + \
-            (end.tv_usec - start.tv_usec);
+    diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
+            ((end).tv_usec - (start).tv_usec);
 
 struct SoftMPEG2 : public SoftVideoDecoderOMXComponent {
     SoftMPEG2(
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
index 91d78bd..422d7ba 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
+++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_cavlc.c
@@ -60,7 +60,7 @@
 #define INFO(vlc) (((vlc) >> 4) & 0xF)  /* 4 MSB bits contain information */
 /* macro to obtain trailing ones from the coeff token information word,
  * bits [5,10] */
-#define TRAILING_ONES(coeffToken) ((coeffToken>>5) & 0x3F)
+#define TRAILING_ONES(coeffToken) (((coeffToken)>>5) & 0x3F)
 /* macro to obtain total coeff from the coeff token information word,
  * bits [11,15] */
 #define TOTAL_COEFF(coeffToken) (((coeffToken) >> 11) & 0x1F)
@@ -323,45 +323,45 @@
 /* macro to initialize stream buffer cache, fills the buffer (32 bits) */
 #define BUFFER_INIT(value, bits) \
 { \
-    bits = 32; \
-    value = h264bsdShowBits32(pStrmData); \
+    (bits) = 32; \
+    (value) = h264bsdShowBits32(pStrmData); \
 }
 
 /* macro to read numBits bits from the buffer, bits will be written to
  * outVal. Refills the buffer if not enough bits left */
 #define BUFFER_SHOW(value, bits, outVal, numBits) \
 { \
-    if (bits < (numBits)) \
+    if ((bits) < (numBits)) \
     { \
-        if(h264bsdFlushBits(pStrmData,32-bits) == END_OF_STREAM) \
+        if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
             return(HANTRO_NOK); \
-        value = h264bsdShowBits32(pStrmData); \
-        bits = 32; \
+        (value) = h264bsdShowBits32(pStrmData); \
+        (bits) = 32; \
     } \
-    (outVal) = value >> (32 - (numBits)); \
+    (outVal) = (value) >> (32 - (numBits)); \
 }
 
 /* macro to flush numBits bits from the buffer */
 #define BUFFER_FLUSH(value, bits, numBits) \
 { \
-    value <<= (numBits); \
-    bits -= (numBits); \
+    (value) <<= (numBits); \
+    (bits) -= (numBits); \
 }
 
 /* macro to read and flush  numBits bits from the buffer, bits will be written
  * to outVal. Refills the buffer if not enough bits left */
 #define BUFFER_GET(value, bits, outVal, numBits) \
 { \
-    if (bits < (numBits)) \
+    if ((bits) < (numBits)) \
     { \
-        if(h264bsdFlushBits(pStrmData,32-bits) == END_OF_STREAM) \
+        if(h264bsdFlushBits(pStrmData,32-(bits)) == END_OF_STREAM) \
             return(HANTRO_NOK); \
-        value = h264bsdShowBits32(pStrmData); \
-        bits = 32; \
+        (value) = h264bsdShowBits32(pStrmData); \
+        (bits) = 32; \
     } \
-    (outVal) = value >> (32 - (numBits)); \
-    value <<= (numBits); \
-    bits -= (numBits); \
+    (outVal) = (value) >> (32 - (numBits)); \
+    (value) <<= (numBits); \
+    (bits) -= (numBits); \
 }
 
 /*------------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
index 9f0eb7d..f43cf82 100644
--- a/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
+++ b/media/libstagefright/codecs/on2/h264dec/source/h264bsd_util.h
@@ -151,7 +151,7 @@
 }
 
 #define ALIGN(ptr, bytePos) \
-        (ptr + ( ((bytePos - (uintptr_t)ptr) & (bytePos - 1)) / sizeof(*ptr) ))
+        ((ptr) + ( (((bytePos) - (uintptr_t)(ptr)) & ((bytePos) - 1)) / sizeof(*(ptr)) ))
 
 extern const u32 h264bsdQpC[52];
 
diff --git a/media/libstagefright/filters/Android.mk b/media/libstagefright/filters/Android.mk
index 179f054..bd75a88 100644
--- a/media/libstagefright/filters/Android.mk
+++ b/media/libstagefright/filters/Android.mk
@@ -23,6 +23,8 @@
 LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
 LOCAL_CLANG := true
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE:= libstagefright_mediafilter
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/foundation/ADebug.cpp b/media/libstagefright/foundation/ADebug.cpp
index 2c5f544..1a5b2a3 100644
--- a/media/libstagefright/foundation/ADebug.cpp
+++ b/media/libstagefright/foundation/ADebug.cpp
@@ -49,7 +49,7 @@
             ++current;
         }
         // check for :
-        char *colon = strchr(current, ':');
+        const char *colon = strchr(current, ':');
 
         // get level
         char *end;
diff --git a/media/libstagefright/foundation/AMessage.cpp b/media/libstagefright/foundation/AMessage.cpp
index 37fb33f..00f2755 100644
--- a/media/libstagefright/foundation/AMessage.cpp
+++ b/media/libstagefright/foundation/AMessage.cpp
@@ -225,7 +225,8 @@
     item->u.FIELDNAME = value;                                          \
 }                                                                       \
                                                                         \
-bool AMessage::find##NAME(const char *name, TYPENAME *value) const {    \
+/* NOLINT added to avoid incorrect warning/fix from clang.tidy */       \
+bool AMessage::find##NAME(const char *name, TYPENAME *value) const {  /* NOLINT */ \
     const Item *item = findItem(name, kType##NAME);                     \
     if (item) {                                                         \
         *value = item->u.FIELDNAME;                                     \
diff --git a/media/libstagefright/foundation/ANetworkSession.cpp b/media/libstagefright/foundation/ANetworkSession.cpp
index 46314eb..f8b7b41 100644
--- a/media/libstagefright/foundation/ANetworkSession.cpp
+++ b/media/libstagefright/foundation/ANetworkSession.cpp
@@ -53,7 +53,7 @@
 static const int32_t kMaxUDPRetries = 200;
 
 struct ANetworkSession::NetworkThread : public Thread {
-    NetworkThread(ANetworkSession *session);
+    explicit NetworkThread(ANetworkSession *session);
 
 protected:
     virtual ~NetworkThread();
diff --git a/media/libstagefright/foundation/Android.mk b/media/libstagefright/foundation/Android.mk
index 3c3ed59..b977c65 100644
--- a/media/libstagefright/foundation/Android.mk
+++ b/media/libstagefright/foundation/Android.mk
@@ -33,6 +33,8 @@
         liblog            \
         libpowermanager
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
 LOCAL_CFLAGS += -Wno-multichar -Werror -Wall
 LOCAL_CLANG := true
 LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk
index f904212..2c985fc 100644
--- a/media/libstagefright/httplive/Android.mk
+++ b/media/libstagefright/httplive/Android.mk
@@ -18,6 +18,7 @@
 LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
 
 LOCAL_SHARED_LIBRARIES := \
+        liblog \
         libbinder \
         libcrypto \
         libcutils \
diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp
index cebf95c..e24d08d 100644
--- a/media/libstagefright/httplive/LiveSession.cpp
+++ b/media/libstagefright/httplive/LiveSession.cpp
@@ -1175,7 +1175,7 @@
 #endif
 
 bool LiveSession::UriIsSameAsIndex(const AString &uri, int32_t i, bool newUri) {
-    ALOGI("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
+    ALOGV("[timed_id3] i %d UriIsSameAsIndex newUri %s, %s", i,
             newUri ? "true" : "false",
             newUri ? mStreams[i].mNewUri.c_str() : mStreams[i].mUri.c_str());
     return i >= 0
diff --git a/media/libstagefright/httplive/M3UParser.cpp b/media/libstagefright/httplive/M3UParser.cpp
index c04549a..71feb9a 100644
--- a/media/libstagefright/httplive/M3UParser.cpp
+++ b/media/libstagefright/httplive/M3UParser.cpp
@@ -46,7 +46,7 @@
         FLAG_HAS_URI            = 16,
     };
 
-    MediaGroup(Type type);
+    explicit MediaGroup(Type type);
 
     Type type() const;
 
@@ -498,8 +498,8 @@
     if (url[0] == '/') {
         // URL is an absolute path.
 
-        char *protocolEnd = strstr(baseURL, "//") + 2;
-        char *pathStart = strchr(protocolEnd, '/');
+        const char *protocolEnd = strstr(baseURL, "//") + 2;
+        const char *pathStart = strchr(protocolEnd, '/');
 
         if (pathStart != NULL) {
             out->setTo(baseURL, pathStart - baseURL);
diff --git a/media/libstagefright/id3/Android.mk b/media/libstagefright/id3/Android.mk
index 2cfba44..bd2e459 100644
--- a/media/libstagefright/id3/Android.mk
+++ b/media/libstagefright/id3/Android.mk
@@ -8,6 +8,8 @@
 LOCAL_CLANG := true
 LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE := libstagefright_id3
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/include/avc_utils.h b/media/libstagefright/include/avc_utils.h
index 7465b35..8e308e9 100644
--- a/media/libstagefright/include/avc_utils.h
+++ b/media/libstagefright/include/avc_utils.h
@@ -37,8 +37,8 @@
 };
 
 struct NALPosition {
-    size_t nalOffset;
-    size_t nalSize;
+    uint32_t nalOffset;
+    uint32_t nalSize;
 };
 
 // Optionally returns sample aspect ratio as well.
diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk
index b0cbf08..89d7ff2 100644
--- a/media/libstagefright/matroska/Android.mk
+++ b/media/libstagefright/matroska/Android.mk
@@ -13,6 +13,8 @@
 LOCAL_CLANG := true
 LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE:= libstagefright_matroska
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index 0f9430e..8e82486 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -40,7 +40,7 @@
 namespace android {
 
 struct DataSourceReader : public mkvparser::IMkvReader {
-    DataSourceReader(const sp<DataSource> &source)
+    explicit DataSourceReader(const sp<DataSource> &source)
         : mSource(source) {
     }
 
diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk
index 70afde9..66722a8 100644
--- a/media/libstagefright/mpeg2ts/Android.mk
+++ b/media/libstagefright/mpeg2ts/Android.mk
@@ -17,6 +17,8 @@
 LOCAL_CLANG := true
 LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE:= libstagefright_mpeg2ts
 
 ifeq ($(TARGET_ARCH),arm)
diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp
index 2e989b5..f7058d7 100644
--- a/media/libstagefright/omx/OMX.cpp
+++ b/media/libstagefright/omx/OMX.cpp
@@ -48,7 +48,7 @@
 // Note that deriving CallbackDispatcher from Thread does not work.
 
 struct OMX::CallbackDispatcherThread : public Thread {
-    CallbackDispatcherThread(CallbackDispatcher *dispatcher)
+    explicit CallbackDispatcherThread(CallbackDispatcher *dispatcher)
         : mDispatcher(dispatcher) {
     }
 
@@ -64,7 +64,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 struct OMX::CallbackDispatcher : public RefBase {
-    CallbackDispatcher(OMXNodeInstance *owner);
+    explicit CallbackDispatcher(OMXNodeInstance *owner);
 
     // Posts |msg| to the listener's queue. If |realTime| is true, the listener thread is notified
     // that a new message is available on the queue. Otherwise, the message stays on the queue, but
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 4f1a952..1c6e0dc 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -93,19 +93,19 @@
 namespace android {
 
 struct BufferMeta {
-    BufferMeta(const sp<IMemory> &mem, OMX_U32 portIndex, bool is_backup = false)
+    explicit BufferMeta(const sp<IMemory> &mem, OMX_U32 portIndex, bool is_backup = false)
         : mMem(mem),
           mIsBackup(is_backup),
           mPortIndex(portIndex) {
     }
 
-    BufferMeta(size_t size, OMX_U32 portIndex)
+    explicit BufferMeta(size_t size, OMX_U32 portIndex)
         : mSize(size),
           mIsBackup(false),
           mPortIndex(portIndex) {
     }
 
-    BufferMeta(const sp<GraphicBuffer> &graphicBuffer, OMX_U32 portIndex)
+    explicit BufferMeta(const sp<GraphicBuffer> &graphicBuffer, OMX_U32 portIndex)
         : mGraphicBuffer(graphicBuffer),
           mIsBackup(false),
           mPortIndex(portIndex) {
diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk
index bdda19c..35301ce 100644
--- a/media/libstagefright/rtsp/Android.mk
+++ b/media/libstagefright/rtsp/Android.mk
@@ -19,7 +19,7 @@
         ASessionDescription.cpp     \
         SDPLoader.cpp               \
 
-LOCAL_SHARED_LIBRARIES += libcrypto
+LOCAL_SHARED_LIBRARIES += libcrypto libmedia
 
 LOCAL_C_INCLUDES:= \
 	$(TOP)/frameworks/av/media/libstagefright \
diff --git a/media/libstagefright/tests/SurfaceMediaSource_test.cpp b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
index ad1e684..d419133 100644
--- a/media/libstagefright/tests/SurfaceMediaSource_test.cpp
+++ b/media/libstagefright/tests/SurfaceMediaSource_test.cpp
@@ -593,7 +593,7 @@
 struct SimpleDummyRecorder {
         sp<MediaSource> mSource;
 
-        SimpleDummyRecorder
+        explicit SimpleDummyRecorder
                 (const sp<MediaSource> &source): mSource(source) {}
 
         status_t start() { return mSource->start();}
diff --git a/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk
index f2c6365..8d128b8 100644
--- a/media/libstagefright/timedtext/Android.mk
+++ b/media/libstagefright/timedtext/Android.mk
@@ -12,6 +12,8 @@
         $(TOP)/frameworks/av/include/media/stagefright/timedtext \
         $(TOP)/frameworks/av/media/libstagefright
 
+LOCAL_SHARED_LIBRARIES := libmedia
+
 LOCAL_MODULE:= libstagefright_timedtext
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
index e26165e..f0a4ded 100644
--- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
+++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp
@@ -782,7 +782,7 @@
             return;
         }
 
-        char *commaPos = strchr(s, ',');
+        const char *commaPos = strchr(s, ',');
         if (commaPos != NULL) {
             s = commaPos + 1;
 
@@ -1669,7 +1669,7 @@
 }
 
 struct WifiDisplaySource::HDCPObserver : public BnHDCPObserver {
-    HDCPObserver(const sp<AMessage> &notify);
+    explicit HDCPObserver(const sp<AMessage> &notify);
 
     virtual void notify(
             int msg, int ext1, int ext2, const Parcel *obj);
diff --git a/media/ndk/NdkMediaCodec.cpp b/media/ndk/NdkMediaCodec.cpp
index 50b490d..3d1eca1 100644
--- a/media/ndk/NdkMediaCodec.cpp
+++ b/media/ndk/NdkMediaCodec.cpp
@@ -59,7 +59,7 @@
 private:
     AMediaCodec* mCodec;
 public:
-    CodecHandler(AMediaCodec *codec);
+    explicit CodecHandler(AMediaCodec *codec);
     virtual void onMessageReceived(const sp<AMessage> &msg);
 };
 
diff --git a/media/utils/ISchedulingPolicyService.cpp b/media/utils/ISchedulingPolicyService.cpp
index f55bc02..f5bfe20 100644
--- a/media/utils/ISchedulingPolicyService.cpp
+++ b/media/utils/ISchedulingPolicyService.cpp
@@ -32,7 +32,7 @@
 class BpSchedulingPolicyService : public BpInterface<ISchedulingPolicyService>
 {
 public:
-    BpSchedulingPolicyService(const sp<IBinder>& impl)
+    explicit BpSchedulingPolicyService(const sp<IBinder>& impl)
         : BpInterface<ISchedulingPolicyService>(impl)
     {
     }
diff --git a/radio/IRadio.cpp b/radio/IRadio.cpp
index 242df77..0881a91 100644
--- a/radio/IRadio.cpp
+++ b/radio/IRadio.cpp
@@ -44,7 +44,7 @@
 class BpRadio: public BpInterface<IRadio>
 {
 public:
-    BpRadio(const sp<IBinder>& impl)
+    explicit BpRadio(const sp<IBinder>& impl)
         : BpInterface<IRadio>(impl)
     {
     }
diff --git a/radio/IRadioClient.cpp b/radio/IRadioClient.cpp
index 033ca49..ca21949 100644
--- a/radio/IRadioClient.cpp
+++ b/radio/IRadioClient.cpp
@@ -33,7 +33,7 @@
 {
 
 public:
-    BpRadioClient(const sp<IBinder>& impl)
+    explicit BpRadioClient(const sp<IBinder>& impl)
         : BpInterface<IRadioClient>(impl)
     {
     }
diff --git a/radio/IRadioService.cpp b/radio/IRadioService.cpp
index 81acf9e..960aab4 100644
--- a/radio/IRadioService.cpp
+++ b/radio/IRadioService.cpp
@@ -45,7 +45,7 @@
 class BpRadioService: public BpInterface<IRadioService>
 {
 public:
-    BpRadioService(const sp<IBinder>& impl)
+    explicit BpRadioService(const sp<IBinder>& impl)
         : BpInterface<IRadioService>(impl)
     {
     }
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 83e8222..09385aa 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1414,11 +1414,15 @@
         mAudioFlinger(audioFlinger),
         mPid(pid)
 {
-    size_t heapSize = kClientSharedHeapSizeBytes;
-    // Increase heap size on non low ram devices to limit risk of reconnection failure for
-    // invalidated tracks
-    if (!audioFlinger->isLowRamDevice()) {
-        heapSize *= kClientSharedHeapSizeMultiplier;
+    size_t heapSize = property_get_int32("ro.af.client_heap_size_kbyte", 0);
+    heapSize *= 1024;
+    if (!heapSize) {
+        heapSize = kClientSharedHeapSizeBytes;
+        // Increase heap size on non low ram devices to limit risk of reconnection failure for
+        // invalidated tracks
+        if (!audioFlinger->isLowRamDevice()) {
+            heapSize *= kClientSharedHeapSizeMultiplier;
+        }
     }
     mMemoryDealer = new MemoryDealer(heapSize, "AudioFlinger::Client");
 }
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index aea6b67..d8f2556 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1679,8 +1679,8 @@
 
 // Needs to derive a compile time constant (constexpr).  Could be targeted to go
 // to a MONOVOL mixtype based on MAX_NUM_VOLUMES, but that's an unnecessary complication.
-#define MIXTYPE_MONOVOL(mixtype) (mixtype == MIXTYPE_MULTI ? MIXTYPE_MULTI_MONOVOL : \
-        mixtype == MIXTYPE_MULTI_SAVEONLY ? MIXTYPE_MULTI_SAVEONLY_MONOVOL : mixtype)
+#define MIXTYPE_MONOVOL(mixtype) ((mixtype) == MIXTYPE_MULTI ? MIXTYPE_MULTI_MONOVOL : \
+        (mixtype) == MIXTYPE_MULTI_SAVEONLY ? MIXTYPE_MULTI_SAVEONLY_MONOVOL : (mixtype))
 
 /* MIXTYPE     (see AudioMixerOps.h MIXTYPE_* enumeration)
  * TO: int32_t (Q4.27) or float
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index f7e6422..ee184fb 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -97,7 +97,7 @@
 }
 
 #ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 #endif
 
 namespace android {
diff --git a/services/audiopolicy/common/managerdefinitions/Android.mk b/services/audiopolicy/common/managerdefinitions/Android.mk
index 3b4ae6b..8ca36ea 100644
--- a/services/audiopolicy/common/managerdefinitions/Android.mk
+++ b/services/audiopolicy/common/managerdefinitions/Android.mk
@@ -25,9 +25,12 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libcutils \
+    libmedia \
     libutils \
     liblog \
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libmedia
+
 LOCAL_C_INCLUDES := \
     $(LOCAL_PATH)/include \
     $(TOPDIR)frameworks/av/services/audiopolicy/common/include \
diff --git a/services/audiopolicy/enginedefault/Android.mk b/services/audiopolicy/enginedefault/Android.mk
index 85d1822..b247e21 100755
--- a/services/audiopolicy/enginedefault/Android.mk
+++ b/services/audiopolicy/enginedefault/Android.mk
@@ -40,6 +40,7 @@
     libxml2
 
 LOCAL_SHARED_LIBRARIES += \
+    liblog \
     libcutils \
     libutils \
     libaudioutils \
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 3b075fa..5d64e44 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -61,6 +61,17 @@
     return setDeviceConnectionStateInt(device, state, device_address, device_name);
 }
 
+void AudioPolicyManager::broadcastDeviceConnectionState(audio_devices_t device,
+                                                        audio_policy_dev_state_t state,
+                                                        const String8 &device_address)
+{
+    AudioParameter param(device_address);
+    const String8 key(state == AUDIO_POLICY_DEVICE_STATE_AVAILABLE ?
+                AUDIO_PARAMETER_DEVICE_CONNECT : AUDIO_PARAMETER_DEVICE_DISCONNECT);
+    param.addInt(key, device);
+    mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+}
+
 status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
                                                          audio_policy_dev_state_t state,
                                                          const char *device_address,
@@ -109,8 +120,15 @@
                 return NO_MEMORY;
             }
 
+            // Before checking outputs, broadcast connect event to allow HAL to retrieve dynamic
+            // parameters on newly connected devices (instead of opening the outputs...)
+            broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
             if (checkOutputsForDevice(devDesc, state, outputs, devDesc->mAddress) != NO_ERROR) {
                 mAvailableOutputDevices.remove(devDesc);
+
+                broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+                                               devDesc->mAddress);
                 return INVALID_OPERATION;
             }
             // Propagate device availability to Engine
@@ -122,11 +140,6 @@
             ALOGV("setDeviceConnectionState() checkOutputsForDevice() returned %zu outputs",
                   outputs.size());
 
-            // Send connect to HALs
-            AudioParameter param = AudioParameter(devDesc->mAddress);
-            param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
-            mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
             } break;
         // handle output device disconnection
         case AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE: {
@@ -138,9 +151,7 @@
             ALOGV("setDeviceConnectionState() disconnecting output device %x", device);
 
             // Send Disconnect to HALs
-            AudioParameter param = AudioParameter(devDesc->mAddress);
-            param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
-            mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+            broadcastDeviceConnectionState(device, state, devDesc->mAddress);
 
             // remove device from available output devices
             mAvailableOutputDevices.remove(devDesc);
@@ -223,7 +234,14 @@
                       device);
                 return INVALID_OPERATION;
             }
+
+            // Before checking intputs, broadcast connect event to allow HAL to retrieve dynamic
+            // parameters on newly connected devices (instead of opening the inputs...)
+            broadcastDeviceConnectionState(device, state, devDesc->mAddress);
+
             if (checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress) != NO_ERROR) {
+                broadcastDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
+                                               devDesc->mAddress);
                 return INVALID_OPERATION;
             }
 
@@ -234,11 +252,6 @@
                 return NO_MEMORY;
             }
 
-            // Set connect to HALs
-            AudioParameter param = AudioParameter(devDesc->mAddress);
-            param.addInt(String8(AUDIO_PARAMETER_DEVICE_CONNECT), device);
-            mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
-
             // Propagate device availability to Engine
             mEngine->setDeviceConnectionState(devDesc, state);
         } break;
@@ -253,9 +266,7 @@
             ALOGV("setDeviceConnectionState() disconnecting input device %x", device);
 
             // Set Disconnect to HALs
-            AudioParameter param = AudioParameter(devDesc->mAddress);
-            param.addInt(String8(AUDIO_PARAMETER_DEVICE_DISCONNECT), device);
-            mpClientInterface->setParameters(AUDIO_IO_HANDLE_NONE, param.toString());
+            broadcastDeviceConnectionState(device, state, devDesc->mAddress);
 
             checkInputsForDevice(devDesc, state, inputs, devDesc->mAddress);
             mAvailableInputDevices.remove(devDesc);
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 6c3e416..1ac89dd 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -594,6 +594,15 @@
         void updateAudioProfiles(audio_devices_t device, audio_io_handle_t ioHandle,
                 AudioProfileVector &profiles);
 
+        // Notify the policy client of any change of device state with AUDIO_IO_HANDLE_NONE,
+        // so that the client interprets it as global to audio hardware interfaces.
+        // It can give a chance to HAL implementer to retrieve dynamic capabilities associated
+        // to this device for example.
+        // TODO avoid opening stream to retrieve capabilities of a profile.
+        void broadcastDeviceConnectionState(audio_devices_t device,
+                                            audio_policy_dev_state_t state,
+                                            const String8 &device_address);
+
         // updates device caching and output for streams that can influence the
         //    routing of notifications
         void handleNotificationRoutingForStream(audio_stream_type_t stream);
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index ebe65e4..a2ca3a8 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -69,6 +69,8 @@
     libjpeg \
     libmemunreachable
 
+LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbinder
+
 LOCAL_C_INCLUDES += \
     system/media/private/camera/include \
     frameworks/native/include/media/openmax \
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index ff73c28..62781bc 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -103,7 +103,7 @@
     sp<CameraService> cs = const_cast<CameraService*>(
             static_cast<const CameraService*>(callbacks));
 
-    cs->onDeviceStatusChanged(static_cast<camera_device_status_t>(camera_id),
+    cs->onDeviceStatusChanged(camera_id,
             static_cast<camera_device_status_t>(new_status));
 }
 
@@ -272,12 +272,14 @@
 }
 
 sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() {
+    sp<ICameraServiceProxy> proxyBinder = nullptr;
+#ifndef __BRILLO__
     sp<IServiceManager> sm = defaultServiceManager();
     sp<IBinder> binder = sm->getService(String16("media.camera.proxy"));
-    if (binder == nullptr) {
-        return nullptr;
+    if (binder != nullptr) {
+        proxyBinder = interface_cast<ICameraServiceProxy>(binder);
     }
-    sp<ICameraServiceProxy> proxyBinder = interface_cast<ICameraServiceProxy>(binder);
+#endif
     return proxyBinder;
 }
 
@@ -296,7 +298,7 @@
     gCameraService = nullptr;
 }
 
-void CameraService::onDeviceStatusChanged(camera_device_status_t  cameraId,
+void CameraService::onDeviceStatusChanged(int  cameraId,
         camera_device_status_t newStatus) {
     ALOGI("%s: Status changed for cameraId=%d, newStatus=%d", __FUNCTION__,
           cameraId, newStatus);
@@ -923,6 +925,48 @@
         const String8& clientName8, /*inout*/int& clientUid, /*inout*/int& clientPid,
         /*out*/int& originalClientPid) const {
 
+#if !defined(__BRILLO__)
+    Status allowed = validateClientPermissionsLocked(cameraId, clientName8, clientUid, clientPid,
+            originalClientPid);
+    if (!allowed.isOk()) {
+        return allowed;
+    }
+#endif  // defined(__BRILLO__)
+
+    int callingPid = getCallingPid();
+
+    if (!mModule) {
+        ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
+                callingPid);
+        return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+                "No camera HAL module available to open camera device \"%s\"", cameraId.string());
+    }
+
+    if (getCameraState(cameraId) == nullptr) {
+        ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
+                cameraId.string());
+        return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+                "No camera device with ID \"%s\" available", cameraId.string());
+    }
+
+    status_t err = checkIfDeviceIsUsable(cameraId);
+    if (err != NO_ERROR) {
+        switch(err) {
+            case -ENODEV:
+            case -EBUSY:
+                return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
+                        "No camera device with ID \"%s\" currently available", cameraId.string());
+            default:
+                return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
+                        "Unknown error connecting to ID \"%s\"", cameraId.string());
+        }
+    }
+    return Status::ok();
+}
+
+Status CameraService::validateClientPermissionsLocked(const String8& cameraId,
+        const String8& clientName8, int& clientUid, int& clientPid,
+        /*out*/int& originalClientPid) const {
     int callingPid = getCallingPid();
     int callingUid = getCallingUid();
 
@@ -966,20 +1010,6 @@
     originalClientPid = clientPid;
     clientPid = callingPid;
 
-    if (!mModule) {
-        ALOGE("CameraService::connect X (PID %d) rejected (camera HAL module not loaded)",
-                callingPid);
-        return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
-                "No camera HAL module available to open camera device \"%s\"", cameraId.string());
-    }
-
-    if (getCameraState(cameraId) == nullptr) {
-        ALOGE("CameraService::connect X (PID %d) rejected (invalid camera ID %s)", callingPid,
-                cameraId.string());
-        return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
-                "No camera device with ID \"%s\" available", cameraId.string());
-    }
-
     userid_t clientUserId = multiuser_get_user_id(clientUid);
 
     // Only allow clients who are being used by the current foreground device user, unless calling
@@ -993,18 +1023,6 @@
                 clientUserId, cameraId.string());
     }
 
-    status_t err = checkIfDeviceIsUsable(cameraId);
-    if (err != NO_ERROR) {
-        switch(err) {
-            case -ENODEV:
-            case -EBUSY:
-                return STATUS_ERROR_FMT(ERROR_DISCONNECTED,
-                        "No camera device with ID \"%s\" currently available", cameraId.string());
-            default:
-                return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
-                        "Unknown error connecting to ID \"%s\"", cameraId.string());
-        }
-    }
     return Status::ok();
 }
 
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 11b1351..4332ce3 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -95,7 +95,7 @@
 
     /////////////////////////////////////////////////////////////////////
     // HAL Callbacks
-    virtual void        onDeviceStatusChanged(camera_device_status_t cameraId,
+    virtual void        onDeviceStatusChanged(int cameraId,
                                               camera_device_status_t newStatus);
     virtual void        onTorchStatusChanged(const String8& cameraId,
                                              int32_t newStatus);
@@ -495,7 +495,9 @@
     // mediaserver to connect to camera (using MediaRecorder to connect to camera). In that case,
     // clientPid is the PID of mediaserver and originalClientPid is the PID of the application.
     binder::Status validateConnectLocked(const String8& cameraId, const String8& clientName8,
-          /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+            /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
+    binder::Status validateClientPermissionsLocked(const String8& cameraId, const String8& clientName8,
+            /*inout*/int& clientUid, /*inout*/int& clientPid, /*out*/int& originalClientPid) const;
 
     // Handle active client evictions, and update service state.
     // Only call with with mServiceLock held.
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index a7fe5e7..b4f8e21 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -530,7 +530,8 @@
     }
 
     // Round dimensions to the nearest dimensions available for this format
-    if (flexibleConsumer && !CameraDeviceClient::roundBufferDimensionNearest(width, height,
+    if (flexibleConsumer && isPublicFormat(format) &&
+            !CameraDeviceClient::roundBufferDimensionNearest(width, height,
             format, dataSpace, mDevice->info(), /*out*/&width, /*out*/&height)) {
         String8 msg = String8::format("Camera %d: No supported stream configurations with "
                 "format %#x defined, failed to create output stream", mCameraId, format);
@@ -714,6 +715,37 @@
     return res;
 }
 
+bool CameraDeviceClient::isPublicFormat(int32_t format)
+{
+    switch(format) {
+        case HAL_PIXEL_FORMAT_RGBA_8888:
+        case HAL_PIXEL_FORMAT_RGBX_8888:
+        case HAL_PIXEL_FORMAT_RGB_888:
+        case HAL_PIXEL_FORMAT_RGB_565:
+        case HAL_PIXEL_FORMAT_BGRA_8888:
+        case HAL_PIXEL_FORMAT_YV12:
+        case HAL_PIXEL_FORMAT_Y8:
+        case HAL_PIXEL_FORMAT_Y16:
+        case HAL_PIXEL_FORMAT_RAW16:
+        case HAL_PIXEL_FORMAT_RAW10:
+        case HAL_PIXEL_FORMAT_RAW12:
+        case HAL_PIXEL_FORMAT_RAW_OPAQUE:
+        case HAL_PIXEL_FORMAT_BLOB:
+        case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
+        case HAL_PIXEL_FORMAT_YCbCr_420_888:
+        case HAL_PIXEL_FORMAT_YCbCr_422_888:
+        case HAL_PIXEL_FORMAT_YCbCr_444_888:
+        case HAL_PIXEL_FORMAT_FLEX_RGB_888:
+        case HAL_PIXEL_FORMAT_FLEX_RGBA_8888:
+        case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+        case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+        case HAL_PIXEL_FORMAT_YCbCr_422_I:
+            return true;
+        default:
+            return false;
+    }
+}
+
 bool CameraDeviceClient::roundBufferDimensionNearest(int32_t width, int32_t height,
         int32_t format, android_dataspace dataSpace, const CameraMetadata& info,
         /*out*/int32_t* outWidth, /*out*/int32_t* outHeight) {
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index dde23fb..de283ea 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -208,6 +208,9 @@
             android_dataspace dataSpace, const CameraMetadata& info,
             /*out*/int32_t* outWidth, /*out*/int32_t* outHeight);
 
+    //check if format is not custom format
+    static bool isPublicFormat(int32_t format);
+
     // IGraphicsBufferProducer binder -> Stream ID for output streams
     KeyedVector<sp<IBinder>, int> mStreamMap;
 
diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.h b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
index bce0762..0b883ba 100644
--- a/services/camera/libcameraservice/device1/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.h
@@ -606,9 +606,9 @@
                 reinterpret_cast<CameraHardwareInterface *>(user);
         return __this->mPreviewWindow.get();
     }
-#define anw(n) __to_anw(((struct camera_preview_window *)n)->user)
+#define anw(n) __to_anw(((struct camera_preview_window *)(n))->user)
 #define hwi(n) reinterpret_cast<CameraHardwareInterface *>(\
-        ((struct camera_preview_window *)n)->user)
+        ((struct camera_preview_window *)(n))->user)
 
     static int __dequeue_buffer(struct preview_stream_ops* w,
                                 buffer_handle_t** buffer, int *stride)
diff --git a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
index 7414c4c..ea138b7 100644
--- a/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3ZslStream.cpp
@@ -40,7 +40,7 @@
         SELECT_NEITHER = 0,
     };
 
-    TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
+    explicit TimestampFinder(nsecs_t timestamp) : mTimestamp(timestamp) {}
     ~TimestampFinder() {}
 
     template <typename T>
diff --git a/soundtrigger/ISoundTrigger.cpp b/soundtrigger/ISoundTrigger.cpp
index 4df2068..25332a4 100644
--- a/soundtrigger/ISoundTrigger.cpp
+++ b/soundtrigger/ISoundTrigger.cpp
@@ -37,7 +37,7 @@
 class BpSoundTrigger: public BpInterface<ISoundTrigger>
 {
 public:
-    BpSoundTrigger(const sp<IBinder>& impl)
+    explicit BpSoundTrigger(const sp<IBinder>& impl)
         : BpInterface<ISoundTrigger>(impl)
     {
     }
diff --git a/soundtrigger/ISoundTriggerClient.cpp b/soundtrigger/ISoundTriggerClient.cpp
index e0d3add..1385631 100644
--- a/soundtrigger/ISoundTriggerClient.cpp
+++ b/soundtrigger/ISoundTriggerClient.cpp
@@ -35,7 +35,7 @@
 {
 
 public:
-    BpSoundTriggerClient(const sp<IBinder>& impl)
+    explicit BpSoundTriggerClient(const sp<IBinder>& impl)
         : BpInterface<ISoundTriggerClient>(impl)
     {
     }
diff --git a/soundtrigger/ISoundTriggerHwService.cpp b/soundtrigger/ISoundTriggerHwService.cpp
index e37bae3..d44f5cb 100644
--- a/soundtrigger/ISoundTriggerHwService.cpp
+++ b/soundtrigger/ISoundTriggerHwService.cpp
@@ -45,7 +45,7 @@
 class BpSoundTriggerHwService: public BpInterface<ISoundTriggerHwService>
 {
 public:
-    BpSoundTriggerHwService(const sp<IBinder>& impl)
+    explicit BpSoundTriggerHwService(const sp<IBinder>& impl)
         : BpInterface<ISoundTriggerHwService>(impl)
     {
     }