Home | History | Annotate | Download | only in src
      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  *
     20  * File Name:  armVCM4P10_PredictIntraDC4x4.c
     21  * OpenMAX DL: v1.0.2
     22  * Revision:   9641
     23  * Date:       Thursday, February 7, 2008
     24  *
     25  *
     26  *
     27  *
     28  * H.264 4x4 intra prediction module
     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  * Description:
     41  * Perform DC style intra prediction, averaging upper and left block
     42  *
     43  * Parameters:
     44  * [in]	pSrcLeft		Pointer to the buffer of 16 left coefficients:
     45  *								p[x, y] (x = -1, y = 0..3)
     46  * [in]	pSrcAbove		Pointer to the buffer of 16 above coefficients:
     47  *								p[x,y] (x = 0..3, y = -1)
     48  * [in]	leftStep		Step of left coefficient buffer
     49  * [in]	dstStep			Step of the destination buffer
     50  * [in]	availability	Neighboring 16x16 MB availability flag
     51  * [out]	pDst			Pointer to the destination buffer
     52  *
     53  * Return Value:
     54  * None
     55  */
     56 
     57 void armVCM4P10_PredictIntraDC4x4(
     58      const OMX_U8* pSrcLeft,
     59      const OMX_U8 *pSrcAbove,
     60      OMX_U8* pDst,
     61      OMX_INT leftStep,
     62      OMX_INT dstStep,
     63      OMX_S32 availability
     64 )
     65 {
     66     int x, y, Sum=0, Count = 0;
     67 
     68     if (availability & OMX_VC_LEFT)
     69     {
     70         for (y=0; y<4; y++)
     71         {
     72             Sum += pSrcLeft[y*leftStep];
     73         }
     74         Count++;
     75     }
     76     if (availability & OMX_VC_UPPER)
     77     {
     78         for (x=0; x<4; x++)
     79         {
     80             Sum += pSrcAbove[x];
     81         }
     82         Count++;
     83     }
     84     if (Count==0)
     85     {
     86         Sum = 128;
     87     }
     88     else if (Count==1)
     89     {
     90         Sum = (Sum + 2) >> 2;
     91     }
     92     else /* Count = 2 */
     93     {
     94         Sum = (Sum + 4) >> 3;
     95     }
     96     for (y=0; y<4; y++)
     97     {
     98         for (x=0; x<4; x++)
     99         {
    100             pDst[y*dstStep+x] = (OMX_U8)Sum;
    101         }
    102     }
    103 }
    104