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