armVCM4P2_SetPredDir.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 *
3 * File Name:  armVCM4P2_SetPredDir.c
4 * OpenMAX DL: v1.0.2
5 * Revision:   9641
6 * Date:       Thursday, February 7, 2008
7 *
8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
9 *
10 *
11 *
12 * Description:
13 * Contains module for detecting the prediction direction
14 *
15 */
16
17#include "omxtypes.h"
18#include "armOMX.h"
19
20#include "armVC.h"
21#include "armCOMM.h"
22
23/**
24 * Function: armVCM4P2_SetPredDir
25 *
26 * Description:
27 * Performs detecting the prediction direction
28 *
29 * Remarks:
30 *
31 * Parameters:
32 * [in] blockIndex  block index indicating the component type and
33 *                          position as defined in subclause 6.1.3.8, of ISO/IEC
34 *                          14496-2. Furthermore, indexes 6 to 9 indicate the
35 *                          alpha blocks spatially corresponding to luminance
36 *                          blocks 0 to 3 in the same macroblock.
37 * [in] pCoefBufRow pointer to the coefficient row buffer
38 * [in] pQpBuf      pointer to the quantization parameter buffer
39 * [out]    predQP      quantization parameter of the predictor block
40 * [out]    predDir     indicates the prediction direction which takes one
41 *                          of the following values:
42 *                          OMX_VC_HORIZONTAL    predict horizontally
43 *                          OMX_VC_VERTICAL      predict vertically
44 *
45 * Return Value:
46 * Standard OMXResult result. See enumeration for possible result codes.
47 *
48 */
49
50OMXResult armVCM4P2_SetPredDir(
51     OMX_INT blockIndex,
52     OMX_S16 *pCoefBufRow,
53     OMX_S16 *pCoefBufCol,
54     OMX_INT *predDir,
55     OMX_INT *predQP,
56     const OMX_U8 *pQpBuf
57)
58{
59    OMX_U8  blockDCLeft;
60    OMX_U8  blockDCTop;
61    OMX_U8  blockDCTopLeft;
62
63    if (blockIndex == 3)
64    {
65        blockDCTop = *(pCoefBufCol - 8);
66    }
67    else
68    {
69        blockDCTop = *pCoefBufRow;
70    }
71    blockDCLeft = *pCoefBufCol;
72    blockDCTopLeft = *(pCoefBufRow - 8);
73
74    if (armAbs(blockDCLeft - blockDCTopLeft) < armAbs(blockDCTopLeft \
75                                                        - blockDCTop))
76    {
77        *predDir = OMX_VC_VERTICAL;
78        *predQP = pQpBuf[1];
79    }
80    else
81    {
82        *predDir = OMX_VC_HORIZONTAL;
83        *predQP = pQpBuf[0];
84    }
85    return OMX_Sts_NoErr;
86}
87
88
89/*End of File*/
90