Home | History | Annotate | Download | only in src
      1 /* ----------------------------------------------------------------
      2  *
      3  *
      4  * File Name:  armVCM4P10_UnpackBlock2x2.c
      5  * OpenMAX DL: v1.0.2
      6  * Revision:   9641
      7  * Date:       Thursday, February 7, 2008
      8  *
      9  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
     10  *
     11  *
     12  *
     13  * H.264 inverse quantize and transform helper module
     14  *
     15  */
     16 
     17 #include "omxtypes.h"
     18 #include "armOMX.h"
     19 #include "omxVC.h"
     20 
     21 #include "armVC.h"
     22 
     23 /*
     24  * Description
     25  * Unpack a 2x2 block of coefficient-residual pair values
     26  *
     27  * Parameters:
     28  * [in]	ppSrc	Double pointer to residual coefficient-position pair
     29  *						buffer output by CALVC decoding
     30  * [out]	ppSrc	*ppSrc is updated to the start of next non empty block
     31  * [out]	pDst	Pointer to unpacked 4x4 block
     32  */
     33 
     34 void armVCM4P10_UnpackBlock2x2(
     35      const OMX_U8 **ppSrc,
     36      OMX_S16* pDst
     37 )
     38 {
     39     const OMX_U8 *pSrc = *ppSrc;
     40     int i;
     41     int Flag, Value;
     42 
     43     for (i=0; i<4; i++)
     44     {
     45         pDst[i] = 0;
     46     }
     47 
     48     do
     49     {
     50         Flag  = *pSrc++;
     51         if (Flag & 0x10)
     52         {
     53             /* 16 bit */
     54             Value = *pSrc++;
     55             Value = Value | ((*pSrc++)<<8);
     56             if (Value & 0x8000)
     57             {
     58                 Value -= 0x10000;
     59             }
     60         }
     61         else
     62         {
     63             /* 8 bit */
     64             Value = *pSrc++;
     65             if (Value & 0x80)
     66             {
     67                 Value -= 0x100;
     68             }
     69         }
     70         i = Flag & 15;
     71         pDst[i] = (OMX_S16)Value;
     72     }
     73     while ((Flag & 0x20)==0);
     74 
     75     *ppSrc = pSrc;
     76 }
     77 
     78 /* End of file */
     79