10c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 20c1bc742181ded4930842b46e9507372f0b1b963James Dong * 30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name: armVCM4P2_SetPredDir.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 * Description: 130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Contains module for detecting the prediction direction 140c1bc742181ded4930842b46e9507372f0b1b963James Dong * 150c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 160c1bc742181ded4930842b46e9507372f0b1b963James Dong 170c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h" 180c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armOMX.h" 190c1bc742181ded4930842b46e9507372f0b1b963James Dong 200c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armVC.h" 210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM.h" 220c1bc742181ded4930842b46e9507372f0b1b963James Dong 230c1bc742181ded4930842b46e9507372f0b1b963James Dong/** 240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_SetPredDir 250c1bc742181ded4930842b46e9507372f0b1b963James Dong * 260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description: 270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs detecting the prediction direction 280c1bc742181ded4930842b46e9507372f0b1b963James Dong * 290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks: 300c1bc742181ded4930842b46e9507372f0b1b963James Dong * 310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters: 320c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] blockIndex block index indicating the component type and 330c1bc742181ded4930842b46e9507372f0b1b963James Dong * position as defined in subclause 6.1.3.8, of ISO/IEC 340c1bc742181ded4930842b46e9507372f0b1b963James Dong * 14496-2. Furthermore, indexes 6 to 9 indicate the 350c1bc742181ded4930842b46e9507372f0b1b963James Dong * alpha blocks spatially corresponding to luminance 360c1bc742181ded4930842b46e9507372f0b1b963James Dong * blocks 0 to 3 in the same macroblock. 370c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pCoefBufRow pointer to the coefficient row buffer 380c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pQpBuf pointer to the quantization parameter buffer 390c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] predQP quantization parameter of the predictor block 400c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] predDir indicates the prediction direction which takes one 410c1bc742181ded4930842b46e9507372f0b1b963James Dong * of the following values: 420c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_HORIZONTAL predict horizontally 430c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_VC_VERTICAL predict vertically 440c1bc742181ded4930842b46e9507372f0b1b963James Dong * 450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value: 460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes. 470c1bc742181ded4930842b46e9507372f0b1b963James Dong * 480c1bc742181ded4930842b46e9507372f0b1b963James Dong */ 490c1bc742181ded4930842b46e9507372f0b1b963James Dong 500c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_SetPredDir( 510c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT blockIndex, 520c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 *pCoefBufRow, 530c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_S16 *pCoefBufCol, 540c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT *predDir, 550c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_INT *predQP, 560c1bc742181ded4930842b46e9507372f0b1b963James Dong const OMX_U8 *pQpBuf 570c1bc742181ded4930842b46e9507372f0b1b963James Dong) 580c1bc742181ded4930842b46e9507372f0b1b963James Dong{ 590c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 blockDCLeft; 600c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 blockDCTop; 610c1bc742181ded4930842b46e9507372f0b1b963James Dong OMX_U8 blockDCTopLeft; 620c1bc742181ded4930842b46e9507372f0b1b963James Dong 630c1bc742181ded4930842b46e9507372f0b1b963James Dong if (blockIndex == 3) 640c1bc742181ded4930842b46e9507372f0b1b963James Dong { 650c1bc742181ded4930842b46e9507372f0b1b963James Dong blockDCTop = *(pCoefBufCol - 8); 660c1bc742181ded4930842b46e9507372f0b1b963James Dong } 670c1bc742181ded4930842b46e9507372f0b1b963James Dong else 680c1bc742181ded4930842b46e9507372f0b1b963James Dong { 690c1bc742181ded4930842b46e9507372f0b1b963James Dong blockDCTop = *pCoefBufRow; 700c1bc742181ded4930842b46e9507372f0b1b963James Dong } 710c1bc742181ded4930842b46e9507372f0b1b963James Dong blockDCLeft = *pCoefBufCol; 720c1bc742181ded4930842b46e9507372f0b1b963James Dong blockDCTopLeft = *(pCoefBufRow - 8); 730c1bc742181ded4930842b46e9507372f0b1b963James Dong 740c1bc742181ded4930842b46e9507372f0b1b963James Dong if (armAbs(blockDCLeft - blockDCTopLeft) < armAbs(blockDCTopLeft \ 750c1bc742181ded4930842b46e9507372f0b1b963James Dong - blockDCTop)) 760c1bc742181ded4930842b46e9507372f0b1b963James Dong { 770c1bc742181ded4930842b46e9507372f0b1b963James Dong *predDir = OMX_VC_VERTICAL; 780c1bc742181ded4930842b46e9507372f0b1b963James Dong *predQP = pQpBuf[1]; 790c1bc742181ded4930842b46e9507372f0b1b963James Dong } 800c1bc742181ded4930842b46e9507372f0b1b963James Dong else 810c1bc742181ded4930842b46e9507372f0b1b963James Dong { 820c1bc742181ded4930842b46e9507372f0b1b963James Dong *predDir = OMX_VC_HORIZONTAL; 830c1bc742181ded4930842b46e9507372f0b1b963James Dong *predQP = pQpBuf[0]; 840c1bc742181ded4930842b46e9507372f0b1b963James Dong } 850c1bc742181ded4930842b46e9507372f0b1b963James Dong return OMX_Sts_NoErr; 860c1bc742181ded4930842b46e9507372f0b1b963James Dong} 870c1bc742181ded4930842b46e9507372f0b1b963James Dong 880c1bc742181ded4930842b46e9507372f0b1b963James Dong 890c1bc742181ded4930842b46e9507372f0b1b963James Dong/*End of File*/ 90