1/**
2 *
3 * File Name:  omxVCCOMM_Copy8x8.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 8x8 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_Copy8x8   (6.1.3.3.1)
24 *
25 * Description:
26 * Copies the reference 8x8 block to the current block.
27 *
28 * Input Arguments:
29 *
30 *   pSrc - pointer to the reference block in the source frame; must be
31 *            aligned on an 8-byte boundary.
32 *   step - distance between the starts of consecutive lines in the reference
33 *            frame, in bytes; must be a multiple of 8 and must be larger than
34 *            or equal to 8.
35 *
36 * Output Arguments:
37 *
38 *   pDst - pointer to the destination block; must be aligned on an 8-byte
39 *            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 an 8-byte
48 *              boundary: pSrc, pDst
49 *    -    step <8 or step is not a multiple of 8.
50 *
51 */
52
53OMXResult omxVCCOMM_Copy8x8(
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(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr);
66    armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr);
67    armRetArgErrIf(((step < 8) || (step % 8)), OMX_Sts_BadArgErr);
68
69
70    /* Copying the ref 8x8 blk to the curr blk */
71    for (y = 0, count = 0, index = 0; y < 8; y++, count = count + step - 8)
72    {
73        for (x = 0; x < 8; x++, count++, index++)
74        {
75            pDst[index] = pSrc[count];
76        }
77    }
78    return OMX_Sts_NoErr;
79 }
80