1 /** 2 * 3 * File Name: omxVCCOMM_ComputeTextureErrorBlock.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 computing the error for a MB of size 8x8 14 * 15 */ 16 17 #include "omxtypes.h" 18 #include "armOMX.h" 19 #include "omxVC.h" 20 #include "armCOMM.h" 21 22 /** 23 * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2) 24 * 25 * Description: 26 * Computes the texture error of the block. 27 * 28 * Input Arguments: 29 * 30 * pSrc - pointer to the source plane. This should be aligned on an 8-byte 31 * boundary. 32 * srcStep - step of the source plane 33 * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be 34 * aligned on an 8-byte boundary. 35 * 36 * Output Arguments: 37 * 38 * pDst - pointer to the destination buffer, an 8x8 block. This should be 39 * aligned on an 8-byte boundary. 40 * 41 * Return Value: 42 * 43 * OMX_Sts_NoErr - no error 44 * OMX_Sts_BadArgErr - bad arguments: 45 * - At least one of the following pointers is NULL: 46 * pSrc, pSrcRef, pDst. 47 * - pSrc is not 8-byte aligned. 48 * - SrcStep <= 0 or srcStep is not a multiple of 8. 49 * - pSrcRef is not 8-byte aligned. 50 * - pDst is not 8-byte aligned 51 * 52 */ 53 54 OMXResult omxVCCOMM_ComputeTextureErrorBlock( 55 const OMX_U8 *pSrc, 56 OMX_INT srcStep, 57 const OMX_U8 *pSrcRef, 58 OMX_S16 * pDst 59 ) 60 { 61 62 OMX_INT x, y, count; 63 64 /* Argument error checks */ 65 armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr); 66 armRetArgErrIf(pSrcRef == NULL, OMX_Sts_BadArgErr); 67 armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr); 68 armRetArgErrIf(!armIs8ByteAligned(pSrc), OMX_Sts_BadArgErr); 69 armRetArgErrIf(!armIs8ByteAligned(pSrcRef), OMX_Sts_BadArgErr); 70 armRetArgErrIf(!armIs8ByteAligned(pDst), OMX_Sts_BadArgErr); 71 armRetArgErrIf((srcStep <= 0) || (srcStep & 7), OMX_Sts_BadArgErr); 72 73 /* Calculate the error block */ 74 for (y = 0, count = 0; 75 y < 8; 76 y++, pSrc += srcStep) 77 { 78 for (x = 0; x < 8; x++, count++) 79 { 80 pDst[count] = pSrc[x] - pSrcRef[count]; 81 } 82 } 83 84 return OMX_Sts_NoErr; 85 86 } 87 88 /* End of file */ 89