10c1bc742181ded4930842b46e9507372f0b1b963James Dong/* ----------------------------------------------------------------
20c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name:  omxVCM4P10_PredictIntraChroma_8x8.c
50c1bc742181ded4930842b46e9507372f0b1b963James Dong * OpenMAX DL: v1.0.2
60c1bc742181ded4930842b46e9507372f0b1b963James Dong * Revision:   9641
70c1bc742181ded4930842b46e9507372f0b1b963James Dong * Date:       Thursday, February 7, 2008
80c1bc742181ded4930842b46e9507372f0b1b963James Dong *
90c1bc742181ded4930842b46e9507372f0b1b963James Dong * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
110c1bc742181ded4930842b46e9507372f0b1b963James Dong *
120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
130c1bc742181ded4930842b46e9507372f0b1b963James Dong * H.264 Chroma 8x8 intra prediction module
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 * Description:
260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Perform DC style intra prediction, upper block has priority
270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
290c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcLeft		Pointer to the buffer of 16 left coefficients:
300c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x, y] (x = -1, y = 0..3)
310c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcAbove		Pointer to the buffer of 16 above coefficients:
320c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x,y] (x = 0..3, y = -1)
330c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	leftStep		Step of left coefficient buffer
340c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	dstStep			Step of the destination buffer
350c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	availability	Neighboring 16x16 MB availability flag
360c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst			Pointer to the destination buffer
370c1bc742181ded4930842b46e9507372f0b1b963James Dong *
380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
390c1bc742181ded4930842b46e9507372f0b1b963James Dong * None
400c1bc742181ded4930842b46e9507372f0b1b963James Dong */
410c1bc742181ded4930842b46e9507372f0b1b963James Dong
420c1bc742181ded4930842b46e9507372f0b1b963James Dongstatic void armVCM4P10_PredictIntraDCUp4x4(
430c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8* pSrcLeft,
440c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcAbove,
450c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pDst,
460c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT leftStep,
470c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT dstStep,
480c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 availability
490c1bc742181ded4930842b46e9507372f0b1b963James Dong)
500c1bc742181ded4930842b46e9507372f0b1b963James Dong{
510c1bc742181ded4930842b46e9507372f0b1b963James Dong    int x, y, Sum=0, Count = 0;
520c1bc742181ded4930842b46e9507372f0b1b963James Dong
530c1bc742181ded4930842b46e9507372f0b1b963James Dong    if (availability & OMX_VC_UPPER)
540c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
550c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (x=0; x<4; x++)
560c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
570c1bc742181ded4930842b46e9507372f0b1b963James Dong            Sum += pSrcAbove[x];
580c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
590c1bc742181ded4930842b46e9507372f0b1b963James Dong        Count++;
600c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
610c1bc742181ded4930842b46e9507372f0b1b963James Dong    else if (availability & OMX_VC_LEFT)
620c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
630c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=0; y<4; y++)
640c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
650c1bc742181ded4930842b46e9507372f0b1b963James Dong            Sum += pSrcLeft[y*leftStep];
660c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
670c1bc742181ded4930842b46e9507372f0b1b963James Dong        Count++;
680c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
690c1bc742181ded4930842b46e9507372f0b1b963James Dong    if (Count==0)
700c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
710c1bc742181ded4930842b46e9507372f0b1b963James Dong        Sum = 128;
720c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
730c1bc742181ded4930842b46e9507372f0b1b963James Dong    else
740c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
750c1bc742181ded4930842b46e9507372f0b1b963James Dong        Sum = (Sum + 2) >> 2;
760c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
770c1bc742181ded4930842b46e9507372f0b1b963James Dong    for (y=0; y<4; y++)
780c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
790c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (x=0; x<4; x++)
800c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
810c1bc742181ded4930842b46e9507372f0b1b963James Dong            pDst[y*dstStep+x] = (OMX_U8)Sum;
820c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
830c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
840c1bc742181ded4930842b46e9507372f0b1b963James Dong}
850c1bc742181ded4930842b46e9507372f0b1b963James Dong
860c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Perform DC style intra prediction, left block has priority
890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
910c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcLeft		Pointer to the buffer of 16 left coefficients:
920c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x, y] (x = -1, y = 0..3)
930c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcAbove		Pointer to the buffer of 16 above coefficients:
940c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x,y] (x = 0..3, y = -1)
950c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	leftStep		Step of left coefficient buffer
960c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	dstStep			Step of the destination buffer
970c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	availability	Neighboring 16x16 MB availability flag
980c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst			Pointer to the destination buffer
990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong * None
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong
1040c1bc742181ded4930842b46e9507372f0b1b963James Dongstatic void armVCM4P10_PredictIntraDCLeft4x4(
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8* pSrcLeft,
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcAbove,
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pDst,
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT leftStep,
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT dstStep,
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 availability
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong)
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong{
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong    int x, y, Sum=0, Count = 0;
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong    if (availability & OMX_VC_LEFT)
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=0; y<4; y++)
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong            Sum += pSrcLeft[y*leftStep];
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong        Count++;
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong    else if (availability & OMX_VC_UPPER)
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (x=0; x<4; x++)
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong            Sum += pSrcAbove[x];
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong        Count++;
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong    if (Count==0)
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong        Sum = 128;
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong    else
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong        Sum = (Sum + 2) >> 2;
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong    for (y=0; y<4; y++)
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (x=0; x<4; x++)
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong            pDst[y*dstStep+x] = (OMX_U8)Sum;
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong}
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_PredictIntraChroma_8x8   (6.3.3.1.3)
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs intra prediction for chroma samples.
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            0..7).
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong *            = -1); must be aligned on an 8-byte boundary.
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong *   leftStep - Step of left pixel buffer; must be a multiple of 8.
1620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - Step of the destination buffer; must be a multiple of 8.
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predMode - Intra chroma prediction mode, please refer to section 3.4.3.
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   availability - Neighboring chroma block availability flag, please refer
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to  "Neighboring Macroblock Availability".
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the destination buffer; must be aligned on an 8-byte
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If any of the following cases occurs, the function returns
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pDst is NULL.
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dstStep < 8 or dstStep is not a multiple of 8.
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    leftStep is not a multiple of 8.
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is not in the valid range of enumeration
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMXVCM4P10IntraChromaPredMode.
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
1830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[-1,y] (y = 0..7) is not available.
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
1870c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
1920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    either pSrcAbove or pDst is not aligned on a 8-byte boundary.  Note:
1930c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
1940c1bc742181ded4930842b46e9507372f0b1b963James Dong *              they are not used by intra prediction implied in predMode.
1950c1bc742181ded4930842b46e9507372f0b1b963James Dong *               Note: OMX_VC_UPPER_RIGHT is not used in intra chroma
1960c1bc742181ded4930842b46e9507372f0b1b963James Dong *              prediction.
1970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1980c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1990c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_PredictIntraChroma_8x8(
2000c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8* pSrcLeft,
2010c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcAbove,
2020c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcAboveLeft,
2030c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pDst,
2040c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT leftStep,
2050c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT dstStep,
2060c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXVCM4P10IntraChromaPredMode predMode,
2070c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 availability
2080c1bc742181ded4930842b46e9507372f0b1b963James Dong )
2090c1bc742181ded4930842b46e9507372f0b1b963James Dong{
2100c1bc742181ded4930842b46e9507372f0b1b963James Dong    int x, y, Sum;
2110c1bc742181ded4930842b46e9507372f0b1b963James Dong    int H, V, a, b, c;
2120c1bc742181ded4930842b46e9507372f0b1b963James Dong
2130c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
2140c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(dstStep < 8,  OMX_Sts_BadArgErr);
2150c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((dstStep % 8) != 0,  OMX_Sts_BadArgErr);
2160c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((leftStep % 8) != 0,  OMX_Sts_BadArgErr);
2170c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(armNot8ByteAligned(pSrcAbove), OMX_Sts_BadArgErr);
2180c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(armNot8ByteAligned(pDst), OMX_Sts_BadArgErr);
2190c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((availability & OMX_VC_UPPER)      && pSrcAbove     == NULL, OMX_Sts_BadArgErr);
2200c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((availability & OMX_VC_LEFT )      && pSrcLeft      == NULL, OMX_Sts_BadArgErr);
2210c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((availability & OMX_VC_UPPER_LEFT) && pSrcAboveLeft == NULL, OMX_Sts_BadArgErr);
2220c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(predMode==OMX_VC_CHROMA_VERT  && !(availability & OMX_VC_UPPER),      OMX_Sts_BadArgErr);
2230c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(predMode==OMX_VC_CHROMA_HOR   && !(availability & OMX_VC_LEFT),       OMX_Sts_BadArgErr);
2240c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_UPPER),      OMX_Sts_BadArgErr);
2250c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_UPPER_LEFT), OMX_Sts_BadArgErr);
2260c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf(predMode==OMX_VC_CHROMA_PLANE && !(availability & OMX_VC_LEFT),       OMX_Sts_BadArgErr);
2270c1bc742181ded4930842b46e9507372f0b1b963James Dong    armRetArgErrIf((unsigned)predMode > OMX_VC_CHROMA_PLANE,   OMX_Sts_BadArgErr);
2280c1bc742181ded4930842b46e9507372f0b1b963James Dong
2290c1bc742181ded4930842b46e9507372f0b1b963James Dong    switch (predMode)
2300c1bc742181ded4930842b46e9507372f0b1b963James Dong    {
2310c1bc742181ded4930842b46e9507372f0b1b963James Dong    case OMX_VC_CHROMA_DC:
2320c1bc742181ded4930842b46e9507372f0b1b963James Dong        armVCM4P10_PredictIntraDC4x4(       pSrcLeft,            pSrcAbove,   pDst,             leftStep, dstStep, availability);
2330c1bc742181ded4930842b46e9507372f0b1b963James Dong        armVCM4P10_PredictIntraDCUp4x4(     pSrcLeft,            pSrcAbove+4, pDst+4,           leftStep, dstStep, availability);
2340c1bc742181ded4930842b46e9507372f0b1b963James Dong        armVCM4P10_PredictIntraDCLeft4x4(   pSrcLeft+4*leftStep, pSrcAbove,   pDst+4*dstStep,   leftStep, dstStep, availability);
2350c1bc742181ded4930842b46e9507372f0b1b963James Dong        armVCM4P10_PredictIntraDC4x4(       pSrcLeft+4*leftStep, pSrcAbove+4, pDst+4+4*dstStep, leftStep, dstStep, availability);
2360c1bc742181ded4930842b46e9507372f0b1b963James Dong        break;
2370c1bc742181ded4930842b46e9507372f0b1b963James Dong
2380c1bc742181ded4930842b46e9507372f0b1b963James Dong    case OMX_VC_CHROMA_HOR:
2390c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=0; y<8; y++)
2400c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
2410c1bc742181ded4930842b46e9507372f0b1b963James Dong            for (x=0; x<8; x++)
2420c1bc742181ded4930842b46e9507372f0b1b963James Dong            {
2430c1bc742181ded4930842b46e9507372f0b1b963James Dong                pDst[y*dstStep+x] = pSrcLeft[y*leftStep];
2440c1bc742181ded4930842b46e9507372f0b1b963James Dong            }
2450c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
2460c1bc742181ded4930842b46e9507372f0b1b963James Dong        break;
2470c1bc742181ded4930842b46e9507372f0b1b963James Dong
2480c1bc742181ded4930842b46e9507372f0b1b963James Dong    case OMX_VC_CHROMA_VERT:
2490c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=0; y<8; y++)
2500c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
2510c1bc742181ded4930842b46e9507372f0b1b963James Dong            for (x=0; x<8; x++)
2520c1bc742181ded4930842b46e9507372f0b1b963James Dong            {
2530c1bc742181ded4930842b46e9507372f0b1b963James Dong                pDst[y*dstStep+x] = pSrcAbove[x];
2540c1bc742181ded4930842b46e9507372f0b1b963James Dong            }
2550c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
2560c1bc742181ded4930842b46e9507372f0b1b963James Dong        break;
2570c1bc742181ded4930842b46e9507372f0b1b963James Dong
2580c1bc742181ded4930842b46e9507372f0b1b963James Dong    case OMX_VC_CHROMA_PLANE:
2590c1bc742181ded4930842b46e9507372f0b1b963James Dong        H = 4*(pSrcAbove[7] - pSrcAboveLeft[0]);
2600c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (x=2; x>=0; x--)
2610c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
2620c1bc742181ded4930842b46e9507372f0b1b963James Dong            H += (x+1)*(pSrcAbove[4+x] - pSrcAbove[2-x]);
2630c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
2640c1bc742181ded4930842b46e9507372f0b1b963James Dong        V = 4*(pSrcLeft[7*leftStep] - pSrcAboveLeft[0]);
2650c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=2; y>=0; y--)
2660c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
2670c1bc742181ded4930842b46e9507372f0b1b963James Dong            V += (y+1)*(pSrcLeft[(4+y)*leftStep] - pSrcLeft[(2-y)*leftStep]);
2680c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
2690c1bc742181ded4930842b46e9507372f0b1b963James Dong        a = 16*(pSrcAbove[7] + pSrcLeft[7*leftStep]);
2700c1bc742181ded4930842b46e9507372f0b1b963James Dong        b = (17*H+16)>>5;
2710c1bc742181ded4930842b46e9507372f0b1b963James Dong        c = (17*V+16)>>5;
2720c1bc742181ded4930842b46e9507372f0b1b963James Dong        for (y=0; y<8; y++)
2730c1bc742181ded4930842b46e9507372f0b1b963James Dong        {
2740c1bc742181ded4930842b46e9507372f0b1b963James Dong            for (x=0; x<8; x++)
2750c1bc742181ded4930842b46e9507372f0b1b963James Dong            {
2760c1bc742181ded4930842b46e9507372f0b1b963James Dong                Sum = (a + b*(x-3) + c*(y-3) + 16)>>5;
2770c1bc742181ded4930842b46e9507372f0b1b963James Dong                pDst[y*dstStep+x] = (OMX_U8)armClip(0,255,Sum);
2780c1bc742181ded4930842b46e9507372f0b1b963James Dong            }
2790c1bc742181ded4930842b46e9507372f0b1b963James Dong        }
2800c1bc742181ded4930842b46e9507372f0b1b963James Dong        break;
2810c1bc742181ded4930842b46e9507372f0b1b963James Dong    }
2820c1bc742181ded4930842b46e9507372f0b1b963James Dong
2830c1bc742181ded4930842b46e9507372f0b1b963James Dong    return OMX_Sts_NoErr;
2840c1bc742181ded4930842b46e9507372f0b1b963James Dong}
285