10c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20c1bc742181ded4930842b46e9507372f0b1b963James Dong * File: omxVC.h
30c1bc742181ded4930842b46e9507372f0b1b963James Dong * Brief: OpenMAX DL v1.0.2 - Video Coding library
40c1bc742181ded4930842b46e9507372f0b1b963James Dong *
50c1bc742181ded4930842b46e9507372f0b1b963James Dong * Copyright � 2005-2008 The Khronos Group Inc. All Rights Reserved.
60c1bc742181ded4930842b46e9507372f0b1b963James Dong *
70c1bc742181ded4930842b46e9507372f0b1b963James Dong * These materials are protected by copyright laws and contain material
80c1bc742181ded4930842b46e9507372f0b1b963James Dong * proprietary to the Khronos Group, Inc.  You may use these materials
90c1bc742181ded4930842b46e9507372f0b1b963James Dong * for implementing Khronos specifications, without altering or removing
100c1bc742181ded4930842b46e9507372f0b1b963James Dong * any trademark, copyright or other notice from the specification.
110c1bc742181ded4930842b46e9507372f0b1b963James Dong *
120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Khronos Group makes no, and expressly disclaims any, representations
130c1bc742181ded4930842b46e9507372f0b1b963James Dong * or warranties, express or implied, regarding these materials, including,
140c1bc742181ded4930842b46e9507372f0b1b963James Dong * without limitation, any implied warranties of merchantability or fitness
150c1bc742181ded4930842b46e9507372f0b1b963James Dong * for a particular purpose or non-infringement of any intellectual property.
160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Khronos Group makes no, and expressly disclaims any, warranties, express
170c1bc742181ded4930842b46e9507372f0b1b963James Dong * or implied, regarding the correctness, accuracy, completeness, timeliness,
180c1bc742181ded4930842b46e9507372f0b1b963James Dong * and reliability of these materials.
190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Under no circumstances will the Khronos Group, or any of its Promoters,
210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Contributors or Members or their respective partners, officers, directors,
220c1bc742181ded4930842b46e9507372f0b1b963James Dong * employees, agents or representatives be liable for any damages, whether
230c1bc742181ded4930842b46e9507372f0b1b963James Dong * direct, indirect, special or consequential damages for lost revenues,
240c1bc742181ded4930842b46e9507372f0b1b963James Dong * lost profits, or otherwise, arising from or in connection with these
250c1bc742181ded4930842b46e9507372f0b1b963James Dong * materials.
260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
290c1bc742181ded4930842b46e9507372f0b1b963James Dong */
300c1bc742181ded4930842b46e9507372f0b1b963James Dong
310c1bc742181ded4930842b46e9507372f0b1b963James Dong/* *****************************************************************************************/
320c1bc742181ded4930842b46e9507372f0b1b963James Dong
330c1bc742181ded4930842b46e9507372f0b1b963James Dong#ifndef _OMXVC_H_
340c1bc742181ded4930842b46e9507372f0b1b963James Dong#define _OMXVC_H_
350c1bc742181ded4930842b46e9507372f0b1b963James Dong
360c1bc742181ded4930842b46e9507372f0b1b963James Dong#include "omxtypes.h"
370c1bc742181ded4930842b46e9507372f0b1b963James Dong
380c1bc742181ded4930842b46e9507372f0b1b963James Dong#ifdef __cplusplus
390c1bc742181ded4930842b46e9507372f0b1b963James Dongextern "C" {
400c1bc742181ded4930842b46e9507372f0b1b963James Dong#endif
410c1bc742181ded4930842b46e9507372f0b1b963James Dong
420c1bc742181ded4930842b46e9507372f0b1b963James Dong
430c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.1.1.1 Motion Vectors  */
440c1bc742181ded4930842b46e9507372f0b1b963James Dong/* In omxVC, motion vectors are represented as follows:  */
450c1bc742181ded4930842b46e9507372f0b1b963James Dong
460c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 dx;
480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 dy;
490c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCMotionVector;
500c1bc742181ded4930842b46e9507372f0b1b963James Dong
510c1bc742181ded4930842b46e9507372f0b1b963James Dong
520c1bc742181ded4930842b46e9507372f0b1b963James Dong
530c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_Average_8x   (6.1.3.1.1)
550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
570c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the average of two 8x4, 8x8, or 8x16 blocks.  The
580c1bc742181ded4930842b46e9507372f0b1b963James Dong * result is rounded according to (a+b+1)/2.  The block average function can
590c1bc742181ded4930842b46e9507372f0b1b963James Dong * be used in conjunction with half-pixel interpolation to obtain quarter
600c1bc742181ded4930842b46e9507372f0b1b963James Dong * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred0     - Pointer to the top-left corner of reference block 0
650c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred1     - Pointer to the top-left corner of reference block 1
660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep0 - Step of reference block 0
670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep1 - Step of reference block 1
680c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstStep   - Step of the destination buffer.
690c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight    - Height of the blocks
700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
730c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstPred - Pointer to the destination buffer. 8-byte aligned.
740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
770c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
790c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
800c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is NULL: pPred0, pPred1, or
810c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pDstPred.
820c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   pDstPred is not aligned on an 8-byte boundary.
830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iPredStep0 <= 0 or iPredStep0 is not a multiple of 8.
840c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iPredStep1 <= 0 or iPredStep1 is not a multiple of 8.
850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iDstStep   <= 0 or iDstStep is not a multiple of 8.
860c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iHeight is not 4, 8, or 16.
870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
880c1bc742181ded4930842b46e9507372f0b1b963James Dong */
890c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_Average_8x (
900c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred0,
910c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred1,
920c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep0,
930c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep1,
940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstPred,
950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstStep,
960c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
970c1bc742181ded4930842b46e9507372f0b1b963James Dong);
980c1bc742181ded4930842b46e9507372f0b1b963James Dong
990c1bc742181ded4930842b46e9507372f0b1b963James Dong
1000c1bc742181ded4930842b46e9507372f0b1b963James Dong
1010c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
1020c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_Average_16x   (6.1.3.1.2)
1030c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
1050c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the average of two 16x16 or 16x8 blocks.  The
1060c1bc742181ded4930842b46e9507372f0b1b963James Dong * result is rounded according to (a+b+1)/2.  The block average function can
1070c1bc742181ded4930842b46e9507372f0b1b963James Dong * be used in conjunction with half-pixel interpolation to obtain quarter
1080c1bc742181ded4930842b46e9507372f0b1b963James Dong * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1.
1090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
1110c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1120c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred0 - Pointer to the top-left corner of reference block 0
1130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred1 - Pointer to the top-left corner of reference block 1
1140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep0 - Step of reference block 0
1150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep1 - Step of reference block 1
1160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstStep - Step of the destination buffer
1170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the blocks
1180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
1200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstPred - Pointer to the destination buffer. 16-byte aligned.
1220c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1230c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1250c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
1260c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
1270c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
1280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is NULL: pPred0, pPred1, or
1290c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pDstPred.
1300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   pDstPred is not aligned on a 16-byte boundary.
1310c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iPredStep0 <= 0 or iPredStep0 is not a multiple of 16.
1320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iPredStep1 <= 0 or iPredStep1 is not a multiple of 16.
1330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iDstStep <= 0 or iDstStep is not a multiple of 16.
1340c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   iHeight is not 8 or 16.
1350c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1360c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1370c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_Average_16x (
1380c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred0,
1390c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred1,
1400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep0,
1410c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep1,
1420c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstPred,
1430c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstStep,
1440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
1450c1bc742181ded4930842b46e9507372f0b1b963James Dong);
1460c1bc742181ded4930842b46e9507372f0b1b963James Dong
1470c1bc742181ded4930842b46e9507372f0b1b963James Dong
1480c1bc742181ded4930842b46e9507372f0b1b963James Dong
1490c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
1500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_ExpandFrame_I   (6.1.3.2.1)
1510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
1530c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function expands a reconstructed frame in-place.  The unexpanded
1540c1bc742181ded4930842b46e9507372f0b1b963James Dong * source frame should be stored in a plane buffer with sufficient space
1550c1bc742181ded4930842b46e9507372f0b1b963James Dong * pre-allocated for edge expansion, and the input frame should be located in
1560c1bc742181ded4930842b46e9507372f0b1b963James Dong * the plane buffer center.  This function executes the pixel expansion by
1570c1bc742181ded4930842b46e9507372f0b1b963James Dong * replicating source frame edge pixel intensities in the empty pixel
1580c1bc742181ded4930842b46e9507372f0b1b963James Dong * locations (expansion region) between the source frame edge and the plane
1590c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer edge.  The width/height of the expansion regions on the
1600c1bc742181ded4930842b46e9507372f0b1b963James Dong * horizontal/vertical edges is controlled by the parameter iExpandPels.
1610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
1630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstPlane - pointer to the top-left corner of the frame to be
1650c1bc742181ded4930842b46e9507372f0b1b963James Dong *            expanded; must be aligned on an 8-byte boundary.
1660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iFrameWidth - frame width; must be a multiple of 8.
1670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iFrameHeight -frame height; must be a multiple of 8.
1680c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iExpandPels - number of pixels to be expanded in the horizontal and
1690c1bc742181ded4930842b46e9507372f0b1b963James Dong *            vertical directions; must be a multiple of 8.
1700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPlaneStep - distance, in bytes, between the start of consecutive lines
1710c1bc742181ded4930842b46e9507372f0b1b963James Dong *            in the plane buffer; must be larger than or equal to
1720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (iFrameWidth + 2 * iExpandPels).
1730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
1750c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the
1770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            top-left corner of the plane); must be aligned on an 8-byte
1780c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
1790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
1810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1820c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
1830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
1840c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
1850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDstPlane is NULL.
1860c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDstPlane is not aligned on an 8-byte boundary.
1870c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one of the following parameters is either equal to zero or is a
1880c1bc742181ded4930842b46e9507372f0b1b963James Dong *              non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or
1890c1bc742181ded4930842b46e9507372f0b1b963James Dong *              iExpandPels.
1900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iPlaneStep < (iFrameWidth + 2 * iExpandPels).
1910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
1920c1bc742181ded4930842b46e9507372f0b1b963James Dong */
1930c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_ExpandFrame_I (
1940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDstPlane,
1950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iFrameWidth,
1960c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iFrameHeight,
1970c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iExpandPels,
1980c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPlaneStep
1990c1bc742181ded4930842b46e9507372f0b1b963James Dong);
2000c1bc742181ded4930842b46e9507372f0b1b963James Dong
2010c1bc742181ded4930842b46e9507372f0b1b963James Dong
2020c1bc742181ded4930842b46e9507372f0b1b963James Dong
2030c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
2040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_Copy8x8   (6.1.3.3.1)
2050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
2070c1bc742181ded4930842b46e9507372f0b1b963James Dong * Copies the reference 8x8 block to the current block.
2080c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
2100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2110c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the reference block in the source frame; must be
2120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on an 8-byte boundary.
2130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   step - distance between the starts of consecutive lines in the reference
2140c1bc742181ded4930842b46e9507372f0b1b963James Dong *            frame, in bytes; must be a multiple of 8 and must be larger than
2150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            or equal to 8.
2160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2170c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
2180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the destination block; must be aligned on an 8-byte
2200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
2210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
2230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2240c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
2250c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
2260c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
2270c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is NULL: pSrc, pDst
2280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is not aligned on an 8-byte
2290c1bc742181ded4930842b46e9507372f0b1b963James Dong *              boundary: pSrc, pDst
2300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    step <8 or step is not a multiple of 8.
2310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2320c1bc742181ded4930842b46e9507372f0b1b963James Dong */
2330c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_Copy8x8 (
2340c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
2350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
2360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT step
2370c1bc742181ded4930842b46e9507372f0b1b963James Dong);
2380c1bc742181ded4930842b46e9507372f0b1b963James Dong
2390c1bc742181ded4930842b46e9507372f0b1b963James Dong
2400c1bc742181ded4930842b46e9507372f0b1b963James Dong
2410c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
2420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_Copy16x16   (6.1.3.3.2)
2430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2440c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
2450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Copies the reference 16x16 macroblock to the current macroblock.
2460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
2480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the reference macroblock in the source frame; must be
2500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on a 16-byte boundary.
2510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   step - distance between the starts of consecutive lines in the reference
2520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            frame, in bytes; must be a multiple of 16 and must be larger
2530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            than or equal to 16.
2540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2550c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
2560c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2570c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the destination macroblock; must be aligned on a
2580c1bc742181ded4930842b46e9507372f0b1b963James Dong *            16-byte boundary.
2590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
2610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
2630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
2640c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
2650c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is NULL: pSrc, pDst
2660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is not aligned on a 16-byte
2670c1bc742181ded4930842b46e9507372f0b1b963James Dong *              boundary: pSrc, pDst
2680c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    step <16 or step is not a multiple of 16.
2690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2700c1bc742181ded4930842b46e9507372f0b1b963James Dong */
2710c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_Copy16x16 (
2720c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
2730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
2740c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT step
2750c1bc742181ded4930842b46e9507372f0b1b963James Dong);
2760c1bc742181ded4930842b46e9507372f0b1b963James Dong
2770c1bc742181ded4930842b46e9507372f0b1b963James Dong
2780c1bc742181ded4930842b46e9507372f0b1b963James Dong
2790c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
2800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_ComputeTextureErrorBlock_SAD   (6.1.4.1.1)
2810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
2830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes texture error of the block; also returns SAD.
2840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
2860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the source plane; must be aligned on an 8-byte
2880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
2890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep - step of the source plane
2900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned
2910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on an 8-byte boundary.
2920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2930c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
2940c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2950c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the destination buffer, an 8x8 block; must be aligned
2960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on an 8-byte boundary.
2970c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to the Sum of Absolute Differences (SAD) value
2980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
2990c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
3000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3010c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
3020c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments
3030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following
3040c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD.
3050c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc is not 8-byte aligned.
3060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    SrcStep <= 0 or srcStep is not a multiple of 8.
3070c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcRef is not 8-byte aligned.
3080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 8-byte aligned.
3090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3100c1bc742181ded4930842b46e9507372f0b1b963James Dong */
3110c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD (
3120c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
3130c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT srcStep,
3140c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
3150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
3160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstSAD
3170c1bc742181ded4930842b46e9507372f0b1b963James Dong);
3180c1bc742181ded4930842b46e9507372f0b1b963James Dong
3190c1bc742181ded4930842b46e9507372f0b1b963James Dong
3200c1bc742181ded4930842b46e9507372f0b1b963James Dong
3210c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
3220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_ComputeTextureErrorBlock   (6.1.4.1.2)
3230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
3250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes the texture error of the block.
3260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
3280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3290c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the source plane. This should be aligned on an 8-byte
3300c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
3310c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep - step of the source plane
3320c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef - pointer to the reference buffer, an 8x8 block. This should be
3330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on an 8-byte boundary.
3340c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3350c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
3360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the destination buffer, an 8x8 block. This should be
3380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on an 8-byte boundary.
3390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
3410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3420c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
3430c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
3440c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL:
3450c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrc, pSrcRef, pDst.
3460c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc is not 8-byte aligned.
3470c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    SrcStep <= 0 or srcStep is not a multiple of 8.
3480c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcRef is not 8-byte aligned.
3490c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 8-byte aligned
3500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3510c1bc742181ded4930842b46e9507372f0b1b963James Dong */
3520c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_ComputeTextureErrorBlock (
3530c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
3540c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT srcStep,
3550c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
3560c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst
3570c1bc742181ded4930842b46e9507372f0b1b963James Dong);
3580c1bc742181ded4930842b46e9507372f0b1b963James Dong
3590c1bc742181ded4930842b46e9507372f0b1b963James Dong
3600c1bc742181ded4930842b46e9507372f0b1b963James Dong
3610c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
3620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_LimitMVToRect   (6.1.4.1.3)
3630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
3650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Limits the motion vector associated with the current block/macroblock to
3660c1bc742181ded4930842b46e9507372f0b1b963James Dong * prevent the motion compensated block/macroblock from moving outside a
3670c1bc742181ded4930842b46e9507372f0b1b963James Dong * bounding rectangle as shown in Figure 6-1.
3680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
3700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3710c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMV - pointer to the motion vector associated with the current block
3720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            or macroblock
3730c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRectVOPRef - pointer to the bounding rectangle
3740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   Xcoord, Ycoord  - coordinates of the current block or macroblock
3750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   size - size of the current block or macroblock; must be equal to 8 or
3760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            16.
3770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
3790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMV - pointer to the limited motion vector
3810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
3830c1bc742181ded4930842b46e9507372f0b1b963James Dong *
3840c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
3850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
3860c1bc742181ded4930842b46e9507372f0b1b963James Dong *              following conditions is true:
3870c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
3880c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcMV, pDstMV, or pRectVOPRef.
3890c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    size is not equal to either 8 or 16.
3900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    the width or height of the bounding rectangle is less than
3910c1bc742181ded4930842b46e9507372f0b1b963James Dong *         twice the block size.
3920c1bc742181ded4930842b46e9507372f0b1b963James Dong */
3930c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_LimitMVToRect (
3940c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcMV,
3950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pDstMV,
3960c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRectVOPRef,
3970c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT Xcoord,
3980c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT Ycoord,
3990c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT size
4000c1bc742181ded4930842b46e9507372f0b1b963James Dong);
4010c1bc742181ded4930842b46e9507372f0b1b963James Dong
4020c1bc742181ded4930842b46e9507372f0b1b963James Dong
4030c1bc742181ded4930842b46e9507372f0b1b963James Dong
4040c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
4050c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_SAD_16x   (6.1.4.1.4)
4060c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4070c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
4080c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD for 16x16 and 16x8 blocks.
4090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
4110c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4120c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrg - Pointer to the original block; must be aligned on a 16-byte
4130c1bc742181ded4930842b46e9507372f0b1b963James Dong *             boundary.
4140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepOrg - Step of the original block buffer
4150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef  - Pointer to the reference block
4160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepRef - Step of the reference block buffer
4170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight  - Height of the block
4180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
4200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - Pointer of result SAD
4220c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4230c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
4240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4250c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
4260c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
4270c1bc742181ded4930842b46e9507372f0b1b963James Dong *              following conditions is true:
4280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
4290c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrg, pDstSAD, or pSrcRef
4300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcOrg is not 16-byte aligned.
4310c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 16
4320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepRef <= 0 or iStepRef is not a multiple of 16
4330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not 8 or 16
4340c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4350c1bc742181ded4930842b46e9507372f0b1b963James Dong */
4360c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_SAD_16x (
4370c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrg,
4380c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepOrg,
4390c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
4400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepRef,
4410c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pDstSAD,
4420c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
4430c1bc742181ded4930842b46e9507372f0b1b963James Dong);
4440c1bc742181ded4930842b46e9507372f0b1b963James Dong
4450c1bc742181ded4930842b46e9507372f0b1b963James Dong
4460c1bc742181ded4930842b46e9507372f0b1b963James Dong
4470c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
4480c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCCOMM_SAD_8x   (6.1.4.1.5)
4490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
4510c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD for 8x16, 8x8, 8x4 blocks.
4520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
4540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4550c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrg  - Pointer to the original block; must be aligned on a 8-byte
4560c1bc742181ded4930842b46e9507372f0b1b963James Dong *              boundary.
4570c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepOrg - Step of the original block buffer
4580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef  - Pointer to the reference block
4590c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepRef - Step of the reference block buffer
4600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight  - Height of the block
4610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
4630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD -Pointer of result SAD
4650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
4670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4680c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
4690c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
4700c1bc742181ded4930842b46e9507372f0b1b963James Dong *              following conditions is true:
4710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
4720c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrg, pDstSAD, or pSrcRef
4730c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcOrg is not 8-byte aligned.
4740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepOrg  <= 0 or iStepOrg is not a multiple of 8
4750c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepRef <= 0 or iStepRef is not a multiple of 8
4760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not 4, 8 or 16
4770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
4780c1bc742181ded4930842b46e9507372f0b1b963James Dong */
4790c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCCOMM_SAD_8x (
4800c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrg,
4810c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepOrg,
4820c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
4830c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepRef,
4840c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32*pDstSAD,
4850c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
4860c1bc742181ded4930842b46e9507372f0b1b963James Dong);
4870c1bc742181ded4930842b46e9507372f0b1b963James Dong
4880c1bc742181ded4930842b46e9507372f0b1b963James Dong
4890c1bc742181ded4930842b46e9507372f0b1b963James Dong
4900c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.1 Direction  */
4910c1bc742181ded4930842b46e9507372f0b1b963James Dong/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan.  */
4920c1bc742181ded4930842b46e9507372f0b1b963James Dong
4930c1bc742181ded4930842b46e9507372f0b1b963James Dongenum {
4940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_NONE       = 0,
4950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_HORIZONTAL = 1,
4960c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_VERTICAL   = 2
4970c1bc742181ded4930842b46e9507372f0b1b963James Dong};
4980c1bc742181ded4930842b46e9507372f0b1b963James Dong
4990c1bc742181ded4930842b46e9507372f0b1b963James Dong
5000c1bc742181ded4930842b46e9507372f0b1b963James Dong
5010c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.2 Bilinear Interpolation  */
5020c1bc742181ded4930842b46e9507372f0b1b963James Dong/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions.  */
5030c1bc742181ded4930842b46e9507372f0b1b963James Dong
5040c1bc742181ded4930842b46e9507372f0b1b963James Dongenum {
5050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTEGER_PIXEL = 0, /* case a */
5060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_HALF_PIXEL_X  = 1, /* case b */
5070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_HALF_PIXEL_Y  = 2, /* case c */
5080c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_HALF_PIXEL_XY = 3  /* case d */
5090c1bc742181ded4930842b46e9507372f0b1b963James Dong};
5100c1bc742181ded4930842b46e9507372f0b1b963James Dong
5110c1bc742181ded4930842b46e9507372f0b1b963James Dong
5120c1bc742181ded4930842b46e9507372f0b1b963James Dong
5130c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.3 Neighboring Macroblock Availability  */
5140c1bc742181ded4930842b46e9507372f0b1b963James Dong/* Neighboring macroblock availability is indicated using the following flags:   */
5150c1bc742181ded4930842b46e9507372f0b1b963James Dong
5160c1bc742181ded4930842b46e9507372f0b1b963James Dongenum {
5170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_UPPER = 1,        /** above macroblock is available */
5180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_LEFT = 2,         /** left macroblock is available */
5190c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CENTER = 4,
5200c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_RIGHT = 8,
5210c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_LOWER = 16,
5220c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_UPPER_LEFT = 32,  /** above-left macroblock is available */
5230c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */
5240c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_LOWER_LEFT = 128,
5250c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_LOWER_RIGHT = 256
5260c1bc742181ded4930842b46e9507372f0b1b963James Dong};
5270c1bc742181ded4930842b46e9507372f0b1b963James Dong
5280c1bc742181ded4930842b46e9507372f0b1b963James Dong
5290c1bc742181ded4930842b46e9507372f0b1b963James Dong
5300c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.4 Video Components  */
5310c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates video components is defined as follows:  */
5320c1bc742181ded4930842b46e9507372f0b1b963James Dong
5330c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
5340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_LUMINANCE,    /** Luminance component */
5350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CHROMINANCE   /** chrominance component */
5360c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2VideoComponent;
5370c1bc742181ded4930842b46e9507372f0b1b963James Dong
5380c1bc742181ded4930842b46e9507372f0b1b963James Dong
5390c1bc742181ded4930842b46e9507372f0b1b963James Dong
5400c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.5 MacroblockTypes  */
5410c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates macroblock types is defined as follows:  */
5420c1bc742181ded4930842b46e9507372f0b1b963James Dong
5430c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
5440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTER     = 0, /** P picture or P-VOP */
5450c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTER_Q   = 1, /** P picture or P-VOP */
5460c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTER4V   = 2, /** P picture or P-VOP */
5470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTRA     = 3, /** I and P picture, I- and P-VOP */
5480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTRA_Q   = 4, /** I and P picture, I- and P-VOP */
5490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTER4V_Q = 5  /** P picture or P-VOP (H.263)*/
5500c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2MacroblockType;
5510c1bc742181ded4930842b46e9507372f0b1b963James Dong
5520c1bc742181ded4930842b46e9507372f0b1b963James Dong
5530c1bc742181ded4930842b46e9507372f0b1b963James Dong
5540c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.6 Coordinates  */
5550c1bc742181ded4930842b46e9507372f0b1b963James Dong/* Coordinates are represented as follows:  */
5560c1bc742181ded4930842b46e9507372f0b1b963James Dong
5570c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
5580c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT x;
5590c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT y;
5600c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2Coordinate;
5610c1bc742181ded4930842b46e9507372f0b1b963James Dong
5620c1bc742181ded4930842b46e9507372f0b1b963James Dong
5630c1bc742181ded4930842b46e9507372f0b1b963James Dong
5640c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.7 Motion Estimation Algorithms  */
5650c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates motion estimation search methods is defined as follows:  */
5660c1bc742181ded4930842b46e9507372f0b1b963James Dong
5670c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
5680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_M4P2_FAST_SEARCH = 0,  /** Fast motion search */
5690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_M4P2_FULL_SEARCH = 1   /** Full motion search */
5700c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2MEMode;
5710c1bc742181ded4930842b46e9507372f0b1b963James Dong
5720c1bc742181ded4930842b46e9507372f0b1b963James Dong
5730c1bc742181ded4930842b46e9507372f0b1b963James Dong
5740c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.8 Motion Estimation Parameters  */
5750c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data structure containing control parameters for
5760c1bc742181ded4930842b46e9507372f0b1b963James Dong * motion estimation functions is defined as follows:
5770c1bc742181ded4930842b46e9507372f0b1b963James Dong */
5780c1bc742181ded4930842b46e9507372f0b1b963James Dong
5790c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
5800c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT searchEnable8x8;     /** enables 8x8 search */
5810c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT halfPelSearchEnable; /** enables half-pel resolution */
5820c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT searchRange;         /** search range */
5830c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT rndVal;              /** rounding control; 0-disabled, 1-enabled*/
5840c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2MEParams;
5850c1bc742181ded4930842b46e9507372f0b1b963James Dong
5860c1bc742181ded4930842b46e9507372f0b1b963James Dong
5870c1bc742181ded4930842b46e9507372f0b1b963James Dong
5880c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.2.1.9 Macroblock Information   */
5890c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data structure containing macroblock parameters for
5900c1bc742181ded4930842b46e9507372f0b1b963James Dong * motion estimation functions is defined as follows:
5910c1bc742181ded4930842b46e9507372f0b1b963James Dong */
5920c1bc742181ded4930842b46e9507372f0b1b963James Dong
5930c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
5940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 sliceId;                 /* slice number */
5950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MacroblockType mbType;  /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */
5960c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 qp;                      /* quantization parameter*/
5970c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 cbpy;                    /* CBP Luma */
5980c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 cbpc;                    /* CBP Chroma */
5990c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector pMV0[2][2];    /* motion vector, represented using 1/2-pel units,
6000c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1)
6010c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      */
6020c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units,
6030c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1)
6040c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      */
6050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 pPredDir[2][2];           /* AC prediction direction:
6060c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      *   OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL
6070c1bc742181ded4930842b46e9507372f0b1b963James Dong                                      */
6080c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr;
6090c1bc742181ded4930842b46e9507372f0b1b963James Dong
6100c1bc742181ded4930842b46e9507372f0b1b963James Dong
6110c1bc742181ded4930842b46e9507372f0b1b963James Dong
6120c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
6130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_FindMVpred   (6.2.3.1.1)
6140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
6160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Predicts a motion vector for the current block using the procedure
6170c1bc742181ded4930842b46e9507372f0b1b963James Dong * specified in [ISO14496-2], subclause 7.6.5.  The resulting predicted MV is
6180c1bc742181ded4930842b46e9507372f0b1b963James Dong * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then
6190c1bc742181ded4930842b46e9507372f0b1b963James Dong * the set of three MV candidates used for prediction is also returned,
6200c1bc742181ded4930842b46e9507372f0b1b963James Dong * otherwise pDstMVPredMEis NULL upon return.
6210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
6230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMVCurMB - pointer to the MV buffer associated with the current Y
6250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            macroblock; a value of NULL indicates unavailability.
6260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated
6270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            with the MB located to the left of the current MB; set to NULL
6280c1bc742181ded4930842b46e9507372f0b1b963James Dong *            if there is no MB to the left.
6290c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated
6300c1bc742181ded4930842b46e9507372f0b1b963James Dong *            with the MB located above the current MB; set to NULL if there
6310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            is no MB located above the current MB.
6320c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated
6330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            with the MB located to the right and above the current MB; set
6340c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to NULL if there is no MB located to the above-right.
6350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlk - the index of block in the current macroblock
6360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMVPredME - MV candidate return buffer;  if set to NULL then
6370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            prediction candidate MVs are not returned and pDstMVPredME will
6380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be NULL upon function return; if pDstMVPredME is non-NULL then it
6390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must point to a buffer containing sufficient space for three
6400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            return MVs.
6410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
6430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMVPred - pointer to the predicted motion vector
6450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMVPredME - if non-NULL upon input then pDstMVPredME  points upon
6460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            return to a buffer containing the three motion vector candidates
6470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            used for prediction as specified in [ISO14496-2], subclause
6480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL
6490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            upon output.
6500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
6520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
6540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
6550c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
6560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    the pointer pDstMVPred is NULL
6570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    the parameter iBlk does not fall into the range 0 <= iBlk<=3
6580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6590c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6600c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_FindMVpred (
6610c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcMVCurMB,
6620c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcCandMV1,
6630c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcCandMV2,
6640c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcCandMV3,
6650c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pDstMVPred,
6660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pDstMVPredME,
6670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT iBlk
6680c1bc742181ded4930842b46e9507372f0b1b963James Dong);
6690c1bc742181ded4930842b46e9507372f0b1b963James Dong
6700c1bc742181ded4930842b46e9507372f0b1b963James Dong
6710c1bc742181ded4930842b46e9507372f0b1b963James Dong
6720c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
6730c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_IDCT8x8blk   (6.2.3.2.1)
6740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
6760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes a 2D inverse DCT for a single 8x8 block, as defined in
6770c1bc742181ded4930842b46e9507372f0b1b963James Dong * [ISO14496-2].
6780c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
6800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the start of the linearly arranged IDCT input buffer;
6820c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be aligned on a 16-byte boundary.  According to
6830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-2], the input coefficient values should lie within the
6840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [-2048, 2047].
6850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
6870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the start of the linearly arranged IDCT output buffer;
6890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be aligned on a 16-byte boundary.
6900c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6910c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
6920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
6940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
6950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is NULL.
6960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is not 16-byte aligned.
6970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
6980c1bc742181ded4930842b46e9507372f0b1b963James Dong */
6990c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_IDCT8x8blk (
7000c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrc,
7010c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst
7020c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7030c1bc742181ded4930842b46e9507372f0b1b963James Dong
7040c1bc742181ded4930842b46e9507372f0b1b963James Dong
7050c1bc742181ded4930842b46e9507372f0b1b963James Dong
7060c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
7070c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_MEGetBufSize   (6.2.4.1.1)
7080c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
7100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes the size, in bytes, of the vendor-specific specification
7110c1bc742181ded4930842b46e9507372f0b1b963James Dong * structure for the following motion estimation functions:
7120c1bc742181ded4930842b46e9507372f0b1b963James Dong * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB.
7130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7140c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
7150c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
7170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P2MEMode
7180c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams - motion estimation parameters
7190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
7210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7220c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSize - pointer to the number of bytes required for the specification
7230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            structure
7240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
7260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7270c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
7280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - one or more of the following is true:
7290c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid value was specified for the parameter MEmode
7300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a negative or zero value was specified for the
7310c1bc742181ded4930842b46e9507372f0b1b963James Dong *         parameter pMEParams->searchRange
7320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7330c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7340c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_MEGetBufSize (
7350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MEMode MEmode,
7360c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2MEParams *pMEParams,
7370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pSize
7380c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7390c1bc742181ded4930842b46e9507372f0b1b963James Dong
7400c1bc742181ded4930842b46e9507372f0b1b963James Dong
7410c1bc742181ded4930842b46e9507372f0b1b963James Dong
7420c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
7430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_MEInit   (6.2.4.1.2)
7440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
7460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Initializes the vendor-specific specification structure required for the
7470c1bc742181ded4930842b46e9507372f0b1b963James Dong * following motion estimation functions:  BlockMatch_Integer_8x8,
7480c1bc742181ded4930842b46e9507372f0b1b963James Dong * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the
7490c1bc742181ded4930842b46e9507372f0b1b963James Dong * specification structure *pMESpec must be allocated prior to calling the
7500c1bc742181ded4930842b46e9507372f0b1b963James Dong * function, and should be aligned on a 4-byte boundary.  Following
7510c1bc742181ded4930842b46e9507372f0b1b963James Dong * initialization by this function, the vendor-specific structure *pMESpec
7520c1bc742181ded4930842b46e9507372f0b1b963James Dong * should contain an implementation-specific representation of all motion
7530c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimation parameters received via the structure pMEParams, for example
7540c1bc742181ded4930842b46e9507372f0b1b963James Dong * rndVal, searchRange, etc.  The number of bytes required for the
7550c1bc742181ded4930842b46e9507372f0b1b963James Dong * specification structure can be determined using the function
7560c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P2_MEGetBufSize.
7570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
7590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
7610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P2MEMode
7620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams - motion estimation parameters
7630c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the uninitialized ME specification structure
7640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
7660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the initialized ME specification structure
7680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
7700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
7720c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - one or more of the following is true:
7730c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid value was specified for the parameter MEmode
7740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a negative or zero value was specified for the
7750c1bc742181ded4930842b46e9507372f0b1b963James Dong *         parameter pMEParams->searchRange
7760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7770c1bc742181ded4930842b46e9507372f0b1b963James Dong */
7780c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_MEInit (
7790c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MEMode MEmode,
7800c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2MEParams*pMEParams,
7810c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec
7820c1bc742181ded4930842b46e9507372f0b1b963James Dong);
7830c1bc742181ded4930842b46e9507372f0b1b963James Dong
7840c1bc742181ded4930842b46e9507372f0b1b963James Dong
7850c1bc742181ded4930842b46e9507372f0b1b963James Dong
7860c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
7870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_BlockMatch_Integer_16x16   (6.2.4.2.1)
7880c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7890c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
7900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a 16x16 block search; estimates motion vector and associated
7910c1bc742181ded4930842b46e9507372f0b1b963James Dong * minimum SAD. Both the input and output motion vectors are represented using
7920c1bc742181ded4930842b46e9507372f0b1b963James Dong * half-pixel units, and therefore a shift left or right by 1 bit may be
7930c1bc742181ded4930842b46e9507372f0b1b963James Dong * required, respectively, to match the input or output MVs with other
7940c1bc742181ded4930842b46e9507372f0b1b963James Dong * functions that either generate output MVs or expect input MVs represented
7950c1bc742181ded4930842b46e9507372f0b1b963James Dong * using integer pixel units.
7960c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7970c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
7980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
7990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
8000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            MB that corresponds to the location of the current macroblock in
8010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the current plane.
8020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   refWidth - width of the reference plane
8030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - pointer to the valid reference plane rectangle; coordinates
8040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            are specified relative to the image origin.  Rectangle
8050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundaries may extend beyond image boundaries if the image has
8060c1bc742181ded4930842b46e9507372f0b1b963James Dong *            been padded.  For example, if padding extends 4 pixels beyond
8070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            frame border, then the value for the left border could be set to
8080c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -4.
8090c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - pointer to the current block in the current macroblock
8100c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer extracted from the original plane (linear array, 256
8110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            entries); must be aligned on a 16-byte boundary.  The number of
8120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bytes between lines (step) is 16.
8130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCurrPointPos - position of the current macroblock in the current plane
8140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no
8150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            predicted MV
8160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
8170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            by pSrcPreMV); may be set to NULL if unavailable.
8180c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - vendor-specific motion estimation specification structure;
8190c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must have been allocated and then initialized using
8200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            omxVCM4P2_MEInit prior to calling the block matching function.
8210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
8230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMV - pointer to estimated MV
8250c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to minimum SAD
8260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
8280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8290c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
8300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
8310c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions is true:
8320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrcRefBuf,
8330c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
8340c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pMESpec, or
8350c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcCurrBuf is not 16-byte aligned
8360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8370c1bc742181ded4930842b46e9507372f0b1b963James Dong */
8380c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_BlockMatch_Integer_16x16 (
8390c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBuf,
8400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT refWidth,
8410c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
8420c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
8430c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pCurrPointPos,
8440c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector*pSrcPreMV,
8450c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_INT *pSrcPreSAD,
8460c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec,
8470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector*pDstMV,
8480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstSAD
8490c1bc742181ded4930842b46e9507372f0b1b963James Dong);
8500c1bc742181ded4930842b46e9507372f0b1b963James Dong
8510c1bc742181ded4930842b46e9507372f0b1b963James Dong
8520c1bc742181ded4930842b46e9507372f0b1b963James Dong
8530c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
8540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_BlockMatch_Integer_8x8   (6.2.4.2.2)
8550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
8570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs an 8x8 block search; estimates motion vector and associated
8580c1bc742181ded4930842b46e9507372f0b1b963James Dong * minimum SAD.  Both the input and output motion vectors are represented
8590c1bc742181ded4930842b46e9507372f0b1b963James Dong * using half-pixel units, and therefore a shift left or right by 1 bit may be
8600c1bc742181ded4930842b46e9507372f0b1b963James Dong * required, respectively, to match the input or output MVs with other
8610c1bc742181ded4930842b46e9507372f0b1b963James Dong * functions that either generate output MVs or expect input MVs represented
8620c1bc742181ded4930842b46e9507372f0b1b963James Dong * using integer pixel units.
8630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
8650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
8670c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block that corresponds to the location of the current 8x8 block
8680c1bc742181ded4930842b46e9507372f0b1b963James Dong *            in the current plane.
8690c1bc742181ded4930842b46e9507372f0b1b963James Dong *   refWidth - width of the reference plane
8700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - pointer to the valid reference plane rectangle; coordinates
8710c1bc742181ded4930842b46e9507372f0b1b963James Dong *            are specified relative to the image origin.  Rectangle
8720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundaries may extend beyond image boundaries if the image has
8730c1bc742181ded4930842b46e9507372f0b1b963James Dong *            been padded.
8740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - pointer to the current block in the current macroblock
8750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer extracted from the original plane (linear array, 128
8760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            entries); must be aligned on an 8-byte boundary.  The number of
8770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bytes between lines (step) is 16 bytes.
8780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCurrPointPos - position of the current block in the current plane
8790c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPreMV - pointer to predicted motion vector; NULL indicates no
8800c1bc742181ded4930842b46e9507372f0b1b963James Dong *            predicted MV
8810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced
8820c1bc742181ded4930842b46e9507372f0b1b963James Dong *            by pSrcPreMV); may be set to NULL if unavailable.
8830c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - vendor-specific motion estimation specification structure;
8840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must have been allocated and then initialized using
8850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            omxVCM4P2_MEInit prior to calling the block matching function.
8860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
8880c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMV - pointer to estimated MV
8900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to minimum SAD
8910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8920c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
8930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
8940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
8950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
8960c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions is true:
8970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrcRefBuf,
8980c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or
8990c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pMESpec, or
9000c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcCurrBuf is not 8-byte aligned
9010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9020c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9030c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_BlockMatch_Integer_8x8 (
9040c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBuf,
9050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT refWidth,
9060c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
9070c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
9080c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pCurrPointPos,
9090c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcPreMV,
9100c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_INT *pSrcPreSAD,
9110c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec,
9120c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pDstMV,
9130c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstSAD
9140c1bc742181ded4930842b46e9507372f0b1b963James Dong);
9150c1bc742181ded4930842b46e9507372f0b1b963James Dong
9160c1bc742181ded4930842b46e9507372f0b1b963James Dong
9170c1bc742181ded4930842b46e9507372f0b1b963James Dong
9180c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
9190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_BlockMatch_Half_16x16   (6.2.4.2.3)
9200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a 16x16 block match with half-pixel resolution.  Returns the
9230c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimated motion vector and associated minimum SAD.  This function
9240c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimates the half-pixel motion vector by interpolating the integer
9250c1bc742181ded4930842b46e9507372f0b1b963James Dong * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
9260c1bc742181ded4930842b46e9507372f0b1b963James Dong * the initial integer MV is generated externally.  The input parameters
9270c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
9280c1bc742181ded4930842b46e9507372f0b1b963James Dong * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function
9290c1bc742181ded4930842b46e9507372f0b1b963James Dong * BlockMatch_Integer_16x16 may be used for integer motion estimation.
9300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
9320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
9340c1bc742181ded4930842b46e9507372f0b1b963James Dong *            macroblock that corresponds to the location of the current
9350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            macroblock in the current plane.
9360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   refWidth - width of the reference plane
9370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - reference plane valid region rectangle
9380c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - pointer to the current block in the current macroblock
9390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer extracted from the original plane (linear array, 256
9400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            entries); must be aligned on a 16-byte boundary.  The number of
9410c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bytes between lines (step) is 16.
9420c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSearchPointRefPos - position of the starting point for half pixel
9430c1bc742181ded4930842b46e9507372f0b1b963James Dong *            search (specified in terms of integer pixel units) in the
9440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference plane, i.e., the reference position pointed to by the
9450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            predicted motion vector.
9460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
9470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMV - pointer to the initial MV estimate; typically generated
9480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            during a prior 16X16 integer search; specified in terms of
9490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            half-pixel units.
9500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
9520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9530c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMV - pointer to estimated MV
9540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to minimum SAD
9550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
9570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
9590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
9600c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions is true:
9610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrcRefBuf,
9620c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV.
9630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcCurrBuf is not 16-byte aligned, or
9640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9650c1bc742181ded4930842b46e9507372f0b1b963James Dong */
9660c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_BlockMatch_Half_16x16 (
9670c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBuf,
9680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT refWidth,
9690c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
9700c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
9710c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pSearchPointRefPos,
9720c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT rndVal,
9730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcDstMV,
9740c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstSAD
9750c1bc742181ded4930842b46e9507372f0b1b963James Dong);
9760c1bc742181ded4930842b46e9507372f0b1b963James Dong
9770c1bc742181ded4930842b46e9507372f0b1b963James Dong
9780c1bc742181ded4930842b46e9507372f0b1b963James Dong
9790c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
9800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_BlockMatch_Half_8x8   (6.2.4.2.4)
9810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
9830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs an 8x8 block match with half-pixel resolution. Returns the
9840c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimated motion vector and associated minimum SAD.  This function
9850c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimates the half-pixel motion vector by interpolating the integer
9860c1bc742181ded4930842b46e9507372f0b1b963James Dong * resolution motion vector referenced by the input parameter pSrcDstMV, i.e.,
9870c1bc742181ded4930842b46e9507372f0b1b963James Dong * the initial integer MV is generated externally.  The input parameters
9880c1bc742181ded4930842b46e9507372f0b1b963James Dong * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of
9890c1bc742181ded4930842b46e9507372f0b1b963James Dong * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function
9900c1bc742181ded4930842b46e9507372f0b1b963James Dong * BlockMatch_Integer_8x8 may be used for integer motion estimation.
9910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9920c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
9930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
9940c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
9950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block that corresponds to the location of the current 8x8 block
9960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            in the current plane.
9970c1bc742181ded4930842b46e9507372f0b1b963James Dong *   refWidth - width of the reference plane
9980c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - reference plane valid region rectangle
9990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - pointer to the current block in the current macroblock
10000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer extracted from the original plane (linear array, 128
10010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            entries); must be aligned on a 8-byte boundary.  The number of
10020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bytes between lines (step) is 16.
10030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSearchPointRefPos - position of the starting point for half pixel
10040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            search (specified in terms of integer pixel units) in the
10050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference plane.
10060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
10070c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMV - pointer to the initial MV estimate; typically generated
10080c1bc742181ded4930842b46e9507372f0b1b963James Dong *            during a prior 8x8 integer search, specified in terms of
10090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            half-pixel units.
10100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
10120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMV - pointer to estimated MV
10140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to minimum SAD
10150c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
10170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10180c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
10190c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one of the following
10200c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions is true:
10210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
10220c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV
10230c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcCurrBuf is not 8-byte aligned
10240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10250c1bc742181ded4930842b46e9507372f0b1b963James Dong */
10260c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_BlockMatch_Half_8x8 (
10270c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBuf,
10280c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT refWidth,
10290c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
10300c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
10310c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pSearchPointRefPos,
10320c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT rndVal,
10330c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcDstMV,
10340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstSAD
10350c1bc742181ded4930842b46e9507372f0b1b963James Dong);
10360c1bc742181ded4930842b46e9507372f0b1b963James Dong
10370c1bc742181ded4930842b46e9507372f0b1b963James Dong
10380c1bc742181ded4930842b46e9507372f0b1b963James Dong
10390c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
10400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_MotionEstimationMB   (6.2.4.3.1)
10410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
10430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs motion search for a 16x16 macroblock.  Selects best motion search
10440c1bc742181ded4930842b46e9507372f0b1b963James Dong * strategy from among inter-1MV, inter-4MV, and intra modes.  Supports
10450c1bc742181ded4930842b46e9507372f0b1b963James Dong * integer and half pixel resolution.
10460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
10480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - pointer to the top-left corner of the current MB in the
10500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            original picture plane; must be aligned on a 16-byte boundary.
10510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            The function does not expect source data outside the region
10520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bounded by the MB to be available; for example it is not
10530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            necessary for the caller to guarantee the availability of
10540c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB
10550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to be processed.
10560c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcCurrStep - width of the original picture plane, in terms of full
10570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of 16.
10580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBuf - pointer to the reference Y plane; points to the reference
10590c1bc742181ded4930842b46e9507372f0b1b963James Dong *            plane location corresponding to the location of the current
10600c1bc742181ded4930842b46e9507372f0b1b963James Dong *            macroblock in the current plane; must be aligned on a 16-byte
10610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
10620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcRefStep - width of the reference picture plane, in terms of full
10630c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of 16.
10640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - reference plane valid region rectangle, specified relative to
10650c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the image origin
10660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCurrPointPos - position of the current macroblock in the current plane
10670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the vendor-specific motion estimation specification
10680c1bc742181ded4930842b46e9507372f0b1b963James Dong *            structure; must be allocated and then initialized using
10690c1bc742181ded4930842b46e9507372f0b1b963James Dong *            omxVCM4P2_MEInit prior to calling this function.
10700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMBInfo - array, of dimension four, containing pointers to information
10710c1bc742181ded4930842b46e9507372f0b1b963James Dong *            associated with four nearby MBs:
10720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   pMBInfo[0] - pointer to left MB information
10730c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   pMBInfo[1] - pointer to top MB information
10740c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   pMBInfo[2] - pointer to top-left MB information
10750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   pMBInfo[3] - pointer to top-right MB information
10760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Any pointer in the array may be set equal to NULL if the
10770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            corresponding MB doesn't exist.  For each MB, the following structure
10780c1bc742181ded4930842b46e9507372f0b1b963James Dong *            members are used:
10790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or
10800c1bc742181ded4930842b46e9507372f0b1b963James Dong *                OMX_VC_INTER4V
10810c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   pMV0[2][2] - estimated motion vectors; represented
10820c1bc742181ded4930842b46e9507372f0b1b963James Dong *                in 1/2 pixel units
10830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -   sliceID - number of the slice to which the MB belongs
10840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMBCurr - pointer to information structure for the current MB.
10850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            The following entries should be set prior to calling the
10860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            function: sliceID - the number of the slice the to which the
10870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            current MB belongs.  The structure elements cbpy and cbpc are
10880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            ignored.
10890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
10910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
10920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMBCurr - pointer to updated information structure for the current
10930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            MB after MB-level motion estimation has been completed.  The
10940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            following structure members are updated by the ME function:
10950c1bc742181ded4930842b46e9507372f0b1b963James Dong *              -  mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or
10960c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 OMX_VC_INTER4V.
10970c1bc742181ded4930842b46e9507372f0b1b963James Dong *              -  pMV0[2][2] - estimated motion vectors; represented in
10980c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 terms of 1/2 pel units.
10990c1bc742181ded4930842b46e9507372f0b1b963James Dong *              -  pMVPred[2][2] - predicted motion vectors; represented
11000c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 in terms of 1/2 pel units.
11010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            The structure members cbpy and cbpc are not updated by the function.
11020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs
11030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for INTER4V
11040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstBlockSAD - pointer to an array of SAD values for each of the four
11050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            8x8 luma blocks in the MB.  The block SADs are in scan order for
11060c1bc742181ded4930842b46e9507372f0b1b963James Dong *            each MB.
11070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
11090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11100c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
11110c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments.  Returned if one or more of the
11120c1bc742181ded4930842b46e9507372f0b1b963James Dong *              following conditions is true:
11130c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrcCurrBuf,
11140c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra,
11150c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcDstMBCurr, or pDstSAD.
11160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11170c1bc742181ded4930842b46e9507372f0b1b963James Dong */
11180c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_MotionEstimationMB (
11190c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
11200c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcCurrStep,
11210c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBuf,
11220c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcRefStep,
11230c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect*pRefRect,
11240c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pCurrPointPos,
11250c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec,
11260c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2MBInfoPtr *pMBInfo,
11270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MBInfo *pSrcDstMBCurr,
11280c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U16 *pDstSAD,
11290c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U16 *pDstBlockSAD
11300c1bc742181ded4930842b46e9507372f0b1b963James Dong);
11310c1bc742181ded4930842b46e9507372f0b1b963James Dong
11320c1bc742181ded4930842b46e9507372f0b1b963James Dong
11330c1bc742181ded4930842b46e9507372f0b1b963James Dong
11340c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
11350c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DCT8x8blk   (6.2.4.4.1)
11360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
11380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes a 2D forward DCT for a single 8x8 block, as defined in
11390c1bc742181ded4930842b46e9507372f0b1b963James Dong * [ISO14496-2].
11400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
11420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the start of the linearly arranged input buffer; must
11440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be aligned on a 16-byte boundary.  Input values (pixel
11450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            intensities) are valid in the range [-255,255].
11460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
11480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the start of the linearly arranged output buffer; must
11500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be aligned on a 16-byte boundary.
11510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
11530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
11550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments, returned if:
11560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is NULL.
11570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is not 16-byte aligned.
11580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11590c1bc742181ded4930842b46e9507372f0b1b963James Dong */
11600c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DCT8x8blk (
11610c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrc,
11620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst
11630c1bc742181ded4930842b46e9507372f0b1b963James Dong);
11640c1bc742181ded4930842b46e9507372f0b1b963James Dong
11650c1bc742181ded4930842b46e9507372f0b1b963James Dong
11660c1bc742181ded4930842b46e9507372f0b1b963James Dong
11670c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
11680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_QuantIntra_I   (6.2.4.4.2)
11690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11700c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
11710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs quantization on intra block coefficients. This function supports
11720c1bc742181ded4930842b46e9507372f0b1b963James Dong * bits_per_pixel == 8.
11730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
11750c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input intra block coefficients; must be aligned
11770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 16-byte boundary.
11780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter (quantizer_scale).
11790c1bc742181ded4930842b46e9507372f0b1b963James Dong *   blockIndex - block index indicating the component type and position,
11800c1bc742181ded4930842b46e9507372f0b1b963James Dong *            valid in the range 0 to 5, as defined in [ISO14496-2], subclause
11810c1bc742181ded4930842b46e9507372f0b1b963James Dong *            6.1.3.8.
11820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
11830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; shortVideoHeader==1 selects linear intra DC
11840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            mode, and shortVideoHeader==0 selects non linear intra DC mode.
11850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
11870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the output (quantized) interblock coefficients.
11890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            When shortVideoHeader==1, AC coefficients are saturated on the
11900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            interval [-127, 127], and DC coefficients are saturated on the
11910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            interval [1, 254].  When shortVideoHeader==0, AC coefficients
11920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            are saturated on the interval [-2047, 2047].
11930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
11950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
11960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
11970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
11980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is NULL.
11990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    blockIndex < 0 or blockIndex >= 10
12000c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0 or QP >= 32.
12010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12020c1bc742181ded4930842b46e9507372f0b1b963James Dong */
12030c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_QuantIntra_I (
12040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
12050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 QP,
12060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT blockIndex,
12070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
12080c1bc742181ded4930842b46e9507372f0b1b963James Dong);
12090c1bc742181ded4930842b46e9507372f0b1b963James Dong
12100c1bc742181ded4930842b46e9507372f0b1b963James Dong
12110c1bc742181ded4930842b46e9507372f0b1b963James Dong
12120c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
12130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_QuantInter_I   (6.2.4.4.3)
12140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
12160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs quantization on an inter coefficient block; supports
12170c1bc742181ded4930842b46e9507372f0b1b963James Dong * bits_per_pixel == 8.
12180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
12200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input inter block coefficients; must be aligned
12220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 16-byte boundary.
12230c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter (quantizer_scale)
12240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of short_video_header;
12250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1 selects linear intra DC mode, and
12260c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0 selects non linear intra DC mode.
12270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
12290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12300c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the output (quantized) interblock coefficients.
12310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            When shortVideoHeader==1, AC coefficients are saturated on the
12320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            interval [-127, 127], and DC coefficients are saturated on the
12330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            interval [1, 254].  When shortVideoHeader==0, AC coefficients
12340c1bc742181ded4930842b46e9507372f0b1b963James Dong *            are saturated on the interval [-2047, 2047].
12350c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12360c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
12370c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12380c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
12390c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
12400c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is NULL.
12410c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0 or QP >= 32.
12420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12430c1bc742181ded4930842b46e9507372f0b1b963James Dong */
12440c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_QuantInter_I (
12450c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
12460c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 QP,
12470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
12480c1bc742181ded4930842b46e9507372f0b1b963James Dong);
12490c1bc742181ded4930842b46e9507372f0b1b963James Dong
12500c1bc742181ded4930842b46e9507372f0b1b963James Dong
12510c1bc742181ded4930842b46e9507372f0b1b963James Dong
12520c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
12530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_TransRecBlockCoef_intra   (6.2.4.4.4)
12540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12550c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
12560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Quantizes the DCT coefficients, implements intra block AC/DC coefficient
12570c1bc742181ded4930842b46e9507372f0b1b963James Dong * prediction, and reconstructs the current intra block texture for prediction
12580c1bc742181ded4930842b46e9507372f0b1b963James Dong * on the next frame.  Quantized row and column coefficients are returned in
12590c1bc742181ded4930842b46e9507372f0b1b963James Dong * the updated coefficient buffers.
12600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
12620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
12630c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the pixels of current intra block; must be aligned on
12640c1bc742181ded4930842b46e9507372f0b1b963James Dong *            an 8-byte boundary.
12650c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufRow - pointer to the coefficient row buffer containing
12660c1bc742181ded4930842b46e9507372f0b1b963James Dong *            ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16.
12670c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Coefficients are organized into blocks of eight as described
12680c1bc742181ded4930842b46e9507372f0b1b963James Dong *            below (Internal Prediction Coefficient Update Procedures).  The
12690c1bc742181ded4930842b46e9507372f0b1b963James Dong *            DC coefficient is first, and the remaining buffer locations
12700c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contain the quantized AC coefficients. Each group of eight row
12710c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer elements combined with one element eight elements ahead
12720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contains the coefficient predictors of the neighboring block
12730c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that is spatially above or to the left of the block currently to
12740c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be decoded. A negative-valued DC coefficient indicates that this
12750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            neighboring block is not INTRA-coded or out of bounds, and
12760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            therefore the AC and DC coefficients are invalid.  Pointer must
12770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be aligned on an 8-byte boundary.
12780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufCol - pointer to the prediction coefficient column buffer
12790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            containing 16 elements of type OMX_S16. Coefficients are
12800c1bc742181ded4930842b46e9507372f0b1b963James Dong *            organized as described in section 6.2.2.5.  Pointer must be
12810c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on an 8-byte boundary.
12820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSumErr - pointer to a flag indicating whether or not AC prediction is
12830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            required; AC prediction is enabled if *pSumErr >=0, but the
12840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            value is not used for coefficient prediction, i.e., the sum of
12850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            absolute differences starts from 0 for each call to this
12860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            function.  Otherwise AC prediction is disabled if *pSumErr < 0 .
12870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   blockIndex - block index indicating the component type and position, as
12880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            defined in [ISO14496-2], subclause 6.1.3.8.
12890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   curQp - quantization parameter of the macroblock to which the current
12900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block belongs
12910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0]
12920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contains the quantization parameter associated with the 8x8
12930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block left of the current block (QPa), and pQpBuf[1] contains
12940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the quantization parameter associated with the 8x8 block above
12950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the current block (QPc).  In the event that the corresponding
12960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block is outside of the VOP bound, the Qp value will not affect
12970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the intra prediction process, as described in [ISO14496-2],
12980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            sub-clause 7.4.3.3,  Adaptive AC Coefficient Prediction.
12990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep - width of the source buffer; must be a multiple of 8.
13000c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - width of the reconstructed destination buffer; must be a
13010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            multiple of 16.
13020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
13030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; shortVideoHeader==1 selects linear intra DC
13040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            mode, and shortVideoHeader==0 selects non linear intra DC mode.
13050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
13070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains
13090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the predicted DC coefficient; the remaining entries contain the
13100c1bc742181ded4930842b46e9507372f0b1b963James Dong *            quantized AC coefficients (without prediction).  The pointer
13110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pDstmust be aligned on a 16-byte boundary.
13120c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRec - pointer to the reconstructed texture; must be aligned on an
13130c1bc742181ded4930842b46e9507372f0b1b963James Dong *            8-byte boundary.
13140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufRow - pointer to the updated coefficient row buffer
13150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufCol - pointer to the updated coefficient column buffer
13160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPreACPredict - if prediction is enabled, the parameter points to the
13170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            start of the buffer containing the coefficient differences for
13180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            VLC encoding. The entry pPreACPredict[0]indicates prediction
13190c1bc742181ded4930842b46e9507372f0b1b963James Dong *            direction for the current block and takes one of the following
13200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or
13210c1bc742181ded4930842b46e9507372f0b1b963James Dong *            OMX_VC_VERTICAL.  The entries
13220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pPreACPredict[1]-pPreACPredict[7]contain predicted AC
13230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficients.  If prediction is disabled (*pSumErr<0) then the
13240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contents of this buffer are undefined upon return from the
13250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            function
13260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSumErr - pointer to the value of the accumulated AC coefficient errors,
13270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            i.e., sum of the absolute differences between predicted and
13280c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unpredicted AC coefficients
13290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13300c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
13310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
13330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - Bad arguments:
13340c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL: pSrc, pDst, pRec,
13350c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr.
13360c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    blockIndex < 0 or blockIndex >= 10;
13370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    curQP <= 0 or curQP >= 32.
13380c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    srcStep, or dstStep <= 0 or not a multiple of 8.
13390c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 16-byte aligned: .
13400c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is not 8-byte aligned:
13410c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrc, pRec.
13420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13430c1bc742181ded4930842b46e9507372f0b1b963James Dong *  Note: The coefficient buffers must be updated in accordance with the
13440c1bc742181ded4930842b46e9507372f0b1b963James Dong *        update procedures defined in section in 6.2.2.
13450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13460c1bc742181ded4930842b46e9507372f0b1b963James Dong */
13470c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_TransRecBlockCoef_intra (
13480c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
13490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
13500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pRec,
13510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pPredBufRow,
13520c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pPredBufCol,
13530c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pPreACPredict,
13540c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pSumErr,
13550c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT blockIndex,
13560c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 curQp,
13570c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pQpBuf,
13580c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT srcStep,
13590c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
13600c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
13610c1bc742181ded4930842b46e9507372f0b1b963James Dong);
13620c1bc742181ded4930842b46e9507372f0b1b963James Dong
13630c1bc742181ded4930842b46e9507372f0b1b963James Dong
13640c1bc742181ded4930842b46e9507372f0b1b963James Dong
13650c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
13660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_TransRecBlockCoef_inter   (6.2.4.4.5)
13670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
13690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Implements DCT, and quantizes the DCT coefficients of the inter block
13700c1bc742181ded4930842b46e9507372f0b1b963James Dong * while reconstructing the texture residual. There is no boundary check for
13710c1bc742181ded4930842b46e9507372f0b1b963James Dong * the bit stream buffer.
13720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13730c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
13740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc -pointer to the residuals to be encoded; must be aligned on an
13760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            16-byte boundary.
13770c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter.
13780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of short_video_header;
13790c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      shortVideoHeader==1 selects linear intra DC mode, and
13800c1bc742181ded4930842b46e9507372f0b1b963James Dong *                      shortVideoHeader==0 selects non linear intra DC mode.
13810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
13830c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the quantized DCT coefficients buffer; must be aligned
13850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 16-byte boundary.
13860c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRec - pointer to the reconstructed texture residuals; must be aligned
13870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 16-byte boundary.
13880c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13890c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
13900c1bc742181ded4930842b46e9507372f0b1b963James Dong *
13910c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
13920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
13930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is either NULL or
13940c1bc742181ded4930842b46e9507372f0b1b963James Dong *         not 16-byte aligned:
13950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            - pSrc
13960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            - pDst
13970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            - pRec
13980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0 or QP >= 32.
13990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14000c1bc742181ded4930842b46e9507372f0b1b963James Dong */
14010c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_TransRecBlockCoef_inter (
14020c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrc,
14030c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
14040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pRec,
14050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 QP,
14060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
14070c1bc742181ded4930842b46e9507372f0b1b963James Dong);
14080c1bc742181ded4930842b46e9507372f0b1b963James Dong
14090c1bc742181ded4930842b46e9507372f0b1b963James Dong
14100c1bc742181ded4930842b46e9507372f0b1b963James Dong
14110c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
14120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_EncodeVLCZigzag_IntraDCVLC   (6.2.4.5.2)
14130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14140c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
14150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
14160c1bc742181ded4930842b46e9507372f0b1b963James Dong * intra block.  Two versions of the function (DCVLC and ACVLC) are provided
14170c1bc742181ded4930842b46e9507372f0b1b963James Dong * in order to support the two different methods of processing DC
14180c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC
14190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Coefficient Decoding for the Case of Switched VLC Encoding".
14200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
14220c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14230c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - double pointer to the current byte in the bitstream
14240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed by
14250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. Valid within 0 to 7.
14260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pQDctBlkCoef - pointer to the quantized DCT coefficient
14270c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predDir - AC prediction direction, which is used to decide the zigzag
14280c1bc742181ded4930842b46e9507372f0b1b963James Dong *            scan pattern; takes one of the following values:
14290c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_NONE - AC prediction not used.
14300c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs classical zigzag scan.
14310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_HORIZONTAL - Horizontal prediction.
14320c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs alternate-vertical zigzag scan.
14330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_VERTICAL - Vertical prediction.
14340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs alternate-horizontal zigzag scan.
14350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pattern - block pattern which is used to decide whether this block is
14360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            encoded
14370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
14380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
14390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
14400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
14410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type (luminance, chrominance) of the current
14420c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block
14430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14440c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
14450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is encoded, so
14470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer.
14480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
14490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream.
14500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
14520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
14540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - Bad arguments:
14550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL: ppBitStream,
14560c1bc742181ded4930842b46e9507372f0b1b963James Dong *              *ppBitStream, pBitOffset, pQDctBlkCoef.
14570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   *pBitOffset < 0, or *pBitOffset >7.
14580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
14590c1bc742181ded4930842b46e9507372f0b1b963James Dong *         OMX_VC_VERTICAL.
14600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    VideoComp is not one component of enum OMXVCM4P2VideoComponent.
14610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14620c1bc742181ded4930842b46e9507372f0b1b963James Dong */
14630c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (
14640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppBitStream,
14650c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
14660c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pQDctBlkCoef,
14670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 predDir,
14680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 pattern,
14690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader,
14700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2VideoComponent videoComp
14710c1bc742181ded4930842b46e9507372f0b1b963James Dong);
14720c1bc742181ded4930842b46e9507372f0b1b963James Dong
14730c1bc742181ded4930842b46e9507372f0b1b963James Dong
14740c1bc742181ded4930842b46e9507372f0b1b963James Dong
14750c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
14760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_EncodeVLCZigzag_IntraACVLC   (6.2.4.5.2)
14770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
14790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs zigzag scan and VLC encoding of AC and DC coefficients for one
14800c1bc742181ded4930842b46e9507372f0b1b963James Dong * intra block.  Two versions of the function (DCVLC and ACVLC) are provided
14810c1bc742181ded4930842b46e9507372f0b1b963James Dong * in order to support the two different methods of processing DC
14820c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC
14830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Coefficient Decoding for the Case of Switched VLC Encoding.
14840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
14860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
14870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - double pointer to the current byte in the bitstream
14880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed by
14890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. Valid within 0 to 7.
14900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pQDctBlkCoef - pointer to the quantized DCT coefficient
14910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predDir - AC prediction direction, which is used to decide the zigzag
14920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            scan pattern; takes one of the following values:
14930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_NONE - AC prediction not used.
14940c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs classical zigzag scan.
14950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_HORIZONTAL - Horizontal prediction.
14960c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs alternate-vertical zigzag scan.
14970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_VERTICAL - Vertical prediction.
14980c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             Performs alternate-horizontal zigzag scan.
14990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pattern - block pattern which is used to decide whether this block is
15000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            encoded
15010c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
15020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
15030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
15040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
15050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
15070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is encoded, so
15090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer.
15100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
15110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream.
15120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
15140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15150c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
15160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - Bad arguments:
15170c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL: ppBitStream,
15180c1bc742181ded4930842b46e9507372f0b1b963James Dong *              *ppBitStream, pBitOffset, pQDctBlkCoef.
15190c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   *pBitOffset < 0, or *pBitOffset >7.
15200c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or
15210c1bc742181ded4930842b46e9507372f0b1b963James Dong *         OMX_VC_VERTICAL.
15220c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    VideoComp is not one component of enum OMXVCM4P2VideoComponent.
15230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15240c1bc742181ded4930842b46e9507372f0b1b963James Dong */
15250c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC (
15260c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppBitStream,
15270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
15280c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pQDctBlkCoef,
15290c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 predDir,
15300c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 pattern,
15310c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
15320c1bc742181ded4930842b46e9507372f0b1b963James Dong);
15330c1bc742181ded4930842b46e9507372f0b1b963James Dong
15340c1bc742181ded4930842b46e9507372f0b1b963James Dong
15350c1bc742181ded4930842b46e9507372f0b1b963James Dong
15360c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
15370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_EncodeVLCZigzag_Inter   (6.2.4.5.3)
15380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
15400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs classical zigzag scanning and VLC encoding for one inter block.
15410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
15430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the bit
15450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            stream
15460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed by
15470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. Valid within 0 to 7
15480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pQDctBlkCoef - pointer to the quantized DCT coefficient
15490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pattern - block pattern which is used to decide whether this block is
15500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            encoded
15510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
15520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
15530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
15540c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
15550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
15570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is encoded so that
15590c1bc742181ded4930842b46e9507372f0b1b963James Dong *            it points to the current byte in the bit stream buffer.
15600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
15610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream.
15620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
15640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15650c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
15660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - Bad arguments
15670c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the pointers: is NULL: ppBitStream, *ppBitStream,
15680c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBitOffset, pQDctBlkCoef
15690c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   *pBitOffset < 0, or *pBitOffset >7.
15700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15710c1bc742181ded4930842b46e9507372f0b1b963James Dong */
15720c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_EncodeVLCZigzag_Inter (
15730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppBitStream,
15740c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
15750c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pQDctBlkCoef,
15760c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 pattern,
15770c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
15780c1bc742181ded4930842b46e9507372f0b1b963James Dong);
15790c1bc742181ded4930842b46e9507372f0b1b963James Dong
15800c1bc742181ded4930842b46e9507372f0b1b963James Dong
15810c1bc742181ded4930842b46e9507372f0b1b963James Dong
15820c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
15830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_EncodeMV   (6.2.4.5.4)
15840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
15860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Predicts a motion vector for the current macroblock, encodes the
15870c1bc742181ded4930842b46e9507372f0b1b963James Dong * difference, and writes the output to the stream buffer. The input MVs
15880c1bc742181ded4930842b46e9507372f0b1b963James Dong * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie
15890c1bc742181ded4930842b46e9507372f0b1b963James Dong * within the ranges associated with the input parameter fcodeForward, as
15900c1bc742181ded4930842b46e9507372f0b1b963James Dong * described in [ISO14496-2], subclause 7.6.3.  This function provides a
15910c1bc742181ded4930842b46e9507372f0b1b963James Dong * superset of the functionality associated with the function
15920c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P2_FindMVpred.
15930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
15950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
15960c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - double pointer to the current byte in the bitstream buffer
15970c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - index of the first free (next available) bit in the stream
15980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer referenced by *ppBitStream, valid in the range 0 to 7.
15990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMVCurMB - pointer to the current macroblock motion vector; a value of
16000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            NULL indicates unavailability.
16010c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMVLeftMB - pointer to the source left macroblock motion vector; a
16020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            value of  NULLindicates unavailability.
16030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMVUpperMB - pointer to source upper macroblock motion vector; a
16040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            value of NULL indicates unavailability.
16050c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a
16060c1bc742181ded4930842b46e9507372f0b1b963James Dong *            value of NULL indicates unavailability.
16070c1bc742181ded4930842b46e9507372f0b1b963James Dong *   fcodeForward - an integer with values from 1 to 7; used in encoding
16080c1bc742181ded4930842b46e9507372f0b1b963James Dong *            motion vectors related to search range, as described in
16090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-2], subclause 7.6.3.
16100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MBType - macro block type, valid in the range 0 to 5
16110c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
16130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - updated pointer to the current byte in the bit stream
16150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer
16160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - updated index of the next available bit position in stream
16170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer referenced by *ppBitStream
16180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
16200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
16220c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments
16230c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL: ppBitStream,
16240c1bc742181ded4930842b46e9507372f0b1b963James Dong *              *ppBitStream, pBitOffset, pMVCurMB
16250c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    *pBitOffset < 0, or *pBitOffset >7.
16260c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    fcodeForward <= 0, or fcodeForward > 7, or MBType < 0.
16270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16280c1bc742181ded4930842b46e9507372f0b1b963James Dong */
16290c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_EncodeMV (
16300c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppBitStream,
16310c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
16320c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pMVCurMB,
16330c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector*pSrcMVLeftMB,
16340c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcMVUpperMB,
16350c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pSrcMVUpperRightMB,
16360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT fcodeForward,
16370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MacroblockType MBType
16380c1bc742181ded4930842b46e9507372f0b1b963James Dong);
16390c1bc742181ded4930842b46e9507372f0b1b963James Dong
16400c1bc742181ded4930842b46e9507372f0b1b963James Dong
16410c1bc742181ded4930842b46e9507372f0b1b963James Dong
16420c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
16430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodePadMV_PVOP   (6.2.5.1.1)
16440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
16460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Decodes and pads the four motion vectors associated with a non-intra P-VOP
16470c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock.  For macroblocks of type OMX_VC_INTER4V, the output MV is
16480c1bc742181ded4930842b46e9507372f0b1b963James Dong * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for
16490c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to
16500c1bc742181ded4930842b46e9507372f0b1b963James Dong * all four output MV buffer entries.
16510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16520c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
16530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the bit
16550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            stream buffer
16560c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed to by
16570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. *pBitOffset is valid within [0-7].
16580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the
16590c1bc742181ded4930842b46e9507372f0b1b963James Dong *            motion vector buffers of the macroblocks specially at the left,
16600c1bc742181ded4930842b46e9507372f0b1b963James Dong *            upper, and upper-right side of the current macroblock,
16610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            respectively; a value of NULL indicates unavailability.  Note:
16620c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Any neighborhood macroblock outside the current VOP or video
16630c1bc742181ded4930842b46e9507372f0b1b963James Dong *            packet or outside the current GOB (when short_video_header is
16640c1bc742181ded4930842b46e9507372f0b1b963James Dong *             1 ) for which gob_header_empty is  0  is treated as
16650c1bc742181ded4930842b46e9507372f0b1b963James Dong *            transparent, according to [ISO14496-2], subclause 7.6.5.
16660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream
16670c1bc742181ded4930842b46e9507372f0b1b963James Dong *            syntax
16680c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MBType - the type of the current macroblock. If MBType is not equal to
16690c1bc742181ded4930842b46e9507372f0b1b963James Dong *            OMX_VC_INTER4V, the destination motion vector buffer is still
16700c1bc742181ded4930842b46e9507372f0b1b963James Dong *            filled with the same decoded vector.
16710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
16730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded, so
16750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer
16760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
16770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream
16780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstMVCurMB - pointer to the motion vector buffer for the current
16790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            macroblock; contains four decoded motion vectors
16800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
16820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
16840c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
16850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL:
16860c1bc742181ded4930842b46e9507372f0b1b963James Dong *         ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB
16870c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    *pBitOffset exceeds [0,7]
16880c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    fcodeForward exceeds (0,7]
16890c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    MBType less than zero
16900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    motion vector buffer is not 4-byte aligned.
16910c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - status error
16920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
16930c1bc742181ded4930842b46e9507372f0b1b963James Dong */
16940c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodePadMV_PVOP (
16950c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
16960c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
16970c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcMVLeftMB,
16980c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector*pSrcMVUpperMB,
16990c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcMVUpperRightMB,
17000c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector*pDstMVCurMB,
17010c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT fcodeForward,
17020c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2MacroblockType MBType
17030c1bc742181ded4930842b46e9507372f0b1b963James Dong);
17040c1bc742181ded4930842b46e9507372f0b1b963James Dong
17050c1bc742181ded4930842b46e9507372f0b1b963James Dong
17060c1bc742181ded4930842b46e9507372f0b1b963James Dong
17070c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
17080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodeVLCZigzag_IntraDCVLC   (6.2.5.2.2)
17090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
17110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
17120c1bc742181ded4930842b46e9507372f0b1b963James Dong * for one intra block.  Two versions of the function (DCVLC and ACVLC) are
17130c1bc742181ded4930842b46e9507372f0b1b963James Dong * provided in order to support the two different methods of processing DC
17140c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC
17150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Coefficient Decoding for the Case of Switched VLC Encoding.
17160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17170c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
17180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the
17200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bitstream buffer
17210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the current byte referenced
17220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            by *ppBitStream.  The parameter *pBitOffset is valid in the
17230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0-7].
17240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Bit Position in one byte:  |Most      Least|
17250c1bc742181ded4930842b46e9507372f0b1b963James Dong *                    *pBitOffset        |0 1 2 3 4 5 6 7|
17260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predDir - AC prediction direction; used to select the zigzag scan
17270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pattern; takes one of the following values:
17280c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_NONE - AC prediction not used;
17290c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             performs classical zigzag scan.
17300c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_HORIZONTAL - Horizontal prediction;
17310c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             performs alternate-vertical zigzag scan;
17320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  OMX_VC_VERTICAL - Vertical prediction;
17330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                             performs alternate-horizontal zigzag scan.
17340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
17350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
17360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
17370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
17380c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type (luminance or chrominance) of the
17390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            current block
17400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
17420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded such
17440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer
17450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated such that it points to the current
17460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bit position in the byte pointed by *ppBitStream
17470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the coefficient buffer of current block; must be
17480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4-byte aligned.
17490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
17510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
17530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments, if:
17540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL:
17550c1bc742181ded4930842b46e9507372f0b1b963James Dong *         ppBitStream, *ppBitStream, pBitOffset, pDst
17560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    *pBitOffset exceeds [0,7]
17570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    preDir exceeds [0,2]
17580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 4-byte aligned
17590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - if:
17600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    In DecodeVLCZigzag_IntraDCVLC, dc_size > 12
17610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of mark bits equals zero
17620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Illegal stream encountered; code cannot be located in VLC table
17630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Forbidden code encountered in the VLC FLC table.
17640c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    The number of coefficients is greater than 64
17650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17660c1bc742181ded4930842b46e9507372f0b1b963James Dong */
17670c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (
17680c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
17690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
17700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
17710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 predDir,
17720c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader,
17730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2VideoComponent videoComp
17740c1bc742181ded4930842b46e9507372f0b1b963James Dong);
17750c1bc742181ded4930842b46e9507372f0b1b963James Dong
17760c1bc742181ded4930842b46e9507372f0b1b963James Dong
17770c1bc742181ded4930842b46e9507372f0b1b963James Dong
17780c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
17790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodeVLCZigzag_IntraACVLC   (6.2.5.2.2)
17800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
17820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients
17830c1bc742181ded4930842b46e9507372f0b1b963James Dong * for one intra block.  Two versions of the function (DCVLC and ACVLC) are
17840c1bc742181ded4930842b46e9507372f0b1b963James Dong * provided in order to support the two different methods of processing DC
17850c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients, as described in [ISO14496-2], subclause 7.4.1.4,  Intra DC
17860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Coefficient Decoding for the Case of Switched VLC Encoding.
17870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
17890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
17900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the
17910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bitstream buffer
17920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the current byte referenced
17930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            by *ppBitStream.  The parameter *pBitOffset is valid in the
17940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0-7]. Bit Position in one byte:  |Most Least| *pBitOffset
17950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            |0 1 2 3 4 5 6 7|
17960c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predDir - AC prediction direction; used to select the zigzag scan
17970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pattern; takes one of the following values: OMX_VC_NONE - AC
17980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            prediction not used; performs classical zigzag scan.
17990c1bc742181ded4930842b46e9507372f0b1b963James Dong *            OMX_VC_HORIZONTAL - Horizontal prediction; performs
18000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical
18010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            prediction; performs alternate-horizontal zigzag scan.
18020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
18030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
18040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
18050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
18060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type (luminance or chrominance) of the
18070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            current block
18080c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
18100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18110c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded such
18120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer
18130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated such that it points to the current
18140c1bc742181ded4930842b46e9507372f0b1b963James Dong *            bit position in the byte pointed by *ppBitStream
18150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the coefficient buffer of current block; must be
18160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4-byte aligned.
18170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
18190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18200c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
18210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments At least one of the following
18220c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst,
18230c1bc742181ded4930842b46e9507372f0b1b963James Dong *              or At least one of the following conditions is true:
18240c1bc742181ded4930842b46e9507372f0b1b963James Dong *              *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is
18250c1bc742181ded4930842b46e9507372f0b1b963James Dong *              not 4-byte aligned
18260c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of
18270c1bc742181ded4930842b46e9507372f0b1b963James Dong *              mark bits equals zero Illegal stream encountered; code cannot
18280c1bc742181ded4930842b46e9507372f0b1b963James Dong *              be located in VLC table Forbidden code encountered in the VLC
18290c1bc742181ded4930842b46e9507372f0b1b963James Dong *              FLC table The number of coefficients is greater than 64
18300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18310c1bc742181ded4930842b46e9507372f0b1b963James Dong */
18320c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC (
18330c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
18340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
18350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
18360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 predDir,
18370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
18380c1bc742181ded4930842b46e9507372f0b1b963James Dong);
18390c1bc742181ded4930842b46e9507372f0b1b963James Dong
18400c1bc742181ded4930842b46e9507372f0b1b963James Dong
18410c1bc742181ded4930842b46e9507372f0b1b963James Dong
18420c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
18430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodeVLCZigzag_Inter   (6.2.5.2.3)
18440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18450c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
18460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
18470c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18480c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
18490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18500c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - double pointer to the current byte in the stream buffer
18510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the next available bit in the current stream
18520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            byte referenced by *ppBitStream. The parameter *pBitOffset is
18530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            valid within the range [0-7].
18540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
18550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; escape modes 0-3 are used if
18560c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==0, and escape mode 4 is used when
18570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            shortVideoHeader==1.
18580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18590c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
18600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18610c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded such
18620c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the stream buffer
18630c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated after decoding such that it points
18640c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to the next available bit in the stream byte referenced by
18650c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream
18660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the coefficient buffer of current block; must be
18670c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4-byte aligned.
18680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
18700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments:
18720c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL:
18730c1bc742181ded4930842b46e9507372f0b1b963James Dong *         ppBitStream, *ppBitStream, pBitOffset, pDst
18740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 4-byte aligned
18750c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   *pBitOffset exceeds [0,7]
18760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - status error, if:
18770c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one mark bit is equal to zero
18780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Encountered an illegal stream code that cannot be found in the VLC table
18790c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Encountered an illegal code in the VLC FLC table
18800c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    The number of coefficients is greater than 64
18810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18820c1bc742181ded4930842b46e9507372f0b1b963James Dong */
18830c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodeVLCZigzag_Inter (
18840c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
18850c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
18860c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
18870c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
18880c1bc742181ded4930842b46e9507372f0b1b963James Dong);
18890c1bc742181ded4930842b46e9507372f0b1b963James Dong
18900c1bc742181ded4930842b46e9507372f0b1b963James Dong
18910c1bc742181ded4930842b46e9507372f0b1b963James Dong
18920c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
18930c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_QuantInvIntra_I   (6.2.5.3.2)
18940c1bc742181ded4930842b46e9507372f0b1b963James Dong *
18950c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
18960c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs the second inverse quantization mode on an intra/inter coded
18970c1bc742181ded4930842b46e9507372f0b1b963James Dong * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
18980c1bc742181ded4930842b46e9507372f0b1b963James Dong * the range [-2048, 2047].
18990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19000c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
19010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input (quantized) intra/inter block; must be
19030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on a 16-byte boundary.
19040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter (quantizer_scale)
19050c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type of the current block. Takes one of the
19060c1bc742181ded4930842b46e9507372f0b1b963James Dong *            following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
19070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            version only).
19080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of short_video_header
19090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (intra version only).
19100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
19120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the output (dequantized) intra/inter block
19140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
19160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19170c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
19180c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; one or more of the following is
19190c1bc742181ded4930842b46e9507372f0b1b963James Dong *              true:
19200c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is NULL
19210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0 or QP >=31
19220c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
19230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19240c1bc742181ded4930842b46e9507372f0b1b963James Dong */
19250c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_QuantInvIntra_I (
19260c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
19270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP,
19280c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2VideoComponent videoComp,
19290c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
19300c1bc742181ded4930842b46e9507372f0b1b963James Dong);
19310c1bc742181ded4930842b46e9507372f0b1b963James Dong
19320c1bc742181ded4930842b46e9507372f0b1b963James Dong
19330c1bc742181ded4930842b46e9507372f0b1b963James Dong
19340c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
19350c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_QuantInvInter_I   (6.2.5.3.2)
19360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
19380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs the second inverse quantization mode on an intra/inter coded
19390c1bc742181ded4930842b46e9507372f0b1b963James Dong * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
19400c1bc742181ded4930842b46e9507372f0b1b963James Dong * the range [-2048, 2047].
19410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
19430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input (quantized) intra/inter block; must be
19450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on a 16-byte boundary.
19460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter (quantizer_scale)
19470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type of the current block. Takes one of the
19480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
19490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            version only).
19500c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of short_video_header
19510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (intra version only).
19520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
19540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19550c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the output (dequantized) intra/inter block
19560c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19570c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
19580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
19600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; one or more of the following is
19610c1bc742181ded4930842b46e9507372f0b1b963James Dong *              true:
19620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is NULL
19630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0 or QP >=31
19640c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
19650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19660c1bc742181ded4930842b46e9507372f0b1b963James Dong */
19670c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_QuantInvInter_I (
19680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
19690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP
19700c1bc742181ded4930842b46e9507372f0b1b963James Dong);
19710c1bc742181ded4930842b46e9507372f0b1b963James Dong
19720c1bc742181ded4930842b46e9507372f0b1b963James Dong
19730c1bc742181ded4930842b46e9507372f0b1b963James Dong
19740c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
19750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodeBlockCoef_Intra   (6.2.5.4.1)
19760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
19780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Decodes the INTRA block coefficients. Inverse quantization, inversely
19790c1bc742181ded4930842b46e9507372f0b1b963James Dong * zigzag positioning, and IDCT, with appropriate clipping on each step, are
19800c1bc742181ded4930842b46e9507372f0b1b963James Dong * performed on the coefficients. The results are then placed in the output
19810c1bc742181ded4930842b46e9507372f0b1b963James Dong * frame/plane on a pixel basis.  Note: This function will be used only when
19820c1bc742181ded4930842b46e9507372f0b1b963James Dong * at least one non-zero AC coefficient of current block exists in the bit
19830c1bc742181ded4930842b46e9507372f0b1b963James Dong * stream. The DC only condition will be handled in another function.
19840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
19870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
19880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the bit
19890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            stream buffer. There is no boundary check for the bit stream
19900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer.
19910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed to by
19920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. *pBitOffset is valid within [0-7].
19930c1bc742181ded4930842b46e9507372f0b1b963James Dong *   step - width of the destination plane
19940c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCoefBufRow - pointer to the coefficient row buffer; must be aligned on
19950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            an 8-byte boundary.
19960c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCoefBufCol - pointer to the coefficient column buffer; must be aligned
19970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on an 8-byte boundary.
19980c1bc742181ded4930842b46e9507372f0b1b963James Dong *   curQP - quantization parameter of the macroblock which the current block
19990c1bc742181ded4930842b46e9507372f0b1b963James Dong *            belongs to
20000c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pQPBuf - pointer to the quantization parameter buffer
20010c1bc742181ded4930842b46e9507372f0b1b963James Dong *   blockIndex - block index indicating the component type and position as
20020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5.
20030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a
20040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            mechanism to switch between two VLC for coding of Intra DC
20050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficients as per [ISO14496-2], Table 6-21.
20060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if
20070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the ac coefficients of the first row or first column are
20080c1bc742181ded4930842b46e9507372f0b1b963James Dong *            differentially coded for intra coded macroblock.
20090c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
20100c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; shortVideoHeader==1 selects linear intra DC
20110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            mode, and shortVideoHeader==0 selects non linear intra DC mode.
20120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
20140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded, so
20160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer
20170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
20180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream
20190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the block in the destination plane; must be aligned on
20200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            an 8-byte boundary.
20210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCoefBufRow - pointer to the updated coefficient row buffer.
20220c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCoefBufCol - pointer to the updated coefficient column buffer  Note:
20230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            The coefficient buffers must be updated in accordance with the
20240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            update procedure defined in section 6.2.2.
20250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
20270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
20290c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments, if:
20300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is NULL:
20310c1bc742181ded4930842b46e9507372f0b1b963James Dong *         ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol,
20320c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pQPBuf, pDst.
20330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    *pBitOffset exceeds [0,7]
20340c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    curQP exceeds (1, 31)
20350c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    blockIndex exceeds [0,5]
20360c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    step is not the multiple of 8
20370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a pointer alignment requirement was violated.
20380c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra.
20390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20400c1bc742181ded4930842b46e9507372f0b1b963James Dong */
20410c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodeBlockCoef_Intra (
20420c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
20430c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
20440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
20450c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT step,
20460c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pCoefBufRow,
20470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pCoefBufCol,
20480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 curQP,
20490c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pQPBuf,
20500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT blockIndex,
20510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT intraDCVLC,
20520c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT ACPredFlag,
20530c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
20540c1bc742181ded4930842b46e9507372f0b1b963James Dong);
20550c1bc742181ded4930842b46e9507372f0b1b963James Dong
20560c1bc742181ded4930842b46e9507372f0b1b963James Dong
20570c1bc742181ded4930842b46e9507372f0b1b963James Dong
20580c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
20590c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_DecodeBlockCoef_Inter   (6.2.5.4.2)
20600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
20620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Decodes the INTER block coefficients. This function performs inverse
20630c1bc742181ded4930842b46e9507372f0b1b963James Dong * quantization, inverse zigzag positioning, and IDCT (with appropriate
20640c1bc742181ded4930842b46e9507372f0b1b963James Dong * clipping on each step) on the coefficients. The results (residuals) are
20650c1bc742181ded4930842b46e9507372f0b1b963James Dong * placed in a contiguous array of 64 elements. For INTER block, the output
20660c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer holds the residuals for further reconstruction.
20670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
20690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - pointer to the pointer to the current byte in the bit
20710c1bc742181ded4930842b46e9507372f0b1b963James Dong *            stream buffer. There is no boundary check for the bit stream
20720c1bc742181ded4930842b46e9507372f0b1b963James Dong *            buffer.
20730c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - pointer to the bit position in the byte pointed to by
20740c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream. *pBitOffset is valid within [0-7]
20750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - quantization parameter
20760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   shortVideoHeader - binary flag indicating presence of
20770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            short_video_header; shortVideoHeader==1 selects linear intra DC
20780c1bc742181ded4930842b46e9507372f0b1b963James Dong *            mode, and shortVideoHeader==0 selects non linear intra DC mode.
20790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
20810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after the block is decoded, so
20830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            that it points to the current byte in the bit stream buffer
20840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBitOffset - *pBitOffset is updated so that it points to the current bit
20850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position in the byte pointed by *ppBitStream
20860c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the decoded residual buffer (a contiguous array of 64
20870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            elements of OMX_S16 data type); must be aligned on a 16-byte
20880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
20890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
20910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
20920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
20930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments, if:
20940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    At least one of the following pointers is Null:
20950c1bc742181ded4930842b46e9507372f0b1b963James Dong *         ppBitStream, *ppBitStream, pBitOffset , pDst
20960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    *pBitOffset exceeds [0,7]
20970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP <= 0.
20980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 16-byte aligned
20990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter .
21000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21010c1bc742181ded4930842b46e9507372f0b1b963James Dong */
21020c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_DecodeBlockCoef_Inter (
21030c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
21040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pBitOffset,
21050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
21060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP,
21070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT shortVideoHeader
21080c1bc742181ded4930842b46e9507372f0b1b963James Dong);
21090c1bc742181ded4930842b46e9507372f0b1b963James Dong
21100c1bc742181ded4930842b46e9507372f0b1b963James Dong
21110c1bc742181ded4930842b46e9507372f0b1b963James Dong
21120c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
21130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_PredictReconCoefIntra   (6.2.5.4.3)
21140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
21160c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs adaptive DC/AC coefficient prediction for an intra block.  Prior
21170c1bc742181ded4930842b46e9507372f0b1b963James Dong * to the function call, prediction direction (predDir) should be selected as
21180c1bc742181ded4930842b46e9507372f0b1b963James Dong * specified in [ISO14496-2], subclause 7.4.3.1.
21190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
21210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21220c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the coefficient buffer which contains the quantized
21230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficient residuals (PQF) of the current block; must be
21240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            aligned on a 4-byte boundary.  The output coefficients are
21250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            saturated to the range [-2048, 2047].
21260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufRow - pointer to the coefficient row buffer; must be aligned on
21270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            a 4-byte boundary.
21280c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufCol - pointer to the coefficient column buffer; must be aligned
21290c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 4-byte boundary.
21300c1bc742181ded4930842b46e9507372f0b1b963James Dong *   curQP - quantization parameter of the current block. curQP may equal to
21310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            predQP especially when the current block and the predictor block
21320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            are in the same macroblock.
21330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predQP - quantization parameter of the predictor block
21340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predDir - indicates the prediction direction which takes one of the
21350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            following values: OMX_VC_HORIZONTAL - predict horizontally
21360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            OMX_VC_VERTICAL - predict vertically
21370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ACPredFlag - a flag indicating if AC prediction should be performed. It
21380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            is equal to ac_pred_flag in the bit stream syntax of MPEG-4
21390c1bc742181ded4930842b46e9507372f0b1b963James Dong *   videoComp - video component type (luminance or chrominance) of the
21400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            current block
21410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
21430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the coefficient buffer which contains the quantized
21450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficients (QF) of the current block
21460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufRow - pointer to the updated coefficient row buffer
21470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPredBufCol - pointer to the updated coefficient column buffer  Note:
21480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Buffer update: Update the AC prediction buffer (both row and
21490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            column buffer).
21500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
21520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
21540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments, if:
21550c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    At least one of the pointers is NULL:
21560c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcDst, pPredBufRow, or pPredBufCol.
21570c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    curQP <= 0,
21580c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    predQP <= 0,
21590c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    curQP >31,
21600c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    predQP > 31,
21610c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    preDir exceeds [1,2]
21620c1bc742181ded4930842b46e9507372f0b1b963James Dong *        -    pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned.
21630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21640c1bc742181ded4930842b46e9507372f0b1b963James Dong */
21650c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_PredictReconCoefIntra (
21660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
21670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pPredBufRow,
21680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pPredBufCol,
21690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT curQP,
21700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT predQP,
21710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT predDir,
21720c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT ACPredFlag,
21730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P2VideoComponent videoComp
21740c1bc742181ded4930842b46e9507372f0b1b963James Dong);
21750c1bc742181ded4930842b46e9507372f0b1b963James Dong
21760c1bc742181ded4930842b46e9507372f0b1b963James Dong
21770c1bc742181ded4930842b46e9507372f0b1b963James Dong
21780c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
21790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P2_MCReconBlock   (6.2.5.5.1)
21800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
21820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs motion compensation prediction for an 8x8 block using
21830c1bc742181ded4930842b46e9507372f0b1b963James Dong * interpolation described in [ISO14496-2], subclause 7.6.2.
21840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
21860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
21870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - pointer to the block in the reference plane.
21880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep - distance between the start of consecutive lines in the
21890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference plane, in bytes; must be a multiple of 8.
21900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - distance between the start of consecutive lines in the
21910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            destination plane, in bytes; must be a multiple of 8.
21920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcResidue - pointer to a buffer containing the 16-bit prediction
21930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            residuals; must be 16-byte aligned. If the pointer is NULL, then
21940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            no prediction is done, only motion compensation, i.e., the block
21950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            is moved with interpolation.
21960c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predictType - bilinear interpolation type, as defined in section
21970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            6.2.1.2.
21980c1bc742181ded4930842b46e9507372f0b1b963James Dong *   rndVal - rounding control parameter: 0 - disabled; 1 - enabled.
21990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
22000c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
22010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
22020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the destination buffer; must be 8-byte aligned.  If
22030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            prediction residuals are added then output intensities are
22040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            clipped to the range [0,255].
22050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
22060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
22070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
22080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
22090c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned under any of the following
22100c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions:
22110c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 8-byte aligned.
22120c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcResidue is not 16-byte aligned.
22130c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more of the following pointers is NULL: pSrc or pDst.
22140c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    either srcStep or dstStep is not a multiple of 8.
22150c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    invalid type specified for the parameter predictType.
22160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    the parameter rndVal is not equal either to 0 or 1.
22170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
22180c1bc742181ded4930842b46e9507372f0b1b963James Dong */
22190c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P2_MCReconBlock (
22200c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
22210c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT srcStep,
22220c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrcResidue,
22230c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
22240c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
22250c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT predictType,
22260c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT rndVal
22270c1bc742181ded4930842b46e9507372f0b1b963James Dong);
22280c1bc742181ded4930842b46e9507372f0b1b963James Dong
22290c1bc742181ded4930842b46e9507372f0b1b963James Dong
22300c1bc742181ded4930842b46e9507372f0b1b963James Dong
22310c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.1 Intra 16x16 Prediction Modes  */
22320c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows:  */
22330c1bc742181ded4930842b46e9507372f0b1b963James Dong
22340c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
22350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_16X16_VERT = 0,  /** Intra_16x16_Vertical */
22360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_16X16_HOR = 1,   /** Intra_16x16_Horizontal */
22370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_16X16_DC = 2,    /** Intra_16x16_DC */
22380c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_16X16_PLANE = 3  /** Intra_16x16_Plane */
22390c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10Intra16x16PredMode;
22400c1bc742181ded4930842b46e9507372f0b1b963James Dong
22410c1bc742181ded4930842b46e9507372f0b1b963James Dong
22420c1bc742181ded4930842b46e9507372f0b1b963James Dong
22430c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.2 Intra 4x4 Prediction Modes  */
22440c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows:  */
22450c1bc742181ded4930842b46e9507372f0b1b963James Dong
22460c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
22470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_VERT = 0,     /** Intra_4x4_Vertical */
22480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_HOR = 1,      /** Intra_4x4_Horizontal */
22490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_DC = 2,       /** Intra_4x4_DC */
22500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_DIAG_DL = 3,  /** Intra_4x4_Diagonal_Down_Left */
22510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_DIAG_DR = 4,  /** Intra_4x4_Diagonal_Down_Right */
22520c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_VR = 5,       /** Intra_4x4_Vertical_Right */
22530c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_HD = 6,       /** Intra_4x4_Horizontal_Down */
22540c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_VL = 7,       /** Intra_4x4_Vertical_Left */
22550c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_4X4_HU = 8        /** Intra_4x4_Horizontal_Up */
22560c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10Intra4x4PredMode;
22570c1bc742181ded4930842b46e9507372f0b1b963James Dong
22580c1bc742181ded4930842b46e9507372f0b1b963James Dong
22590c1bc742181ded4930842b46e9507372f0b1b963James Dong
22600c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.3 Chroma Prediction Modes  */
22610c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates intra chroma prediction modes is defined as follows:  */
22620c1bc742181ded4930842b46e9507372f0b1b963James Dong
22630c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
22640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CHROMA_DC = 0,    /** Intra_Chroma_DC */
22650c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CHROMA_HOR = 1,   /** Intra_Chroma_Horizontal */
22660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CHROMA_VERT = 2,  /** Intra_Chroma_Vertical */
22670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_CHROMA_PLANE = 3  /** Intra_Chroma_Plane */
22680c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10IntraChromaPredMode;
22690c1bc742181ded4930842b46e9507372f0b1b963James Dong
22700c1bc742181ded4930842b46e9507372f0b1b963James Dong
22710c1bc742181ded4930842b46e9507372f0b1b963James Dong
22720c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.4 Motion Estimation Modes  */
22730c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates H.264 motion estimation modes is defined as follows:  */
22740c1bc742181ded4930842b46e9507372f0b1b963James Dong
22750c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
22760c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */
22770c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_M4P10_FULL_SEARCH = 1  /** Full motion search */
22780c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10MEMode;
22790c1bc742181ded4930842b46e9507372f0b1b963James Dong
22800c1bc742181ded4930842b46e9507372f0b1b963James Dong
22810c1bc742181ded4930842b46e9507372f0b1b963James Dong
22820c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.5 Macroblock Types  */
22830c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates H.264 macroblock types is defined as follows:  */
22840c1bc742181ded4930842b46e9507372f0b1b963James Dong
22850c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
22860c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_P_16x16  = 0, /* defined by [ISO14496-10] */
22870c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_P_16x8  = 1,
22880c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_P_8x16  = 2,
22890c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_P_8x8  = 3,
22900c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_PREF0_8x8  = 4,
22910c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTER_SKIP  = 5,
22920c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTRA_4x4  = 8,
22930c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTRA_16x16  = 9,
22940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_INTRA_PCM = 10
22950c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10MacroblockType;
22960c1bc742181ded4930842b46e9507372f0b1b963James Dong
22970c1bc742181ded4930842b46e9507372f0b1b963James Dong
22980c1bc742181ded4930842b46e9507372f0b1b963James Dong
22990c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.6 Sub-Macroblock Types  */
23000c1bc742181ded4930842b46e9507372f0b1b963James Dong/* A data type that enumerates H.264 sub-macroblock types is defined as follows:  */
23010c1bc742181ded4930842b46e9507372f0b1b963James Dong
23020c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef enum {
23030c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */
23040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_SUB_P_8x4 = 1,
23050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_SUB_P_4x8 = 2,
23060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_VC_SUB_P_4x4 = 3
23070c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10SubMacroblockType;
23080c1bc742181ded4930842b46e9507372f0b1b963James Dong
23090c1bc742181ded4930842b46e9507372f0b1b963James Dong
23100c1bc742181ded4930842b46e9507372f0b1b963James Dong
23110c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.7 Variable Length Coding (VLC) Information  */
23120c1bc742181ded4930842b46e9507372f0b1b963James Dong
23130c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
23140c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 uTrailing_Ones;      /* Trailing ones; 3 at most */
23150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */
23160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 uNumCoeffs;          /* Total number of non-zero coefs, including trailing ones */
23170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 uTotalZeros;         /* Total number of zero coefs */
23180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 iLevels[16];        /* Levels of non-zero coefs, in reverse zig-zag order */
23190c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 uRuns[16];           /* Runs for levels and trailing ones, in reverse zig-zag order */
23200c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10VLCInfo;
23210c1bc742181ded4930842b46e9507372f0b1b963James Dong
23220c1bc742181ded4930842b46e9507372f0b1b963James Dong
23230c1bc742181ded4930842b46e9507372f0b1b963James Dong
23240c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.8 Macroblock Information  */
23250c1bc742181ded4930842b46e9507372f0b1b963James Dong
23260c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
23270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 sliceId;                          /* slice number */
23280c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MacroblockType mbType;          /* MB type */
23290c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */
23300c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 qpy;                              /* qp for luma */
23310c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 qpc;                              /* qp for chroma */
23320c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 cbpy;                             /* CBP Luma */
23330c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 cbpc;                             /* CBP Chroma */
23340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */
23350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */
23360c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 pRefL0Idx[4];                      /* reference picture indices */
23370c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */
23380c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */
23390c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr;
23400c1bc742181ded4930842b46e9507372f0b1b963James Dong
23410c1bc742181ded4930842b46e9507372f0b1b963James Dong
23420c1bc742181ded4930842b46e9507372f0b1b963James Dong
23430c1bc742181ded4930842b46e9507372f0b1b963James Dong/* 6.3.1.9 Motion Estimation Parameters  */
23440c1bc742181ded4930842b46e9507372f0b1b963James Dong
23450c1bc742181ded4930842b46e9507372f0b1b963James Dongtypedef struct {
23460c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */
23470c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */
23480c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 halfSearchEnable;
23490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 quarterSearchEnable;
23500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 intraEnable4x4;      /* 1=enable, 0=disable */
23510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 searchRange16x16;    /* integer pixel units */
23520c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 searchRange8x8;
23530c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 searchRange4x4;
23540c1bc742181ded4930842b46e9507372f0b1b963James Dong} OMXVCM4P10MEParams;
23550c1bc742181ded4930842b46e9507372f0b1b963James Dong
23560c1bc742181ded4930842b46e9507372f0b1b963James Dong
23570c1bc742181ded4930842b46e9507372f0b1b963James Dong
23580c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
23590c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_PredictIntra_4x4   (6.3.3.1.1)
23600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
23620c1bc742181ded4930842b46e9507372f0b1b963James Dong * Perform Intra_4x4 prediction for luma samples. If the upper-right block is
23630c1bc742181ded4930842b46e9507372f0b1b963James Dong * not available, then duplication work should be handled inside the function.
23640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Users need not define them outside.
23650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23660c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
23670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23680c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcLeft -  Pointer to the buffer of 4 left pixels:
23690c1bc742181ded4930842b46e9507372f0b1b963James Dong *                  p[x, y] (x = -1, y = 0..3)
23700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAbove - Pointer to the buffer of 8 above pixels:
23710c1bc742181ded4930842b46e9507372f0b1b963James Dong *                  p[x,y] (x = 0..7, y =-1);
23720c1bc742181ded4930842b46e9507372f0b1b963James Dong *               must be aligned on a 4-byte boundary.
23730c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
23740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   leftStep - Step of left pixel buffer; must be a multiple of 4.
23750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - Step of the destination buffer; must be a multiple of 4.
23760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predMode - Intra_4x4 prediction mode.
23770c1bc742181ded4930842b46e9507372f0b1b963James Dong *   availability - Neighboring 4x4 block availability flag, refer to
23780c1bc742181ded4930842b46e9507372f0b1b963James Dong *             "Neighboring Macroblock Availability" .
23790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
23810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the destination buffer; must be aligned on a 4-byte
23830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
23840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
23850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
23860c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
23870c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
23880c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
23890c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pDst is NULL.
23900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dstStep < 4, or dstStep is not a multiple of 4.
23910c1bc742181ded4930842b46e9507372f0b1b963James Dong *    leftStep is not a multiple of 4.
23920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is not in the valid range of enumeration
23930c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMXVCM4P10Intra4x4PredMode.
23940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER
23950c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[x,-1] (x = 0..3) is not available.
23960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT
23970c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[-1,y] (y = 0..3) is not available.
23980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set
23990c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available.
24000c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set
24010c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
24020c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
24030c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
24040c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_VR, but availability doesn't set
24050c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
24060c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
24070c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
24080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_HD, but availability doesn't set
24090c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
24100c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not
24110c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
24120c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER
24130c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[x,-1] (x = 0..3) is not available.
24140c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT
24150c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[-1,y] (y = 0..3) is not available.
24160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
24170c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
24180c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
24190c1bc742181ded4930842b46e9507372f0b1b963James Dong *    either pSrcAbove or pDst is not aligned on a 4-byte boundary.
24200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Note:
24220c1bc742181ded4930842b46e9507372f0b1b963James Dong *     pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
24230c1bc742181ded4930842b46e9507372f0b1b963James Dong *     they are not used by intra prediction as implied in predMode.
24240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24250c1bc742181ded4930842b46e9507372f0b1b963James Dong */
24260c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_PredictIntra_4x4 (
24270c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcLeft,
24280c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAbove,
24290c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAboveLeft,
24300c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
24310c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT leftStep,
24320c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
24330c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10Intra4x4PredMode predMode,
24340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 availability
24350c1bc742181ded4930842b46e9507372f0b1b963James Dong);
24360c1bc742181ded4930842b46e9507372f0b1b963James Dong
24370c1bc742181ded4930842b46e9507372f0b1b963James Dong
24380c1bc742181ded4930842b46e9507372f0b1b963James Dong
24390c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
24400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_PredictIntra_16x16   (6.3.3.1.2)
24410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
24430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Perform Intra_16x16 prediction for luma samples. If the upper-right block
24440c1bc742181ded4930842b46e9507372f0b1b963James Dong * is not available, then duplication work should be handled inside the
24450c1bc742181ded4930842b46e9507372f0b1b963James Dong * function. Users need not define them outside.
24460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
24480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y =
24500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            0..15)
24510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15,
24520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            y= -1); must be aligned on a 16-byte boundary.
24530c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
24540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   leftStep - Step of left pixel buffer; must be a multiple of 16.
24550c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - Step of the destination buffer; must be a multiple of 16.
24560c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predMode - Intra_16x16 prediction mode, please refer to section 3.4.1.
24570c1bc742181ded4930842b46e9507372f0b1b963James Dong *   availability - Neighboring 16x16 MB availability flag. Refer to
24580c1bc742181ded4930842b46e9507372f0b1b963James Dong *                  section 3.4.4.
24590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
24610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst -Pointer to the destination buffer; must be aligned on a 16-byte
24630c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
24640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
24660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
24670c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
24680c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
24690c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pDst is NULL.
24700c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dstStep < 16. or dstStep is not a multiple of 16.
24710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    leftStep is not a multiple of 16.
24720c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is not in the valid range of enumeration
24730c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMXVCM4P10Intra16x16PredMode
24740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_16X16_VERT, but availability doesn't set
24750c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available.
24760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT
24770c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[-1,y] (y = 0..15) is not available.
24780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_16X16_PLANE, but availability doesn't set
24790c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
24800c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not
24810c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
24820c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
24830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
24840c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
24850c1bc742181ded4930842b46e9507372f0b1b963James Dong *    either pSrcAbove or pDst is not aligned on a 16-byte boundary.
24860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Note:
24880c1bc742181ded4930842b46e9507372f0b1b963James Dong *     pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if
24890c1bc742181ded4930842b46e9507372f0b1b963James Dong *     they are not used by intra prediction implied in predMode.
24900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Note:
24910c1bc742181ded4930842b46e9507372f0b1b963James Dong *     OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction.
24920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
24930c1bc742181ded4930842b46e9507372f0b1b963James Dong */
24940c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_PredictIntra_16x16 (
24950c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcLeft,
24960c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAbove,
24970c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAboveLeft,
24980c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
24990c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT leftStep,
25000c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
25010c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10Intra16x16PredMode predMode,
25020c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 availability
25030c1bc742181ded4930842b46e9507372f0b1b963James Dong);
25040c1bc742181ded4930842b46e9507372f0b1b963James Dong
25050c1bc742181ded4930842b46e9507372f0b1b963James Dong
25060c1bc742181ded4930842b46e9507372f0b1b963James Dong
25070c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
25080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_PredictIntraChroma_8x8   (6.3.3.1.3)
25090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
25110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs intra prediction for chroma samples.
25120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
25140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y=
25160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            0..7).
25170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y
25180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            = -1); must be aligned on an 8-byte boundary.
25190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1)
25200c1bc742181ded4930842b46e9507372f0b1b963James Dong *   leftStep - Step of left pixel buffer; must be a multiple of 8.
25210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - Step of the destination buffer; must be a multiple of 8.
25220c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predMode - Intra chroma prediction mode, please refer to section 3.4.3.
25230c1bc742181ded4930842b46e9507372f0b1b963James Dong *   availability - Neighboring chroma block availability flag, please refer
25240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to  "Neighboring Macroblock Availability".
25250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
25270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25280c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the destination buffer; must be aligned on an 8-byte
25290c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
25300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
25320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
25330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If any of the following cases occurs, the function returns
25340c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
25350c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pDst is NULL.
25360c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dstStep < 8 or dstStep is not a multiple of 8.
25370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    leftStep is not a multiple of 8.
25380c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is not in the valid range of enumeration
25390c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMXVCM4P10IntraChromaPredMode.
25400c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_VERT, but availability doesn't set
25410c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available.
25420c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT
25430c1bc742181ded4930842b46e9507372f0b1b963James Dong *              indicating p[-1,y] (y = 0..7) is not available.
25440c1bc742181ded4930842b46e9507372f0b1b963James Dong *    predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set
25450c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating
25460c1bc742181ded4930842b46e9507372f0b1b963James Dong *              p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not
25470c1bc742181ded4930842b46e9507372f0b1b963James Dong *              available.
25480c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER, but pSrcAbove is NULL.
25490c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_LEFT, but pSrcLeft is NULL.
25500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL.
25510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    either pSrcAbove or pDst is not aligned on a 8-byte boundary.
25520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25530c1bc742181ded4930842b46e9507372f0b1b963James Dong *  Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if
25540c1bc742181ded4930842b46e9507372f0b1b963James Dong *  they are not used by intra prediction implied in predMode.
25550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25560c1bc742181ded4930842b46e9507372f0b1b963James Dong *  Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction.
25570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25580c1bc742181ded4930842b46e9507372f0b1b963James Dong */
25590c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_PredictIntraChroma_8x8 (
25600c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcLeft,
25610c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAbove,
25620c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcAboveLeft,
25630c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
25640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT leftStep,
25650c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
25660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10IntraChromaPredMode predMode,
25670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 availability
25680c1bc742181ded4930842b46e9507372f0b1b963James Dong);
25690c1bc742181ded4930842b46e9507372f0b1b963James Dong
25700c1bc742181ded4930842b46e9507372f0b1b963James Dong
25710c1bc742181ded4930842b46e9507372f0b1b963James Dong
25720c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
25730c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InterpolateLuma   (6.3.3.2.1)
25740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
25760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs quarter-pixel interpolation for inter luma MB. It is assumed that
25770c1bc742181ded4930842b46e9507372f0b1b963James Dong * the frame is already padded when calling this function.
25780c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
25800c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the source reference frame buffer
25820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep - reference frame step, in bytes; must be a multiple of roi.width
25830c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - destination frame step, in bytes; must be a multiple of
25840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.width
25850c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dx - Fractional part of horizontal motion vector component in 1/4 pixel
25860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,3]
25870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dy - Fractional part of vertical motion vector y component in 1/4 pixel
25880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,3]
25890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   roi - Dimension of the interpolation region; the parameters roi.width and
25900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.height must be equal to either 4, 8, or 16.
25910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25920c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
25930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25940c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the destination frame buffer:
25950c1bc742181ded4930842b46e9507372f0b1b963James Dong *          if roi.width==4,  4-byte alignment required
25960c1bc742181ded4930842b46e9507372f0b1b963James Dong *          if roi.width==8,  8-byte alignment required
25970c1bc742181ded4930842b46e9507372f0b1b963James Dong *          if roi.width==16, 16-byte alignment required
25980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
25990c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
26000c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
26010c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
26020c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
26030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pSrc or pDst is NULL.
26040c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep < roi.width.
26050c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dx or dy is out of range [0,3].
26060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width or roi.height is out of range {4, 8, 16}.
26070c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 4, but pDst is not 4 byte aligned.
26080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 8 or 16, but pDst is not 8 byte aligned.
26090c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep is not a multiple of 8.
26100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26110c1bc742181ded4930842b46e9507372f0b1b963James Dong */
26120c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InterpolateLuma (
26130c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
26140c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcStep,
26150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
26160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dstStep,
26170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dx,
26180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dy,
26190c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXSize roi
26200c1bc742181ded4930842b46e9507372f0b1b963James Dong);
26210c1bc742181ded4930842b46e9507372f0b1b963James Dong
26220c1bc742181ded4930842b46e9507372f0b1b963James Dong
26230c1bc742181ded4930842b46e9507372f0b1b963James Dong
26240c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
26250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InterpolateChroma   (6.3.3.2.2)
26260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26270c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
26280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs 1/8-pixel interpolation for inter chroma MB.
26290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26300c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
26310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26320c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc -Pointer to the source reference frame buffer
26330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcStep -Reference frame step in bytes
26340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep -Destination frame step in bytes; must be a multiple of
26350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.width.
26360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dx -Fractional part of horizontal motion vector component in 1/8 pixel
26370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,7]
26380c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dy -Fractional part of vertical motion vector component in 1/8 pixel
26390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            unit; valid in the range [0,7]
26400c1bc742181ded4930842b46e9507372f0b1b963James Dong *   roi -Dimension of the interpolation region; the parameters roi.width and
26410c1bc742181ded4930842b46e9507372f0b1b963James Dong *            roi.height must be equal to either 2, 4, or 8.
26420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
26440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst -Pointer to the destination frame buffer:
26460c1bc742181ded4930842b46e9507372f0b1b963James Dong *         if roi.width==2,  2-byte alignment required
26470c1bc742181ded4930842b46e9507372f0b1b963James Dong *         if roi.width==4,  4-byte alignment required
26480c1bc742181ded4930842b46e9507372f0b1b963James Dong *         if roi.width==8, 8-byte alignment required
26490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
26510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
26520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
26530c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
26540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pSrc or pDst is NULL.
26550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep < 8.
26560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    dx or dy is out of range [0-7].
26570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width or roi.height is out of range {2,4,8}.
26580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 2, but pDst is not 2-byte aligned.
26590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 4, but pDst is not 4-byte aligned.
26600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    roi.width is equal to 8, but pDst is not 8 byte aligned.
26610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcStep or dstStep is not a multiple of 8.
26620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26630c1bc742181ded4930842b46e9507372f0b1b963James Dong */
26640c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InterpolateChroma (
26650c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
26660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcStep,
26670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
26680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dstStep,
26690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dx,
26700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 dy,
26710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXSize roi
26720c1bc742181ded4930842b46e9507372f0b1b963James Dong);
26730c1bc742181ded4930842b46e9507372f0b1b963James Dong
26740c1bc742181ded4930842b46e9507372f0b1b963James Dong
26750c1bc742181ded4930842b46e9507372f0b1b963James Dong
26760c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
26770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_FilterDeblockingLuma_VerEdge_I   (6.3.3.3.1)
26780c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26790c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
26800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs in-place deblock filtering on four vertical edges of the luma
26810c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock (16x16).
26820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
26840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
26850c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to the input macroblock; must be 16-byte aligned.
26860c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep -Step of the arrays; must be a multiple of 16.
26870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha
26880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for the external vertical edge, and the second item is
26890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for the internal vertical edge); per [ISO14496-10] alpha values
26900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be in the range [0,255].
26910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta -Array of size 2 of beta thresholds (the first item is the beta
26920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for the external vertical edge, and the second item is
26930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for the internal vertical edge); per [ISO14496-10] beta values
26940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be in the range [0,18].
26950c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds -Array of size 16 of Thresholds (TC0) (values for the left
26960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            edge of each 4x4 block, arranged in vertical block order); must
26970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be aligned on a 4-byte boundary..  Per [ISO14496-10] values must
26980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be in the range [0,25].
26990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS -Array of size 16 of BS parameters (arranged in vertical block
27000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            order); valid in the range [0,4] with the following
27010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
27020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pBS[i]== 4 if and only if pBS[i^3]== 4.  Must be 4-byte aligned.
27030c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
27050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst -Pointer to filtered output macroblock.
27070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
27090c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If the function runs without error, it returns OMX_Sts_NoErr.
27100c1bc742181ded4930842b46e9507372f0b1b963James Dong *    If one of the following cases occurs, the function returns
27110c1bc742181ded4930842b46e9507372f0b1b963James Dong *              OMX_Sts_BadArgErr:
27120c1bc742181ded4930842b46e9507372f0b1b963James Dong *    Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS
27130c1bc742181ded4930842b46e9507372f0b1b963James Dong *              is NULL.
27140c1bc742181ded4930842b46e9507372f0b1b963James Dong *    Either pThresholds or pBS is not aligned on a 4-byte boundary.
27150c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pSrcDst is not 16-byte aligned.
27160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    srcdstStep is not a multiple of 16.
27170c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
27180c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pBeta[0] and/or pBeta[1] is outside the range [0,18].
27190c1bc742181ded4930842b46e9507372f0b1b963James Dong *    One or more entries in the table pThresholds[0..15]is outside of the
27200c1bc742181ded4930842b46e9507372f0b1b963James Dong *              range [0,25].
27210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    pBS is out of range, i.e., one of the following conditions is true:
27220c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 &&
27230c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBS[i^3]!=4) for 0<=i<=3.
27240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27250c1bc742181ded4930842b46e9507372f0b1b963James Dong */
27260c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I (
27270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
27280c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
27290c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
27300c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
27310c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
27320c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
27330c1bc742181ded4930842b46e9507372f0b1b963James Dong);
27340c1bc742181ded4930842b46e9507372f0b1b963James Dong
27350c1bc742181ded4930842b46e9507372f0b1b963James Dong
27360c1bc742181ded4930842b46e9507372f0b1b963James Dong
27370c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
27380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_FilterDeblockingLuma_HorEdge_I   (6.3.3.3.2)
27390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
27410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs in-place deblock filtering on four horizontal edges of the luma
27420c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock (16x16).
27430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27440c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
27450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
27470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep - step of the arrays; must be a multiple of 16.
27480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha - array of size 2 of alpha thresholds (the first item is the alpha
27490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for the external vertical edge, and the second item is
27500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for the internal horizontal edge); per [ISO14496-10] alpha
27510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            values must be in the range [0,255].
27520c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta - array of size 2 of beta thresholds (the first item is the beta
27530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for the external horizontal edge, and the second item
27540c1bc742181ded4930842b46e9507372f0b1b963James Dong *            is for the internal horizontal edge). Per [ISO14496-10] beta
27550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            values must be in the range [0,18].
27560c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds - array of size 16 containing thresholds, TC0, for the top
27570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            horizontal edge of each 4x4 block, arranged in horizontal block
27580c1bc742181ded4930842b46e9507372f0b1b963James Dong *            order; must be aligned on a 4-byte boundary.  Per [ISO14496 10]
27590c1bc742181ded4930842b46e9507372f0b1b963James Dong *            values must be in the range [0,25].
27600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS - array of size 16 of BS parameters (arranged in horizontal block
27610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            order); valid in the range [0,4] with the following
27620c1bc742181ded4930842b46e9507372f0b1b963James Dong *            restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii)
27630c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pBS[i]== 4 if and only if pBS[i^3]== 4.  Must be 4-byte aligned.
27640c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
27660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst -Pointer to filtered output macroblock.
27680c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
27700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
27720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27730c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr, if one of the following cases occurs:
27740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more of the following pointers is NULL: pSrcDst, pAlpha,
27750c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBeta, pThresholds, or pBS.
27760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    either pThresholds or pBS is not aligned on a 4-byte boundary.
27770c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not 16-byte aligned.
27780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    srcdstStep is not a multiple of 16.
27790c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
27800c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18].
27810c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more entries in the table pThresholds[0..15] is
27820c1bc742181ded4930842b46e9507372f0b1b963James Dong *         outside of the range [0,25].
27830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is out of range, i.e., one of the following conditions is true:
27840c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
27850c1bc742181ded4930842b46e9507372f0b1b963James Dong *              (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
27860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
27870c1bc742181ded4930842b46e9507372f0b1b963James Dong */
27880c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I (
27890c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
27900c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
27910c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
27920c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
27930c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
27940c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
27950c1bc742181ded4930842b46e9507372f0b1b963James Dong);
27960c1bc742181ded4930842b46e9507372f0b1b963James Dong
27970c1bc742181ded4930842b46e9507372f0b1b963James Dong
27980c1bc742181ded4930842b46e9507372f0b1b963James Dong
27990c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
28000c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_FilterDeblockingChroma_VerEdge_I   (6.3.3.3.3)
28010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28020c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
28030c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs in-place deblock filtering on four vertical edges of the chroma
28040c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock (8x8).
28050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
28070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to the input macroblock; must be 8-byte aligned.
28090c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep - Step of the arrays; must be a multiple of 8.
28100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha - Array of size 2 of alpha thresholds (the first item is alpha
28110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for external vertical edge, and the second item is for
28120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            internal vertical edge); per [ISO14496-10] alpha values must be
28130c1bc742181ded4930842b46e9507372f0b1b963James Dong *            in the range [0,255].
28140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta - Array of size 2 of beta thresholds (the first item is the beta
28150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            threshold for the external vertical edge, and the second item is
28160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for the internal vertical edge); per [ISO14496-10] beta values
28170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be in the range [0,18].
28180c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds - Array of size 8 containing thresholds, TC0, for the left
28190c1bc742181ded4930842b46e9507372f0b1b963James Dong *            vertical edge of each 4x2 chroma block, arranged in vertical
28200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block order; must be aligned on a 4-byte boundary.  Per
28210c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-10] values must be in the range [0,25].
28220c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS - Array of size 16 of BS parameters (values for each 2x2 chroma
28230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block, arranged in vertical block order). This parameter is the
28240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            same as the pBS parameter passed into FilterDeblockLuma_VerEdge;
28250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            valid in the range [0,4] with the following restrictions: i)
28260c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and
28270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            only if pBS[i^3]== 4.  Must be 4 byte aligned.
28280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
28300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28310c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst -Pointer to filtered output macroblock.
28320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28330c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
28340c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28350c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
28360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
28380c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more of the following pointers is NULL: pSrcDst, pAlpha,
28390c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBeta, pThresholds, or pBS.
28400c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not 8-byte aligned.
28410c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    srcdstStep is not a multiple of 8.
28420c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pThresholds is not 4-byte aligned.
28430c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
28440c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18].
28450c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more entries in the table pThresholds[0..7] is outside
28460c1bc742181ded4930842b46e9507372f0b1b963James Dong *         of the range [0,25].
28470c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is out of range, i.e., one of the following conditions is true:
28480c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
28490c1bc742181ded4930842b46e9507372f0b1b963James Dong *         (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
28500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is not 4-byte aligned.
28510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28520c1bc742181ded4930842b46e9507372f0b1b963James Dong */
28530c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I (
28540c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
28550c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
28560c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
28570c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
28580c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
28590c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
28600c1bc742181ded4930842b46e9507372f0b1b963James Dong);
28610c1bc742181ded4930842b46e9507372f0b1b963James Dong
28620c1bc742181ded4930842b46e9507372f0b1b963James Dong
28630c1bc742181ded4930842b46e9507372f0b1b963James Dong
28640c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
28650c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_FilterDeblockingChroma_HorEdge_I   (6.3.3.3.4)
28660c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28670c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
28680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs in-place deblock filtering on the horizontal edges of the chroma
28690c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock (8x8).
28700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
28720c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28730c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
28740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep - array step; must be a multiple of 8.
28750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha - array of size 2 containing alpha thresholds; the first element
28760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contains the threshold for the external horizontal edge, and the
28770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            second element contains the threshold for internal horizontal
28780c1bc742181ded4930842b46e9507372f0b1b963James Dong *            edge.  Per [ISO14496-10] alpha values must be in the range
28790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [0,255].
28800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta - array of size 2 containing beta thresholds; the first element
28810c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contains the threshold for the external horizontal edge, and the
28820c1bc742181ded4930842b46e9507372f0b1b963James Dong *            second element contains the threshold for the internal
28830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            horizontal edge.  Per [ISO14496-10] beta values must be in the
28840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0,18].
28850c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds - array of size 8 containing thresholds, TC0, for the top
28860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            horizontal edge of each 2x4 chroma block, arranged in horizontal
28870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block order; must be aligned on a 4-byte boundary.  Per
28880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-10] values must be in the range [0,25].
28890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS - array of size 16 containing BS parameters for each 2x2 chroma
28900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block, arranged in horizontal block order; valid in the range
28910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [0,4] with the following restrictions: i) pBS[i]== 4 may occur
28920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4.
28930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Must be 4-byte aligned.
28940c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28950c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
28960c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28970c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst -Pointer to filtered output macroblock.
28980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
28990c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
29000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29010c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
29020c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr, if one of the following cases occurs:
29040c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    any of the following pointers is NULL:
29050c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcDst, pAlpha, pBeta, pThresholds, or pBS.
29060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not 8-byte aligned.
29070c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    srcdstStep is not a multiple of 8.
29080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pThresholds is not 4-byte aligned.
29090c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pAlpha[0] and/or pAlpha[1] is outside the range [0,255].
29100c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBeta[0] and/or pBeta[1] is outside the range [0,18].
29110c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more entries in the table pThresholds[0..7] is outside
29120c1bc742181ded4930842b46e9507372f0b1b963James Dong *         of the range [0,25].
29130c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is out of range, i.e., one of the following conditions is true:
29140c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
29150c1bc742181ded4930842b46e9507372f0b1b963James Dong *              (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
29160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is not 4-byte aligned.
29170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29180c1bc742181ded4930842b46e9507372f0b1b963James Dong */
29190c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I (
29200c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
29210c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
29220c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
29230c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
29240c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
29250c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
29260c1bc742181ded4930842b46e9507372f0b1b963James Dong);
29270c1bc742181ded4930842b46e9507372f0b1b963James Dong
29280c1bc742181ded4930842b46e9507372f0b1b963James Dong
29290c1bc742181ded4930842b46e9507372f0b1b963James Dong
29300c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
29310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_DeblockLuma_I   (6.3.3.3.5)
29320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29330c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
29340c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs in-place deblock filtering the horizontal and
29350c1bc742181ded4930842b46e9507372f0b1b963James Dong * vertical edges of a luma macroblock (16x16).
29360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
29380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29390c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input macroblock; must be 16-byte aligned.
29400c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep - image width; must be a multiple of 16.
29410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha - pointer to a 2x2 table of alpha thresholds, organized as
29420c1bc742181ded4930842b46e9507372f0b1b963James Dong *            follows: {external vertical edge, internal vertical edge,
29430c1bc742181ded4930842b46e9507372f0b1b963James Dong *            external horizontal edge, internal horizontal edge }.  Per
29440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-10] alpha values must be in the range [0,255].
29450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta - pointer to a 2x2 table of beta thresholds, organized as follows:
29460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            {external vertical edge, internal vertical edge, external
29470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10]
29480c1bc742181ded4930842b46e9507372f0b1b963James Dong *            beta values must be in the range [0,18].
29490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds - pointer to a 16x2 table of threshold (TC0), organized as
29500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            follows: {values for the left or above edge of each 4x4 block,
29510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            arranged in vertical block order and then in horizontal block
29520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            order}; must be aligned on a 4-byte boundary.  Per [ISO14496-10]
29530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            values must be in the range [0,25].
29540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS - pointer to a 16x2 table of BS parameters arranged in scan block
29550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            order for vertical edges and then horizontal edges; valid in the
29560c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0,4] with the following restrictions: i) pBS[i]== 4 may
29570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
29580c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4. Must be 4-byte aligned.
29590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
29610c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to filtered output macroblock.
29630c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
29650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
29670c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments
29680c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -     one or more of the following pointers is NULL: pSrcDst, pAlpha,
29690c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBeta, pThresholds or pBS.
29700c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not 16-byte aligned.
29710c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    either pThresholds or pBS is not aligned on a 4-byte boundary.
29720c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more entries in the table pAlpha[0..3] is outside the range
29730c1bc742181ded4930842b46e9507372f0b1b963James Dong *              [0,255].
29740c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more entries in the table pBeta[0..3] is outside the range
29750c1bc742181ded4930842b46e9507372f0b1b963James Dong *              [0,18].
29760c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    one or more entries in the table pThresholds[0..31]is outside of
29770c1bc742181ded4930842b46e9507372f0b1b963James Dong *              the range [0,25].
29780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pBS is out of range, i.e., one of the following conditions is true:
29790c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or
29800c1bc742181ded4930842b46e9507372f0b1b963James Dong *             (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
29810c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    srcdstStep is not a multiple of 16.
29820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29830c1bc742181ded4930842b46e9507372f0b1b963James Dong */
29840c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DeblockLuma_I (
29850c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
29860c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
29870c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
29880c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
29890c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
29900c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
29910c1bc742181ded4930842b46e9507372f0b1b963James Dong);
29920c1bc742181ded4930842b46e9507372f0b1b963James Dong
29930c1bc742181ded4930842b46e9507372f0b1b963James Dong
29940c1bc742181ded4930842b46e9507372f0b1b963James Dong
29950c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
29960c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_DeblockChroma_I   (6.3.3.3.6)
29970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
29980c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
29990c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs in-place deblocking filtering on all edges of the chroma
30000c1bc742181ded4930842b46e9507372f0b1b963James Dong * macroblock (16x16).
30010c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30020c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
30030c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to the input macroblock; must be 8-byte aligned.
30050c1bc742181ded4930842b46e9507372f0b1b963James Dong *   srcdstStep - step of the arrays; must be a multiple of 8.
30060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pAlpha - pointer to a 2x2 array of alpha thresholds, organized as
30070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            follows: {external vertical edge, internal vertical edge,
30080c1bc742181ded4930842b46e9507372f0b1b963James Dong *            external horizontal edge, internal horizontal edge }.  Per
30090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-10] alpha values must be in the range [0,255].
30100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows:
30110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            { external vertical edge, internal vertical edge, external
30120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            horizontal edge, internal horizontal edge }.  Per [ISO14496-10]
30130c1bc742181ded4930842b46e9507372f0b1b963James Dong *            beta values must be in the range [0,18].
30140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left
30150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            or above edge of each 4x2 or 2x4 block, arranged in vertical
30160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block order and then in horizontal block order); must be aligned
30170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            on a 4-byte boundary. Per [ISO14496-10] values must be in the
30180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0,25].
30190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBS - array of size 16x2 of BS parameters (arranged in scan block order
30200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for vertical edges and then horizontal edges); valid in the
30210c1bc742181ded4930842b46e9507372f0b1b963James Dong *            range [0,4] with the following restrictions: i) pBS[i]== 4 may
30220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]==
30230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4.  Must be 4-byte aligned.
30240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30250c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
30260c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30270c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - pointer to filtered output macroblock.
30280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
30300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30310c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
30320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments
30330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more of the following pointers is NULL: pSrcDst, pAlpha,
30340c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pBeta, pThresholds, or pBS.
30350c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   pSrcDst is not 8-byte aligned.
30360c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   either pThresholds or pBS is not 4-byte aligned.
30370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more entries in the table pAlpha[0..3] is outside the range
30380c1bc742181ded4930842b46e9507372f0b1b963James Dong *              [0,255].
30390c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more entries in the table pBeta[0..3] is outside the range
30400c1bc742181ded4930842b46e9507372f0b1b963James Dong *              [0,18].
30410c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   one or more entries in the table pThresholds[0..15]is outside of
30420c1bc742181ded4930842b46e9507372f0b1b963James Dong *              the range [0,25].
30430c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   pBS is out of range, i.e., one of the following conditions is true:
30440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pBS[i]<0, pBS[i]>4, pBS[i]==4  for i>=4, or
30450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3.
30460c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   srcdstStep is not a multiple of 8.
30470c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30480c1bc742181ded4930842b46e9507372f0b1b963James Dong */
30490c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DeblockChroma_I (
30500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pSrcDst,
30510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 srcdstStep,
30520c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pAlpha,
30530c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBeta,
30540c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pThresholds,
30550c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pBS
30560c1bc742181ded4930842b46e9507372f0b1b963James Dong);
30570c1bc742181ded4930842b46e9507372f0b1b963James Dong
30580c1bc742181ded4930842b46e9507372f0b1b963James Dong
30590c1bc742181ded4930842b46e9507372f0b1b963James Dong
30600c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
30610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC   (6.3.4.1.1)
30620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30630c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
30640c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs CAVLC decoding and inverse raster scan for a 2x2 block of
30650c1bc742181ded4930842b46e9507372f0b1b963James Dong * ChromaDCLevel.  The decoded coefficients in the packed position-coefficient
30660c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer are stored in reverse zig-zag order, i.e., the first buffer element
30670c1bc742181ded4930842b46e9507372f0b1b963James Dong * contains the last non-zero postion-coefficient pair of the block. Within
30680c1bc742181ded4930842b46e9507372f0b1b963James Dong * each position-coefficient pair, the position entry indicates the
30690c1bc742181ded4930842b46e9507372f0b1b963James Dong * raster-scan position of the coefficient, while the coefficient entry
30700c1bc742181ded4930842b46e9507372f0b1b963James Dong * contains the coefficient value.
30710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
30730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - Double pointer to current byte in bit stream buffer
30750c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pOffset - Pointer to current bit position in the byte pointed to by
30760c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream; valid in the range [0,7].
30770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
30790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after each block is decoded
30810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pOffset - *pOffset is updated after each block is decoded
30820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pNumCoeff - Pointer to the number of nonzero coefficients in this block
30830c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppPosCoefBuf - Double pointer to destination residual
30840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficient-position pair buffer.  Buffer position
30850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (*ppPosCoefBuf) is updated upon return, unless there are only
30860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            zero coefficients in the currently decoded block.  In this case
30870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the caller is expected to bypass the transform/dequantization of
30880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the empty blocks.
30890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
30910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
30930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
30940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
30950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppBitStream or pOffset is NULL.
30960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppPosCoefBuf or pNumCoeff is NULL.
30970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - if one of the following is true:
30980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an illegal code is encountered in the bitstream
30990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31000c1bc742181ded4930842b46e9507372f0b1b963James Dong */
31010c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (
31020c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
31030c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32*pOffset,
31040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pNumCoeff,
31050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppPosCoefbuf
31060c1bc742181ded4930842b46e9507372f0b1b963James Dong);
31070c1bc742181ded4930842b46e9507372f0b1b963James Dong
31080c1bc742181ded4930842b46e9507372f0b1b963James Dong
31090c1bc742181ded4930842b46e9507372f0b1b963James Dong
31100c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
31110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_DecodeCoeffsToPairCAVLC   (6.3.4.1.2)
31120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
31140c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of
31150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse
31160c1bc742181ded4930842b46e9507372f0b1b963James Dong * field scan is not supported. The decoded coefficients in the packed
31170c1bc742181ded4930842b46e9507372f0b1b963James Dong * position-coefficient buffer are stored in reverse zig-zag order, i.e., the
31180c1bc742181ded4930842b46e9507372f0b1b963James Dong * first buffer element contains the last non-zero postion-coefficient pair of
31190c1bc742181ded4930842b46e9507372f0b1b963James Dong * the block. Within each position-coefficient pair, the position entry
31200c1bc742181ded4930842b46e9507372f0b1b963James Dong * indicates the raster-scan position of the coefficient, while the
31210c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficient entry contains the coefficient value.
31220c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31230c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
31240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31250c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream -Double pointer to current byte in bit stream buffer
31260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pOffset - Pointer to current bit position in the byte pointed to by
31270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            *ppBitStream; valid in the range [0,7].
31280c1bc742181ded4930842b46e9507372f0b1b963James Dong *   sMaxNumCoeff - Maximum the number of non-zero coefficients in current
31290c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block
31300c1bc742181ded4930842b46e9507372f0b1b963James Dong *   sVLCSelect - VLC table selector, obtained from the number of non-zero
31310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficients contained in the above and left 4x4 blocks.  It is
31320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            equivalent to the variable nC described in H.264 standard table
31330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            9 5, except its value can t be less than zero.
31340c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31350c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
31360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppBitStream - *ppBitStream is updated after each block is decoded.
31380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Buffer position (*ppPosCoefBuf) is updated upon return, unless
31390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            there are only zero coefficients in the currently decoded block.
31400c1bc742181ded4930842b46e9507372f0b1b963James Dong *             In this case the caller is expected to bypass the
31410c1bc742181ded4930842b46e9507372f0b1b963James Dong *            transform/dequantization of the empty blocks.
31420c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pOffset - *pOffset is updated after each block is decoded
31430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pNumCoeff - Pointer to the number of nonzero coefficients in this block
31440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppPosCoefBuf - Double pointer to destination residual
31450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            coefficient-position pair buffer
31460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
31480c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
31490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
31510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppBitStream or pOffset is NULL.
31520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppPosCoefBuf or pNumCoeff is NULL.
31530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    sMaxNumCoeff is not equal to either 15 or 16.
31540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    sVLCSelect is less than 0.
31550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_Err - if one of the following is true:
31570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an illegal code is encountered in the bitstream
31580c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31590c1bc742181ded4930842b46e9507372f0b1b963James Dong */
31600c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC (
31610c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppBitStream,
31620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pOffset,
31630c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pNumCoeff,
31640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 **ppPosCoefbuf,
31650c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT sVLCSelect,
31660c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT sMaxNumCoeff
31670c1bc742181ded4930842b46e9507372f0b1b963James Dong);
31680c1bc742181ded4930842b46e9507372f0b1b963James Dong
31690c1bc742181ded4930842b46e9507372f0b1b963James Dong
31700c1bc742181ded4930842b46e9507372f0b1b963James Dong
31710c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
31720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_TransformDequantLumaDCFromPair   (6.3.4.2.1)
31730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31740c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
31750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Reconstructs the 4x4 LumaDC block from the coefficient-position pair
31760c1bc742181ded4930842b46e9507372f0b1b963James Dong * buffer, performs integer inverse, and dequantization for 4x4 LumaDC
31770c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients, and updates the pair buffer pointer to the next non-empty
31780c1bc742181ded4930842b46e9507372f0b1b963James Dong * block.
31790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
31810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppSrc - Double pointer to residual coefficient-position pair buffer
31830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            output by CALVC decoding
31840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - Quantization parameter QpY
31850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
31870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppSrc - *ppSrc is updated to the start of next non empty block
31890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must
31900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be aligned on a 8-byte boundary.
31910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31920c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
31930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
31940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
31950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppSrc or pDst is NULL.
31960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 8 byte aligned.
31970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP is not in the range of [0-51].
31980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
31990c1bc742181ded4930842b46e9507372f0b1b963James Dong */
32000c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_TransformDequantLumaDCFromPair (
32010c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppSrc,
32020c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
32030c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP
32040c1bc742181ded4930842b46e9507372f0b1b963James Dong);
32050c1bc742181ded4930842b46e9507372f0b1b963James Dong
32060c1bc742181ded4930842b46e9507372f0b1b963James Dong
32070c1bc742181ded4930842b46e9507372f0b1b963James Dong
32080c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
32090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_TransformDequantChromaDCFromPair   (6.3.4.2.2)
32100c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
32120c1bc742181ded4930842b46e9507372f0b1b963James Dong * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer,
32130c1bc742181ded4930842b46e9507372f0b1b963James Dong * perform integer inverse transformation, and dequantization for 2x2 chroma
32140c1bc742181ded4930842b46e9507372f0b1b963James Dong * DC coefficients, and update the pair buffer pointer to next non-empty
32150c1bc742181ded4930842b46e9507372f0b1b963James Dong * block.
32160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32170c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
32180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppSrc - Double pointer to residual coefficient-position pair buffer
32200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            output by CALVC decoding
32210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - Quantization parameter QpC
32220c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32230c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
32240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32250c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppSrc - *ppSrc is updated to the start of next non empty block
32260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer;
32270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            must be aligned on a 4-byte boundary.
32280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
32300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
32310c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
32320c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    ppSrc or pDst is NULL.
32330c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDst is not 4-byte aligned.
32340c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    QP is not in the range of [0-51].
32350c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32360c1bc742181ded4930842b46e9507372f0b1b963James Dong */
32370c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_TransformDequantChromaDCFromPair (
32380c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppSrc,
32390c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
32400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP
32410c1bc742181ded4930842b46e9507372f0b1b963James Dong);
32420c1bc742181ded4930842b46e9507372f0b1b963James Dong
32430c1bc742181ded4930842b46e9507372f0b1b963James Dong
32440c1bc742181ded4930842b46e9507372f0b1b963James Dong
32450c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
32460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_DequantTransformResidualFromPairAndAdd   (6.3.4.2.3)
32470c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32480c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
32490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Reconstruct the 4x4 residual block from coefficient-position pair buffer,
32500c1bc742181ded4930842b46e9507372f0b1b963James Dong * perform dequantization and integer inverse transformation for 4x4 block of
32510c1bc742181ded4930842b46e9507372f0b1b963James Dong * residuals with previous intra prediction or motion compensation data, and
32520c1bc742181ded4930842b46e9507372f0b1b963James Dong * update the pair buffer pointer to next non-empty block. If pDC == NULL,
32530c1bc742181ded4930842b46e9507372f0b1b963James Dong * there re 16 non-zero AC coefficients at most in the packed buffer starting
32540c1bc742181ded4930842b46e9507372f0b1b963James Dong * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC
32550c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficients at most in the packet buffer starting from 4x4 block position
32560c1bc742181ded4930842b46e9507372f0b1b963James Dong * 1.
32570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
32590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32600c1bc742181ded4930842b46e9507372f0b1b963James Dong *   ppSrc - Double pointer to residual coefficient-position pair buffer
32610c1bc742181ded4930842b46e9507372f0b1b963James Dong *            output by CALVC decoding
32620c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte
32630c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary
32640c1bc742181ded4930842b46e9507372f0b1b963James Dong *   predStep - Predicted frame step size in bytes; must be a multiple of 4
32650c1bc742181ded4930842b46e9507372f0b1b963James Dong *   dstStep - Destination frame step in bytes; must be a multiple of 4
32660c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDC - Pointer to the DC coefficient of this block, NULL if it doesn't
32670c1bc742181ded4930842b46e9507372f0b1b963James Dong *            exist
32680c1bc742181ded4930842b46e9507372f0b1b963James Dong *   QP - QP Quantization parameter.  It should be QpC in chroma 4x4 block
32690c1bc742181ded4930842b46e9507372f0b1b963James Dong *            decoding, otherwise it should be QpY.
32700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   AC - Flag indicating if at least one non-zero AC coefficient exists
32710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
32730c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - pointer to the reconstructed 4x4 block data; must be aligned on a
32750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4-byte boundary
32760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
32780c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
32790c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
32800c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pPred or pDst is NULL.
32810c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pPred or pDst is not 4-byte aligned.
32820c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    predStep or dstStep is not a multiple of 4.
32830c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL.
32840c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    AC ==0 && pDC ==NULL.
32850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
32860c1bc742181ded4930842b46e9507372f0b1b963James Dong */
32870c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd (
32880c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 **ppSrc,
32890c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred,
32900c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pDC,
32910c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDst,
32920c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT predStep,
32930c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT dstStep,
32940c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT QP,
32950c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT AC
32960c1bc742181ded4930842b46e9507372f0b1b963James Dong);
32970c1bc742181ded4930842b46e9507372f0b1b963James Dong
32980c1bc742181ded4930842b46e9507372f0b1b963James Dong
32990c1bc742181ded4930842b46e9507372f0b1b963James Dong
33000c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
33010c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_MEGetBufSize   (6.3.5.1.1)
33020c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33030c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
33040c1bc742181ded4930842b46e9507372f0b1b963James Dong * Computes the size, in bytes, of the vendor-specific specification
33050c1bc742181ded4930842b46e9507372f0b1b963James Dong * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer
33060c1bc742181ded4930842b46e9507372f0b1b963James Dong * and MotionEstimationMB.
33070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33080c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
33090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
33110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P10MEMode
33120c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams -motion estimation parameters
33130c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33140c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
33150c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33160c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSize - pointer to the number of bytes required for the motion
33170c1bc742181ded4930842b46e9507372f0b1b963James Dong *            estimation specification structure
33180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
33200c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
33210c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
33220c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pMEParams or pSize is NULL.
33230c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid MEMode is specified.
33240c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33250c1bc742181ded4930842b46e9507372f0b1b963James Dong */
33260c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_MEGetBufSize (
33270c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MEMode MEmode,
33280c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P10MEParams *pMEParams,
33290c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pSize
33300c1bc742181ded4930842b46e9507372f0b1b963James Dong);
33310c1bc742181ded4930842b46e9507372f0b1b963James Dong
33320c1bc742181ded4930842b46e9507372f0b1b963James Dong
33330c1bc742181ded4930842b46e9507372f0b1b963James Dong
33340c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
33350c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_MEInit   (6.3.5.1.2)
33360c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33370c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
33380c1bc742181ded4930842b46e9507372f0b1b963James Dong * Initializes the vendor-specific specification structure required for the
33390c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P10 motion estimation functions:  BlockMatch_Integer and
33400c1bc742181ded4930842b46e9507372f0b1b963James Dong * MotionEstimationMB. Memory for the specification structure *pMESpec must be
33410c1bc742181ded4930842b46e9507372f0b1b963James Dong * allocated prior to calling the function, and should be aligned on a 4-byte
33420c1bc742181ded4930842b46e9507372f0b1b963James Dong * boundary.  The number of bytes required for the specification structure can
33430c1bc742181ded4930842b46e9507372f0b1b963James Dong * be determined using the function omxVCM4P10_MEGetBufSize. Following
33440c1bc742181ded4930842b46e9507372f0b1b963James Dong * initialization by this function, the vendor-specific structure *pMESpec
33450c1bc742181ded4930842b46e9507372f0b1b963James Dong * should contain an implementation-specific representation of all motion
33460c1bc742181ded4930842b46e9507372f0b1b963James Dong * estimation parameters received via the structure pMEParams, for example
33470c1bc742181ded4930842b46e9507372f0b1b963James Dong * searchRange16x16, searchRange8x8, etc.
33480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
33500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MEmode - motion estimation mode; available modes are defined by the
33520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            enumerated type OMXVCM4P10MEMode
33530c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMEParams - motion estimation parameters
33540c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the uninitialized ME specification structure
33550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33560c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
33570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33580c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the initialized ME specification structure
33590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
33610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
33620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
33630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pMEParams or pSize is NULL.
33640c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    an invalid value was specified for the parameter MEmode
33650c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    a negative or zero value was specified for one of the search ranges
33660c1bc742181ded4930842b46e9507372f0b1b963James Dong *         (e.g.,  pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.)
33670c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    either in isolation or in combination, one or more of the enables or
33680c1bc742181ded4930842b46e9507372f0b1b963James Dong *         search ranges in the structure *pMEParams were configured such
33690c1bc742181ded4930842b46e9507372f0b1b963James Dong *         that the requested behavior fails to comply with [ISO14496-10].
33700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33710c1bc742181ded4930842b46e9507372f0b1b963James Dong */
33720c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_MEInit (
33730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MEMode MEmode,
33740c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P10MEParams *pMEParams,
33750c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec
33760c1bc742181ded4930842b46e9507372f0b1b963James Dong);
33770c1bc742181ded4930842b46e9507372f0b1b963James Dong
33780c1bc742181ded4930842b46e9507372f0b1b963James Dong
33790c1bc742181ded4930842b46e9507372f0b1b963James Dong
33800c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
33810c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_BlockMatch_Integer   (6.3.5.2.1)
33820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
33840c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs integer block match.  Returns best MV and associated cost.
33850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
33870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
33880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrgY - Pointer to the top-left corner of the current block:
33890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==4,  4-byte alignment required.
33900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==8,  8-byte alignment required.
33910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==16, 16-byte alignment required.
33920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefY - Pointer to the top-left corner of the co-located block in the
33930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference picture:
33940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==4,  4-byte alignment required.
33950c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==8,  8-byte alignment required.
33960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==16, 16-byte alignment required.
33970c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcOrgStep - Stride of the original picture plane, expressed in terms
33980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            of integer pixels; must be a multiple of iBlockWidth.
33990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcRefStep - Stride of the reference picture plane, expressed in terms
34000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            of integer pixels
34010c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - pointer to the valid reference rectangle inside the reference
34020c1bc742181ded4930842b46e9507372f0b1b963James Dong *            picture plane
34030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nCurrPointPos - position of the current block in the current plane
34040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockWidth - Width of the current block, expressed in terms of integer
34050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be equal to either 4, 8, or 16.
34060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockHeight - Height of the current block, expressed in terms of
34070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            integer pixels; must be equal to either 4, 8, or 16.
34080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nLamda - Lamda factor; used to compute motion cost
34090c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMVPred - Predicted MV; used to compute motion cost, expressed in terms
34100c1bc742181ded4930842b46e9507372f0b1b963James Dong *            of 1/4-pel units
34110c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMVCandidate - Candidate MV; used to initialize the motion search,
34120c1bc742181ded4930842b46e9507372f0b1b963James Dong *            expressed in terms of integer pixels
34130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - pointer to the ME specification structure
34140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
34160c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstBestMV - Best MV resulting from integer search, expressed in terms
34180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            of 1/4-pel units
34190c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBestCost - Motion cost associated with the best MV; computed as
34200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            SAD+Lamda*BitsUsedByMV
34210c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34220c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
34230c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
34240c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
34250c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    any of the following pointers are NULL:
34260c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec.
34270c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
34280c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
34290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34300c1bc742181ded4930842b46e9507372f0b1b963James Dong */
34310c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_BlockMatch_Integer (
34320c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrgY,
34330c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcOrgStep,
34340c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefY,
34350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcRefStep,
34360c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
34370c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pCurrPointPos,
34380c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockWidth,
34390c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockHeight,
34400c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 nLamda,
34410c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pMVPred,
34420c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pMVCandidate,
34430c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pBestMV,
34440c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pBestCost,
34450c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec
34460c1bc742181ded4930842b46e9507372f0b1b963James Dong);
34470c1bc742181ded4930842b46e9507372f0b1b963James Dong
34480c1bc742181ded4930842b46e9507372f0b1b963James Dong
34490c1bc742181ded4930842b46e9507372f0b1b963James Dong
34500c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
34510c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_BlockMatch_Half   (6.3.5.2.2)
34520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
34540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a half-pel block match using results from a prior integer search.
34550c1bc742181ded4930842b46e9507372f0b1b963James Dong *  Returns the best MV and associated cost.  This function estimates the
34560c1bc742181ded4930842b46e9507372f0b1b963James Dong * half-pixel motion vector by interpolating the integer resolution motion
34570c1bc742181ded4930842b46e9507372f0b1b963James Dong * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial
34580c1bc742181ded4930842b46e9507372f0b1b963James Dong * integer MV is generated externally.  The function
34590c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation.
34600c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34610c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
34620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34630c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrgY - Pointer to the current position in original picture plane:
34640c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==4,  4-byte alignment required.
34650c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==8,  8-byte alignment required.
34660c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==16, 16-byte alignment required.
34670c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefY - Pointer to the top-left corner of the co-located block in the
34680c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference picture:
34690c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==4,  4-byte alignment required.
34700c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==8,  8-byte alignment required.
34710c1bc742181ded4930842b46e9507372f0b1b963James Dong *              If iBlockWidth==16, 16-byte alignment required.
34720c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcOrgStep - Stride of the original picture plane in terms of full
34730c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of iBlockWidth.
34740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcRefStep - Stride of the reference picture plane in terms of full
34750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels
34760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockWidth - Width of the current block in terms of full pixels; must
34770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be equal to either 4, 8, or 16.
34780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockHeight - Height of the current block in terms of full pixels; must
34790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be equal to either 4, 8, or 16.
34800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nLamda - Lamda factor, used to compute motion cost
34810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
34820c1bc742181ded4930842b46e9507372f0b1b963James Dong *            compute motion cost
34830c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstBestMV - The best MV resulting from a prior integer search,
34840c1bc742181ded4930842b46e9507372f0b1b963James Dong *            represented in terms of 1/4-pel units
34850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
34870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in
34890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            terms of 1/4-pel units
34900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBestCost - Motion cost associated with the best MV; computed as
34910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            SAD+Lamda*BitsUsedByMV
34920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
34930c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
34940c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
34950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
34960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    any of the following pointers is NULL: pSrcOrgY, pSrcRefY,
34970c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcDstBestMV, pMVPred, pBestCost
34980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
34990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
35000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35010c1bc742181ded4930842b46e9507372f0b1b963James Dong */
35020c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_BlockMatch_Half (
35030c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrgY,
35040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcOrgStep,
35050c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefY,
35060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcRefStep,
35070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockWidth,
35080c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockHeight,
35090c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 nLamda,
35100c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pMVPred,
35110c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcDstBestMV,
35120c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pBestCost
35130c1bc742181ded4930842b46e9507372f0b1b963James Dong);
35140c1bc742181ded4930842b46e9507372f0b1b963James Dong
35150c1bc742181ded4930842b46e9507372f0b1b963James Dong
35160c1bc742181ded4930842b46e9507372f0b1b963James Dong
35170c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
35180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_BlockMatch_Quarter   (6.3.5.2.3)
35190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35200c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
35210c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs a quarter-pel block match using results from a prior half-pel
35220c1bc742181ded4930842b46e9507372f0b1b963James Dong * search.  Returns the best MV and associated cost.  This function estimates
35230c1bc742181ded4930842b46e9507372f0b1b963James Dong * the quarter-pixel motion vector by interpolating the half-pel resolution
35240c1bc742181ded4930842b46e9507372f0b1b963James Dong * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the
35250c1bc742181ded4930842b46e9507372f0b1b963James Dong * initial half-pel MV is generated externally.  The function
35260c1bc742181ded4930842b46e9507372f0b1b963James Dong * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation.
35270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
35290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35300c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrgY - Pointer to the current position in original picture plane:
35310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==4,  4-byte alignment required.
35320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==8,  8-byte alignment required.
35330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==16, 16-byte alignment required.
35340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefY - Pointer to the top-left corner of the co-located block in the
35350c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference picture:
35360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==4,  4-byte alignment required.
35370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==8,  8-byte alignment required.
35380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            If iBlockWidth==16, 16-byte alignment required.
35390c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcOrgStep - Stride of the original picture plane in terms of full
35400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of iBlockWidth.
35410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nSrcRefStep - Stride of the reference picture plane in terms of full
35420c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels
35430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockWidth - Width of the current block in terms of full pixels; must
35440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be equal to either 4, 8, or 16.
35450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iBlockHeight - Height of the current block in terms of full pixels; must
35460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            be equal to either 4, 8, or 16.
35470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nLamda - Lamda factor, used to compute motion cost
35480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to
35490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            compute motion cost
35500c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstBestMV - The best MV resulting from a prior half-pel search,
35510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            represented in terms of 1/4 pel units
35520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
35540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35550c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed
35560c1bc742181ded4930842b46e9507372f0b1b963James Dong *            in terms of 1/4-pel units
35570c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pBestCost - Motion cost associated with the best MV; computed as
35580c1bc742181ded4930842b46e9507372f0b1b963James Dong *            SAD+Lamda*BitsUsedByMV
35590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
35610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
35620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
35630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more of the following pointers is NULL:
35640c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost
35650c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16.
35660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
35670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35680c1bc742181ded4930842b46e9507372f0b1b963James Dong */
35690c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_BlockMatch_Quarter (
35700c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrgY,
35710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcOrgStep,
35720c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefY,
35730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 nSrcRefStep,
35740c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockWidth,
35750c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 iBlockHeight,
35760c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 nLamda,
35770c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCMotionVector *pMVPred,
35780c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCMotionVector *pSrcDstBestMV,
35790c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pBestCost
35800c1bc742181ded4930842b46e9507372f0b1b963James Dong);
35810c1bc742181ded4930842b46e9507372f0b1b963James Dong
35820c1bc742181ded4930842b46e9507372f0b1b963James Dong
35830c1bc742181ded4930842b46e9507372f0b1b963James Dong
35840c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
35850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_MotionEstimationMB   (6.3.5.3.1)
35860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35870c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
35880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Performs MB-level motion estimation and selects best motion estimation
35890c1bc742181ded4930842b46e9507372f0b1b963James Dong * strategy from the set of modes supported in baseline profile [ISO14496-10].
35900c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35910c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
35920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
35930c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCurrBuf - Pointer to the current position in original picture plane;
35940c1bc742181ded4930842b46e9507372f0b1b963James Dong *            16-byte alignment required
35950c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRefBufList - Pointer to an array with 16 entries.  Each entry points
35960c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to the top-left corner of the co-located MB in a reference
35970c1bc742181ded4930842b46e9507372f0b1b963James Dong *            picture.  The array is filled from low-to-high with valid
35980c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reference frame pointers; the unused high entries should be set
35990c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to NULL.  Ordering of the reference frames should follow
36000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            [ISO14496-10] subclause 8.2.4  Decoding Process for Reference
36010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Picture Lists.   The entries must be 16-byte aligned.
36020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the
36030c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reconstructed picture; must be 16-byte aligned.
36040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   SrcCurrStep - Width of the original picture plane in terms of full
36050c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of 16.
36060c1bc742181ded4930842b46e9507372f0b1b963James Dong *   SrcRefStep - Width of the reference picture plane in terms of full
36070c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of 16.
36080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   SrcRecStep - Width of the reconstructed picture plane in terms of full
36090c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pixels; must be a multiple of 16.
36100c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pRefRect - Pointer to the valid reference rectangle; relative to the
36110c1bc742181ded4930842b46e9507372f0b1b963James Dong *            image origin.
36120c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pCurrPointPos - Position of the current macroblock in the current plane.
36130c1bc742181ded4930842b46e9507372f0b1b963James Dong *   Lambda - Lagrange factor for computing the cost function
36140c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMESpec - Pointer to the motion estimation specification structure; must
36150c1bc742181ded4930842b46e9507372f0b1b963James Dong *            have been allocated and initialized prior to calling this
36160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            function.
36170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMBInter - Array, of dimension four, containing pointers to information
36180c1bc742181ded4930842b46e9507372f0b1b963James Dong *            associated with four adjacent type INTER MBs (Left, Top,
36190c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Top-Left, Top-Right). Any pointer in the array may be set equal
36200c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to NULL if the corresponding MB doesn t exist or is not of type
36210c1bc742181ded4930842b46e9507372f0b1b963James Dong *            INTER.
36220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBInter[0] - Pointer to left MB information
36230c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBInter[1] - Pointer to top MB information
36240c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBInter[2] - Pointer to top-left MB information
36250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBInter[3] - Pointer to top-right MB information
36260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pMBIntra - Array, of dimension four, containing pointers to information
36270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            associated with four adjacent type INTRA MBs (Left, Top,
36280c1bc742181ded4930842b46e9507372f0b1b963James Dong *            Top-Left, Top-Right). Any pointer in the array may be set equal
36290c1bc742181ded4930842b46e9507372f0b1b963James Dong *            to NULL if the corresponding MB doesn t exist or is not of type
36300c1bc742181ded4930842b46e9507372f0b1b963James Dong *            INTRA.
36310c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBIntra[0] - Pointer to left MB information
36320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBIntra[1] - Pointer to top MB information
36330c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBIntra[2] - Pointer to top-left MB information
36340c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMBIntra[3] - Pointer to top-right MB information
36350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMBCurr - Pointer to information structure for the current MB.
36360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            The following entries should be set prior to calling the
36370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            function:  sliceID - the number of the slice the to which the
36380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            current MB belongs.
36390c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36400c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
36410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36420c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstCost - Pointer to the minimum motion cost for the current MB.
36430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma
36440c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4x4 blocks in each MB.  The block SADs are in scan order for
36450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            each MB.  For implementations that cannot compute the SAD values
36460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            individually, the maximum possible value (0xffff) is returned
36470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for each of the 16 block SAD entries.
36480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDstMBCurr - Pointer to updated information structure for the current
36490c1bc742181ded4930842b46e9507372f0b1b963James Dong *            MB after MB-level motion estimation has been completed.  The
36500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            following fields are updated by the ME function.   The following
36510c1bc742181ded4930842b46e9507372f0b1b963James Dong *            parameter set quantifies the MB-level ME search results:
36520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  MbType
36530c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  subMBType[4]
36540c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMV0[4][4]
36550c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pMVPred[4][4]
36560c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pRefL0Idx[4]
36570c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  Intra16x16PredMode
36580c1bc742181ded4930842b46e9507372f0b1b963James Dong *            -  pIntra4x4PredMode[4][4]
36590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
36610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
36620c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
36630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -   One or more of the following pointers is NULL: pSrcCurrBuf,
36640c1bc742181ded4930842b46e9507372f0b1b963James Dong *           pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec,
36650c1bc742181ded4930842b46e9507372f0b1b963James Dong *           pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0]
36660c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    SrcRefStep, SrcRecStep are not multiples of 16
36670c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iBlockWidth or iBlockHeight are values other than 4, 8, or 16.
36680c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
36690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36700c1bc742181ded4930842b46e9507372f0b1b963James Dong */
36710c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_MotionEstimationMB (
36720c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcCurrBuf,
36730c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 SrcCurrStep,
36740c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRefBufList[15],
36750c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 SrcRefStep,
36760c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRecBuf,
36770c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 SrcRecStep,
36780c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXRect *pRefRect,
36790c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P2Coordinate *pCurrPointPos,
36800c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 Lambda,
36810c1bc742181ded4930842b46e9507372f0b1b963James Dong    void *pMESpec,
36820c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P10MBInfoPtr *pMBInter,
36830c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMXVCM4P10MBInfoPtr *pMBIntra,
36840c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10MBInfoPtr pSrcDstMBCurr,
36850c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_INT *pDstCost,
36860c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U16 *pDstBlockSAD
36870c1bc742181ded4930842b46e9507372f0b1b963James Dong);
36880c1bc742181ded4930842b46e9507372f0b1b963James Dong
36890c1bc742181ded4930842b46e9507372f0b1b963James Dong
36900c1bc742181ded4930842b46e9507372f0b1b963James Dong
36910c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
36920c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SAD_4x   (6.3.5.4.1)
36930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
36950c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD for 4x8 and 4x4 blocks.
36960c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36970c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
36980c1bc742181ded4930842b46e9507372f0b1b963James Dong *
36990c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrg -Pointer to the original block; must be aligned on a 4-byte
37000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
37010c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepOrg -Step of the original block buffer; must be a multiple of 4.
37020c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef -Pointer to the reference block
37030c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepRef -Step of the reference block buffer
37040c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight -Height of the block; must be equal to either 4 or 8.
37050c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37060c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
37070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37080c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD -Pointer of result SAD
37090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37100c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
37110c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
37120c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
37130c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more of the following pointers is NULL:
37140c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrg, pSrcRef, or pDstSAD
37150c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not equal to either 4 or 8.
37160c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepOrg is not a multiple of 4
37170c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
37180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37190c1bc742181ded4930842b46e9507372f0b1b963James Dong */
37200c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SAD_4x (
37210c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrg,
37220c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepOrg,
37230c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
37240c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepRef,
37250c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S32 *pDstSAD,
37260c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
37270c1bc742181ded4930842b46e9507372f0b1b963James Dong);
37280c1bc742181ded4930842b46e9507372f0b1b963James Dong
37290c1bc742181ded4930842b46e9507372f0b1b963James Dong
37300c1bc742181ded4930842b46e9507372f0b1b963James Dong
37310c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
37320c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SADQuar_4x   (6.3.5.4.2)
37330c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37340c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
37350c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD between one block (pSrc) and the average
37360c1bc742181ded4930842b46e9507372f0b1b963James Dong * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks.  Rounding
37370c1bc742181ded4930842b46e9507372f0b1b963James Dong * is applied according to the convention (a+b+1)>>1.
37380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
37400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the original block; must be aligned on a 4-byte
37420c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
37430c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef0 - Pointer to reference block 0
37440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef1 - Pointer to reference block 1
37450c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcStep - Step of the original block buffer; must be a multiple of 4.
37460c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep0 - Step of reference block 0
37470c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep1 - Step of reference block 1
37480c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the block; must be equal to either 4 or 8.
37490c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37500c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
37510c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37520c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - Pointer of result SAD
37530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
37550c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
37560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
37570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not equal to either 4 or 8.
37580c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0,
37590c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcRef1, pDstSAD.
37600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcStep is not a multiple of 4
37610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
37620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37630c1bc742181ded4930842b46e9507372f0b1b963James Dong */
37640c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SADQuar_4x (
37650c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
37660c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef0,
37670c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef1,
37680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcStep,
37690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep0,
37700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep1,
37710c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pDstSAD,
37720c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
37730c1bc742181ded4930842b46e9507372f0b1b963James Dong);
37740c1bc742181ded4930842b46e9507372f0b1b963James Dong
37750c1bc742181ded4930842b46e9507372f0b1b963James Dong
37760c1bc742181ded4930842b46e9507372f0b1b963James Dong
37770c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
37780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SADQuar_8x   (6.3.5.4.3)
37790c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37800c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
37810c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD between one block (pSrc) and the average
37820c1bc742181ded4930842b46e9507372f0b1b963James Dong * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks.
37830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Rounding is applied according to the convention (a+b+1)>>1.
37840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
37860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the original block; must be aligned on an 8-byte
37880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
37890c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef0 - Pointer to reference block 0
37900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef1 - Pointer to reference block 1
37910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcStep - Step of the original block buffer; must be a multiple of 8.
37920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep0 - Step of reference block 0
37930c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep1 - Step of reference block 1
37940c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the block; must be equal either 4, 8, or 16.
37950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37960c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
37970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
37980c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - Pointer of result SAD
37990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38000c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
38010c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
38020c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
38030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not equal to either 4, 8, or 16.
38040c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0,
38050c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcRef1, pDstSAD.
38060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcStep is not a multiple of 8
38070c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
38080c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38090c1bc742181ded4930842b46e9507372f0b1b963James Dong */
38100c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SADQuar_8x (
38110c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
38120c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef0,
38130c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef1,
38140c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcStep,
38150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep0,
38160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep1,
38170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pDstSAD,
38180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
38190c1bc742181ded4930842b46e9507372f0b1b963James Dong);
38200c1bc742181ded4930842b46e9507372f0b1b963James Dong
38210c1bc742181ded4930842b46e9507372f0b1b963James Dong
38220c1bc742181ded4930842b46e9507372f0b1b963James Dong
38230c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
38240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SADQuar_16x   (6.3.5.4.4)
38250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
38270c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the SAD between one block (pSrc) and the average
38280c1bc742181ded4930842b46e9507372f0b1b963James Dong * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks.
38290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Rounding is applied according to the convention (a+b+1)>>1.
38300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38310c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
38320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the original block; must be aligned on a 16-byte
38340c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary.
38350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef0 - Pointer to reference block 0
38360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef1 - Pointer to reference block 1
38370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcStep - Step of the original block buffer; must be a multiple of 16
38380c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep0 - Step of reference block 0
38390c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iRefStep1 - Step of reference block 1
38400c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the block; must be equal to either 8 or 16
38410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
38430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD -Pointer of result SAD
38450c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38460c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
38470c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr, if the function runs without error.
38480c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs:
38490c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not equal to either 8 or 16.
38500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    One or more of the following pointers is NULL: pSrc, pSrcRef0,
38510c1bc742181ded4930842b46e9507372f0b1b963James Dong *              pSrcRef1, pDstSAD.
38520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcStep is not a multiple of 16
38530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    Any alignment restrictions are violated
38540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38550c1bc742181ded4930842b46e9507372f0b1b963James Dong */
38560c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SADQuar_16x (
38570c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
38580c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef0,
38590c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef1,
38600c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcStep,
38610c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep0,
38620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iRefStep1,
38630c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pDstSAD,
38640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
38650c1bc742181ded4930842b46e9507372f0b1b963James Dong);
38660c1bc742181ded4930842b46e9507372f0b1b963James Dong
38670c1bc742181ded4930842b46e9507372f0b1b963James Dong
38680c1bc742181ded4930842b46e9507372f0b1b963James Dong
38690c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
38700c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SATD_4x4   (6.3.5.4.5)
38710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
38730c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the sum of absolute transform differences (SATD)
38740c1bc742181ded4930842b46e9507372f0b1b963James Dong * for a 4x4 block by applying a Hadamard transform to the difference block
38750c1bc742181ded4930842b46e9507372f0b1b963James Dong * and then calculating the sum of absolute coefficient values.
38760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38770c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
38780c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38790c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrg - Pointer to the original block; must be aligned on a 4-byte
38800c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary
38810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepOrg - Step of the original block buffer; must be a multiple of 4
38820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcRef - Pointer to the reference block; must be aligned on a 4-byte
38830c1bc742181ded4930842b46e9507372f0b1b963James Dong *            boundary
38840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iStepRef - Step of the reference block buffer; must be a multiple of 4
38850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38860c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
38870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstSAD - pointer to the resulting SAD
38890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38900c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
38910c1bc742181ded4930842b46e9507372f0b1b963James Dong *
38920c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
38930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
38940c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
38950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
38960c1bc742181ded4930842b46e9507372f0b1b963James Dong *         pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg
38970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcRef is not aligned on a 4-byte boundary
38980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepOrg <= 0 or iStepOrg is not a multiple of 4
38990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iStepRef <= 0 or iStepRef is not a multiple of 4
39000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39010c1bc742181ded4930842b46e9507372f0b1b963James Dong */
39020c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SATD_4x4 (
39030c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrg,
39040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepOrg,
39050c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcRef,
39060c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iStepRef,
39070c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 *pDstSAD
39080c1bc742181ded4930842b46e9507372f0b1b963James Dong);
39090c1bc742181ded4930842b46e9507372f0b1b963James Dong
39100c1bc742181ded4930842b46e9507372f0b1b963James Dong
39110c1bc742181ded4930842b46e9507372f0b1b963James Dong
39120c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
39130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InterpolateHalfHor_Luma   (6.3.5.5.1)
39140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39150c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
39160c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for two horizontal 1/2-pel positions
39170c1bc742181ded4930842b46e9507372f0b1b963James Dong * (-1/2,0) and (1/2, 0) - around a full-pel position.
39180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
39200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the top-left corner of the block used to interpolate in
39220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the reconstruction frame plane.
39230c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcStep - Step of the source buffer.
39240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstStep - Step of the destination(interpolation) buffer; must be a
39250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            multiple of iWidth.
39260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iWidth - Width of the current block; must be equal to either 4, 8, or 16
39270c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the current block; must be equal to 4, 8, or 16
39280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
39300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39310c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstLeft -Pointer to the interpolation buffer of the left -pel position
39320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            (-1/2, 0)
39330c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==4,  4-byte alignment required.
39340c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==8,  8-byte alignment required.
39350c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==16, 16-byte alignment required.
39360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstRight -Pointer to the interpolation buffer of the right -pel
39370c1bc742181ded4930842b46e9507372f0b1b963James Dong *            position (1/2, 0)
39380c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==4,  4-byte alignment required.
39390c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==8,  8-byte alignment required.
39400c1bc742181ded4930842b46e9507372f0b1b963James Dong *                 If iWidth==16, 16-byte alignment required.
39410c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39420c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
39430c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39440c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
39450c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
39460c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
39470c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
39480c1bc742181ded4930842b46e9507372f0b1b963James Dong *             pSrc, pDstLeft, or pDstRight
39490c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth or iHeight have values other than 4, 8, or 16
39500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary
39510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary
39520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary
39530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    any alignment restrictions are violated
39540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39550c1bc742181ded4930842b46e9507372f0b1b963James Dong */
39560c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InterpolateHalfHor_Luma (
39570c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
39580c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcStep,
39590c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstLeft,
39600c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstRight,
39610c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstStep,
39620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iWidth,
39630c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
39640c1bc742181ded4930842b46e9507372f0b1b963James Dong);
39650c1bc742181ded4930842b46e9507372f0b1b963James Dong
39660c1bc742181ded4930842b46e9507372f0b1b963James Dong
39670c1bc742181ded4930842b46e9507372f0b1b963James Dong
39680c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
39690c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InterpolateHalfVer_Luma   (6.3.5.5.2)
39700c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39710c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
39720c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs interpolation for two vertical 1/2-pel positions -
39730c1bc742181ded4930842b46e9507372f0b1b963James Dong * (0, -1/2) and (0, 1/2) - around a full-pel position.
39740c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39750c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
39760c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39770c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to top-left corner of block used to interpolate in the
39780c1bc742181ded4930842b46e9507372f0b1b963James Dong *            reconstructed frame plane
39790c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcStep - Step of the source buffer.
39800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstStep - Step of the destination (interpolation) buffer; must be a
39810c1bc742181ded4930842b46e9507372f0b1b963James Dong *            multiple of iWidth.
39820c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iWidth - Width of the current block; must be equal to either 4, 8, or 16
39830c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the current block; must be equal to either 4, 8, or 16
39840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39850c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
39860c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39870c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstUp -Pointer to the interpolation buffer of the -pel position above
39880c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the current full-pel position (0, -1/2)
39890c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==4, 4-byte alignment required.
39900c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==8, 8-byte alignment required.
39910c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==16, 16-byte alignment required.
39920c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstDown -Pointer to the interpolation buffer of the -pel position below
39930c1bc742181ded4930842b46e9507372f0b1b963James Dong *            the current full-pel position (0, 1/2)
39940c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==4, 4-byte alignment required.
39950c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==8, 8-byte alignment required.
39960c1bc742181ded4930842b46e9507372f0b1b963James Dong *                If iWidth==16, 16-byte alignment required.
39970c1bc742181ded4930842b46e9507372f0b1b963James Dong *
39980c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
39990c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40000c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
40010c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
40020c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
40030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
40040c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pSrc, pDstUp, or pDstDown
40050c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth or iHeight have values other than 4, 8, or 16
40060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary
40070c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary
40080c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary
40090c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40100c1bc742181ded4930842b46e9507372f0b1b963James Dong */
40110c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InterpolateHalfVer_Luma (
40120c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrc,
40130c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcStep,
40140c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstUp,
40150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstDown,
40160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstStep,
40170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iWidth,
40180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
40190c1bc742181ded4930842b46e9507372f0b1b963James Dong);
40200c1bc742181ded4930842b46e9507372f0b1b963James Dong
40210c1bc742181ded4930842b46e9507372f0b1b963James Dong
40220c1bc742181ded4930842b46e9507372f0b1b963James Dong
40230c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
40240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_Average_4x   (6.3.5.5.3)
40250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
40270c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function calculates the average of two 4x4, 4x8 blocks.  The result
40280c1bc742181ded4930842b46e9507372f0b1b963James Dong * is rounded according to (a+b+1)/2.
40290c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40300c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
40310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40320c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred0 - Pointer to the top-left corner of reference block 0
40330c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pPred1 - Pointer to the top-left corner of reference block 1
40340c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep0 - Step of reference block 0; must be a multiple of 4.
40350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iPredStep1 - Step of reference block 1; must be a multiple of 4.
40360c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstStep - Step of the destination buffer; must be a multiple of 4.
40370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iHeight - Height of the blocks; must be either 4 or 8.
40380c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40390c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
40400c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40410c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstPred - Pointer to the destination buffer. 4-byte alignment required.
40420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
40440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40450c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
40460c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
40470c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
40480c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
40490c1bc742181ded4930842b46e9507372f0b1b963James Dong *           pPred0, pPred1, or pDstPred
40500c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDstPred is not aligned on a 4-byte boundary
40510c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iPredStep0 <= 0 or iPredStep0 is not a multiple of 4
40520c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iPredStep1 <= 0 or iPredStep1 is not a multiple of 4
40530c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iDstStep <= 0 or iDstStep is not a multiple of 4
40540c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iHeight is not equal to either 4 or 8
40550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40560c1bc742181ded4930842b46e9507372f0b1b963James Dong */
40570c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_Average_4x (
40580c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred0,
40590c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pPred1,
40600c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep0,
40610c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iPredStep1,
40620c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstPred,
40630c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstStep,
40640c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iHeight
40650c1bc742181ded4930842b46e9507372f0b1b963James Dong);
40660c1bc742181ded4930842b46e9507372f0b1b963James Dong
40670c1bc742181ded4930842b46e9507372f0b1b963James Dong
40680c1bc742181ded4930842b46e9507372f0b1b963James Dong
40690c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
40700c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_TransformQuant_ChromaDC   (6.3.5.6.1)
40710c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40720c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
40730c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs 2x2 Hadamard transform of chroma DC coefficients
40740c1bc742181ded4930842b46e9507372f0b1b963James Dong * and then quantizes the coefficients.
40750c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
40770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to the 2x2 array of chroma DC coefficients.  8-byte
40790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
40800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iQP - Quantization parameter; must be in the range [0,51].
40810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER
40820c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40830c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
40840c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40850c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to transformed and quantized coefficients.  8-byte
40860c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
40870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
40890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40900c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
40910c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
40920c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
40930c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
40940c1bc742181ded4930842b46e9507372f0b1b963James Dong *             pSrcDst
40950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not aligned on an 8-byte boundary
40960c1bc742181ded4930842b46e9507372f0b1b963James Dong *
40970c1bc742181ded4930842b46e9507372f0b1b963James Dong */
40980c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_TransformQuant_ChromaDC (
40990c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
41000c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iQP,
41010c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 bIntra
41020c1bc742181ded4930842b46e9507372f0b1b963James Dong);
41030c1bc742181ded4930842b46e9507372f0b1b963James Dong
41040c1bc742181ded4930842b46e9507372f0b1b963James Dong
41050c1bc742181ded4930842b46e9507372f0b1b963James Dong
41060c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
41070c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_TransformQuant_LumaDC   (6.3.5.6.2)
41080c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41090c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
41100c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs a 4x4 Hadamard transform of luma DC coefficients
41110c1bc742181ded4930842b46e9507372f0b1b963James Dong * and then quantizes the coefficients.
41120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
41140c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41150c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to the 4x4 array of luma DC coefficients.  16-byte
41160c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
41170c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iQP - Quantization parameter; must be in the range [0,51].
41180c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41190c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
41200c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcDst - Pointer to transformed and quantized coefficients.  16-byte
41220c1bc742181ded4930842b46e9507372f0b1b963James Dong *             alignment required.
41230c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41240c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
41250c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41260c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
41270c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
41280c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
41290c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrcDst
41300c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcDst is not aligned on an 16-byte boundary
41310c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41320c1bc742181ded4930842b46e9507372f0b1b963James Dong */
41330c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_TransformQuant_LumaDC (
41340c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pSrcDst,
41350c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iQP
41360c1bc742181ded4930842b46e9507372f0b1b963James Dong);
41370c1bc742181ded4930842b46e9507372f0b1b963James Dong
41380c1bc742181ded4930842b46e9507372f0b1b963James Dong
41390c1bc742181ded4930842b46e9507372f0b1b963James Dong
41400c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
41410c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InvTransformDequant_LumaDC   (6.3.5.6.3)
41420c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41430c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
41440c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs inverse 4x4 Hadamard transform and then dequantizes
41450c1bc742181ded4930842b46e9507372f0b1b963James Dong * the coefficients.
41460c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41470c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
41480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41490c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and
41500c1bc742181ded4930842b46e9507372f0b1b963James Dong *            quantized coefficients.  16 byte alignment required.
41510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iQP - Quantization parameter; must be in the range [0,51].
41520c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41530c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
41540c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41550c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to inverse-transformed and dequantized coefficients.
41560c1bc742181ded4930842b46e9507372f0b1b963James Dong *            16-byte alignment required.
41570c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
41590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41600c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
41610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
41620c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
41630c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrc
41640c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is not aligned on a 16-byte boundary
41650c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41660c1bc742181ded4930842b46e9507372f0b1b963James Dong */
41670c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InvTransformDequant_LumaDC (
41680c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrc,
41690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
41700c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iQP
41710c1bc742181ded4930842b46e9507372f0b1b963James Dong);
41720c1bc742181ded4930842b46e9507372f0b1b963James Dong
41730c1bc742181ded4930842b46e9507372f0b1b963James Dong
41740c1bc742181ded4930842b46e9507372f0b1b963James Dong
41750c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
41760c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InvTransformDequant_ChromaDC   (6.3.5.6.4)
41770c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41780c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
41790c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs inverse 2x2 Hadamard transform and then dequantizes
41800c1bc742181ded4930842b46e9507372f0b1b963James Dong * the coefficients.
41810c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41820c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
41830c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41840c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and
41850c1bc742181ded4930842b46e9507372f0b1b963James Dong *            quantized coefficients.  8 byte alignment required.
41860c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iQP - Quantization parameter; must be in the range [0,51].
41870c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41880c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
41890c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41900c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDst - Pointer to inverse-transformed and dequantized coefficients.
41910c1bc742181ded4930842b46e9507372f0b1b963James Dong *            8-byte alignment required.
41920c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41930c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
41940c1bc742181ded4930842b46e9507372f0b1b963James Dong *
41950c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
41960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
41970c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
41980c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL: pSrc
41990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrc or pDst is not aligned on an 8-byte boundary
42000c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42010c1bc742181ded4930842b46e9507372f0b1b963James Dong */
42020c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InvTransformDequant_ChromaDC (
42030c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrc,
42040c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDst,
42050c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iQP
42060c1bc742181ded4930842b46e9507372f0b1b963James Dong);
42070c1bc742181ded4930842b46e9507372f0b1b963James Dong
42080c1bc742181ded4930842b46e9507372f0b1b963James Dong
42090c1bc742181ded4930842b46e9507372f0b1b963James Dong
42100c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
42110c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_InvTransformResidualAndAdd   (6.3.5.7.1)
42120c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42130c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
42140c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function performs inverse an 4x4 integer transformation to produce
42150c1bc742181ded4930842b46e9507372f0b1b963James Dong * the difference signal and then adds the difference to the prediction to get
42160c1bc742181ded4930842b46e9507372f0b1b963James Dong * the reconstructed signal.
42170c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42180c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
42190c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42200c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPred - Pointer to prediction signal.  4-byte alignment required.
42210c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDequantCoeff - Pointer to the transformed coefficients.  8-byte
42220c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
42230c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcPredStep - Step of the prediction buffer; must be a multiple of 4.
42240c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iDstReconStep - Step of the destination reconstruction buffer; must be a
42250c1bc742181ded4930842b46e9507372f0b1b963James Dong *            multiple of 4.
42260c1bc742181ded4930842b46e9507372f0b1b963James Dong *   bAC - Indicate whether there is AC coefficients in the coefficients
42270c1bc742181ded4930842b46e9507372f0b1b963James Dong *            matrix.
42280c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42290c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
42300c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42310c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstRecon -Pointer to the destination reconstruction buffer.  4-byte
42320c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
42330c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42340c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
42350c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42360c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
42370c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
42380c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
42390c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
42400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pSrcPred, pDequantCoeff, pDstRecon
42410c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcPred is not aligned on a 4-byte boundary
42420c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcPredStep or iDstReconStep is not a multiple of 4.
42430c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDequantCoeff is not aligned on an 8-byte boundary
42440c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42450c1bc742181ded4930842b46e9507372f0b1b963James Dong */
42460c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_InvTransformResidualAndAdd (
42470c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcPred,
42480c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pDequantCoeff,
42490c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 *pDstRecon,
42500c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcPredStep,
42510c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iDstReconStep,
42520c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 bAC
42530c1bc742181ded4930842b46e9507372f0b1b963James Dong);
42540c1bc742181ded4930842b46e9507372f0b1b963James Dong
42550c1bc742181ded4930842b46e9507372f0b1b963James Dong
42560c1bc742181ded4930842b46e9507372f0b1b963James Dong
42570c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
42580c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_SubAndTransformQDQResidual   (6.3.5.8.1)
42590c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42600c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
42610c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function subtracts the prediction signal from the original signal to
42620c1bc742181ded4930842b46e9507372f0b1b963James Dong * produce the difference signal and then performs a 4x4 integer transform and
42630c1bc742181ded4930842b46e9507372f0b1b963James Dong * quantization. The quantized transformed coefficients are stored as
42640c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstQuantCoeff. This function can also output dequantized coefficients or
42650c1bc742181ded4930842b46e9507372f0b1b963James Dong * unquantized DC coefficients optionally by setting the pointers
42660c1bc742181ded4930842b46e9507372f0b1b963James Dong * pDstDeQuantCoeff, pDCCoeff.
42670c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42680c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
42690c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42700c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcOrg - Pointer to original signal. 4-byte alignment required.
42710c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcPred - Pointer to prediction signal. 4-byte alignment required.
42720c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcOrgStep - Step of the original signal buffer; must be a multiple of
42730c1bc742181ded4930842b46e9507372f0b1b963James Dong *            4.
42740c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iSrcPredStep - Step of the prediction signal buffer; must be a multiple
42750c1bc742181ded4930842b46e9507372f0b1b963James Dong *            of 4.
42760c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pNumCoeff -Number of non-zero coefficients after quantization. If this
42770c1bc742181ded4930842b46e9507372f0b1b963James Dong *            parameter is not required, it is set to NULL.
42780c1bc742181ded4930842b46e9507372f0b1b963James Dong *   nThreshSAD - Zero-block early detection threshold. If this parameter is
42790c1bc742181ded4930842b46e9507372f0b1b963James Dong *            not required, it is set to 0.
42800c1bc742181ded4930842b46e9507372f0b1b963James Dong *   iQP - Quantization parameter; must be in the range [0,51].
42810c1bc742181ded4930842b46e9507372f0b1b963James Dong *   bIntra - Indicates whether this is an INTRA block, either 1-INTRA or
42820c1bc742181ded4930842b46e9507372f0b1b963James Dong *            0-INTER
42830c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42840c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
42850c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42860c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstQuantCoeff - Pointer to the quantized transformed coefficients.
42870c1bc742181ded4930842b46e9507372f0b1b963James Dong *            8-byte alignment required.
42880c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients
42890c1bc742181ded4930842b46e9507372f0b1b963James Dong *            if this parameter is not equal to NULL.  8-byte alignment
42900c1bc742181ded4930842b46e9507372f0b1b963James Dong *            required.
42910c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDCCoeff - Pointer to the unquantized DC coefficient if this parameter
42920c1bc742181ded4930842b46e9507372f0b1b963James Dong *            is not equal to NULL.
42930c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42940c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
42950c1bc742181ded4930842b46e9507372f0b1b963James Dong *
42960c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
42970c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
42980c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
42990c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
43000c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff,
43010c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pDstDeQuantCoeff, pDCCoeff
43020c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcOrg is not aligned on a 4-byte boundary
43030c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcPred is not aligned on a 4-byte boundary
43040c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcOrgStep is not a multiple of 4
43050c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    iSrcPredStep is not a multiple of 4
43060c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary
43070c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43080c1bc742181ded4930842b46e9507372f0b1b963James Dong */
43090c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_SubAndTransformQDQResidual (
43100c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcOrg,
43110c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pSrcPred,
43120c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcOrgStep,
43130c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iSrcPredStep,
43140c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDstQuantCoeff,
43150c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDstDeQuantCoeff,
43160c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S16 *pDCCoeff,
43170c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_S8 *pNumCoeff,
43180c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 nThreshSAD,
43190c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 iQP,
43200c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 bIntra
43210c1bc742181ded4930842b46e9507372f0b1b963James Dong);
43220c1bc742181ded4930842b46e9507372f0b1b963James Dong
43230c1bc742181ded4930842b46e9507372f0b1b963James Dong
43240c1bc742181ded4930842b46e9507372f0b1b963James Dong
43250c1bc742181ded4930842b46e9507372f0b1b963James Dong/**
43260c1bc742181ded4930842b46e9507372f0b1b963James Dong * Function:  omxVCM4P10_GetVLCInfo   (6.3.5.9.1)
43270c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43280c1bc742181ded4930842b46e9507372f0b1b963James Dong * Description:
43290c1bc742181ded4930842b46e9507372f0b1b963James Dong * This function extracts run-length encoding (RLE) information from the
43300c1bc742181ded4930842b46e9507372f0b1b963James Dong * coefficient matrix.  The results are returned in an OMXVCM4P10VLCInfo
43310c1bc742181ded4930842b46e9507372f0b1b963James Dong * structure.
43320c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43330c1bc742181ded4930842b46e9507372f0b1b963James Dong * Input Arguments:
43340c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43350c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pSrcCoeff - pointer to the transform coefficient matrix.  8-byte
43360c1bc742181ded4930842b46e9507372f0b1b963James Dong *            alignment required.
43370c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pScanMatrix - pointer to the scan order definition matrix.  For a luma
43380c1bc742181ded4930842b46e9507372f0b1b963James Dong *            block the scan matrix should follow [ISO14496-10] section 8.5.4,
43390c1bc742181ded4930842b46e9507372f0b1b963James Dong *            and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13,
43400c1bc742181ded4930842b46e9507372f0b1b963James Dong *            10, 7, 11, 14, 15.  For a chroma block, the scan matrix should
43410c1bc742181ded4930842b46e9507372f0b1b963James Dong *            contain the values 0, 1, 2, 3.
43420c1bc742181ded4930842b46e9507372f0b1b963James Dong *   bAC - indicates presence of a DC coefficient; 0 = DC coefficient
43430c1bc742181ded4930842b46e9507372f0b1b963James Dong *            present, 1= DC coefficient absent.
43440c1bc742181ded4930842b46e9507372f0b1b963James Dong *   MaxNumCoef - specifies the number of coefficients contained in the
43450c1bc742181ded4930842b46e9507372f0b1b963James Dong *            transform coefficient matrix, pSrcCoeff. The value should be 16
43460c1bc742181ded4930842b46e9507372f0b1b963James Dong *            for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The
43470c1bc742181ded4930842b46e9507372f0b1b963James Dong *            value should be 4 for blocks of type CHROMADC.
43480c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43490c1bc742181ded4930842b46e9507372f0b1b963James Dong * Output Arguments:
43500c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43510c1bc742181ded4930842b46e9507372f0b1b963James Dong *   pDstVLCInfo - pointer to structure that stores information for
43520c1bc742181ded4930842b46e9507372f0b1b963James Dong *            run-length coding.
43530c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43540c1bc742181ded4930842b46e9507372f0b1b963James Dong * Return Value:
43550c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43560c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_NoErr - no error
43570c1bc742181ded4930842b46e9507372f0b1b963James Dong *    OMX_Sts_BadArgErr - bad arguments; returned if any of the following
43580c1bc742181ded4930842b46e9507372f0b1b963James Dong *              conditions are true:
43590c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    at least one of the following pointers is NULL:
43600c1bc742181ded4930842b46e9507372f0b1b963James Dong *            pSrcCoeff, pScanMatrix, pDstVLCInfo
43610c1bc742181ded4930842b46e9507372f0b1b963James Dong *    -    pSrcCoeff is not aligned on an 8-byte boundary
43620c1bc742181ded4930842b46e9507372f0b1b963James Dong *
43630c1bc742181ded4930842b46e9507372f0b1b963James Dong */
43640c1bc742181ded4930842b46e9507372f0b1b963James DongOMXResult omxVCM4P10_GetVLCInfo (
43650c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_S16 *pSrcCoeff,
43660c1bc742181ded4930842b46e9507372f0b1b963James Dong    const OMX_U8 *pScanMatrix,
43670c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U8 bAC,
43680c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMX_U32 MaxNumCoef,
43690c1bc742181ded4930842b46e9507372f0b1b963James Dong    OMXVCM4P10VLCInfo*pDstVLCInfo
43700c1bc742181ded4930842b46e9507372f0b1b963James Dong);
43710c1bc742181ded4930842b46e9507372f0b1b963James Dong
43720c1bc742181ded4930842b46e9507372f0b1b963James Dong
43730c1bc742181ded4930842b46e9507372f0b1b963James Dong
43740c1bc742181ded4930842b46e9507372f0b1b963James Dong#ifdef __cplusplus
43750c1bc742181ded4930842b46e9507372f0b1b963James Dong}
43760c1bc742181ded4930842b46e9507372f0b1b963James Dong#endif
43770c1bc742181ded4930842b46e9507372f0b1b963James Dong
43780c1bc742181ded4930842b46e9507372f0b1b963James Dong#endif /** end of #define _OMXVC_H_ */
43790c1bc742181ded4930842b46e9507372f0b1b963James Dong
43800c1bc742181ded4930842b46e9507372f0b1b963James Dong/** EOF */
43810c1bc742181ded4930842b46e9507372f0b1b963James Dong
4382