Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  omxVCCOMM_Copy16x16.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  * Description:
     12  * MPEG4 16x16 Copy module
     13  *
     14  */
     15 
     16 #include "omxtypes.h"
     17 #include "armOMX.h"
     18 #include "omxVC.h"
     19 
     20 #include "armCOMM.h"
     21 
     22 /**
     23  * Function:  omxVCCOMM_Copy16x16   (6.1.3.3.2)
     24  *
     25  * Description:
     26  * Copies the reference 16x16 macroblock to the current macroblock.
     27  *
     28  * Input Arguments:
     29  *
     30  *   pSrc - pointer to the reference macroblock in the source frame; must be
     31  *            aligned on a 16-byte boundary.
     32  *   step - distance between the starts of consecutive lines in the reference
     33  *            frame, in bytes; must be a multiple of 16 and must be larger
     34  *            than or equal to 16.
     35  *
     36  * Output Arguments:
     37  *
     38  *   pDst - pointer to the destination macroblock; must be aligned on a
     39  *            16-byte boundary.
     40  *
     41  * Return Value:
     42  *
     43  *    OMX_Sts_NoErr - no error
     44  *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
     45  *              conditions:
     46  *    -   one or more of the following pointers is NULL: pSrc, pDst
     47  *    -   one or more of the following pointers is not aligned on a 16-byte
     48  *              boundary: pSrc, pDst
     49  *    -    step <16 or step is not a multiple of 16.
     50  *
     51  */
     52 
     53 OMXResult omxVCCOMM_Copy16x16(
     54 		const OMX_U8 *pSrc,
     55 		OMX_U8 *pDst,
     56 		OMX_INT step)
     57  {
     58     /* Definitions and Initializations*/
     59 
     60     OMX_INT count,index, x, y;
     61 
     62     /* Argument error checks */
     63     armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
     64     armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
     65     armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
     66     armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
     67     armRetArgErrIf(((step < 16) || (step % 16)), OMX_Sts_BadArgErr);
     68 
     69 
     70     /* Copying the ref 16x16 blk to the curr blk */
     71     for (y = 0, count = 0, index = 0; y < 16; y++, count = count + step - 16)
     72     {
     73         for (x = 0; x < 16; x++, count++, index++)
     74         {
     75             pDst[index] = pSrc[count];
     76         }
     77     }
     78     return OMX_Sts_NoErr;
     79  }
     80