shithub: h264bsd

Download patch

ref: fbf22d9c44e81ab5593664bdf77d6f7a0bc63770
parent: adb27023e44aa64b868881e0b9e11bbb6ea4cae9
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Sep 15 13:29:23 EDT 2020

fix lots of warnings

--- a/src/basetype.h
+++ b/src/basetype.h
@@ -26,6 +26,8 @@
 #include <libc.h>
 typedef unsigned long size_t;
 typedef uintptr uintptr_t;
+#define _ASSERT_USED
+#define NULL nil
 #endif
 #else
 #define werrstr(...)
--- a/src/h264bsd_cavlc.c
+++ b/src/h264bsd_cavlc.c
@@ -393,7 +393,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeCoeffToken(u32 bits, u32 nc)
+static u32 DecodeCoeffToken(u32 bits, u32 nc)
 {
 
 /* Variables */
@@ -470,7 +470,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeLevelPrefix(u32 bits)
+static u32 DecodeLevelPrefix(u32 bits)
 {
 
 /* Variables */
@@ -536,12 +536,12 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeTotalZeros(u32 bits, u32 totalCoeff, u32 isChromaDC)
+static u32 DecodeTotalZeros(u32 bits, u32 totalCoeff, u32 isChromaDC)
 {
 
 /* Variables */
 
-    u32 value = 0x0;
+    u32 value;
 
 /* Code */
 
@@ -658,7 +658,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeRunBefore(u32 bits, u32 zerosLeft)
+static u32 DecodeRunBefore(u32 bits, u32 zerosLeft)
 {
 
 /* Variables */
--- a/src/h264bsd_conceal.c
+++ b/src/h264bsd_conceal.c
@@ -263,7 +263,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 ConcealMb(mbStorage_t *pMb, image_t *currImage, u32 row, u32 col,
+static u32 ConcealMb(mbStorage_t *pMb, image_t *currImage, u32 row, u32 col,
     u32 sliceType, u8 *refData)
 {
 
@@ -356,6 +356,7 @@
         a[1] = *pData++; a[1] += *pData++; a[1] += *pData++; a[1] += *pData++;
         a[2] = *pData++; a[2] += *pData++; a[2] += *pData++; a[2] += *pData++;
         a[3] = *pData++; a[3] += *pData++; a[3] += *pData++; a[3] += *pData++;
+        USED(pData);
         j++;
         hor++;
         firstPhase[0] += a[0] + a[1] + a[2] + a[3];
@@ -369,6 +370,7 @@
         b[1] = *pData++; b[1] += *pData++; b[1] += *pData++; b[1] += *pData++;
         b[2] = *pData++; b[2] += *pData++; b[2] += *pData++; b[2] += *pData++;
         b[3] = *pData++; b[3] += *pData++; b[3] += *pData++; b[3] += *pData++;
+        USED(pData);
         j++;
         hor++;
         firstPhase[0] += b[0] + b[1] + b[2] + b[3];
@@ -483,6 +485,7 @@
             a[1] = *pData++; a[1] += *pData++;
             a[2] = *pData++; a[2] += *pData++;
             a[3] = *pData++; a[3] += *pData++;
+            USED(pData);
             j++;
             hor++;
             firstPhase[0] += a[0] + a[1] + a[2] + a[3];
@@ -495,6 +498,7 @@
             b[1] = *pData++; b[1] += *pData++;
             b[2] = *pData++; b[2] += *pData++;
             b[3] = *pData++; b[3] += *pData++;
+            USED(pData);
             j++;
             hor++;
             firstPhase[0] += b[0] + b[1] + b[2] + b[3];
@@ -597,7 +601,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Transform(i32 *data)
+static void Transform(i32 *data)
 {
 
     u32 col;
--- a/src/h264bsd_deblocking.c
+++ b/src/h264bsd_deblocking.c
@@ -234,7 +234,7 @@
             of a macroblock.
 
 ------------------------------------------------------------------------------*/
-u32 IsSliceBoundaryOnLeft(mbStorage_t *mb)
+static u32 IsSliceBoundaryOnLeft(mbStorage_t *mb)
 {
 
 /* Variables */
@@ -259,7 +259,7 @@
             current macroblock.
 
 ------------------------------------------------------------------------------*/
-u32 IsSliceBoundaryOnTop(mbStorage_t *mb)
+static u32 IsSliceBoundaryOnTop(mbStorage_t *mb)
 {
 
 /* Variables */
@@ -286,7 +286,7 @@
           shall be filtered.
 
 ------------------------------------------------------------------------------*/
-u32 GetMbFilteringFlags(mbStorage_t *mb)
+static u32 GetMbFilteringFlags(mbStorage_t *mb)
 {
 
 /* Variables */
@@ -329,7 +329,7 @@
             called -> no intra mb condition here.
 
 ------------------------------------------------------------------------------*/
-u32 InnerBoundaryStrength(mbStorage_t *mb1, u32 ind1, u32 ind2)
+static u32 InnerBoundaryStrength(mbStorage_t *mb1, u32 ind1, u32 ind2)
 {
     i32 tmp1, tmp2;
     i32 mv1, mv2, mv3, mv4;
@@ -392,7 +392,7 @@
             before this is called -> no intra mb conditions here.
 
 ------------------------------------------------------------------------------*/
-u32 EdgeBoundaryStrength(mbStorage_t *mb1, mbStorage_t *mb2,
+static u32 EdgeBoundaryStrength(mbStorage_t *mb1, mbStorage_t *mb2,
     u32 ind1, u32 ind2)
 {
 
@@ -596,7 +596,6 @@
     ASSERT(image->height);
 
     picWidthInMbs = image->width;
-    data = image->data;
     picSizeInMbs = picWidthInMbs * image->height;
 
     pMb = mb;
@@ -653,7 +652,7 @@
             Filter one vertical 4-pixel luma edge.
 
 ------------------------------------------------------------------------------*/
-void FilterVerLumaEdge(
+static void FilterVerLumaEdge(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -768,7 +767,7 @@
             Filter one horizontal 4-pixel luma edge
 
 ------------------------------------------------------------------------------*/
-void FilterHorLumaEdge(
+static void FilterHorLumaEdge(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -844,7 +843,7 @@
             be done when bS is equal to all four edges.
 
 ------------------------------------------------------------------------------*/
-void FilterHorLuma(
+static void FilterHorLuma(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -964,7 +963,7 @@
             Filter one vertical 2-pixel chroma edge
 
 ------------------------------------------------------------------------------*/
-void FilterVerChromaEdge(
+static void FilterVerChromaEdge(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -1039,7 +1038,7 @@
             Filter one horizontal 2-pixel chroma edge
 
 ------------------------------------------------------------------------------*/
-void FilterHorChromaEdge(
+static void FilterHorChromaEdge(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -1087,7 +1086,7 @@
             can be done if bS is equal for all four edges.
 
 ------------------------------------------------------------------------------*/
-void FilterHorChroma(
+static void FilterHorChroma(
   u8 *data,
   u32 bS,
   edgeThreshold_t *thresholds,
@@ -1184,7 +1183,7 @@
             the macroblock had non-zero value, HANTRO_FALSE otherwise.
 
 ------------------------------------------------------------------------------*/
-u32 GetBoundaryStrengths(mbStorage_t *mb, bS_t *bS, u32 flags)
+static u32 GetBoundaryStrengths(mbStorage_t *mb, bS_t *bS, u32 flags)
 {
 
 /* Variables */
@@ -1387,7 +1386,7 @@
             luma edges of a macroblock.
 
 ------------------------------------------------------------------------------*/
-void GetLumaEdgeThresholds(
+static void GetLumaEdgeThresholds(
   edgeThreshold_t *thresholds,
   mbStorage_t *mb,
   u32 filteringFlags)
@@ -1466,7 +1465,7 @@
             chroma edges of a macroblock.
 
 ------------------------------------------------------------------------------*/
-void GetChromaEdgeThresholds(
+static void GetChromaEdgeThresholds(
   edgeThreshold_t *thresholds,
   mbStorage_t *mb,
   u32 filteringFlags,
@@ -1548,7 +1547,7 @@
             Function to filter all luma edges of a macroblock
 
 ------------------------------------------------------------------------------*/
-void FilterLuma(
+static void FilterLuma(
   u8 *data,
   bS_t *bS,
   edgeThreshold_t *thresholds,
@@ -1630,7 +1629,7 @@
             Function to filter all chroma edges of a macroblock
 
 ------------------------------------------------------------------------------*/
-void FilterChroma(
+static void FilterChroma(
   u8 *dataCb,
   u8 *dataCr,
   bS_t *bS,
--- a/src/h264bsd_decoder.c
+++ b/src/h264bsd_decoder.c
@@ -244,10 +244,10 @@
                 pStorage->currImage->data =
                     h264bsdAllocateDpbImage(pStorage->dpb);
                 h264bsdInitRefPicList(pStorage->dpb);
-                tmp = h264bsdConceal(pStorage, pStorage->currImage, P_SLICE);
+                h264bsdConceal(pStorage, pStorage->currImage, P_SLICE);
             }
             else
-                tmp = h264bsdConceal(pStorage, pStorage->currImage,
+                h264bsdConceal(pStorage, pStorage->currImage,
                     pStorage->sliceHeader->sliceType);
 
             picReady = HANTRO_TRUE;
@@ -279,7 +279,7 @@
                     FREE(seqParamSet.vuiParameters);
                     return(H264BSD_ERROR);
                 }
-                tmp = h264bsdStoreSeqParamSet(pStorage, &seqParamSet);
+                h264bsdStoreSeqParamSet(pStorage, &seqParamSet);
                 break;
 
             case NAL_PIC_PARAM_SET:
@@ -294,7 +294,7 @@
                     FREE(picParamSet.sliceGroupId);
                     return(H264BSD_ERROR);
                 }
-                tmp = h264bsdStorePicParamSet(pStorage, &picParamSet);
+                h264bsdStorePicParamSet(pStorage, &picParamSet);
                 break;
 
             case NAL_CODED_SLICE_IDR:
@@ -483,7 +483,7 @@
         {
             if (pStorage->prevNalUnit->nalRefIdc)
             {
-                tmp = h264bsdMarkDecRefPic(pStorage->dpb,
+                h264bsdMarkDecRefPic(pStorage->dpb,
                     &pStorage->sliceHeader->decRefPicMarking,
                     pStorage->currImage, pStorage->sliceHeader->frameNum,
                     picOrderCnt,
@@ -495,7 +495,7 @@
              * reordering */
             else
             {
-                tmp = h264bsdMarkDecRefPic(pStorage->dpb, NULL,
+                h264bsdMarkDecRefPic(pStorage->dpb, NULL,
                     pStorage->currImage, pStorage->sliceHeader->frameNum,
                     picOrderCnt,
                     IS_IDR_NAL_UNIT(pStorage->prevNalUnit) ?
--- a/src/h264bsd_dpb.c
+++ b/src/h264bsd_dpb.c
@@ -1378,7 +1378,7 @@
 
 ------------------------------------------------------------------------------*/
 
-dpbPicture_t* FindSmallestPicOrderCnt(dpbStorage_t *dpb)
+static dpbPicture_t* FindSmallestPicOrderCnt(dpbStorage_t *dpb)
 {
 
 /* Variables */
@@ -1421,7 +1421,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 OutputPicture(dpbStorage_t *dpb)
+static u32 OutputPicture(dpbStorage_t *dpb)
 {
 
 /* Variables */
--- a/src/h264bsd_image.c
+++ b/src/h264bsd_image.c
@@ -93,7 +93,7 @@
 
     ASSERT(image);
     ASSERT(data);
-    ASSERT(!((u32)data&0x3));
+    ASSERT(!((uintptr_t)data&0x3));
 
     width = image->width;
 
@@ -102,9 +102,9 @@
     lum = (u32*)image->luma;
     cb = (u32*)image->cb;
     cr = (u32*)image->cr;
-    ASSERT(!((u32)lum&0x3));
-    ASSERT(!((u32)cb&0x3));
-    ASSERT(!((u32)cr&0x3));
+    ASSERT(!((uintptr_t)lum&0x3));
+    ASSERT(!((uintptr_t)cb&0x3));
+    ASSERT(!((uintptr_t)cr&0x3));
 
     ptr = (u32*)data;
 
@@ -192,7 +192,7 @@
     ASSERT(image);
     ASSERT(data);
     ASSERT(mbNum < image->width * image->height);
-    ASSERT(!((u32)data&0x3));
+    ASSERT(!((uintptr_t)data&0x3));
 
     /* Image size in macroblocks */
     picWidth = image->width;
@@ -219,8 +219,8 @@
         tmp = data + y*16 + x;
         imageBlock = lum + y*picWidth + x;
 
-        ASSERT(!((u32)tmp&0x3));
-        ASSERT(!((u32)imageBlock&0x3));
+        ASSERT(!((uintptr_t)tmp&0x3));
+        ASSERT(!((uintptr_t)imageBlock&0x3));
 
         if (IS_RESIDUAL_EMPTY(pRes))
         {
@@ -293,8 +293,8 @@
         tmp += y*8 + x;
         imageBlock += y*picWidth + x;
 
-        ASSERT(!((u32)tmp&0x3));
-        ASSERT(!((u32)imageBlock&0x3));
+        ASSERT(!((uintptr_t)tmp&0x3));
+        ASSERT(!((uintptr_t)imageBlock&0x3));
 
         if (IS_RESIDUAL_EMPTY(pRes))
         {
--- a/src/h264bsd_inter_prediction.c
+++ b/src/h264bsd_inter_prediction.c
@@ -491,7 +491,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 MvPrediction16x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
+static u32 MvPrediction16x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
 {
 
 /* Variables */
@@ -548,10 +548,22 @@
     if (tmp == NULL)
         return(HANTRO_NOK);
 
-    pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
-    pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] =
-    pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] =
-    pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
+    pMb->mv[0] = mv;
+    pMb->mv[1] = mv;
+    pMb->mv[2] = mv;
+    pMb->mv[3] = mv;
+    pMb->mv[4] = mv;
+    pMb->mv[5] = mv;
+    pMb->mv[6] = mv;
+    pMb->mv[7] = mv;
+    pMb->mv[8] = mv;
+    pMb->mv[9] = mv;
+    pMb->mv[10] = mv;
+    pMb->mv[11] = mv;
+    pMb->mv[12] = mv;
+    pMb->mv[13] = mv;
+    pMb->mv[14] = mv;
+    pMb->mv[15] = mv;
 
     pMb->refPic[0] = refIndex;
     pMb->refPic[1] = refIndex;
@@ -575,7 +587,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 MvPrediction16x8(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
+static u32 MvPrediction16x8(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
 {
 
 /* Variables */
@@ -622,8 +634,14 @@
     if (tmp == NULL)
         return(HANTRO_NOK);
 
-    pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
-    pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] = mv;
+    pMb->mv[0] = mv;
+    pMb->mv[1] = mv;
+    pMb->mv[2] = mv;
+    pMb->mv[3] = mv;
+    pMb->mv[4] = mv;
+    pMb->mv[5] = mv;
+    pMb->mv[6] = mv;
+    pMb->mv[7] = mv;
     pMb->refPic[0] = refIndex;
     pMb->refPic[1] = refIndex;
     pMb->refAddr[0] = tmp;
@@ -662,8 +680,14 @@
     if (tmp == NULL)
         return(HANTRO_NOK);
 
-    pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] =
-    pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
+    pMb->mv[8] = mv;
+    pMb->mv[9] = mv;
+    pMb->mv[10] = mv;
+    pMb->mv[11] = mv;
+    pMb->mv[12] = mv;
+    pMb->mv[13] = mv;
+    pMb->mv[14] = mv;
+    pMb->mv[15] = mv;
     pMb->refPic[2] = refIndex;
     pMb->refPic[3] = refIndex;
     pMb->refAddr[2] = tmp;
@@ -682,7 +706,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 MvPrediction8x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
+static u32 MvPrediction8x16(mbStorage_t *pMb, mbPred_t *mbPred, dpbStorage_t *dpb)
 {
 
 /* Variables */
@@ -729,8 +753,14 @@
     if (tmp == NULL)
         return(HANTRO_NOK);
 
-    pMb->mv[0] = pMb->mv[1] = pMb->mv[2] = pMb->mv[3] =
-    pMb->mv[8] = pMb->mv[9] = pMb->mv[10] = pMb->mv[11] = mv;
+    pMb->mv[0] = mv;
+    pMb->mv[1] = mv;
+    pMb->mv[2] = mv;
+    pMb->mv[3] = mv;
+    pMb->mv[8] = mv;
+    pMb->mv[9] = mv;
+    pMb->mv[10] = mv;
+    pMb->mv[11] = mv;
     pMb->refPic[0] = refIndex;
     pMb->refPic[2] = refIndex;
     pMb->refAddr[0] = tmp;
@@ -772,8 +802,14 @@
     if (tmp == NULL)
         return(HANTRO_NOK);
 
-    pMb->mv[4] = pMb->mv[5] = pMb->mv[6] = pMb->mv[7] =
-    pMb->mv[12] = pMb->mv[13] = pMb->mv[14] = pMb->mv[15] = mv;
+    pMb->mv[4] = mv;
+    pMb->mv[5] = mv;
+    pMb->mv[6] = mv;
+    pMb->mv[7] = mv;
+    pMb->mv[12] = mv;
+    pMb->mv[13] = mv;
+    pMb->mv[14] = mv;
+    pMb->mv[15] = mv;
     pMb->refPic[1] = refIndex;
     pMb->refPic[3] = refIndex;
     pMb->refAddr[1] = tmp;
@@ -792,7 +828,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 MvPrediction8x8(mbStorage_t *pMb, subMbPred_t *subMbPred, dpbStorage_t *dpb)
+static u32 MvPrediction8x8(mbStorage_t *pMb, subMbPred_t *subMbPred, dpbStorage_t *dpb)
 {
 
 /* Variables */
@@ -829,7 +865,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 MvPrediction(mbStorage_t *pMb, subMbPred_t *subMbPred, u32 mbPartIdx,
+static u32 MvPrediction(mbStorage_t *pMb, subMbPred_t *subMbPred, u32 mbPartIdx,
     u32 subMbPartIdx)
 {
 
@@ -917,7 +953,7 @@
 
 ------------------------------------------------------------------------------*/
 
-i32 MedianFilter(i32 a, i32 b, i32 c)
+static i32 MedianFilter(i32 a, i32 b, i32 c)
 {
 
 /* Variables */
@@ -926,7 +962,7 @@
 
 /* Code */
 
-    max = min = med = a;
+    max = min = a;
     if (b > max)
     {
         max = b;
@@ -960,7 +996,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void GetInterNeighbour(u32 sliceId, mbStorage_t *nMb,
+static void GetInterNeighbour(u32 sliceId, mbStorage_t *nMb,
     interNeighbour_t *n, u32 index)
 {
 
@@ -996,7 +1032,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void GetPredictionMv(mv_t *mv, interNeighbour_t *a, u32 refIndex)
+static void GetPredictionMv(mv_t *mv, interNeighbour_t *a, u32 refIndex)
 {
 
     if ( a[1].available || a[2].available || !a[0].available)
--- a/src/h264bsd_intra_prediction.c
+++ b/src/h264bsd_intra_prediction.c
@@ -997,7 +997,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra16x16VerticalPrediction(u8 *data, u8 *above)
+static void Intra16x16VerticalPrediction(u8 *data, u8 *above)
 {
 
 /* Variables */
@@ -1028,7 +1028,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra16x16HorizontalPrediction(u8 *data, u8 *left)
+static void Intra16x16HorizontalPrediction(u8 *data, u8 *left)
 {
 
 /* Variables */
@@ -1059,7 +1059,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra16x16DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
+static void Intra16x16DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
     u32 availableB)
 {
 
@@ -1110,7 +1110,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left)
+static void Intra16x16PlanePrediction(u8 *data, u8 *above, u8 *left)
 {
 
 /* Variables */
@@ -1157,7 +1157,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void IntraChromaDcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
+static void IntraChromaDcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
     u32 availableB)
 {
 
@@ -1255,7 +1255,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void IntraChromaHorizontalPrediction(u8 *data, u8 *left)
+static void IntraChromaHorizontalPrediction(u8 *data, u8 *left)
 {
 
 /* Variables */
@@ -1290,7 +1290,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void IntraChromaVerticalPrediction(u8 *data, u8 *above)
+static void IntraChromaVerticalPrediction(u8 *data, u8 *above)
 {
 
 /* Variables */
@@ -1325,7 +1325,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void IntraChromaPlanePrediction(u8 *data, u8 *above, u8 *left)
+static void IntraChromaPlanePrediction(u8 *data, u8 *above, u8 *left)
 {
 
 /* Variables */
@@ -1385,7 +1385,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Get4x4NeighbourPels(u8 *a, u8 *l, u8 *data, u8 *above, u8 *left,
+static void Get4x4NeighbourPels(u8 *a, u8 *l, u8 *data, u8 *above, u8 *left,
     u32 blockNum)
 {
 
@@ -1490,7 +1490,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4VerticalPrediction(u8 *data, u8 *above)
+static void Intra4x4VerticalPrediction(u8 *data, u8 *above)
 {
 
 /* Variables */
@@ -1522,7 +1522,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4HorizontalPrediction(u8 *data, u8 *left)
+static void Intra4x4HorizontalPrediction(u8 *data, u8 *left)
 {
 
 /* Variables */
@@ -1554,7 +1554,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
+static void Intra4x4DcPrediction(u8 *data, u8 *above, u8 *left, u32 availableA,
     u32 availableB)
 {
 
@@ -1609,7 +1609,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4DiagonalDownLeftPrediction(u8 *data, u8 *above)
+static void Intra4x4DiagonalDownLeftPrediction(u8 *data, u8 *above)
 {
 
 /* Variables */
@@ -1647,7 +1647,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4DiagonalDownRightPrediction(u8 *data, u8 *above, u8 *left)
+static void Intra4x4DiagonalDownRightPrediction(u8 *data, u8 *above, u8 *left)
 {
 
 /* Variables */
@@ -1685,7 +1685,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4VerticalRightPrediction(u8 *data, u8 *above, u8 *left)
+static void Intra4x4VerticalRightPrediction(u8 *data, u8 *above, u8 *left)
 {
 
 /* Variables */
@@ -1724,7 +1724,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4HorizontalDownPrediction(u8 *data, u8 *above, u8 *left)
+static void Intra4x4HorizontalDownPrediction(u8 *data, u8 *above, u8 *left)
 {
 
 /* Variables */
@@ -1762,7 +1762,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4VerticalLeftPrediction(u8 *data, u8 *above)
+static void Intra4x4VerticalLeftPrediction(u8 *data, u8 *above)
 {
 
 /* Variables */
@@ -1800,7 +1800,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Intra4x4HorizontalUpPrediction(u8 *data, u8 *left)
+static void Intra4x4HorizontalUpPrediction(u8 *data, u8 *left)
 {
 
 /* Variables */
@@ -1841,7 +1841,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void Write4x4To16x16(u8 *data, u8 *data4x4, u32 blockNum)
+static void Write4x4To16x16(u8 *data, u8 *data4x4, u32 blockNum)
 {
 
 /* Variables */
@@ -1860,7 +1860,7 @@
 
     data += y*16+x;
 
-    ASSERT(((u32)data&0x3) == 0);
+    ASSERT(((uintptr_t)data&0x3) == 0);
 
     /*lint --e(826) */
     out32 = (u32 *)data;
@@ -1870,7 +1870,7 @@
     out32[0] = *in32++;
     out32[4] = *in32++;
     out32[8] = *in32++;
-    out32[12] = *in32++;
+    out32[12] = *in32;
 }
 
 /*------------------------------------------------------------------------------
@@ -1883,7 +1883,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DetermineIntra4x4PredMode(macroblockLayer_t *pMbLayer,
+static u32 DetermineIntra4x4PredMode(macroblockLayer_t *pMbLayer,
     u32 available, neighbour_t *nA, neighbour_t *nB, u32 index,
     mbStorage_t *nMbA, mbStorage_t *nMbB)
 {
--- a/src/h264bsd_macroblock_layer.c
+++ b/src/h264bsd_macroblock_layer.c
@@ -351,7 +351,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeMbPred(strmData_t *pStrmData, mbPred_t *pMbPred, mbType_e mbType,
+static u32 DecodeMbPred(strmData_t *pStrmData, mbPred_t *pMbPred, mbType_e mbType,
     u32 numRefIdxActive)
 {
 
@@ -439,7 +439,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeSubMbPred(strmData_t *pStrmData, subMbPred_t *pSubMbPred,
+static u32 DecodeSubMbPred(strmData_t *pStrmData, subMbPred_t *pSubMbPred,
     mbType_e mbType, u32 numRefIdxActive)
 {
 
@@ -697,7 +697,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecodeResidual(strmData_t *pStrmData, residual_t *pResidual,
+static u32 DecodeResidual(strmData_t *pStrmData, residual_t *pResidual,
     mbStorage_t *pMb, mbType_e mbType, u32 codedBlockPattern)
 {
 
@@ -805,9 +805,9 @@
 
 ------------------------------------------------------------------------------*/
 #ifdef H264DEC_OMXDL
-u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, u8 *pTotalCoeff)
+static u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, u8 *pTotalCoeff)
 #else
-u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, i16 *pTotalCoeff)
+static u32 DetermineNc(mbStorage_t *pMb, u32 blockIndex, i16 *pTotalCoeff)
 #endif
 {
 /*lint -e702 */
@@ -878,7 +878,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 CbpIntra16x16(mbType_e mbType)
+static u32 CbpIntra16x16(mbType_e mbType)
 {
 
 /* Variables */
@@ -1337,7 +1337,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 ProcessResidual(mbStorage_t *pMb, i32 residualLevel[][16], u32 *coeffMap)
+static u32 ProcessResidual(mbStorage_t *pMb, i32 residualLevel[][16], u32 *coeffMap)
 {
 
 /* Variables */
--- a/src/h264bsd_pic_order_cnt.c
+++ b/src/h264bsd_pic_order_cnt.c
@@ -245,6 +245,8 @@
                 absFrameNum -= 1;
 
             /* step 3 */
+            picOrderCntCycleCnt = 0;
+            frameNumInPicOrderCntCycle = 0;
             if (absFrameNum > 0)
             {
                 picOrderCntCycleCnt =
--- a/src/h264bsd_pic_param_set.c
+++ b/src/h264bsd_pic_param_set.c
@@ -327,7 +327,7 @@
     pPicParamSet->redundantPicCntPresentFlag = (tmp == 1) ?
                                     HANTRO_TRUE : HANTRO_FALSE;
 
-    tmp = h264bsdRbspTrailingBits(pStrmData);
+    h264bsdRbspTrailingBits(pStrmData);
 
     /* ignore possible errors in trailing bits of parameters sets */
     return(HANTRO_OK);
--- a/src/h264bsd_reconstruct.c
+++ b/src/h264bsd_reconstruct.c
@@ -2140,6 +2140,8 @@
 #ifndef FLASCC
     ASSERT(ref);
     ASSERT(fill);
+    USED(left);
+    USED(right);
 
     memcpy(fill, ref, center);
 #else
@@ -2257,7 +2259,6 @@
 /* Variables */
 
     i32 xstop, ystop;
-    void (*fp)(u8*, u8*, i32, i32, i32);
     i32 left, x, right;
     i32 top, y, bottom;
 
@@ -2274,13 +2275,6 @@
     xstop = x0 + (i32)blockWidth;
     ystop = y0 + (i32)blockHeight;
 
-    /* Choose correct function whether overfilling on left-edge or right-edge
-     * is needed or not */
-    if (x0 >= 0 && xstop <= (i32)width)
-        fp = FillRow1;
-    else
-        fp = h264bsdFillRow7;
-
     if (ystop < 0)
         y0 = -(i32)blockHeight;
 
@@ -2357,7 +2351,8 @@
     /* Bottom-overfilling */
     for ( ; bottom; bottom-- )
     {
-        //(*fp)(ref, fill, left, x, right);
+        /* Choose correct function whether overfilling on left-edge or right-edge
+         * is needed or not */
         if (x0 >= 0 && xstop <= (i32)width)
             FillRow1(ref, fill, left, x, right);
         else
--- a/src/h264bsd_sei.c
+++ b/src/h264bsd_sei.c
@@ -981,6 +981,7 @@
 
     ASSERT(pStrmData);
     ASSERT(pDecRefPicMarkingRepetition);
+    USED(numRefFrames);
 
 
     tmp = h264bsdGetBits(pStrmData, 1);
@@ -999,7 +1000,7 @@
     //  &pDecRefPicMarkingRepetition->decRefPicMarking, NAL_SEI, numRefFrames);
     return(HANTRO_NOK);
 
-    return(tmp);
+    //return(tmp);
 
 }
 
--- a/src/h264bsd_seq_param_set.c
+++ b/src/h264bsd_seq_param_set.c
@@ -106,9 +106,9 @@
     pSeqParamSet->profileIdc = tmp;
 
     /* constrained_set0_flag */
-    tmp = h264bsdGetBits(pStrmData, 1);
+    h264bsdGetBits(pStrmData, 1);
     /* constrained_set1_flag */
-    tmp = h264bsdGetBits(pStrmData, 1);
+    h264bsdGetBits(pStrmData, 1);
     /* constrained_set2_flag */
     tmp = h264bsdGetBits(pStrmData, 1);
 
@@ -349,7 +349,7 @@
         }
     }
 
-    tmp = h264bsdRbspTrailingBits(pStrmData);
+    h264bsdRbspTrailingBits(pStrmData);
 
     /* ignore possible errors in trailing bits of parameters sets */
     return(HANTRO_OK);
@@ -381,7 +381,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 GetDpbSize(u32 picSizeInMbs, u32 levelIdc)
+static u32 GetDpbSize(u32 picSizeInMbs, u32 levelIdc)
 {
 
 /* Variables */
--- a/src/h264bsd_slice_data.c
+++ b/src/h264bsd_slice_data.c
@@ -251,7 +251,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void SetMbParams(mbStorage_t *pMb, sliceHeader_t *pSlice, u32 sliceId,
+static void SetMbParams(mbStorage_t *pMb, sliceHeader_t *pSlice, u32 sliceId,
     i32 chromaQpIndexOffset)
 {
 
--- a/src/h264bsd_slice_group_map.c
+++ b/src/h264bsd_slice_group_map.c
@@ -118,7 +118,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeInterleavedMap(
+static void DecodeInterleavedMap(
   u32 *map,
   u32 numSliceGroups,
   u32 *runLength,
@@ -172,7 +172,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeDispersedMap(
+static void DecodeDispersedMap(
   u32 *map,
   u32 numSliceGroups,
   u32 picWidth,
@@ -223,7 +223,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeForegroundLeftOverMap(
+static void DecodeForegroundLeftOverMap(
   u32 *map,
   u32 numSliceGroups,
   u32 *topLeft,
@@ -292,7 +292,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeBoxOutMap(
+static void DecodeBoxOutMap(
   u32 *map,
   u32 sliceGroupChangeDirectionFlag,
   u32 unitsInSliceGroup0,
@@ -398,7 +398,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeRasterScanMap(
+static void DecodeRasterScanMap(
   u32 *map,
   u32 sliceGroupChangeDirectionFlag,
   u32 sizeOfUpperLeftGroup,
@@ -446,7 +446,7 @@
 
 ------------------------------------------------------------------------------*/
 
-void DecodeWipeMap(
+static void DecodeWipeMap(
   u32 *map,
   u32 sliceGroupChangeDirectionFlag,
   u32 sizeOfUpperLeftGroup,
--- a/src/h264bsd_slice_header.c
+++ b/src/h264bsd_slice_header.c
@@ -407,7 +407,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 NumSliceGroupChangeCycleBits(u32 picSizeInMbs, u32 sliceGroupChangeRate)
+static u32 NumSliceGroupChangeCycleBits(u32 picSizeInMbs, u32 sliceGroupChangeRate)
 {
 
 /* Variables */
@@ -465,7 +465,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 RefPicListReordering(strmData_t *pStrmData,
+static u32 RefPicListReordering(strmData_t *pStrmData,
     refPicListReordering_t *pRefPicListReordering, u32 numRefIdxActive,
     u32 maxPicNum)
 {
@@ -569,7 +569,7 @@
 
 ------------------------------------------------------------------------------*/
 
-u32 DecRefPicMarking(strmData_t *pStrmData,
+static u32 DecRefPicMarking(strmData_t *pStrmData,
     decRefPicMarking_t *pDecRefPicMarking, nalUnitType_e nalUnitType,
     u32 numRefFrames)
 {
--- a/src/h264bsd_storage.c
+++ b/src/h264bsd_storage.c
@@ -792,7 +792,7 @@
             HANTRO_NOK     invalid data in picture parameter set
 
 ------------------------------------------------------------------------------*/
-u32 CheckPps(picParamSet_t *pps, seqParamSet_t *sps)
+static u32 CheckPps(picParamSet_t *pps, seqParamSet_t *sps)
 {
 
     u32 i;
--- a/src/h264bsd_util.h
+++ b/src/h264bsd_util.h
@@ -41,10 +41,6 @@
 #include "h264bsd_stream.h"
 #include "h264bsd_image.h"
 
-#ifdef _ASSERT_USED
-#include <assert.h>
-#endif
-
 #if defined(_RANGE_CHECK) || defined(_DEBUG_PRINT) || defined(_ERROR_PRINT)
 #include <stdio.h>
 #endif
@@ -78,6 +74,9 @@
 
 /* macro for assertion, used only if compiler flag _ASSERT_USED is defined */
 #ifdef _ASSERT_USED
+#ifndef __plan9__
+#include <assert.h>
+#endif
 #define ASSERT(expr) assert(expr)
 #else
 #define ASSERT(expr)