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: omxVCM4P2_TransRecBlockCoef_inter.c 20 * OpenMAX DL: v1.0.2 21 * Revision: 9641 22 * Date: Thursday, February 7, 2008 23 * 24 * 25 * 26 * 27 * Description: 28 * Contains modules DCT->quant and reconstructing the inter texture data 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34#include "omxVC.h" 35 36#include "armCOMM.h" 37 38 39/** 40 * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5) 41 * 42 * Description: 43 * Implements DCT, and quantizes the DCT coefficients of the inter block 44 * while reconstructing the texture residual. There is no boundary check for 45 * the bit stream buffer. 46 * 47 * Input Arguments: 48 * 49 * pSrc -pointer to the residuals to be encoded; must be aligned on an 50 * 16-byte boundary. 51 * QP - quantization parameter. 52 * shortVideoHeader - binary flag indicating presence of short_video_header; 53 * shortVideoHeader==1 selects linear intra DC mode, and 54 * shortVideoHeader==0 selects non linear intra DC mode. 55 * 56 * Output Arguments: 57 * 58 * pDst - pointer to the quantized DCT coefficients buffer; must be aligned 59 * on a 16-byte boundary. 60 * pRec - pointer to the reconstructed texture residuals; must be aligned 61 * on a 16-byte boundary. 62 * 63 * Return Value: 64 * 65 * OMX_Sts_NoErr - no error 66 * OMX_Sts_BadArgErr - bad arguments: 67 * - At least one of the following pointers is either NULL or 68 * not 16-byte aligned: 69 * - pSrc 70 * - pDst 71 * - pRec 72 * - QP <= 0 or QP >= 32. 73 * 74 */ 75 76OMXResult omxVCM4P2_TransRecBlockCoef_inter( 77 const OMX_S16 *pSrc, 78 OMX_S16 * pDst, 79 OMX_S16 * pRec, 80 OMX_U8 QP, 81 OMX_INT shortVideoHeader 82) 83{ 84 /* 64 elements are needed but to align it to 16 bytes need 85 8 more elements of padding */ 86 OMX_S16 tempBuffer[72]; 87 OMX_S16 *pTempBuffer; 88 OMX_INT i; 89 90 /* Aligning the local buffers */ 91 pTempBuffer = armAlignTo16Bytes(tempBuffer); 92 93 /* Argument error checks */ 94 armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr); 95 armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr); 96 armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr); 97 armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr); 98 armRetArgErrIf(!armIs16ByteAligned(pRec), OMX_Sts_BadArgErr); 99 armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr); 100 armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr); 101 102 omxVCM4P2_DCT8x8blk (pSrc, pDst); 103 omxVCM4P2_QuantInter_I( 104 pDst, 105 QP, 106 shortVideoHeader); 107 108 for (i = 0; i < 64; i++) 109 { 110 pTempBuffer[i] = pDst[i]; 111 } 112 113 omxVCM4P2_QuantInvInter_I( 114 pTempBuffer, 115 QP); 116 omxVCM4P2_IDCT8x8blk (pTempBuffer, pRec); 117 118 return OMX_Sts_NoErr; 119} 120 121/* End of file */ 122 123 124