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