Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2007-2008 ARM Limited
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  *
     16  */
     17 /**
     18  *
     19  * File Name:  omxVCCOMM_Copy8x8.c
     20  * OpenMAX DL: v1.0.2
     21  * Revision:   9641
     22  * Date:       Thursday, February 7, 2008
     23  *
     24  *
     25  *
     26  * Description:
     27  * MPEG4 8x8 Copy module
     28  *
     29  */
     30 
     31 #include "omxtypes.h"
     32 #include "armOMX.h"
     33 #include "omxVC.h"
     34 
     35 #include "armCOMM.h"
     36 
     37 /**
     38  * Function:  omxVCCOMM_Copy8x8   (6.1.3.3.1)
     39  *
     40  * Description:
     41  * Copies the reference 8x8 block to the current block.
     42  *
     43  * Input Arguments:
     44  *
     45  *   pSrc - pointer to the reference block in the source frame; must be
     46  *            aligned on an 8-byte boundary.
     47  *   step - distance between the starts of consecutive lines in the reference
     48  *            frame, in bytes; must be a multiple of 8 and must be larger than
     49  *            or equal to 8.
     50  *
     51  * Output Arguments:
     52  *
     53  *   pDst - pointer to the destination block; must be aligned on an 8-byte
     54  *            boundary.
     55  *
     56  * Return Value:
     57  *
     58  *    OMX_Sts_NoErr - no error
     59  *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
     60  *              conditions:
     61  *    -   one or more of the following pointers is NULL: pSrc, pDst
     62  *    -   one or more of the following pointers is not aligned on an 8-byte
     63  *              boundary: pSrc, pDst
     64  *    -    step <8 or step is not a multiple of 8.
     65  *
     66  */
     67 
     68 OMXResult omxVCCOMM_Copy8x8(
     69 		const OMX_U8 *pSrc,
     70 		OMX_U8 *pDst,
     71 		OMX_INT step)
     72  {
     73     /* Definitions and Initializations*/
     74 
     75     OMX_INT count,index, x, y;
     76 
     77     /* Argument error checks */
     78     armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
     79     armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
     80     armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
     81     armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
     82     armRetArgErrIf(((step < 8) || (step % 8)), OMX_Sts_BadArgErr);
     83 
     84 
     85     /* Copying the ref 8x8 blk to the curr blk */
     86     for (y = 0, count = 0, index = 0; y < 8; y++, count = count + step - 8)
     87     {
     88         for (x = 0; x < 8; x++, count++, index++)
     89         {
     90             pDst[index] = pSrc[count];
     91         }
     92     }
     93     return OMX_Sts_NoErr;
     94  }
     95