Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  armVCM4P2_FillVLDBuffer.c
      4  * OpenMAX DL: v1.0.2
      5  * Revision:   9641
      6  * Date:       Thursday, February 7, 2008
      7  *
      8  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
      9  *
     10  *
     11  *
     12  * Description:
     13  * Contains module for VLC get bits from the stream
     14  *
     15  */
     16 
     17 #include "omxtypes.h"
     18 #include "armOMX.h"
     19 
     20 #include "armVCM4P2_ZigZag_Tables.h"
     21 
     22 
     23 /**
     24  * Function: armVCM4P2_FillVLDBuffer
     25  *
     26  * Description:
     27  * Performs filling of the coefficient buffer according to the run, level
     28  * and sign, also updates the index
     29  *
     30  * Parameters:
     31  * [in]  storeRun        Stored Run value (count of zeros)
     32  * [in]  storeLevel      Stored Level value (non-zero value)
     33  * [in]  sign            Flag indicating the sign of level
     34  * [in]  last            status of the last flag
     35  * [in]  pIndex          pointer to coefficient index in 8x8 matrix
     36  * [out] pIndex          pointer to updated coefficient index in 8x8
     37  *                       matrix
     38  * [in]  pZigzagTable    pointer to the zigzag tables
     39  * [out] pDst            pointer to the coefficient buffer of current
     40  *                       block. Should be 32-bit aligned
     41  * Return Value:
     42  * Standard OMXResult result. See enumeration for possible result codes.
     43  *
     44  */
     45 
     46 OMXResult armVCM4P2_FillVLDBuffer(
     47     OMX_U32 storeRun,
     48     OMX_S16 * pDst,
     49     OMX_S16 storeLevel,
     50     OMX_U8  sign,
     51     OMX_U8  last,
     52     OMX_U8  * pIndex,
     53     const OMX_U8 * pZigzagTable
     54 )
     55 {
     56     /* Store the zero's as per the run length count */
     57     for (;storeRun > 0; storeRun--, (*pIndex)++)
     58     {
     59         pDst[pZigzagTable[*pIndex]] = 0;
     60     }
     61     /* Store the level depending on the sign*/
     62     if (sign == 1)
     63     {
     64         pDst[pZigzagTable[*pIndex]] = -storeLevel;
     65     }
     66     else
     67     {
     68         pDst[pZigzagTable[*pIndex]] = storeLevel;
     69     }
     70     (*pIndex)++;
     71 
     72     /* If last is 1, fill the remaining elments of the buffer with zeros */
     73     if (last == 1)
     74     {
     75         while (*pIndex < 64)
     76         {
     77             pDst[pZigzagTable[*pIndex]] = 0;
     78             (*pIndex)++;
     79         }
     80     }
     81 
     82     return OMX_Sts_NoErr;
     83 }
     84 
     85