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_PredictReconCoefIntra.c 20 * OpenMAX DL: v1.0.2 21 * Revision: 9641 22 * Date: Thursday, February 7, 2008 23 * 24 * 25 * 26 * 27 * File: omxVCM4P2_PredictReconCoefIntra_S16.c 28 * Description: Contains modules for AC DC prediction 29 * 30 */ 31 32#include "omxtypes.h" 33#include "armOMX.h" 34#include "omxVC.h" 35 36#include "armCOMM.h" 37#include "armVC.h" 38 39/** 40 * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3) 41 * 42 * Description: 43 * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 44 * to the function call, prediction direction (predDir) should be selected as 45 * specified in [ISO14496-2], subclause 7.4.3.1. 46 * 47 * Input Arguments: 48 * 49 * pSrcDst - pointer to the coefficient buffer which contains the quantized 50 * coefficient residuals (PQF) of the current block; must be 51 * aligned on a 4-byte boundary. The output coefficients are 52 * saturated to the range [-2048, 2047]. 53 * pPredBufRow - pointer to the coefficient row buffer; must be aligned on 54 * a 4-byte boundary. 55 * pPredBufCol - pointer to the coefficient column buffer; must be aligned 56 * on a 4-byte boundary. 57 * curQP - quantization parameter of the current block. curQP may equal to 58 * predQP especially when the current block and the predictor block 59 * are in the same macroblock. 60 * predQP - quantization parameter of the predictor block 61 * predDir - indicates the prediction direction which takes one of the 62 * following values: OMX_VC_HORIZONTAL - predict horizontally 63 * OMX_VC_VERTICAL - predict vertically 64 * ACPredFlag - a flag indicating if AC prediction should be performed. It 65 * is equal to ac_pred_flag in the bit stream syntax of MPEG-4 66 * videoComp - video component type (luminance or chrominance) of the 67 * current block 68 * 69 * Output Arguments: 70 * 71 * pSrcDst - pointer to the coefficient buffer which contains the quantized 72 * coefficients (QF) of the current block 73 * pPredBufRow - pointer to the updated coefficient row buffer 74 * pPredBufCol - pointer to the updated coefficient column buffer Note: 75 * Buffer update: Update the AC prediction buffer (both row and 76 * column buffer). 77 * 78 * Return Value: 79 * 80 * OMX_Sts_NoErr - no error 81 * OMX_Sts_BadArgErr - bad arguments, if: 82 * - At least one of the pointers is NULL: 83 * pSrcDst, pPredBufRow, or pPredBufCol. 84 * - curQP <= 0, 85 * - predQP <= 0, 86 * - curQP >31, 87 * - predQP > 31, 88 * - preDir exceeds [1,2] 89 * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned. 90 * 91 */ 92 93OMXResult omxVCM4P2_PredictReconCoefIntra( 94 OMX_S16 * pSrcDst, 95 OMX_S16 * pPredBufRow, 96 OMX_S16 * pPredBufCol, 97 OMX_INT curQP, 98 OMX_INT predQP, 99 OMX_INT predDir, 100 OMX_INT ACPredFlag, 101 OMXVCM4P2VideoComponent videoComp 102 ) 103{ 104 OMX_U8 flag; 105 /* Argument error checks */ 106 armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); 107 armRetArgErrIf(pPredBufRow == NULL, OMX_Sts_BadArgErr); 108 armRetArgErrIf(pPredBufCol == NULL, OMX_Sts_BadArgErr); 109 armRetArgErrIf(curQP <= 0, OMX_Sts_BadArgErr); 110 armRetArgErrIf(predQP <= 0, OMX_Sts_BadArgErr); 111 armRetArgErrIf(curQP > 31, OMX_Sts_BadArgErr); 112 armRetArgErrIf(predQP > 31, OMX_Sts_BadArgErr); 113 armRetArgErrIf((predDir != 1) && (predDir != 2), OMX_Sts_BadArgErr); 114 armRetArgErrIf(!armIs4ByteAligned(pSrcDst), OMX_Sts_BadArgErr); 115 armRetArgErrIf(!armIs4ByteAligned(pPredBufRow), OMX_Sts_BadArgErr); 116 armRetArgErrIf(!armIs4ByteAligned(pPredBufCol), OMX_Sts_BadArgErr); 117 118 flag = 0; 119 return armVCM4P2_ACDCPredict( 120 pSrcDst, 121 NULL, 122 pPredBufRow, 123 pPredBufCol, 124 curQP, 125 predQP, 126 predDir, 127 ACPredFlag, 128 videoComp, 129 flag, 130 NULL); 131 132} 133 134/* End of file */ 135 136 137