10c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30c1bc742181ded4930842b46e9507372f0b1b963James Dong * File Name:  armVC.h
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 * File: armVideo.h
130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Brief: Declares API's/Basic Data types used across the OpenMAX Video domain
140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
150c1bc742181ded4930842b46e9507372f0b1b963James Dong */
160c1bc742181ded4930842b46e9507372f0b1b963James Dong
170c1bc742181ded4930842b46e9507372f0b1b963James Dong
180c1bc742181ded4930842b46e9507372f0b1b963James Dong#ifndef _armVideo_H_
190c1bc742181ded4930842b46e9507372f0b1b963James Dong#define _armVideo_H_
200c1bc742181ded4930842b46e9507372f0b1b963James Dong
210c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxVC.h"
220c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "armCOMM_Bitstream.h"
230c1bc742181ded4930842b46e9507372f0b1b963James Dong
240c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
250c1bc742181ded4930842b46e9507372f0b1b963James Dong * ARM specific state structure to hold Motion Estimation information.
260c1bc742181ded4930842b46e9507372f0b1b963James Dong */
270c1bc742181ded4930842b46e9507372f0b1b963James Dong
280c1bc742181ded4930842b46e9507372f0b1b963James Dongstruct m4p2_MESpec
290c1bc742181ded4930842b46e9507372f0b1b963James Dong{
300c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MEParams MEParams;
310c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MEMode   MEMode;
320c1bc742181ded4930842b46e9507372f0b1b963James Dong};
330c1bc742181ded4930842b46e9507372f0b1b963James Dong
340c1bc742181ded4930842b46e9507372f0b1b963James Dongstruct m4p10_MESpec
350c1bc742181ded4930842b46e9507372f0b1b963James Dong{
360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MEParams MEParams;
370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MEMode   MEMode;
380c1bc742181ded4930842b46e9507372f0b1b963James Dong};
390c1bc742181ded4930842b46e9507372f0b1b963James Dong
400c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct m4p2_MESpec  ARMVCM4P2_MESpec;
410c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct m4p10_MESpec ARMVCM4P10_MESpec;
420c1bc742181ded4930842b46e9507372f0b1b963James Dong
430c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
440c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_CompareMV
450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs comparision of motion vectors and SAD's to decide the
480c1bc742181ded4930842b46e9507372f0b1b963James Dong * best MV and SAD
490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
530c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     mvX     x coordinate of the candidate motion vector
540c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     mvY     y coordinate of the candidate motion vector
550c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     candSAD Candidate SAD
560c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     bestMVX x coordinate of the best motion vector
570c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     bestMVY y coordinate of the best motion vector
580c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]     bestSAD best SAD
590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
610c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_INT -- 1 to indicate that the current sad is the best
620c1bc742181ded4930842b46e9507372f0b1b963James Dong *            0 to indicate that it is NOT the best SAD
630c1bc742181ded4930842b46e9507372f0b1b963James Dong */
640c1bc742181ded4930842b46e9507372f0b1b963James Dong
650c1bc742181ded4930842b46e9507372f0b1b963James DongOMX_INT armVCM4P2_CompareMV (
660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 mvX,
670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 mvY,
680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT candSAD,
690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 bestMVX,
700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 bestMVY,
710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT bestSAD);
720c1bc742181ded4930842b46e9507372f0b1b963James Dong
730c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_ACDCPredict
750c1bc742181ded4930842b46e9507372f0b1b963James Dong *
760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs adaptive DC/AC coefficient prediction for an intra block. Prior
780c1bc742181ded4930842b46e9507372f0b1b963James Dong * to the function call, prediction direction (predDir) should be selected
790c1bc742181ded4930842b46e9507372f0b1b963James Dong * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2.
800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
840c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pSrcDst     pointer to the coefficient buffer which contains
850c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          the quantized coefficient residuals (PQF) of the
860c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          current block
870c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pPredBufRow pointer to the coefficient row buffer
880c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pPredBufCol pointer to the coefficient column buffer
890c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] curQP       quantization parameter of the current block. curQP
900c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          may equal to predQP especially when the current
910c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          block and the predictor block are in the same
920c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          macroblock.
930c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predQP      quantization parameter of the predictor block
940c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predDir     indicates the prediction direction which takes one
950c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          of the following values:
960c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          OMX_VIDEO_HORIZONTAL    predict horizontally
970c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          OMX_VIDEO_VERTICAL      predict vertically
980c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ACPredFlag  a flag indicating if AC prediction should be
990c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          performed. It is equal to ac_pred_flag in the bit
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          stream syntax of MPEG-4
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] videoComp   video component type (luminance, chrominance or
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          alpha) of the current block
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] flag        This flag defines the if one wants to use this functions to
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong *                  calculate PQF (set 1, prediction) or QF (set 0, reconstruction)
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pPreACPredict   pointer to the predicted coefficients buffer.
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          Filled ONLY if it is not NULL
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pSrcDst     pointer to the coefficient buffer which contains
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          the quantized coefficients (QF) of the current
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          block
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pPredBufRow pointer to the updated coefficient row buffer
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pPredBufCol pointer to the updated coefficient column buffer
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pSumErr     pointer to the updated sum of the difference
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      between predicted and unpredicted coefficients
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      If this is NULL, do not update
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong
1210c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_ACDCPredict(
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 * pSrcDst,
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 * pPreACPredict,
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 * pPredBufRow,
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 * pPredBufCol,
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT curQP,
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT predQP,
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT predDir,
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT ACPredFlag,
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXVCM4P2VideoComponent  videoComp,
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 flag,
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *pSumErr
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong);
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_SetPredDir
1370c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs detecting the prediction direction
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] blockIndex  block index indicating the component type and
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          position as defined in subclause 6.1.3.8, of ISO/IEC
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          14496-2. Furthermore, indexes 6 to 9 indicate the
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          alpha blocks spatially corresponding to luminance
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          blocks 0 to 3 in the same macroblock.
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pCoefBufRow pointer to the coefficient row buffer
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pQpBuf      pointer to the quantization parameter buffer
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    predQP      quantization parameter of the predictor block
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    predDir     indicates the prediction direction which takes one
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          of the following values:
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          OMX_VIDEO_HORIZONTAL    predict horizontally
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          OMX_VIDEO_VERTICAL      predict vertically
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong
1620c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_SetPredDir(
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT blockIndex,
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 *pCoefBufRow,
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 *pCoefBufCol,
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *predDir,
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *predQP,
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pQpBuf
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong);
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_EncodeVLCZigzag_Intra
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs zigzag scanning and VLC encoding for one intra block.
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ppBitStream     pointer to the pointer to the current byte in
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              the bit stream
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pBitOffset      pointer to the bit position in the byte pointed
1830c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              by *ppBitStream. Valid within 0 to 7.
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pQDctBlkCoef    pointer to the quantized DCT coefficient
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predDir         AC prediction direction, which is used to decide
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              the zigzag scan pattern. This takes one of the
1870c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              following values:
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_NONE          AC prediction not used.
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      Performs classical zigzag
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      scan.
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_HORIZONTAL    Horizontal prediction.
1920c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      Performs alternate-vertical
1930c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      zigzag scan.
1940c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_VERTICAL      Vertical prediction.
1950c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      Performs alternate-horizontal
1960c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      zigzag scan.
1970c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pattern         block pattern which is used to decide whether
1980c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              this block is encoded
1990c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] start           start indicates whether the encoding begins with 0th element
2000c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      or 1st.
2010c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    ppBitStream     *ppBitStream is updated after the block is encoded,
2020c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              so that it points to the current byte in the bit
2030c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              stream buffer.
2040c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pBitOffset      *pBitOffset is updated so that it points to the
2050c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              current bit position in the byte pointed by
2060c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              *ppBitStream.
2070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
2090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
2100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2110c1bc742181ded4930842b46e9507372f0b1b963James Dong */
2120c1bc742181ded4930842b46e9507372f0b1b963James Dong
2130c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_EncodeVLCZigzag_Intra(
2140c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 **ppBitStream,
2150c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *pBitOffset,
2160c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_S16 *pQDctBlkCoef,
2170c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 predDir,
2180c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 pattern,
2190c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT shortVideoHeader,
2200c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 start
2210c1bc742181ded4930842b46e9507372f0b1b963James Dong);
2220c1bc742181ded4930842b46e9507372f0b1b963James Dong
2230c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
2240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_DecodeVLCZigzag_Intra
2250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
2270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs VLC decoding and inverse zigzag scan for one intra coded block.
2280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
2300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
2320c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ppBitStream     pointer to the pointer to the current byte in
2330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              the bitstream buffer
2340c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pBitOffset      pointer to the bit position in the byte pointed
2350c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              to by *ppBitStream. *pBitOffset is valid within
2360c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              [0-7].
2370c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] predDir         AC prediction direction which is used to decide
2380c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              the zigzag scan pattern. It takes one of the
2390c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              following values:
2400c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_NONE  AC prediction not used;
2410c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              perform classical zigzag scan;
2420c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_HORIZONTAL    Horizontal prediction;
2430c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      perform alternate-vertical
2440c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      zigzag scan;
2450c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              OMX_VIDEO_VERTICAL      Vertical prediction;
2460c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      thus perform
2470c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      alternate-horizontal
2480c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                                      zigzag scan.
2490c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] videoComp       video component type (luminance, chrominance or
2500c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              alpha) of the current block
2510c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
2520c1bc742181ded4930842b46e9507372f0b1b963James Dong *                           and escape mode 4 is used when shortVideoHeader==1.
2530c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] start           start indicates whether the encoding begins with 0th element
2540c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      or 1st.
2550c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    ppBitStream     *ppBitStream is updated after the block is
2560c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              decoded, so that it points to the current byte
2570c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              in the bit stream buffer
2580c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pBitOffset      *pBitOffset is updated so that it points to the
2590c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              current bit position in the byte pointed by
2600c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              *ppBitStream
2610c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pDst            pointer to the coefficient buffer of current
2620c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              block. Should be 32-bit aligned
2630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
2650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
2660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2670c1bc742181ded4930842b46e9507372f0b1b963James Dong */
2680c1bc742181ded4930842b46e9507372f0b1b963James Dong
2690c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_DecodeVLCZigzag_Intra(
2700c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 ** ppBitStream,
2710c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT * pBitOffset,
2720c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 * pDst,
2730c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 predDir,
2740c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT shortVideoHeader,
2750c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8  start
2760c1bc742181ded4930842b46e9507372f0b1b963James Dong);
2770c1bc742181ded4930842b46e9507372f0b1b963James Dong
2780c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
2790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_FillVLDBuffer
2800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
2820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs filling of the coefficient buffer according to the run, level
2830c1bc742181ded4930842b46e9507372f0b1b963James Dong * and sign, also updates the index
2840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
2860c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  storeRun        Stored Run value (count of zeros)
2870c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  storeLevel      Stored Level value (non-zero value)
2880c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  sign            Flag indicating the sign of level
2890c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  last            status of the last flag
2900c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pIndex          pointer to coefficient index in 8x8 matrix
2910c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pIndex          pointer to updated coefficient index in 8x8
2920c1bc742181ded4930842b46e9507372f0b1b963James Dong *                       matrix
2930c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pZigzagTable    pointer to the zigzag tables
2940c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pDst            pointer to the coefficient buffer of current
2950c1bc742181ded4930842b46e9507372f0b1b963James Dong *                       block. Should be 32-bit aligned
2960c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
2970c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
2980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2990c1bc742181ded4930842b46e9507372f0b1b963James Dong */
3000c1bc742181ded4930842b46e9507372f0b1b963James Dong
3010c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_FillVLDBuffer(
3020c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 storeRun,
3030c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 * pDst,
3040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 storeLevel,
3050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8  sign,
3060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8  last,
3070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8  * index,
3080c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 * pZigzagTable
3090c1bc742181ded4930842b46e9507372f0b1b963James Dong);
3100c1bc742181ded4930842b46e9507372f0b1b963James Dong
3110c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
3120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_GetVLCBits
3130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3140c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
3150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs escape mode decision based on the run, run+, level, level+ and
3160c1bc742181ded4930842b46e9507372f0b1b963James Dong * last combinations.
3170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
3190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
3210c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	ppBitStream		pointer to the pointer to the current byte in
3220c1bc742181ded4930842b46e9507372f0b1b963James Dong *								the bit stream
3230c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pBitOffset		pointer to the bit position in the byte pointed
3240c1bc742181ded4930842b46e9507372f0b1b963James Dong *								by *ppBitStream. Valid within 0 to 7
3250c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
3260c1bc742181ded4930842b46e9507372f0b1b963James Dong *                           and escape mode 4 is used when shortVideoHeader==1.
3270c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] start           start indicates whether the encoding begins with
3280c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      0th element or 1st.
3290c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in/out] pLast       pointer to last status flag
3300c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] runBeginSingleLevelEntriesL0      The run value from which level
3310c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        will be equal to 1: last == 0
3320c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] IndexBeginSingleLevelEntriesL0    Array index in the VLC table
3330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        pointing to the
3340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        runBeginSingleLevelEntriesL0
3350c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] runBeginSingleLevelEntriesL1      The run value from which level
3360c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        will be equal to 1: last == 1
3370c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] IndexBeginSingleLevelEntriesL1    Array index in the VLC table
3380c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        pointing to the
3390c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                        runBeginSingleLevelEntriesL0
3400c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pRunIndexTableL0    Run Index table defined in
3410c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 0
3420c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pVlcTableL0         VLC table for last == 0
3430c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pRunIndexTableL1    Run Index table defined in
3440c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 1
3450c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pVlcTableL1         VLC table for last == 1
3460c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pLMAXTableL0        Level MAX table defined in
3470c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 0
3480c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pLMAXTableL1        Level MAX table defined in
3490c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 1
3500c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pRMAXTableL0        Run MAX table defined in
3510c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 0
3520c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pRMAXTableL1        Run MAX table defined in
3530c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_Tables_VLC.c for last == 1
3540c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]pDst			    pointer to the coefficient buffer of current
3550c1bc742181ded4930842b46e9507372f0b1b963James Dong *							block. Should be 32-bit aligned
3560c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
3580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
3590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3600c1bc742181ded4930842b46e9507372f0b1b963James Dong */
3610c1bc742181ded4930842b46e9507372f0b1b963James Dong
3620c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_GetVLCBits (
3630c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8 **ppBitStream,
3640c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_INT * pBitOffset,
3650c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_S16 * pDst,
3660c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_INT shortVideoHeader,
3670c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8    start,
3680c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8  * pLast,
3690c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8    runBeginSingleLevelEntriesL0,
3700c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8    maxIndexForMultipleEntriesL0,
3710c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8    maxRunForMultipleEntriesL1,
3720c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8    maxIndexForMultipleEntriesL1,
3730c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRunIndexTableL0,
3740c1bc742181ded4930842b46e9507372f0b1b963James Dong              const ARM_VLC32 *pVlcTableL0,
3750c1bc742181ded4930842b46e9507372f0b1b963James Dong			  const OMX_U8  * pRunIndexTableL1,
3760c1bc742181ded4930842b46e9507372f0b1b963James Dong              const ARM_VLC32 *pVlcTableL1,
3770c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pLMAXTableL0,
3780c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pLMAXTableL1,
3790c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRMAXTableL0,
3800c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRMAXTableL1,
3810c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pZigzagTable
3820c1bc742181ded4930842b46e9507372f0b1b963James Dong);
3830c1bc742181ded4930842b46e9507372f0b1b963James Dong
3840c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
3850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_PutVLCBits
3860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
3880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Checks the type of Escape Mode and put encoded bits for
3890c1bc742181ded4930842b46e9507372f0b1b963James Dong * quantized DCT coefficients.
3900c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3910c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
3920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3930c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
3940c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	 ppBitStream      pointer to the pointer to the current byte in
3950c1bc742181ded4930842b46e9507372f0b1b963James Dong *						  the bit stream
3960c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	 pBitOffset       pointer to the bit position in the byte pointed
3970c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        by *ppBitStream. Valid within 0 to 7
3980c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
3990c1bc742181ded4930842b46e9507372f0b1b963James Dong *                           and escape mode 4 is used when shortVideoHeader==1.
4000c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  start            start indicates whether the encoding begins with
4010c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        0th element or 1st.
4020c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  maxStoreRunL0    Max store possible (considering last and inter/intra)
4030c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        for last = 0
4040c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  maxStoreRunL1    Max store possible (considering last and inter/intra)
4050c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        for last = 1
4060c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  maxRunForMultipleEntriesL0
4070c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        The run value after which level
4080c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        will be equal to 1:
4090c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        (considering last and inter/intra status) for last = 0
4100c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  maxRunForMultipleEntriesL1
4110c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        The run value after which level
4120c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        will be equal to 1:
4130c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        (considering last and inter/intra status) for last = 1
4140c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pRunIndexTableL0 Run Index table defined in
4150c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 0
4160c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pVlcTableL0      VLC table for last == 0
4170c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pRunIndexTableL1 Run Index table defined in
4180c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 1
4190c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pVlcTableL1      VLC table for last == 1
4200c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pLMAXTableL0     Level MAX table defined in
4210c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 0
4220c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pLMAXTableL1     Level MAX table defined in
4230c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 1
4240c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pRMAXTableL0     Run MAX table defined in
4250c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 0
4260c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pRMAXTableL1     Run MAX table defined in
4270c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        armVCM4P2_Huff_Tables_VLC.c for last == 1
4280c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pQDctBlkCoef     pointer to the quantized DCT coefficient
4290c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] ppBitStream      *ppBitStream is updated after the block is encoded
4300c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        so that it points to the current byte in the bit
4310c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        stream buffer.
4320c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pBitOffset       *pBitOffset is updated so that it points to the
4330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        current bit position in the byte pointed by
4340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                        *ppBitStream.
4350c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4360c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
4370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
4380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4390c1bc742181ded4930842b46e9507372f0b1b963James Dong */
4400c1bc742181ded4930842b46e9507372f0b1b963James Dong
4410c1bc742181ded4930842b46e9507372f0b1b963James Dong
4420c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_PutVLCBits (
4430c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8 **ppBitStream,
4440c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_INT * pBitOffset,
4450c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_S16 *pQDctBlkCoef,
4460c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_INT shortVideoHeader,
4470c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8 start,
4480c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8 maxStoreRunL0,
4490c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8 maxStoreRunL1,
4500c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8  maxRunForMultipleEntriesL0,
4510c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8  maxRunForMultipleEntriesL1,
4520c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRunIndexTableL0,
4530c1bc742181ded4930842b46e9507372f0b1b963James Dong              const ARM_VLC32 *pVlcTableL0,
4540c1bc742181ded4930842b46e9507372f0b1b963James Dong			  const OMX_U8  * pRunIndexTableL1,
4550c1bc742181ded4930842b46e9507372f0b1b963James Dong              const ARM_VLC32 *pVlcTableL1,
4560c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pLMAXTableL0,
4570c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pLMAXTableL1,
4580c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRMAXTableL0,
4590c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pRMAXTableL1,
4600c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  * pZigzagTable
4610c1bc742181ded4930842b46e9507372f0b1b963James Dong);
4620c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
4630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_FillVLCBuffer
4640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
4660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs calculating the VLC bits depending on the escape type and insert
4670c1bc742181ded4930842b46e9507372f0b1b963James Dong * the same in the bitstream
4680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
4700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
4720c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	 ppBitStream		pointer to the pointer to the current byte in
4730c1bc742181ded4930842b46e9507372f0b1b963James Dong *	                        the bit stream
4740c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	 pBitOffset         pointer to the bit position in the byte pointed
4750c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          by *ppBitStream. Valid within 0 to 7
4760c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  run                Run value (count of zeros) to be encoded
4770c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  level              Level value (non-zero value) to be encoded
4780c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  runPlus            Calculated as runPlus = run - (RMAX + 1)
4790c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  levelPlus          Calculated as
4800c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          levelPlus = sign(level)*[abs(level) - LMAX]
4810c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  fMode              Flag indicating the escape modes
4820c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  last               status of the last flag
4830c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  maxRunForMultipleEntries
4840c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          The run value after which level will be equal to 1:
4850c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          (considering last and inter/intra status)
4860c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pRunIndexTable     Run Index table defined in
4870c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          armVCM4P2_Huff_tables_VLC.h
4880c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pVlcTable          VLC table defined in armVCM4P2_Huff_tables_VLC.h
4890c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] ppBitStream		*ppBitStream is updated after the block is encoded
4900c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          so that it points to the current byte in the bit
4910c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          stream buffer.
4920c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pBitOffset         *pBitOffset is updated so that it points to the
4930c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          current bit position in the byte pointed by
4940c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          *ppBitStream.
4950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4960c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
4970c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
4980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4990c1bc742181ded4930842b46e9507372f0b1b963James Dong */
5000c1bc742181ded4930842b46e9507372f0b1b963James Dong
5010c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_FillVLCBuffer (
5020c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8 **ppBitStream,
5030c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_INT * pBitOffset,
5040c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U32 run,
5050c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_S16 level,
5060c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U32 runPlus,
5070c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_S16 levelPlus,
5080c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8  fMode,
5090c1bc742181ded4930842b46e9507372f0b1b963James Dong			  OMX_U8  last,
5100c1bc742181ded4930842b46e9507372f0b1b963James Dong              OMX_U8  maxRunForMultipleEntries,
5110c1bc742181ded4930842b46e9507372f0b1b963James Dong              const OMX_U8  *pRunIndexTable,
5120c1bc742181ded4930842b46e9507372f0b1b963James Dong              const ARM_VLC32 *pVlcTable
5130c1bc742181ded4930842b46e9507372f0b1b963James Dong);
5140c1bc742181ded4930842b46e9507372f0b1b963James Dong
5150c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
5160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_CheckVLCEscapeMode
5170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
5190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs escape mode decision based on the run, run+, level, level+ and
5200c1bc742181ded4930842b46e9507372f0b1b963James Dong * last combinations.
5210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
5230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
5250c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] run             Run value (count of zeros) to be encoded
5260c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] level           Level value (non-zero value) to be encoded
5270c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] runPlus         Calculated as runPlus = run - (RMAX + 1)
5280c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] levelPlus       Calculated as
5290c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      levelPlus = sign(level)*[abs(level) - LMAX]
5300c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] maxStoreRun     Max store possible (considering last and inter/intra)
5310c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] maxRunForMultipleEntries
5320c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      The run value after which level
5330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      will be equal to 1:
5340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      (considering last and inter/intra status)
5350c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0,
5360c1bc742181ded4930842b46e9507372f0b1b963James Dong *                           and escape mode 4 is used when shortVideoHeader==1.
5370c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pRunIndexTable  Run Index table defined in
5380c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      armVCM4P2_Huff_Tables_VLC.c
5390c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      (considering last and inter/intra status)
5400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
5430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Returns an Escape mode which can take values from 0 to 3
5440c1bc742181ded4930842b46e9507372f0b1b963James Dong * 0 --> no escape mode, 1 --> escape type 1,
5450c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3
5460c1bc742181ded4930842b46e9507372f0b1b963James Dong * in the MPEG ISO standard.
5470c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5480c1bc742181ded4930842b46e9507372f0b1b963James Dong */
5490c1bc742181ded4930842b46e9507372f0b1b963James Dong
5500c1bc742181ded4930842b46e9507372f0b1b963James DongOMX_U8 armVCM4P2_CheckVLCEscapeMode(
5510c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32 run,
5520c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32 runPlus,
5530c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 level,
5540c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 levelPlus,
5550c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8  maxStoreRun,
5560c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8  maxRunForMultipleEntries,
5570c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT shortVideoHeader,
5580c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8  *pRunIndexTable
5590c1bc742181ded4930842b46e9507372f0b1b963James Dong);
5600c1bc742181ded4930842b46e9507372f0b1b963James Dong
5610c1bc742181ded4930842b46e9507372f0b1b963James Dong
5620c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
5630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_BlockMatch_Integer
5640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
5660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a 16x16 block search; estimates motion vector and associated minimum SAD.
5670c1bc742181ded4930842b46e9507372f0b1b963James Dong * Both the input and output motion vectors are represented using half-pixel units, and
5680c1bc742181ded4930842b46e9507372f0b1b963James Dong * therefore a shift left or right by 1 bit may be required, respectively, to match the
5690c1bc742181ded4930842b46e9507372f0b1b963James Dong * input or output MVs with other functions that either generate output MVs or expect
5700c1bc742181ded4930842b46e9507372f0b1b963James Dong * input MVs represented using integer pixel units.
5710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
5730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
5750c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcRefBuf		pointer to the reference Y plane; points to the reference MB that
5760c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    corresponds to the location of the current macroblock in the current
5770c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    plane.
5780c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	refWidth		  width of the reference plane
5790c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pRefRect		  pointer to the valid rectangular in reference plane. Relative to image origin.
5800c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    It's not limited to the image boundary, but depended on the padding. For example,
5810c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    if you pad 4 pixels outside the image border, then the value for left border
5820c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    can be -4
5830c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcCurrBuf		pointer to the current macroblock extracted from original plane (linear array,
5840c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    256 entries); must be aligned on an 8-byte boundary.
5850c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pCurrPointPos	position of the current macroblock in the current plane
5860c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pSrcPreMV		  pointer to predicted motion vector; NULL indicates no predicted MV
5870c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pSrcPreSAD		pointer to SAD associated with the predicted MV (referenced by pSrcPreMV)
5880c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] searchRange		search range for 16X16 integer block,the units of it is full pixel,the search range
5890c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    is the same in all directions.It is in inclusive of the boundary and specified in
5900c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    terms of integer pixel units.
5910c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pMESpec			  vendor-specific motion estimation specification structure; must have been allocated
5920c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    and then initialized using omxVCM4P2_MEInit prior to calling the block matching
5930c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    function.
5940c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] BlockSize     MacroBlock Size i.e either 16x16 or 8x8.
5950c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDstMV			pointer to estimated MV
5960c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDstSAD			pointer to minimum SAD
5970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
5980c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
5990c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr �C no error.
6000c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr �C bad arguments
6010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6020c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6030c1bc742181ded4930842b46e9507372f0b1b963James Dong
6040c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_BlockMatch_Integer(
6050c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcRefBuf,
6060c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT refWidth,
6070c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMXRect *pRefRect,
6080c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcCurrBuf,
6090c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMXVCM4P2Coordinate *pCurrPointPos,
6100c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMXVCMotionVector *pSrcPreMV,
6110c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_INT *pSrcPreSAD,
6120c1bc742181ded4930842b46e9507372f0b1b963James Dong     void *pMESpec,
6130c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXVCMotionVector *pDstMV,
6140c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *pDstSAD,
6150c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 BlockSize
6160c1bc742181ded4930842b46e9507372f0b1b963James Dong);
6170c1bc742181ded4930842b46e9507372f0b1b963James Dong
6180c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
6190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_BlockMatch_Half
6200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
6220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a 16x16 block match with half-pixel resolution.  Returns the estimated
6230c1bc742181ded4930842b46e9507372f0b1b963James Dong * motion vector and associated minimum SAD.  This function estimates the half-pixel
6240c1bc742181ded4930842b46e9507372f0b1b963James Dong * motion vector by interpolating the integer resolution motion vector referenced
6250c1bc742181ded4930842b46e9507372f0b1b963James Dong * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated
6260c1bc742181ded4930842b46e9507372f0b1b963James Dong * externally.  The input parameters pSrcRefBuf and pSearchPointRefPos should be
6270c1bc742181ded4930842b46e9507372f0b1b963James Dong * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16.
6280c1bc742181ded4930842b46e9507372f0b1b963James Dong * The function BlockMatch_Integer_16x16 may be used for integer motion estimation.
6290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6300c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
6310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
6330c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcRefBuf		pointer to the reference Y plane; points to the reference MB
6340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    that corresponds to the location of the current macroblock in
6350c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    the	current plane.
6360c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	refWidth		  width of the reference plane
6370c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pRefRect		  reference plane valid region rectangle
6380c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcCurrBuf		pointer to the current macroblock extracted from original plane
6390c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    (linear array, 256 entries); must be aligned on an 8-byte boundary.
6400c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSearchPointRefPos	position of the starting point for half pixel search (specified
6410c1bc742181ded4930842b46e9507372f0b1b963James Dong *                          in terms of integer pixel units) in the reference plane.
6420c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	rndVal			  rounding control bit for half pixel motion estimation;
6430c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    0=rounding control disabled; 1=rounding control enabled
6440c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcDstMV		pointer to the initial MV estimate; typically generated during a prior
6450c1bc742181ded4930842b46e9507372f0b1b963James Dong *                  16X16 integer search and its unit is half pixel.
6460c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] BlockSize     MacroBlock Size i.e either 16x16 or 8x8.
6470c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]pSrcDstMV		pointer to estimated MV
6480c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]pDstSAD			pointer to minimum SAD
6490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
6510c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_NoErr �C no error
6520c1bc742181ded4930842b46e9507372f0b1b963James Dong * OMX_Sts_BadArgErr �C bad arguments
6530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6540c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6550c1bc742181ded4930842b46e9507372f0b1b963James Dong
6560c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_BlockMatch_Half(
6570c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcRefBuf,
6580c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT refWidth,
6590c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMXRect *pRefRect,
6600c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcCurrBuf,
6610c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMXVCM4P2Coordinate *pSearchPointRefPos,
6620c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT rndVal,
6630c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXVCMotionVector *pSrcDstMV,
6640c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT *pDstSAD,
6650c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 BlockSize
6660c1bc742181ded4930842b46e9507372f0b1b963James Dong);
6670c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
6680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P2_PadMV
6690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6700c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
6710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs motion vector padding for a macroblock.
6720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6730c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
6740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
6760c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pSrcDstMV       pointer to motion vector buffer of the current
6770c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              macroblock
6780c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] pTransp         pointer to transparent status buffer of the
6790c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              current macroblock
6800c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]    pSrcDstMV       pointer to motion vector buffer in which the
6810c1bc742181ded4930842b46e9507372f0b1b963James Dong *                              motion vectors have been padded
6820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
6830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult result. See enumeration for possible result codes.
6840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6850c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6860c1bc742181ded4930842b46e9507372f0b1b963James Dong
6870c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P2_PadMV(
6880c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMXVCMotionVector * pSrcDstMV,
6890c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 * pTransp
6900c1bc742181ded4930842b46e9507372f0b1b963James Dong);
6910c1bc742181ded4930842b46e9507372f0b1b963James Dong
6920c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
6930c1bc742181ded4930842b46e9507372f0b1b963James Dong * H.264 Specific Declarations
6940c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6950c1bc742181ded4930842b46e9507372f0b1b963James Dong/* Defines */
6960c1bc742181ded4930842b46e9507372f0b1b963James Dong#define ARM_M4P10_Q_OFFSET        (15)
6970c1bc742181ded4930842b46e9507372f0b1b963James Dong
6980c1bc742181ded4930842b46e9507372f0b1b963James Dong
6990c1bc742181ded4930842b46e9507372f0b1b963James Dong/* Dequant tables */
7000c1bc742181ded4930842b46e9507372f0b1b963James Dong
7010c1bc742181ded4930842b46e9507372f0b1b963James Dongextern const OMX_U8 armVCM4P10_PosToVCol4x4[16];
7020c1bc742181ded4930842b46e9507372f0b1b963James Dongextern const OMX_U8 armVCM4P10_PosToVCol2x2[4];
7030c1bc742181ded4930842b46e9507372f0b1b963James Dongextern const OMX_U8 armVCM4P10_VMatrix[6][3];
7040c1bc742181ded4930842b46e9507372f0b1b963James Dongextern const OMX_U32 armVCM4P10_MFMatrix[6][3];
7050c1bc742181ded4930842b46e9507372f0b1b963James Dong
7060c1bc742181ded4930842b46e9507372f0b1b963James Dong
7070c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
7080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
7090c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function perform the work required by the OpenMAX
7100c1bc742181ded4930842b46e9507372f0b1b963James Dong * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair.
7110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Since most of the code is common we share it here.
7120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
7140c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	ppBitStream		Double pointer to current byte in bit stream buffer
7150c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pOffset			Pointer to current bit position in the byte pointed
7160c1bc742181ded4930842b46e9507372f0b1b963James Dong *								to by *ppBitStream
7170c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	sMaxNumCoeff	Maximum number of non-zero coefficients in current
7180c1bc742181ded4930842b46e9507372f0b1b963James Dong *								block (4,15 or 16)
7190c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	nTable          Table number (0 to 4) according to the five columns
7200c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      of Table 9-5 in the H.264 spec
7210c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	ppBitStream		*ppBitStream is updated after each block is decoded
7220c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pOffset			*pOffset is updated after each block is decoded
7230c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pNumCoeff		Pointer to the number of nonzero coefficients in
7240c1bc742181ded4930842b46e9507372f0b1b963James Dong *								this block
7250c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	ppPosCoefbuf	Double pointer to destination residual
7260c1bc742181ded4930842b46e9507372f0b1b963James Dong *								coefficient-position pair buffer
7270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
7280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard omxError result. See enumeration for possible result codes.
7290c1bc742181ded4930842b46e9507372f0b1b963James Dong
7300c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7310c1bc742181ded4930842b46e9507372f0b1b963James Dong
7320c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_DecodeCoeffsToPair(
7330c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8** ppBitStream,
7340c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32* pOffset,
7350c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pNumCoeff,
7360c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8**ppPosCoefbuf,
7370c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT nTable,
7380c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT sMaxNumCoeff
7390c1bc742181ded4930842b46e9507372f0b1b963James Dong );
7400c1bc742181ded4930842b46e9507372f0b1b963James Dong
7410c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
7420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
7430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Perform DC style intra prediction, averaging upper and left block
7440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
7460c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcLeft		Pointer to the buffer of 16 left coefficients:
7470c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x, y] (x = -1, y = 0..3)
7480c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pSrcAbove		Pointer to the buffer of 16 above coefficients:
7490c1bc742181ded4930842b46e9507372f0b1b963James Dong *								p[x,y] (x = 0..3, y = -1)
7500c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	leftStep		Step of left coefficient buffer
7510c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	dstStep			Step of the destination buffer
7520c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	availability	Neighboring 16x16 MB availability flag
7530c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst			Pointer to the destination buffer
7540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7550c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
7560c1bc742181ded4930842b46e9507372f0b1b963James Dong * None
7570c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7580c1bc742181ded4930842b46e9507372f0b1b963James Dong
7590c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_PredictIntraDC4x4(
7600c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8* pSrcLeft,
7610c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 *pSrcAbove,
7620c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8* pDst,
7630c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT leftStep,
7640c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT dstStep,
7650c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S32 availability
7660c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7670c1bc742181ded4930842b46e9507372f0b1b963James Dong
7680c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
7690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description
7700c1bc742181ded4930842b46e9507372f0b1b963James Dong * Unpack a 4x4 block of coefficient-residual pair values
7710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
7730c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	ppSrc	Double pointer to residual coefficient-position pair
7740c1bc742181ded4930842b46e9507372f0b1b963James Dong *						buffer output by CALVC decoding
7750c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	ppSrc	*ppSrc is updated to the start of next non empty block
7760c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst	Pointer to unpacked 4x4 block
7770c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7780c1bc742181ded4930842b46e9507372f0b1b963James Dong
7790c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_UnpackBlock4x4(
7800c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 **ppSrc,
7810c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16* pDst
7820c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7830c1bc742181ded4930842b46e9507372f0b1b963James Dong
7840c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
7850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description
7860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Unpack a 2x2 block of coefficient-residual pair values
7870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
7890c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	ppSrc	Double pointer to residual coefficient-position pair
7900c1bc742181ded4930842b46e9507372f0b1b963James Dong *						buffer output by CALVC decoding
7910c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	ppSrc	*ppSrc is updated to the start of next non empty block
7920c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst	Pointer to unpacked 4x4 block
7930c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7940c1bc742181ded4930842b46e9507372f0b1b963James Dong
7950c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_UnpackBlock2x2(
7960c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8 **ppSrc,
7970c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16* pDst
7980c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7990c1bc742181ded4930842b46e9507372f0b1b963James Dong
8000c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
8010c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description
8020c1bc742181ded4930842b46e9507372f0b1b963James Dong * Deblock one boundary pixel
8030c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
8050c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pQ0         Pointer to pixel q0
8060c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] Step        Step between pixels q0 and q1
8070c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] tC0         Edge threshold value
8080c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] alpha       alpha threshold value
8090c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] beta        beta threshold value
8100c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] bS          deblocking strength
8110c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] ChromaFlag  True for chroma blocks
8120c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pQ0        Deblocked pixels
8130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8140c1bc742181ded4930842b46e9507372f0b1b963James Dong */
8150c1bc742181ded4930842b46e9507372f0b1b963James Dong
8160c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_DeBlockPixel(
8170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pQ0,    /* pointer to the pixel q0 */
8180c1bc742181ded4930842b46e9507372f0b1b963James Dong    int Step,       /* step between pixels q0 and q1 */
8190c1bc742181ded4930842b46e9507372f0b1b963James Dong    int tC0,        /* edge threshold value */
8200c1bc742181ded4930842b46e9507372f0b1b963James Dong    int alpha,      /* alpha */
8210c1bc742181ded4930842b46e9507372f0b1b963James Dong    int beta,       /* beta */
8220c1bc742181ded4930842b46e9507372f0b1b963James Dong    int bS,         /* deblocking strength */
8230c1bc742181ded4930842b46e9507372f0b1b963James Dong    int ChromaFlag
8240c1bc742181ded4930842b46e9507372f0b1b963James Dong);
8250c1bc742181ded4930842b46e9507372f0b1b963James Dong
8260c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
8270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_InterpolateHalfHor_Luma
8280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
8300c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for horizontal 1/2-pel positions
8310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
8330c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8340c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	pSrc			Pointer to top-left corner of block used to interpolate
8350c1bc742181ded4930842b46e9507372f0b1b963James Dong 													in the reconstructed frame plane
8360c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iSrcStep	Step of the source buffer.
8370c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iDstStep	Step of the destination(interpolation) buffer.
8380c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iWidth		Width of the current block
8390c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iHeight		Height of the current block
8400c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[out]	pDst	    Pointer to the interpolation buffer of the 1/2-pel
8410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
8430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
8440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8450c1bc742181ded4930842b46e9507372f0b1b963James Dong */
8460c1bc742181ded4930842b46e9507372f0b1b963James Dong
8470c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_InterpolateHalfHor_Luma(
8480c1bc742181ded4930842b46e9507372f0b1b963James Dong        const OMX_U8*		pSrc,
8490c1bc742181ded4930842b46e9507372f0b1b963James Dong		OMX_U32 	iSrcStep,
8500c1bc742181ded4930842b46e9507372f0b1b963James Dong		OMX_U8* 	pDst,
8510c1bc742181ded4930842b46e9507372f0b1b963James Dong		OMX_U32 	iDstStep,
8520c1bc742181ded4930842b46e9507372f0b1b963James Dong		OMX_U32 	iWidth,
8530c1bc742181ded4930842b46e9507372f0b1b963James Dong		OMX_U32 	iHeight
8540c1bc742181ded4930842b46e9507372f0b1b963James Dong);
8550c1bc742181ded4930842b46e9507372f0b1b963James Dong
8560c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
8570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_InterpolateHalfVer_Luma
8580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8590c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
8600c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for vertical 1/2-pel positions
8610c1bc742181ded4930842b46e9507372f0b1b963James Dong * around a full-pel position.
8620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
8640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8650c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	pSrc			Pointer to top-left corner of block used to interpolate
8660c1bc742181ded4930842b46e9507372f0b1b963James Dong *												in the reconstructed frame plane
8670c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iSrcStep	Step of the source buffer.
8680c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iDstStep	Step of the destination(interpolation) buffer.
8690c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iWidth		Width of the current block
8700c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iHeight		Height of the current block
8710c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[out]	pDst    	Pointer to the interpolation buffer of the 1/2-pel
8720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8730c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
8740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
8750c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8760c1bc742181ded4930842b46e9507372f0b1b963James Dong */
8770c1bc742181ded4930842b46e9507372f0b1b963James Dong
8780c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_InterpolateHalfVer_Luma(
8790c1bc742181ded4930842b46e9507372f0b1b963James Dong	 const OMX_U8* 	pSrc,
8800c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32 	iSrcStep,
8810c1bc742181ded4930842b46e9507372f0b1b963James Dong 	 OMX_U8* 	pDst,
8820c1bc742181ded4930842b46e9507372f0b1b963James Dong 	 OMX_U32 	iDstStep,
8830c1bc742181ded4930842b46e9507372f0b1b963James Dong 	 OMX_U32 	iWidth,
8840c1bc742181ded4930842b46e9507372f0b1b963James Dong 	 OMX_U32 	iHeight
8850c1bc742181ded4930842b46e9507372f0b1b963James Dong);
8860c1bc742181ded4930842b46e9507372f0b1b963James Dong
8870c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
8880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_InterpolateHalfDiag_Luma
8890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
8910c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for (1/2, 1/2)  positions
8920c1bc742181ded4930842b46e9507372f0b1b963James Dong * around a full-pel position.
8930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
8950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8960c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    pSrc        Pointer to top-left corner of block used to interpolate
8970c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      in the reconstructed frame plane
8980c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iSrcStep    Step of the source buffer.
8990c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iDstStep    Step of the destination(interpolation) buffer.
9000c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iWidth      Width of the current block
9010c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iHeight     Height of the current block
9020c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [out]   pDst        Pointer to the interpolation buffer of the (1/2,1/2)-pel
9030c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
9050c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
9060c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9070c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9080c1bc742181ded4930842b46e9507372f0b1b963James Dong
9090c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_InterpolateHalfDiag_Luma(
9100c1bc742181ded4930842b46e9507372f0b1b963James Dong        const OMX_U8*     pSrc,
9110c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iSrcStep,
9120c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U8*     pDst,
9130c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iDstStep,
9140c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iWidth,
9150c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iHeight
9160c1bc742181ded4930842b46e9507372f0b1b963James Dong);
9170c1bc742181ded4930842b46e9507372f0b1b963James Dong
9180c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
9190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Transform Residual 4x4 Coefficients
9210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
9230c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pSrc		Source 4x4 block
9240c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pDst		Destination 4x4 block
9250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9260c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9270c1bc742181ded4930842b46e9507372f0b1b963James Dong
9280c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
9290c1bc742181ded4930842b46e9507372f0b1b963James Dong
9300c1bc742181ded4930842b46e9507372f0b1b963James Dong/*
9310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Forward Transform Residual 4x4 Coefficients
9330c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9340c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
9350c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]  pSrc		Source 4x4 block
9360c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out] pDst		Destination 4x4 block
9370c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9380c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9390c1bc742181ded4930842b46e9507372f0b1b963James Dong
9400c1bc742181ded4930842b46e9507372f0b1b963James Dongvoid armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc);
9410c1bc742181ded4930842b46e9507372f0b1b963James Dong
9420c1bc742181ded4930842b46e9507372f0b1b963James DongOMX_INT armVCM4P10_CompareMotionCostToMV (
9430c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16  mvX,
9440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16  mvY,
9450c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector diffMV,
9460c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT candSAD,
9470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *bestMV,
9480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 nLamda,
9490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pBestCost);
9500c1bc742181ded4930842b46e9507372f0b1b963James Dong
9510c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
9520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCCOMM_SAD
9530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9550c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculate the SAD for NxM blocks.
9560c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
9580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9590c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		pSrcOrg		Pointer to the original block
9600c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iStepOrg	Step of the original block buffer
9610c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		pSrcRef		Pointer to the reference block
9620c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iStepRef	Step of the reference block buffer
9630c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iHeight		Height of the block
9640c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iWidth		Width of the block
9650c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDstSAD		Pointer of result SAD
9660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9670c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
9680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
9690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9700c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9710c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCCOMM_SAD(
9720c1bc742181ded4930842b46e9507372f0b1b963James Dong	const OMX_U8* 	pSrcOrg,
9730c1bc742181ded4930842b46e9507372f0b1b963James Dong	OMX_U32 	iStepOrg,
9740c1bc742181ded4930842b46e9507372f0b1b963James Dong	const OMX_U8* 	pSrcRef,
9750c1bc742181ded4930842b46e9507372f0b1b963James Dong	OMX_U32 	iStepRef,
9760c1bc742181ded4930842b46e9507372f0b1b963James Dong	OMX_S32*	pDstSAD,
9770c1bc742181ded4930842b46e9507372f0b1b963James Dong	OMX_U32		iHeight,
9780c1bc742181ded4930842b46e9507372f0b1b963James Dong	OMX_U32		iWidth);
9790c1bc742181ded4930842b46e9507372f0b1b963James Dong
9800c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
9810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCCOMM_Average
9820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9840c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the average of two blocks and stores the result.
9850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
9870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9880c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	pPred0			Pointer to the top-left corner of reference block 0
9890c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	pPred1			Pointer to the top-left corner of reference block 1
9900c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iPredStep0	    Step of reference block 0
9910c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iPredStep1	    Step of reference block 1
9920c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iDstStep 		Step of the destination buffer
9930c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iWidth			Width of the blocks
9940c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[in]	iHeight			Height of the blocks
9950c1bc742181ded4930842b46e9507372f0b1b963James Dong *	[out]	pDstPred		Pointer to the destination buffer
9960c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9970c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
9980c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
9990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10000c1bc742181ded4930842b46e9507372f0b1b963James Dong */
10010c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXResult armVCCOMM_Average (
10020c1bc742181ded4930842b46e9507372f0b1b963James Dong	 const OMX_U8* 	    pPred0,
10030c1bc742181ded4930842b46e9507372f0b1b963James Dong	 const OMX_U8* 	    pPred1,
10040c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32		iPredStep0,
10050c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32		iPredStep1,
10060c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U8*		pDstPred,
10070c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32		iDstStep,
10080c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32		iWidth,
10090c1bc742181ded4930842b46e9507372f0b1b963James Dong	 OMX_U32		iHeight
10100c1bc742181ded4930842b46e9507372f0b1b963James Dong);
10110c1bc742181ded4930842b46e9507372f0b1b963James Dong
10120c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
10130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_SADQuar
10140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
10160c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD between one block (pSrc) and the
10170c1bc742181ded4930842b46e9507372f0b1b963James Dong * average of the other two (pSrcRef0 and pSrcRef1)
10180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
10200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10210c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		pSrc				Pointer to the original block
10220c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		pSrcRef0		Pointer to reference block 0
10230c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		pSrcRef1		Pointer to reference block 1
10240c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iSrcStep 		Step of the original block buffer
10250c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iRefStep0		Step of reference block 0
10260c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iRefStep1 	Step of reference block 1
10270c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iHeight			Height of the block
10280c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]		iWidth			Width of the block
10290c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDstSAD			Pointer of result SAD
10300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
10320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
10330c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10340c1bc742181ded4930842b46e9507372f0b1b963James Dong */
10350c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_SADQuar(
10360c1bc742181ded4930842b46e9507372f0b1b963James Dong	const OMX_U8* 	pSrc,
10370c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8* 	pSrcRef0,
10380c1bc742181ded4930842b46e9507372f0b1b963James Dong	const OMX_U8* 	pSrcRef1,
10390c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 	iSrcStep,
10400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32		iRefStep0,
10410c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32		iRefStep1,
10420c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32*	pDstSAD,
10430c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32     iHeight,
10440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32     iWidth
10450c1bc742181ded4930842b46e9507372f0b1b963James Dong);
10460c1bc742181ded4930842b46e9507372f0b1b963James Dong
10470c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
10480c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_Interpolate_Chroma
10490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
10510c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for chroma components.
10520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
10540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10550c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    pSrc            Pointer to top-left corner of block used to
10560c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              interpolate in the reconstructed frame plane
10570c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iSrcStep    Step of the source buffer.
10580c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iDstStep    Step of the destination(interpolation) buffer.
10590c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iWidth      Width of the current block
10600c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iHeight     Height of the current block
10610c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    dx              Fractional part of horizontal motion vector
10620c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              component in 1/8 pixel unit (0~7)
10630c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    dy              Fractional part of vertical motion vector
10640c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              component in 1/8 pixel unit (0~7)
10650c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [out]   pDst            Pointer to the interpolation buffer
10660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10670c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
10680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
10690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10700c1bc742181ded4930842b46e9507372f0b1b963James Dong */
10710c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXResult armVCM4P10_Interpolate_Chroma(
10720c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U8      *pSrc,
10730c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iSrcStep,
10740c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U8      *pDst,
10750c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iDstStep,
10760c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iWidth,
10770c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     iHeight,
10780c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     dx,
10790c1bc742181ded4930842b46e9507372f0b1b963James Dong        OMX_U32     dy
10800c1bc742181ded4930842b46e9507372f0b1b963James Dong);
10810c1bc742181ded4930842b46e9507372f0b1b963James Dong
10820c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
10830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: armVCM4P10_Interpolate_Luma
10840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
10860c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for luma components.
10870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
10890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10900c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    pSrc            Pointer to top-left corner of block used to
10910c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              interpolate in the reconstructed frame plane
10920c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iSrcStep    Step of the source buffer.
10930c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iDstStep    Step of the destination(interpolation) buffer.
10940c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iWidth      Width of the current block
10950c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    iHeight     Height of the current block
10960c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    dx              Fractional part of horizontal motion vector
10970c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              component in 1/4 pixel unit (0~3)
10980c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [in]    dy              Fractional part of vertical motion vector
10990c1bc742181ded4930842b46e9507372f0b1b963James Dong *                                              component in 1/4 pixel unit (0~3)
11000c1bc742181ded4930842b46e9507372f0b1b963James Dong *  [out]   pDst            Pointer to the interpolation buffer
11010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11020c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
11030c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard OMXResult value.
11040c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11050c1bc742181ded4930842b46e9507372f0b1b963James Dong */
11060c1bc742181ded4930842b46e9507372f0b1b963James Dong
11070c1bc742181ded4930842b46e9507372f0b1b963James Dong OMXResult armVCM4P10_Interpolate_Luma(
11080c1bc742181ded4930842b46e9507372f0b1b963James Dong     const OMX_U8     *pSrc,
11090c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    iSrcStep,
11100c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8     *pDst,
11110c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    iDstStep,
11120c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    iWidth,
11130c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    iHeight,
11140c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    dx,
11150c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U32    dy
11160c1bc742181ded4930842b46e9507372f0b1b963James Dong);
11170c1bc742181ded4930842b46e9507372f0b1b963James Dong
11180c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
11190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function: omxVCH264_DequantTransformACFromPair_U8_S16_C1_DLx
11200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
11220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
11230c1bc742181ded4930842b46e9507372f0b1b963James Dong * perform dequantisation and integer inverse transformation for 4x4 block of
11240c1bc742181ded4930842b46e9507372f0b1b963James Dong * residuals and update the pair buffer pointer to next non-empty block.
11250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Remarks:
11270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Parameters:
11290c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	ppSrc		Double pointer to residual coefficient-position
11300c1bc742181ded4930842b46e9507372f0b1b963James Dong *							pair buffer output by CALVC decoding
11310c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	pDC			Pointer to the DC coefficient of this block, NULL
11320c1bc742181ded4930842b46e9507372f0b1b963James Dong *							if it doesn't exist
11330c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in]	QP			Quantization parameter
11340c1bc742181ded4930842b46e9507372f0b1b963James Dong * [in] AC          Flag indicating if at least one non-zero coefficient exists
11350c1bc742181ded4930842b46e9507372f0b1b963James Dong * [out]	pDst		pointer to the reconstructed 4x4 block data
11360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
11380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Standard omxError result. See enumeration for possible result codes.
11390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11400c1bc742181ded4930842b46e9507372f0b1b963James Dong */
11410c1bc742181ded4930842b46e9507372f0b1b963James Dong
11420c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult armVCM4P10_DequantTransformACFromPair_U8_S16_C1_DLx(
11430c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_U8 **ppSrc,
11440c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16 *pDst,
11450c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_INT QP,
11460c1bc742181ded4930842b46e9507372f0b1b963James Dong     OMX_S16* pDC,
11470c1bc742181ded4930842b46e9507372f0b1b963James Dong     int AC
11480c1bc742181ded4930842b46e9507372f0b1b963James Dong);
11490c1bc742181ded4930842b46e9507372f0b1b963James Dong
11500c1bc742181ded4930842b46e9507372f0b1b963James Dong#endif  /*_armVideo_H_*/
11510c1bc742181ded4930842b46e9507372f0b1b963James Dong
11520c1bc742181ded4930842b46e9507372f0b1b963James Dong/*End of File*/
11530c1bc742181ded4930842b46e9507372f0b1b963James Dong
1154