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: omxVCM4P10_InvTransformDequant_ChromaDC.c 20 * OpenMAX DL: v1.0.2 21 * Revision: 9641 22 * Date: Thursday, February 7, 2008 23 * 24 * 25 * 26 * Description: 27 * This function will calculate 4x4 hadamard transform of chroma DC 28 * coefficients and quantization 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34#include "omxVC.h" 35 36#include "armVC.h" 37#include "armCOMM.h" 38 39/** 40 * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4) 41 * 42 * Description: 43 * This function performs inverse 2x2 Hadamard transform and then dequantizes 44 * the coefficients. 45 * 46 * Input Arguments: 47 * 48 * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and 49 * quantized coefficients. 8 byte alignment required. 50 * iQP - Quantization parameter; must be in the range [0,51]. 51 * 52 * Output Arguments: 53 * 54 * pDst - Pointer to inverse-transformed and dequantized coefficients. 55 * 8-byte alignment required. 56 * 57 * Return Value: 58 * 59 * OMX_Sts_NoErr - no error 60 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 61 * conditions are true: 62 * - at least one of the following pointers is NULL: pSrc 63 * - pSrc or pDst is not aligned on an 8-byte boundary 64 * 65 */ 66OMXResult omxVCM4P10_InvTransformDequant_ChromaDC( 67 const OMX_S16* pSrc, 68 OMX_S16* pDst, 69 OMX_U32 iQP 70) 71{ 72 OMX_INT i, j; 73 OMX_S32 m[2][2]; 74 OMX_S32 QPer, V00, Value; 75 76 /* check for argument error */ 77 armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr) 78 armRetArgErrIf(armNot8ByteAligned(pSrc), OMX_Sts_BadArgErr); 79 armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr) 80 armRetArgErrIf(armNot8ByteAligned(pDst), OMX_Sts_BadArgErr); 81 armRetArgErrIf(iQP > 51, OMX_Sts_BadArgErr) 82 83 /* Inv Hadamard Transform for 2x2 block */ 84 m[0][0] = pSrc[0] + pSrc[1] + pSrc[2] + pSrc[3]; 85 m[0][1] = pSrc[0] - pSrc[1] + pSrc[2] - pSrc[3]; 86 m[1][0] = pSrc[0] + pSrc[1] - pSrc[2] - pSrc[3]; 87 m[1][1] = pSrc[0] - pSrc[1] - pSrc[2] + pSrc[3]; 88 89 /* Quantization */ 90 /* Scaling */ 91 QPer = iQP / 6; 92 V00 = armVCM4P10_VMatrix [iQP % 6][0]; 93 94 for (j = 0; j < 2; j++) 95 { 96 for (i = 0; i < 2; i++) 97 { 98 if (QPer < 1) 99 { 100 Value = (m[j][i] * V00) >> 1; 101 } 102 else 103 { 104 Value = (m[j][i] * V00) << (QPer - 1); 105 } 106 107 pDst[j * 2 + i] = (OMX_S16) Value; 108 } 109 } 110 111 return OMX_Sts_NoErr; 112} 113 114/***************************************************************************** 115 * END OF FILE 116 *****************************************************************************/ 117 118