armVCM4P10_PredictIntraDC4x4.c revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/* ----------------------------------------------------------------
2 *
3 *
4 * File Name:  armVCM4P10_PredictIntraDC4x4.c
5 * OpenMAX DL: v1.0.2
6 * Revision:   9641
7 * Date:       Thursday, February 7, 2008
8 *
9 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
10 *
11 *
12 *
13 * H.264 4x4 intra prediction module
14 *
15 */
16
17#include "omxtypes.h"
18#include "armOMX.h"
19#include "omxVC.h"
20
21#include "armCOMM.h"
22#include "armVC.h"
23
24/*
25 * Description:
26 * Perform DC style intra prediction, averaging upper and left block
27 *
28 * Parameters:
29 * [in]	pSrcLeft		Pointer to the buffer of 16 left coefficients:
30 *								p[x, y] (x = -1, y = 0..3)
31 * [in]	pSrcAbove		Pointer to the buffer of 16 above coefficients:
32 *								p[x,y] (x = 0..3, y = -1)
33 * [in]	leftStep		Step of left coefficient buffer
34 * [in]	dstStep			Step of the destination buffer
35 * [in]	availability	Neighboring 16x16 MB availability flag
36 * [out]	pDst			Pointer to the destination buffer
37 *
38 * Return Value:
39 * None
40 */
41
42void armVCM4P10_PredictIntraDC4x4(
43     const OMX_U8* pSrcLeft,
44     const OMX_U8 *pSrcAbove,
45     OMX_U8* pDst,
46     OMX_INT leftStep,
47     OMX_INT dstStep,
48     OMX_S32 availability
49)
50{
51    int x, y, Sum=0, Count = 0;
52
53    if (availability & OMX_VC_LEFT)
54    {
55        for (y=0; y<4; y++)
56        {
57            Sum += pSrcLeft[y*leftStep];
58        }
59        Count++;
60    }
61    if (availability & OMX_VC_UPPER)
62    {
63        for (x=0; x<4; x++)
64        {
65            Sum += pSrcAbove[x];
66        }
67        Count++;
68    }
69    if (Count==0)
70    {
71        Sum = 128;
72    }
73    else if (Count==1)
74    {
75        Sum = (Sum + 2) >> 2;
76    }
77    else /* Count = 2 */
78    {
79        Sum = (Sum + 4) >> 3;
80    }
81    for (y=0; y<4; y++)
82    {
83        for (x=0; x<4; x++)
84        {
85            pDst[y*dstStep+x] = (OMX_U8)Sum;
86        }
87    }
88}
89