diff --git a/system/embdrv/encoder_for_aptx/Android.bp b/system/embdrv/encoder_for_aptx/Android.bp
index 502759e92500dbb40dac968696d9f0957e26a796..e619c0960c75a2f1b61bdd98927f2b024ad5a0ab 100644
--- a/system/embdrv/encoder_for_aptx/Android.bp
+++ b/system/embdrv/encoder_for_aptx/Android.bp
@@ -7,6 +7,8 @@ tidy_errors = [
     "-cppcoreguidelines-init-variables",
     "-cppcoreguidelines-narrowing-conversions",
     "-hicpp-signed-bitwise",
+    "-llvm-header-guard",
+    "-readability-avoid-const-params-in-decls",
     "-readability-identifier-length",
     "-readability-magic-numbers",
 ]
diff --git a/system/embdrv/encoder_for_aptx/src/AptxEncoder.h b/system/embdrv/encoder_for_aptx/src/AptxEncoder.h
index 5f7ceecf12fc75c4afe3f0af048867f03627f927..229029b4a0373b133b6b6a433615fdd05ec628f7 100644
--- a/system/embdrv/encoder_for_aptx/src/AptxEncoder.h
+++ b/system/embdrv/encoder_for_aptx/src/AptxEncoder.h
@@ -35,7 +35,7 @@
 #include "SubbandFunctionsCommon.h"
 
 /* Function to carry out a single-channel aptX encode on 4 new PCM samples */
-XBT_INLINE_ void aptxEncode(int32_t pcm[4], Qmf_storage* Qmf_St,
+XBT_INLINE_ void aptxEncode(const int32_t pcm[4], Qmf_storage* Qmf_St,
                             Encoder_data* EncoderDataPt) {
   int32_t predVals[4];
   int32_t qCodes[4];
diff --git a/system/embdrv/encoder_for_aptx/src/AptxParameters.h b/system/embdrv/encoder_for_aptx/src/AptxParameters.h
index 4735fd82e65b2853ac085f805b96937f756ab6e8..b4f909364cad0cae4dfda5d0fbada3e151ef2854 100644
--- a/system/embdrv/encoder_for_aptx/src/AptxParameters.h
+++ b/system/embdrv/encoder_for_aptx/src/AptxParameters.h
@@ -45,8 +45,12 @@
 
 /* Signed saturate to a 24bit value */
 XBT_INLINE_ int32_t ssat24(int32_t val) {
-  if (val > 8388607) val = 8388607;
-  if (val < -8388608) val = -8388608;
+  if (val > 8388607) {
+    val = 8388607;
+  }
+  if (val < -8388608) {
+    val = -8388608;
+  }
   return val;
 }
 
diff --git a/system/embdrv/encoder_for_aptx/src/DitherGenerator.h b/system/embdrv/encoder_for_aptx/src/DitherGenerator.h
index 3c4f24ccf55c1699641f38aa671d568e62d15e4f..baa5605491f8c88c8c4385df92a59521830d6152 100644
--- a/system/embdrv/encoder_for_aptx/src/DitherGenerator.h
+++ b/system/embdrv/encoder_for_aptx/src/DitherGenerator.h
@@ -29,7 +29,7 @@
 /* This function updates an internal bit-pool (private
  * variable in DitherGenerator) based on bits obtained from
  * previously encoded or received aptX codewords. */
-XBT_INLINE_ int32_t xbtEncupdateCodewordHistory(int32_t quantisedCodes[4],
+XBT_INLINE_ int32_t xbtEncupdateCodewordHistory(const int32_t quantisedCodes[4],
                                                 int32_t m_codewordHistory) {
   int32_t newBits;
   int32_t updatedCodewordHistory;
@@ -62,7 +62,8 @@ XBT_INLINE_ int32_t xbtEncupdateCodewordHistory(int32_t quantisedCodes[4],
 XBT_INLINE_ int32_t xbtEncgenerateDither(int32_t m_codewordHistory,
                                          int32_t* m_ditherOutputs) {
   int32_t history24b;
-  int32_t upperAcc, lowerAcc;
+  int32_t upperAcc;
+  int32_t lowerAcc;
   int32_t accSum;
   int64_t tmp_acc;
   int32_t ditherSample;
diff --git a/system/embdrv/encoder_for_aptx/src/Qmf.h b/system/embdrv/encoder_for_aptx/src/Qmf.h
index 2e56ee9081fa3c5ca503b9dfff625b2921e6c011..0d7fa7f8d06542f21fc3bd8ea5e70de8c0eb9600 100644
--- a/system/embdrv/encoder_for_aptx/src/Qmf.h
+++ b/system/embdrv/encoder_for_aptx/src/Qmf.h
@@ -77,8 +77,9 @@ void AsmQmfConvI(const int32_t* p1dl_buffPtr, const int32_t* p2dl_buffPtr,
 void AsmQmfConvO(const int16_t* p1dl_buffPtr, const int16_t* p2dl_buffPtr,
                  const int32_t* coeffPtr, int32_t* convSumDiff);
 
-XBT_INLINE_ void QmfAnalysisFilter(int32_t pcm[4], Qmf_storage* Qmf_St,
-                                   int32_t* predVals, int32_t* aqmfOutputs) {
+XBT_INLINE_ void QmfAnalysisFilter(const int32_t pcm[4], Qmf_storage* Qmf_St,
+                                   const int32_t predVals[4],
+                                   int32_t* aqmfOutputs) {
   int32_t convSumDiff[4];
   int32_t filterOutputs[4];
 
diff --git a/system/embdrv/encoder_for_aptx/src/SubbandFunctions.h b/system/embdrv/encoder_for_aptx/src/SubbandFunctions.h
index 16c1b9fb2d2471020b654d19faf000c0f2454452..ef5bee8d6a08dfe24a48ded9f1b59883121e4230 100644
--- a/system/embdrv/encoder_for_aptx/src/SubbandFunctions.h
+++ b/system/embdrv/encoder_for_aptx/src/SubbandFunctions.h
@@ -167,7 +167,7 @@ XBT_INLINE_ void updatePredictorPoleCoefficients(
     acc--;
   }
 
-  newCoeffs[a1] = (int32_t)acc;
+  newCoeffs[a1] = acc;
 
   /* Clip the new value of a1(k) to +/- (1 - 2^4 - a2(k)). The constant 1 -
    * 2^4 is expressed in Q22 format (as is a1 and a2) */
diff --git a/system/embdrv/encoder_for_aptx/src/SubbandFunctionsCommon.h b/system/embdrv/encoder_for_aptx/src/SubbandFunctionsCommon.h
index 61fbc16712d4e76613b4e3ec4ff3cadc8ca9df45..cfd16e2447eed32e74331074acf0641a8083da3e 100644
--- a/system/embdrv/encoder_for_aptx/src/SubbandFunctionsCommon.h
+++ b/system/embdrv/encoder_for_aptx/src/SubbandFunctionsCommon.h
@@ -57,10 +57,14 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
    * element at table base). Then set invQ to be +/- the threshold value,
    * depending on the code sign. */
   index = qCode;
-  if (qCode < 0) index = (~index);
+  if (qCode < 0) {
+    index = (~index);
+  }
   index = index + 1;
   invQ = iqdata_pt->thresholdTablePtr_sl1[index];
-  if (qCode < 0) invQ = -invQ;
+  if (qCode < 0) {
+    invQ = -invQ;
+  }
 
   /* Load invQ into the accumulator. Add the product of the dither value times
    * the indexed dither table value. Then get the result back from the
@@ -71,11 +75,15 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
   acc = tmp_r64.s32.h;
 
   tmp_round1 = tmp_r64.s32.h & 0x00000001L;
-  if (tmp_r64.u32.l >= 0x80000000) acc++;
-  if (tmp_round1 == 0 && tmp_r64.s32.l == (int32_t)0x80000000L) acc--;
+  if (tmp_r64.u32.l >= 0x80000000) {
+    acc++;
+  }
+  if (tmp_round1 == 0 && tmp_r64.s32.l == (int32_t)0x80000000L) {
+    acc--;
+  }
   acc = ssat24(acc);
 
-  invQ = (int32_t)acc;
+  invQ = acc;
 
   /* Scale invQ by the current delta value. Left-shift the result (in the
    * accumulator) by 4 positions for the delta scaling. Get the updated invQ
@@ -101,12 +109,20 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
 
   tmp_round0 = tmp_r64.u32.l;
   tmp_round1 = (int32_t)(tmp_r64.u64 >> 1);
-  if (tmp_round0 >= 0x80000000L) acc++;
-  if (tmp_round1 == 0x40000000L) acc--;
+  if (tmp_round0 >= 0x80000000L) {
+    acc++;
+  }
+  if (tmp_round1 == 0x40000000L) {
+    acc--;
+  }
 
   /* Limit the updated logDelta between 0 and its subband-specific maximum. */
-  if (acc < 0) acc = 0;
-  if (acc > iqdata_pt->maxLogDelta) acc = iqdata_pt->maxLogDelta;
+  if (acc < 0) {
+    acc = 0;
+  }
+  if (acc > iqdata_pt->maxLogDelta) {
+    acc = iqdata_pt->maxLogDelta;
+  }
 
   iqdata_pt->logDelta = (uint16_t)acc;
 
@@ -142,10 +158,14 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
    * element at table base). Then set invQ to be +/- the threshold value,
    * depending on the code sign. */
   index = qCode;
-  if (qCode < 0) index = (~index);
+  if (qCode < 0) {
+    index = (~index);
+  }
   index = index + 1;
   invQ = iqdata_pt->thresholdTablePtr_sl1[index];
-  if (qCode < 0) invQ = -invQ;
+  if (qCode < 0) {
+    invQ = -invQ;
+  }
 
   /* Load invQ into the accumulator. Add the product of the dither value times
    * the indexed dither table value. Then get the result back from the
@@ -156,11 +176,15 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
   acc = tmp_r64.s32.h;
 
   tmp_round1 = tmp_r64.s32.h & 0x00000001L;
-  if (tmp_r64.u32.l >= 0x80000000) acc++;
-  if (tmp_round1 == 0 && tmp_r64.u32.l == 0x80000000L) acc--;
+  if (tmp_r64.u32.l >= 0x80000000) {
+    acc++;
+  }
+  if (tmp_round1 == 0 && tmp_r64.u32.l == 0x80000000L) {
+    acc--;
+  }
   acc = ssat24(acc);
 
-  invQ = (int32_t)acc;
+  invQ = acc;
 
   /* Scale invQ by the current delta value. Left-shift the result (in the
    * accumulator) by 4 positions for the delta scaling. Get the updated invQ
@@ -185,12 +209,20 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
 
   tmp_round0 = tmp_r64.u32.l;
   tmp_round1 = (int32_t)(tmp_r64.u64 >> 1);
-  if (tmp_round0 >= 0x80000000L) acc++;
-  if (tmp_round1 == 0x40000000L) acc--;
+  if (tmp_round0 >= 0x80000000L) {
+    acc++;
+  }
+  if (tmp_round1 == 0x40000000L) {
+    acc--;
+  }
 
   /* Limit the updated logDelta between 0 and its subband-specific maximum. */
-  if (acc < 0) acc = 0;
-  if (acc > iqdata_pt->maxLogDelta) acc = iqdata_pt->maxLogDelta;
+  if (acc < 0) {
+    acc = 0;
+  }
+  if (acc > iqdata_pt->maxLogDelta) {
+    acc = iqdata_pt->maxLogDelta;
+  }
 
   iqdata_pt->logDelta = (uint16_t)acc;
 
@@ -259,8 +291,9 @@ XBT_INLINE_ void performPredictionFiltering(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 12;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 12)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 12) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -280,7 +313,9 @@ XBT_INLINE_ void performPredictionFiltering(const int32_t invQ,
     }
     tmp_round0 = acc;
     acc = (acc >> 8) + coeffValue;
-    if (((tmp_round0 << 23) ^ 0x80000000) == 0) acc--;
+    if (((tmp_round0 << 23) ^ 0x80000000) == 0) {
+      acc--;
+    }
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
     *(zeroCoeffPt + k) = acc;
@@ -360,8 +395,9 @@ XBT_INLINE_ void performPredictionFilteringLL(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 24;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 24)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 24) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -380,7 +416,9 @@ XBT_INLINE_ void performPredictionFilteringLL(const int32_t invQ,
     } else {
       acc = invQincr_pos - coeffValue;
     }
-    if (((acc << 23) ^ 0x80000000) == 0) coeffValue--;
+    if (((acc << 23) ^ 0x80000000) == 0) {
+      coeffValue--;
+    }
     acc = (acc >> 8) + coeffValue;
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
@@ -461,8 +499,9 @@ XBT_INLINE_ void performPredictionFilteringHL(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 6;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 6)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 6) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -483,7 +522,9 @@ XBT_INLINE_ void performPredictionFilteringHL(const int32_t invQ,
     }
     tmp_round0 = acc;
     acc = (acc >> 8) + coeffValue;
-    if (((tmp_round0 << 23) ^ roundCte) == 0) acc--;
+    if (((tmp_round0 << 23) ^ roundCte) == 0) {
+      acc--;
+    }
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
     *(zeroCoeffPt + k) = acc;
diff --git a/system/embdrv/encoder_for_aptx/src/SyncInserter.h b/system/embdrv/encoder_for_aptx/src/SyncInserter.h
index f36a5f0c036e643b8d85700195709e77f30a59f7..c55ac537dd3ea03076c150f297eb937ad02a73f9 100644
--- a/system/embdrv/encoder_for_aptx/src/SyncInserter.h
+++ b/system/embdrv/encoder_for_aptx/src/SyncInserter.h
@@ -79,12 +79,15 @@ XBT_INLINE_ void xbtEncinsertSync(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HL];
-  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[LL];
-  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HH];
+  }
 
   /* Traverse across all quantisers from the left channel */
   for (i = LL; i <= HH; i++) {
@@ -95,14 +98,18 @@ XBT_INLINE_ void xbtEncinsertSync(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LH];
-  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HL];
-  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LL];
-  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HH];
+  }
 
   /* If the lsbs of all 8 quantised codes don't happen to equal the desired
    * sync bit to embed, then force them to be by replacing the optimum code
@@ -162,14 +169,18 @@ XBT_INLINE_ void xbtEncinsertSyncDualMono(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LH];
-  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HL];
-  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LL];
-  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HH];
+  }
 
   /* If the lsbs of all 4 quantised codes don't happen to equal the desired
    * sync bit to embed, then force them to be by replacing the optimum code
@@ -193,14 +204,18 @@ XBT_INLINE_ void xbtEncinsertSyncDualMono(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (rightQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (rightQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[LH];
-  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HL];
-  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[LL];
-  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HH];
+  }
 
   /* If the lsbs of all 4 quantised codes don't happen to equal the desired
    * sync bit to embed, then force them to be by replacing the optimum code
diff --git a/system/embdrv/encoder_for_aptx/src/swversion.h b/system/embdrv/encoder_for_aptx/src/swversion.h
index a55b211377d60599f390344f499c8362a80a7a6a..07ad8dce385c45277cde920efa7ba1cdfc0296c2 100644
--- a/system/embdrv/encoder_for_aptx/src/swversion.h
+++ b/system/embdrv/encoder_for_aptx/src/swversion.h
@@ -16,6 +16,6 @@
 #ifndef SWVERSION_H
 #define SWVERSION_H
 
-static const char* swversion = "1.0.0";
+static const char* const swversion = "1.0.0";
 
 #endif  // SWVERSION_H
diff --git a/system/embdrv/encoder_for_aptxhd/Android.bp b/system/embdrv/encoder_for_aptxhd/Android.bp
index 801563e4ef6bbe1f484887f0d2578c7bf7b89b04..7f90809f90bebbb7be20d8810701ca6d2d08e978 100644
--- a/system/embdrv/encoder_for_aptxhd/Android.bp
+++ b/system/embdrv/encoder_for_aptxhd/Android.bp
@@ -7,6 +7,8 @@ tidy_errors = [
     "-cppcoreguidelines-init-variables",
     "-cppcoreguidelines-narrowing-conversions",
     "-hicpp-signed-bitwise",
+    "-llvm-header-guard",
+    "-readability-avoid-const-params-in-decls",
     "-readability-identifier-length",
     "-readability-magic-numbers",
 ]
diff --git a/system/embdrv/encoder_for_aptxhd/src/AptxParameters.h b/system/embdrv/encoder_for_aptxhd/src/AptxParameters.h
index cfa9fcbd45e5e486cf8155a2b689a00b79d44faa..e1092d3e671ac3f2cd36ff9704ba35f252843d93 100644
--- a/system/embdrv/encoder_for_aptxhd/src/AptxParameters.h
+++ b/system/embdrv/encoder_for_aptxhd/src/AptxParameters.h
@@ -45,8 +45,12 @@
 
 /* Signed saturate to a 24bit value */
 XBT_INLINE_ int32_t ssat24(int32_t val) {
-  if (val > 0x7FFFFF) val = 0x7FFFFF;
-  if (val < -0x800000) val = -0x800000;
+  if (val > 0x7FFFFF) {
+    val = 0x7FFFFF;
+  }
+  if (val < -0x800000) {
+    val = -0x800000;
+  }
   return val;
 }
 
diff --git a/system/embdrv/encoder_for_aptxhd/src/DitherGenerator.h b/system/embdrv/encoder_for_aptxhd/src/DitherGenerator.h
index 9202a3e222f08c54a24c6c11d567faf04ca8f2ac..26a6071ab9f0b76f634888da03b61ebbd1ebffac 100644
--- a/system/embdrv/encoder_for_aptxhd/src/DitherGenerator.h
+++ b/system/embdrv/encoder_for_aptxhd/src/DitherGenerator.h
@@ -62,7 +62,8 @@ XBT_INLINE_ int32_t xbtEncupdateCodewordHistory(const int32_t quantisedCodes[4],
 XBT_INLINE_ int32_t xbtEncgenerateDither(int32_t m_codewordHistory,
                                          int32_t* m_ditherOutputs) {
   int32_t history24b;
-  int32_t upperAcc, lowerAcc;
+  int32_t upperAcc;
+  int32_t lowerAcc;
   int32_t accSum;
   int64_t tmp_acc;
   int32_t ditherSample;
diff --git a/system/embdrv/encoder_for_aptxhd/src/Qmf.h b/system/embdrv/encoder_for_aptxhd/src/Qmf.h
index 0efb762e7ddd40052705ba8991df716292ae4dc2..984c93b9ee10db724590605c51993ef72ed371c2 100644
--- a/system/embdrv/encoder_for_aptxhd/src/Qmf.h
+++ b/system/embdrv/encoder_for_aptxhd/src/Qmf.h
@@ -147,20 +147,36 @@ XBT_INLINE_ void QmfAnalysisFilter(const int32_t pcm[4], Qmf_storage* Qmf_St,
    * per-subband basis. Ensure these values are saturated, if necessary.
    * Manual unrolling */
   aqmfOutputs[LL] = filterOutputs[LL] - predVals[LL];
-  if (aqmfOutputs[LL] > 8388607) aqmfOutputs[LL] = 8388607;
-  if (aqmfOutputs[LL] < -8388608) aqmfOutputs[LL] = -8388608;
+  if (aqmfOutputs[LL] > 8388607) {
+    aqmfOutputs[LL] = 8388607;
+  }
+  if (aqmfOutputs[LL] < -8388608) {
+    aqmfOutputs[LL] = -8388608;
+  }
 
   aqmfOutputs[LH] = filterOutputs[LH] - predVals[LH];
-  if (aqmfOutputs[LH] > 8388607) aqmfOutputs[LH] = 8388607;
-  if (aqmfOutputs[LH] < -8388608) aqmfOutputs[LH] = -8388608;
+  if (aqmfOutputs[LH] > 8388607) {
+    aqmfOutputs[LH] = 8388607;
+  }
+  if (aqmfOutputs[LH] < -8388608) {
+    aqmfOutputs[LH] = -8388608;
+  }
 
   aqmfOutputs[HL] = filterOutputs[HL] - predVals[HL];
-  if (aqmfOutputs[HL] > 8388607) aqmfOutputs[HL] = 8388607;
-  if (aqmfOutputs[HL] < -8388608) aqmfOutputs[HL] = -8388608;
+  if (aqmfOutputs[HL] > 8388607) {
+    aqmfOutputs[HL] = 8388607;
+  }
+  if (aqmfOutputs[HL] < -8388608) {
+    aqmfOutputs[HL] = -8388608;
+  }
 
   aqmfOutputs[HH] = filterOutputs[HH] - predVals[HH];
-  if (aqmfOutputs[HH] > 8388607) aqmfOutputs[HH] = 8388607;
-  if (aqmfOutputs[HH] < -8388608) aqmfOutputs[HH] = -8388608;
+  if (aqmfOutputs[HH] > 8388607) {
+    aqmfOutputs[HH] = 8388607;
+  }
+  if (aqmfOutputs[HH] < -8388608) {
+    aqmfOutputs[HH] = -8388608;
+  }
 
   (Qmf_St->QmfO_pt) = lc_QmfO_pt;
   (Qmf_St->QmfI_pt) = lc_QmfI_pt;
diff --git a/system/embdrv/encoder_for_aptxhd/src/SubbandFunctions.h b/system/embdrv/encoder_for_aptxhd/src/SubbandFunctions.h
index ebf8f4853417d88cb8467d3a3e8eb5db1e23dd09..8802af72573b0d1d0e63524a9aa5194f6a6463a7 100644
--- a/system/embdrv/encoder_for_aptxhd/src/SubbandFunctions.h
+++ b/system/embdrv/encoder_for_aptxhd/src/SubbandFunctions.h
@@ -167,7 +167,7 @@ XBT_INLINE_ void updatePredictorPoleCoefficients(
     acc--;
   }
 
-  newCoeffs[a1] = (int32_t)acc;
+  newCoeffs[a1] = acc;
 
   /* Clip the new value of a1(k) to +/- (1 - 2^4 - a2(k)). The constant 1 -
    * 2^4 is expressed in Q22 format (as is a1 and a2) */
diff --git a/system/embdrv/encoder_for_aptxhd/src/SubbandFunctionsCommon.h b/system/embdrv/encoder_for_aptxhd/src/SubbandFunctionsCommon.h
index 6a6d0264d72da5821ba27e8c44c496a3cde9f359..c52b7c66650cf78d3dfadbf93006059f48a61461 100644
--- a/system/embdrv/encoder_for_aptxhd/src/SubbandFunctionsCommon.h
+++ b/system/embdrv/encoder_for_aptxhd/src/SubbandFunctionsCommon.h
@@ -58,10 +58,14 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
    * element at table base). Then set invQ to be +/- the threshold value,
    * depending on the code sign. */
   index = qCode;
-  if (qCode < 0) index = (~index);
+  if (qCode < 0) {
+    index = (~index);
+  }
   index = index + 1;
   invQ = iqdata_pt->thresholdTablePtr_sl1[index];
-  if (qCode < 0) invQ = -invQ;
+  if (qCode < 0) {
+    invQ = -invQ;
+  }
 
   /* Load invQ into the accumulator. Add the product of the dither value times
    * the indexed dither table value. Then get the result back from the
@@ -72,11 +76,15 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
   acc = tmp_r64.s32.h;
 
   tmp_round1 = tmp_r64.s32.h & 0x00000001L;
-  if (tmp_r64.u32.l >= 0x80000000) acc++;
-  if (tmp_round1 == 0 && tmp_r64.s32.l == (int32_t)0x80000000L) acc--;
+  if (tmp_r64.u32.l >= 0x80000000) {
+    acc++;
+  }
+  if (tmp_round1 == 0 && tmp_r64.s32.l == (int32_t)0x80000000L) {
+    acc--;
+  }
   acc = ssat24(acc);
 
-  invQ = (int32_t)acc;
+  invQ = acc;
 
   /* Scale invQ by the current delta value. Left-shift the result (in the
    * accumulator) by 4 positions for the delta scaling. Get the updated invQ
@@ -101,12 +109,20 @@ XBT_INLINE_ void invertQuantisation(const int32_t qCode,
 
   tmp_round0 = tmp_r64.u32.l;
   tmp_round1 = (int32_t)(tmp_r64.u64 >> 1);
-  if (tmp_round0 >= 0x80000000L) acc++;
-  if (tmp_round1 == 0x40000000L) acc--;
+  if (tmp_round0 >= 0x80000000L) {
+    acc++;
+  }
+  if (tmp_round1 == 0x40000000L) {
+    acc--;
+  }
 
   /* Limit the updated logDelta between 0 and its subband-specific maximum. */
-  if (acc < 0) acc = 0;
-  if (acc > iqdata_pt->maxLogDelta) acc = iqdata_pt->maxLogDelta;
+  if (acc < 0) {
+    acc = 0;
+  }
+  if (acc > iqdata_pt->maxLogDelta) {
+    acc = iqdata_pt->maxLogDelta;
+  }
 
   iqdata_pt->logDelta = (uint16_t)acc;
 
@@ -140,10 +156,14 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
    * element at table base). Then set invQ to be +/- the threshold value,
    * depending on the code sign. */
   index = qCode;
-  if (qCode < 0) index = (~index);
+  if (qCode < 0) {
+    index = (~index);
+  }
   index = index + 1;
   invQ = iqdata_pt->thresholdTablePtr_sl1[index];
-  if (qCode < 0) invQ = -invQ;
+  if (qCode < 0) {
+    invQ = -invQ;
+  }
 
   /* Load invQ into the accumulator. Add the product of the dither value times
    * the indexed dither table value. Then get the result back from the
@@ -154,11 +174,15 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
   acc = tmp_r64.s32.h;
 
   tmp_round1 = tmp_r64.s32.h & 0x00000001L;
-  if (tmp_r64.u32.l >= 0x80000000) acc++;
-  if (tmp_round1 == 0 && tmp_r64.u32.l == 0x80000000L) acc--;
+  if (tmp_r64.u32.l >= 0x80000000) {
+    acc++;
+  }
+  if (tmp_round1 == 0 && tmp_r64.u32.l == 0x80000000L) {
+    acc--;
+  }
   acc = ssat24(acc);
 
-  invQ = (int32_t)acc;
+  invQ = acc;
 
   /* Scale invQ by the current delta value. Left-shift the result (in the
    * accumulator) by 4 positions for the delta scaling. Get the updated invQ
@@ -183,12 +207,20 @@ XBT_INLINE_ void invertQuantisationHL(const int32_t qCode,
 
   tmp_round0 = tmp_r64.u32.l;
   tmp_round1 = (int32_t)(tmp_r64.u64 >> 1);
-  if (tmp_round0 >= 0x80000000L) acc++;
-  if (tmp_round1 == 0x40000000L) acc--;
+  if (tmp_round0 >= 0x80000000L) {
+    acc++;
+  }
+  if (tmp_round1 == 0x40000000L) {
+    acc--;
+  }
 
   /* Limit the updated logDelta between 0 and its subband-specific maximum. */
-  if (acc < 0) acc = 0;
-  if (acc > iqdata_pt->maxLogDelta) acc = iqdata_pt->maxLogDelta;
+  if (acc < 0) {
+    acc = 0;
+  }
+  if (acc > iqdata_pt->maxLogDelta) {
+    acc = iqdata_pt->maxLogDelta;
+  }
 
   iqdata_pt->logDelta = (uint16_t)acc;
 
@@ -256,8 +288,9 @@ XBT_INLINE_ void performPredictionFiltering(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 12;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 12)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 12) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -279,7 +312,9 @@ XBT_INLINE_ void performPredictionFiltering(const int32_t invQ,
     }
     tmp_round0 = acc;
     acc = (acc >> 8) + coeffValue;
-    if (((tmp_round0 << 23) ^ 0x80000000) == 0) acc--;
+    if (((tmp_round0 << 23) ^ 0x80000000) == 0) {
+      acc--;
+    }
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
     *(zeroCoeffPt + k) = acc;
@@ -360,8 +395,9 @@ XBT_INLINE_ void performPredictionFilteringLL(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 24;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 24)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 24) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -379,7 +415,9 @@ XBT_INLINE_ void performPredictionFilteringLL(const int32_t invQ,
     } else {
       acc = invQincr_pos - coeffValue;
     }
-    if (((acc << 23) ^ 0x80000000) == 0) coeffValue--;
+    if (((acc << 23) ^ 0x80000000) == 0) {
+      coeffValue--;
+    }
     acc = (acc >> 8) + coeffValue;
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
@@ -460,8 +498,9 @@ XBT_INLINE_ void performPredictionFilteringHL(const int32_t invQ,
   pointer = (SubbandDataPt->m_predData.m_zeroDelayLine.pointer++) + 6;
   cbuf_pt = &SubbandDataPt->m_predData.m_zeroDelayLine.buffer[pointer];
   /* partial manual unrolling to improve performance */
-  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 6)
+  if (SubbandDataPt->m_predData.m_zeroDelayLine.pointer >= 6) {
     SubbandDataPt->m_predData.m_zeroDelayLine.pointer = 0;
+  }
 
   SubbandDataPt->m_predData.m_zeroDelayLine.modulo = invQ;
 
@@ -484,7 +523,9 @@ XBT_INLINE_ void performPredictionFilteringHL(const int32_t invQ,
     }
     tmp_round0 = acc;
     acc = (acc >> 8) + coeffValue;
-    if (((tmp_round0 << 23) ^ roundCte) == 0) acc--;
+    if (((tmp_round0 << 23) ^ roundCte) == 0) {
+      acc--;
+    }
     accL += (int64_t)acc * (int64_t)(oldZData);
     oldZData = zData0;
     *(zeroCoeffPt + k) = acc;
diff --git a/system/embdrv/encoder_for_aptxhd/src/SyncInserter.h b/system/embdrv/encoder_for_aptxhd/src/SyncInserter.h
index 8bad975a24da99236e30aa6ffc8509007cfc2af5..1e21e8b816b8ea604245e107f80542d5ab18c2b8 100644
--- a/system/embdrv/encoder_for_aptxhd/src/SyncInserter.h
+++ b/system/embdrv/encoder_for_aptxhd/src/SyncInserter.h
@@ -79,12 +79,15 @@ XBT_INLINE_ void xbtEncinsertSync(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (rightQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HL];
-  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[LL];
-  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (rightQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = rightQuant[HH];
+  }
 
   /* Traverse across all quantisers from the left channel */
   for (i = LL; i <= HH; i++) {
@@ -95,14 +98,18 @@ XBT_INLINE_ void xbtEncinsertSync(Encoder_data* leftChannelEncoder,
   /* If the distance penalty associated with a quantiser is less than the
    * current minimum, then make that quantiser the minimum penalty
    * quantiser. */
-  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  if (leftQuant[LH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LH];
-  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HL];
-  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[LL]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[LL];
-  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty)
+  }
+  if (leftQuant[HH]->distPenalty < minPenaltyQuantiser->distPenalty) {
     minPenaltyQuantiser = leftQuant[HH];
+  }
 
   /* If the lsbs of all 8 quantised codes don't happen to equal the desired
    * sync bit to embed, then force them to be by replacing the optimum code
diff --git a/system/embdrv/encoder_for_aptxhd/src/swversion.h b/system/embdrv/encoder_for_aptxhd/src/swversion.h
index a55b211377d60599f390344f499c8362a80a7a6a..07ad8dce385c45277cde920efa7ba1cdfc0296c2 100644
--- a/system/embdrv/encoder_for_aptxhd/src/swversion.h
+++ b/system/embdrv/encoder_for_aptxhd/src/swversion.h
@@ -16,6 +16,6 @@
 #ifndef SWVERSION_H
 #define SWVERSION_H
 
-static const char* swversion = "1.0.0";
+static const char* const swversion = "1.0.0";
 
 #endif  // SWVERSION_H