10c1bc742181ded4930842b46e9507372f0b1b963James Dong /** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: omxVCM4P2_PredictReconCoefIntra.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 * 120c1bc742181ded4930842b46e9507372f0b1b963James Dong * File: omxVCM4P2_PredictReconCoefIntra_S16.c 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: Contains modules for AC DC prediction 140c1bc742181ded4930842b46e9507372f0b1b963James Dong * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 160c1bc742181ded4930842b46e9507372f0b1b963James Dong 170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h" 200c1bc742181ded4930842b46e9507372f0b1b963James Dong 210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 220c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 230c1bc742181ded4930842b46e9507372f0b1b963James Dong 240c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3) 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * to the function call, prediction direction (predDir) should be selected as 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * specified in [ISO14496-2], subclause 7.4.3.1. 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * 320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments: 330c1bc742181ded4930842b46e9507372f0b1b963James Dong * 340c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcDst - pointer to the coefficient buffer which contains the quantized 350c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficient residuals (PQF) of the current block; must be 360c1bc742181ded4930842b46e9507372f0b1b963James Dong * aligned on a 4-byte boundary. The output coefficients are 370c1bc742181ded4930842b46e9507372f0b1b963James Dong * saturated to the range [-2048, 2047]. 380c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufRow - pointer to the coefficient row buffer; must be aligned on 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * a 4-byte boundary. 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufCol - pointer to the coefficient column buffer; must be aligned 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * on a 4-byte boundary. 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * curQP - quantization parameter of the current block. curQP may equal to 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * predQP especially when the current block and the predictor block 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * are in the same macroblock. 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * predQP - quantization parameter of the predictor block 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * predDir - indicates the prediction direction which takes one of the 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * following values: OMX_VC_HORIZONTAL - predict horizontally 480c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_VERTICAL - predict vertically 490c1bc742181ded4930842b46e9507372f0b1b963James Dong * ACPredFlag - a flag indicating if AC prediction should be performed. It 500c1bc742181ded4930842b46e9507372f0b1b963James Dong * is equal to ac_pred_flag in the bit stream syntax of MPEG-4 510c1bc742181ded4930842b46e9507372f0b1b963James Dong * videoComp - video component type (luminance or chrominance) of the 520c1bc742181ded4930842b46e9507372f0b1b963James Dong * current block 530c1bc742181ded4930842b46e9507372f0b1b963James Dong * 540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments: 550c1bc742181ded4930842b46e9507372f0b1b963James Dong * 560c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcDst - pointer to the coefficient buffer which contains the quantized 570c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients (QF) of the current block 580c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufRow - pointer to the updated coefficient row buffer 590c1bc742181ded4930842b46e9507372f0b1b963James Dong * pPredBufCol - pointer to the updated coefficient column buffer Note: 600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Buffer update: Update the AC prediction buffer (both row and 610c1bc742181ded4930842b46e9507372f0b1b963James Dong * column buffer). 620c1bc742181ded4930842b46e9507372f0b1b963James Dong * 630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 640c1bc742181ded4930842b46e9507372f0b1b963James Dong * 650c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr - no error 660c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr - bad arguments, if: 670c1bc742181ded4930842b46e9507372f0b1b963James Dong * - At least one of the pointers is NULL: 680c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcDst, pPredBufRow, or pPredBufCol. 690c1bc742181ded4930842b46e9507372f0b1b963James Dong * - curQP <= 0, 700c1bc742181ded4930842b46e9507372f0b1b963James Dong * - predQP <= 0, 710c1bc742181ded4930842b46e9507372f0b1b963James Dong * - curQP >31, 720c1bc742181ded4930842b46e9507372f0b1b963James Dong * - predQP > 31, 730c1bc742181ded4930842b46e9507372f0b1b963James Dong * - preDir exceeds [1,2] 740c1bc742181ded4930842b46e9507372f0b1b963James Dong * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned. 750c1bc742181ded4930842b46e9507372f0b1b963James Dong * 760c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 770c1bc742181ded4930842b46e9507372f0b1b963James Dong 780c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_PredictReconCoefIntra( 790c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pSrcDst, 800c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPredBufRow, 810c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 * pPredBufCol, 820c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT curQP, 830c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT predQP, 840c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT predDir, 850c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT ACPredFlag, 860c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXVCM4P2VideoComponent videoComp 870c1bc742181ded4930842b46e9507372f0b1b963James Dong ) 880c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 890c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 flag; 900c1bc742181ded4930842b46e9507372f0b1b963James Dong /* Argument error checks */ 910c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); 920c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr); 930c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr); 940c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr); 950c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr); 960c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(curQP > 31, OMX_Sts_BadArgErr); 970c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(predQP > 31, OMX_Sts_BadArgErr); 980c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr); 990c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr); 1000c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr); 1010c1bc742181ded4930842b46e9507372f0b1b963James Dong armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr); 1020c1bc742181ded4930842b46e9507372f0b1b963James Dong 1030c1bc742181ded4930842b46e9507372f0b1b963James Dong flag = 0; 1040c1bc742181ded4930842b46e9507372f0b1b963James Dong return armVCM4P2_ACDCPredict( 1050c1bc742181ded4930842b46e9507372f0b1b963James Dong pSrcDst, 1060c1bc742181ded4930842b46e9507372f0b1b963James Dong NULL, 1070c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufRow, 1080c1bc742181ded4930842b46e9507372f0b1b963James Dong pPredBufCol, 1090c1bc742181ded4930842b46e9507372f0b1b963James Dong curQP, 1100c1bc742181ded4930842b46e9507372f0b1b963James Dong predQP, 1110c1bc742181ded4930842b46e9507372f0b1b963James Dong predDir, 1120c1bc742181ded4930842b46e9507372f0b1b963James Dong ACPredFlag, 1130c1bc742181ded4930842b46e9507372f0b1b963James Dong videoComp, 1140c1bc742181ded4930842b46e9507372f0b1b963James Dong flag, 1150c1bc742181ded4930842b46e9507372f0b1b963James Dong NULL); 1160c1bc742181ded4930842b46e9507372f0b1b963James Dong 1170c1bc742181ded4930842b46e9507372f0b1b963James Dong} 1180c1bc742181ded4930842b46e9507372f0b1b963James Dong 1190c1bc742181ded4930842b46e9507372f0b1b963James Dong/* End of file */ 1200c1bc742181ded4930842b46e9507372f0b1b963James Dong 1210c1bc742181ded4930842b46e9507372f0b1b963James Dong 122