omxVCM4P10_InvTransformResidualAndAdd.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
10c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: omxVCM4P10_InvTransformResidualAndAdd.c 40c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2 50c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision: 9641 60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date: Thursday, February 7, 2008 70c1bc742181ded4930842b46e9507372f0b1b963James Dong * 80c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 90c1bc742181ded4930842b46e9507372f0b1b963James Dong * 100c1bc742181ded4930842b46e9507372f0b1b963James Dong * 110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 120c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function will inverse integer 4x4 transform 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * 140c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 150c1bc742181ded4930842b46e9507372f0b1b963James Dong 160c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong 200c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 220c1bc742181ded4930842b46e9507372f0b1b963James Dong 230c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1) 250c1bc742181ded4930842b46e9507372f0b1b963James Dong * 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs inverse an 4x4 integer transformation to produce 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * the difference signal and then adds the difference to the prediction to get 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * the reconstructed signal. 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments: 320c1bc742181ded4930842b46e9507372f0b1b963James Dong * 330c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcPred - Pointer to prediction signal. 4-byte alignment required. 340c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDequantCoeff - Pointer to the transformed coefficients. 8-byte 350c1bc742181ded4930842b46e9507372f0b1b963James Dong * alignment required. 360c1bc742181ded4930842b46e9507372f0b1b963James Dong * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4. 370c1bc742181ded4930842b46e9507372f0b1b963James Dong * iDstReconStep - Step of the destination reconstruction buffer; must be a 380c1bc742181ded4930842b46e9507372f0b1b963James Dong * multiple of 4. 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * bAC - Indicate whether there is AC coefficients in the coefficients 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * matrix. 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments: 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * alignment required. 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr - no error 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * conditions are true: 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * - at least one of the following pointers is NULL: 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcPred, pDequantCoeff, pDstRecon 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pSrcPred is not aligned on a 4-byte boundary 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * - iSrcPredStep or iDstReconStep is not a multiple of 4. 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pDequantCoeff is not aligned on an 8-byte boundary 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * 580c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 590c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InvTransformResidualAndAdd( 600c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8* pSrcPred, 610c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_S16* pDequantCoeff, 620c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8* pDstRecon, 630c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U32 iSrcPredStep, 640c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U32 iDstReconStep, 650c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 bAC 660c1bc742181ded4930842b46e9507372f0b1b963James Dong) 670c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 680c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT i, j; 690c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 In[16], Out[16]; 700c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S32 Value; 710c1bc742181ded4930842b46e9507372f0b1b963James Dong 720c1bc742181ded4930842b46e9507372f0b1b963James Dong /* check for argument error */ 730c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSrcPred == NULL, OMX_Sts_BadArgErr) 740c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot4ByteAligned(pSrcPred), OMX_Sts_BadArgErr) 750c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pDequantCoeff == NULL, OMX_Sts_BadArgErr) 760c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot8ByteAligned(pDequantCoeff), OMX_Sts_BadArgErr) 770c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pDstRecon == NULL, OMX_Sts_BadArgErr) 780c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(armNot4ByteAligned(pDstRecon), OMX_Sts_BadArgErr) 790c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(bAC > 1, OMX_Sts_BadArgErr) 800c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(iSrcPredStep == 0 || iSrcPredStep & 3, OMX_Sts_BadArgErr) 810c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(iDstReconStep == 0 || iDstReconStep & 3, OMX_Sts_BadArgErr) 820c1bc742181ded4930842b46e9507372f0b1b963James Dong 830c1bc742181ded4930842b46e9507372f0b1b963James Dong if (bAC) 840c1bc742181ded4930842b46e9507372f0b1b963James Dong { 850c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i = 0; i < 16; i++) 860c1bc742181ded4930842b46e9507372f0b1b963James Dong { 870c1bc742181ded4930842b46e9507372f0b1b963James Dong In[i] = pDequantCoeff [i]; 880c1bc742181ded4930842b46e9507372f0b1b963James Dong } 890c1bc742181ded4930842b46e9507372f0b1b963James Dong } 900c1bc742181ded4930842b46e9507372f0b1b963James Dong else 910c1bc742181ded4930842b46e9507372f0b1b963James Dong { 920c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Copy DC */ 930c1bc742181ded4930842b46e9507372f0b1b963James Dong In[0] = pDequantCoeff [0]; 940c1bc742181ded4930842b46e9507372f0b1b963James Dong 950c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i = 1; i < 16; i++) 960c1bc742181ded4930842b46e9507372f0b1b963James Dong { 970c1bc742181ded4930842b46e9507372f0b1b963James Dong In[i] = 0; 980c1bc742181ded4930842b46e9507372f0b1b963James Dong } 990c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Residual Transform */ 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong armVCM4P10_TransformResidual4x4 (Out, In); 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong for (j = 0; j < 4; j++) 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong for (i = 0; i < 4; i++) 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong { 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Add predition */ 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong Value = (OMX_S32) Out [j * 4 + i] + pSrcPred [j * iSrcPredStep + i]; 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Saturate Value to OMX_U8 */ 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong Value = armClip (0, 255, Value); 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong pDstRecon[j * iDstReconStep + i] = (OMX_U8) Value; 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong } 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong return OMX_Sts_NoErr; 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong} 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong/***************************************************************************** 1220c1bc742181ded4930842b46e9507372f0b1b963James Dong * END OF FILE 1230c1bc742181ded4930842b46e9507372f0b1b963James Dong *****************************************************************************/ 1240c1bc742181ded4930842b46e9507372f0b1b963James Dong 125