1/** 2 * File: omxVC.h 3 * Brief: OpenMAX DL v1.0.2 - Video Coding library 4 * 5 * Copyright � 2005-2008 The Khronos Group Inc. All Rights Reserved. 6 * 7 * These materials are protected by copyright laws and contain material 8 * proprietary to the Khronos Group, Inc. You may use these materials 9 * for implementing Khronos specifications, without altering or removing 10 * any trademark, copyright or other notice from the specification. 11 * 12 * Khronos Group makes no, and expressly disclaims any, representations 13 * or warranties, express or implied, regarding these materials, including, 14 * without limitation, any implied warranties of merchantability or fitness 15 * for a particular purpose or non-infringement of any intellectual property. 16 * Khronos Group makes no, and expressly disclaims any, warranties, express 17 * or implied, regarding the correctness, accuracy, completeness, timeliness, 18 * and reliability of these materials. 19 * 20 * Under no circumstances will the Khronos Group, or any of its Promoters, 21 * Contributors or Members or their respective partners, officers, directors, 22 * employees, agents or representatives be liable for any damages, whether 23 * direct, indirect, special or consequential damages for lost revenues, 24 * lost profits, or otherwise, arising from or in connection with these 25 * materials. 26 * 27 * Khronos and OpenMAX are trademarks of the Khronos Group Inc. 28 * 29 */ 30 31/* *****************************************************************************************/ 32 33#ifndef _OMXVC_H_ 34#define _OMXVC_H_ 35 36#include "omxtypes.h" 37 38#ifdef __cplusplus 39extern "C" { 40#endif 41 42 43/* 6.1.1.1 Motion Vectors */ 44/* In omxVC, motion vectors are represented as follows: */ 45 46typedef struct { 47 OMX_S16 dx; 48 OMX_S16 dy; 49} OMXVCMotionVector; 50 51 52 53/** 54 * Function: omxVCCOMM_Average_8x (6.1.3.1.1) 55 * 56 * Description: 57 * This function calculates the average of two 8x4, 8x8, or 8x16 blocks. The 58 * result is rounded according to (a+b+1)/2. The block average function can 59 * be used in conjunction with half-pixel interpolation to obtain quarter 60 * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1. 61 * 62 * Input Arguments: 63 * 64 * pPred0 - Pointer to the top-left corner of reference block 0 65 * pPred1 - Pointer to the top-left corner of reference block 1 66 * iPredStep0 - Step of reference block 0 67 * iPredStep1 - Step of reference block 1 68 * iDstStep - Step of the destination buffer. 69 * iHeight - Height of the blocks 70 * 71 * Output Arguments: 72 * 73 * pDstPred - Pointer to the destination buffer. 8-byte aligned. 74 * 75 * Return Value: 76 * 77 * OMX_Sts_NoErr - no error 78 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 79 * conditions: 80 * - one or more of the following pointers is NULL: pPred0, pPred1, or 81 * pDstPred. 82 * - pDstPred is not aligned on an 8-byte boundary. 83 * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 8. 84 * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 8. 85 * - iDstStep <= 0 or iDstStep is not a multiple of 8. 86 * - iHeight is not 4, 8, or 16. 87 * 88 */ 89OMXResult omxVCCOMM_Average_8x ( 90 const OMX_U8 *pPred0, 91 const OMX_U8 *pPred1, 92 OMX_U32 iPredStep0, 93 OMX_U32 iPredStep1, 94 OMX_U8 *pDstPred, 95 OMX_U32 iDstStep, 96 OMX_U32 iHeight 97); 98 99 100 101/** 102 * Function: omxVCCOMM_Average_16x (6.1.3.1.2) 103 * 104 * Description: 105 * This function calculates the average of two 16x16 or 16x8 blocks. The 106 * result is rounded according to (a+b+1)/2. The block average function can 107 * be used in conjunction with half-pixel interpolation to obtain quarter 108 * pixel motion estimates, as described in [ISO14496-10], subclause 8.4.2.2.1. 109 * 110 * Input Arguments: 111 * 112 * pPred0 - Pointer to the top-left corner of reference block 0 113 * pPred1 - Pointer to the top-left corner of reference block 1 114 * iPredStep0 - Step of reference block 0 115 * iPredStep1 - Step of reference block 1 116 * iDstStep - Step of the destination buffer 117 * iHeight - Height of the blocks 118 * 119 * Output Arguments: 120 * 121 * pDstPred - Pointer to the destination buffer. 16-byte aligned. 122 * 123 * Return Value: 124 * 125 * OMX_Sts_NoErr - no error 126 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 127 * conditions: 128 * - one or more of the following pointers is NULL: pPred0, pPred1, or 129 * pDstPred. 130 * - pDstPred is not aligned on a 16-byte boundary. 131 * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 16. 132 * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 16. 133 * - iDstStep <= 0 or iDstStep is not a multiple of 16. 134 * - iHeight is not 8 or 16. 135 * 136 */ 137OMXResult omxVCCOMM_Average_16x ( 138 const OMX_U8 *pPred0, 139 const OMX_U8 *pPred1, 140 OMX_U32 iPredStep0, 141 OMX_U32 iPredStep1, 142 OMX_U8 *pDstPred, 143 OMX_U32 iDstStep, 144 OMX_U32 iHeight 145); 146 147 148 149/** 150 * Function: omxVCCOMM_ExpandFrame_I (6.1.3.2.1) 151 * 152 * Description: 153 * This function expands a reconstructed frame in-place. The unexpanded 154 * source frame should be stored in a plane buffer with sufficient space 155 * pre-allocated for edge expansion, and the input frame should be located in 156 * the plane buffer center. This function executes the pixel expansion by 157 * replicating source frame edge pixel intensities in the empty pixel 158 * locations (expansion region) between the source frame edge and the plane 159 * buffer edge. The width/height of the expansion regions on the 160 * horizontal/vertical edges is controlled by the parameter iExpandPels. 161 * 162 * Input Arguments: 163 * 164 * pSrcDstPlane - pointer to the top-left corner of the frame to be 165 * expanded; must be aligned on an 8-byte boundary. 166 * iFrameWidth - frame width; must be a multiple of 8. 167 * iFrameHeight -frame height; must be a multiple of 8. 168 * iExpandPels - number of pixels to be expanded in the horizontal and 169 * vertical directions; must be a multiple of 8. 170 * iPlaneStep - distance, in bytes, between the start of consecutive lines 171 * in the plane buffer; must be larger than or equal to 172 * (iFrameWidth + 2 * iExpandPels). 173 * 174 * Output Arguments: 175 * 176 * pSrcDstPlane -Pointer to the top-left corner of the frame (NOT the 177 * top-left corner of the plane); must be aligned on an 8-byte 178 * boundary. 179 * 180 * Return Value: 181 * 182 * OMX_Sts_NoErr - no error 183 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 184 * conditions: 185 * - pSrcDstPlane is NULL. 186 * - pSrcDstPlane is not aligned on an 8-byte boundary. 187 * - one of the following parameters is either equal to zero or is a 188 * non-multiple of 8: iFrameHeight, iFrameWidth, iPlaneStep, or 189 * iExpandPels. 190 * - iPlaneStep < (iFrameWidth + 2 * iExpandPels). 191 * 192 */ 193OMXResult omxVCCOMM_ExpandFrame_I ( 194 OMX_U8 *pSrcDstPlane, 195 OMX_U32 iFrameWidth, 196 OMX_U32 iFrameHeight, 197 OMX_U32 iExpandPels, 198 OMX_U32 iPlaneStep 199); 200 201 202 203/** 204 * Function: omxVCCOMM_Copy8x8 (6.1.3.3.1) 205 * 206 * Description: 207 * Copies the reference 8x8 block to the current block. 208 * 209 * Input Arguments: 210 * 211 * pSrc - pointer to the reference block in the source frame; must be 212 * aligned on an 8-byte boundary. 213 * step - distance between the starts of consecutive lines in the reference 214 * frame, in bytes; must be a multiple of 8 and must be larger than 215 * or equal to 8. 216 * 217 * Output Arguments: 218 * 219 * pDst - pointer to the destination block; must be aligned on an 8-byte 220 * boundary. 221 * 222 * Return Value: 223 * 224 * OMX_Sts_NoErr - no error 225 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 226 * conditions: 227 * - one or more of the following pointers is NULL: pSrc, pDst 228 * - one or more of the following pointers is not aligned on an 8-byte 229 * boundary: pSrc, pDst 230 * - step <8 or step is not a multiple of 8. 231 * 232 */ 233OMXResult omxVCCOMM_Copy8x8 ( 234 const OMX_U8 *pSrc, 235 OMX_U8 *pDst, 236 OMX_INT step 237); 238 239 240 241/** 242 * Function: omxVCCOMM_Copy16x16 (6.1.3.3.2) 243 * 244 * Description: 245 * Copies the reference 16x16 macroblock to the current macroblock. 246 * 247 * Input Arguments: 248 * 249 * pSrc - pointer to the reference macroblock in the source frame; must be 250 * aligned on a 16-byte boundary. 251 * step - distance between the starts of consecutive lines in the reference 252 * frame, in bytes; must be a multiple of 16 and must be larger 253 * than or equal to 16. 254 * 255 * Output Arguments: 256 * 257 * pDst - pointer to the destination macroblock; must be aligned on a 258 * 16-byte boundary. 259 * 260 * Return Value: 261 * 262 * OMX_Sts_NoErr - no error 263 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 264 * conditions: 265 * - one or more of the following pointers is NULL: pSrc, pDst 266 * - one or more of the following pointers is not aligned on a 16-byte 267 * boundary: pSrc, pDst 268 * - step <16 or step is not a multiple of 16. 269 * 270 */ 271OMXResult omxVCCOMM_Copy16x16 ( 272 const OMX_U8 *pSrc, 273 OMX_U8 *pDst, 274 OMX_INT step 275); 276 277 278 279/** 280 * Function: omxVCCOMM_ComputeTextureErrorBlock_SAD (6.1.4.1.1) 281 * 282 * Description: 283 * Computes texture error of the block; also returns SAD. 284 * 285 * Input Arguments: 286 * 287 * pSrc - pointer to the source plane; must be aligned on an 8-byte 288 * boundary. 289 * srcStep - step of the source plane 290 * pSrcRef - pointer to the reference buffer, an 8x8 block; must be aligned 291 * on an 8-byte boundary. 292 * 293 * Output Arguments: 294 * 295 * pDst - pointer to the destination buffer, an 8x8 block; must be aligned 296 * on an 8-byte boundary. 297 * pDstSAD - pointer to the Sum of Absolute Differences (SAD) value 298 * 299 * Return Value: 300 * 301 * OMX_Sts_NoErr - no error 302 * OMX_Sts_BadArgErr - bad arguments 303 * - At least one of the following 304 * pointers is NULL: pSrc, pSrcRef, pDst and pDstSAD. 305 * - pSrc is not 8-byte aligned. 306 * - SrcStep <= 0 or srcStep is not a multiple of 8. 307 * - pSrcRef is not 8-byte aligned. 308 * - pDst is not 8-byte aligned. 309 * 310 */ 311OMXResult omxVCCOMM_ComputeTextureErrorBlock_SAD ( 312 const OMX_U8 *pSrc, 313 OMX_INT srcStep, 314 const OMX_U8 *pSrcRef, 315 OMX_S16 *pDst, 316 OMX_INT *pDstSAD 317); 318 319 320 321/** 322 * Function: omxVCCOMM_ComputeTextureErrorBlock (6.1.4.1.2) 323 * 324 * Description: 325 * Computes the texture error of the block. 326 * 327 * Input Arguments: 328 * 329 * pSrc - pointer to the source plane. This should be aligned on an 8-byte 330 * boundary. 331 * srcStep - step of the source plane 332 * pSrcRef - pointer to the reference buffer, an 8x8 block. This should be 333 * aligned on an 8-byte boundary. 334 * 335 * Output Arguments: 336 * 337 * pDst - pointer to the destination buffer, an 8x8 block. This should be 338 * aligned on an 8-byte boundary. 339 * 340 * Return Value: 341 * 342 * OMX_Sts_NoErr - no error 343 * OMX_Sts_BadArgErr - bad arguments: 344 * - At least one of the following pointers is NULL: 345 * pSrc, pSrcRef, pDst. 346 * - pSrc is not 8-byte aligned. 347 * - SrcStep <= 0 or srcStep is not a multiple of 8. 348 * - pSrcRef is not 8-byte aligned. 349 * - pDst is not 8-byte aligned 350 * 351 */ 352OMXResult omxVCCOMM_ComputeTextureErrorBlock ( 353 const OMX_U8 *pSrc, 354 OMX_INT srcStep, 355 const OMX_U8 *pSrcRef, 356 OMX_S16 *pDst 357); 358 359 360 361/** 362 * Function: omxVCCOMM_LimitMVToRect (6.1.4.1.3) 363 * 364 * Description: 365 * Limits the motion vector associated with the current block/macroblock to 366 * prevent the motion compensated block/macroblock from moving outside a 367 * bounding rectangle as shown in Figure 6-1. 368 * 369 * Input Arguments: 370 * 371 * pSrcMV - pointer to the motion vector associated with the current block 372 * or macroblock 373 * pRectVOPRef - pointer to the bounding rectangle 374 * Xcoord, Ycoord - coordinates of the current block or macroblock 375 * size - size of the current block or macroblock; must be equal to 8 or 376 * 16. 377 * 378 * Output Arguments: 379 * 380 * pDstMV - pointer to the limited motion vector 381 * 382 * Return Value: 383 * 384 * OMX_Sts_NoErr - no error 385 * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the 386 * following conditions is true: 387 * - at least one of the following pointers is NULL: 388 * pSrcMV, pDstMV, or pRectVOPRef. 389 * - size is not equal to either 8 or 16. 390 * - the width or height of the bounding rectangle is less than 391 * twice the block size. 392 */ 393OMXResult omxVCCOMM_LimitMVToRect ( 394 const OMXVCMotionVector *pSrcMV, 395 OMXVCMotionVector *pDstMV, 396 const OMXRect *pRectVOPRef, 397 OMX_INT Xcoord, 398 OMX_INT Ycoord, 399 OMX_INT size 400); 401 402 403 404/** 405 * Function: omxVCCOMM_SAD_16x (6.1.4.1.4) 406 * 407 * Description: 408 * This function calculates the SAD for 16x16 and 16x8 blocks. 409 * 410 * Input Arguments: 411 * 412 * pSrcOrg - Pointer to the original block; must be aligned on a 16-byte 413 * boundary. 414 * iStepOrg - Step of the original block buffer 415 * pSrcRef - Pointer to the reference block 416 * iStepRef - Step of the reference block buffer 417 * iHeight - Height of the block 418 * 419 * Output Arguments: 420 * 421 * pDstSAD - Pointer of result SAD 422 * 423 * Return Value: 424 * 425 * OMX_Sts_NoErr - no error 426 * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the 427 * following conditions is true: 428 * - at least one of the following pointers is NULL: 429 * pSrcOrg, pDstSAD, or pSrcRef 430 * - pSrcOrg is not 16-byte aligned. 431 * - iStepOrg <= 0 or iStepOrg is not a multiple of 16 432 * - iStepRef <= 0 or iStepRef is not a multiple of 16 433 * - iHeight is not 8 or 16 434 * 435 */ 436OMXResult omxVCCOMM_SAD_16x ( 437 const OMX_U8 *pSrcOrg, 438 OMX_U32 iStepOrg, 439 const OMX_U8 *pSrcRef, 440 OMX_U32 iStepRef, 441 OMX_S32 *pDstSAD, 442 OMX_U32 iHeight 443); 444 445 446 447/** 448 * Function: omxVCCOMM_SAD_8x (6.1.4.1.5) 449 * 450 * Description: 451 * This function calculates the SAD for 8x16, 8x8, 8x4 blocks. 452 * 453 * Input Arguments: 454 * 455 * pSrcOrg - Pointer to the original block; must be aligned on a 8-byte 456 * boundary. 457 * iStepOrg - Step of the original block buffer 458 * pSrcRef - Pointer to the reference block 459 * iStepRef - Step of the reference block buffer 460 * iHeight - Height of the block 461 * 462 * Output Arguments: 463 * 464 * pDstSAD -Pointer of result SAD 465 * 466 * Return Value: 467 * 468 * OMX_Sts_NoErr - no error 469 * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the 470 * following conditions is true: 471 * - at least one of the following pointers is NULL: 472 * pSrcOrg, pDstSAD, or pSrcRef 473 * - pSrcOrg is not 8-byte aligned. 474 * - iStepOrg <= 0 or iStepOrg is not a multiple of 8 475 * - iStepRef <= 0 or iStepRef is not a multiple of 8 476 * - iHeight is not 4, 8 or 16 477 * 478 */ 479OMXResult omxVCCOMM_SAD_8x ( 480 const OMX_U8 *pSrcOrg, 481 OMX_U32 iStepOrg, 482 const OMX_U8 *pSrcRef, 483 OMX_U32 iStepRef, 484 OMX_S32*pDstSAD, 485 OMX_U32 iHeight 486); 487 488 489 490/* 6.2.1.1 Direction */ 491/* The direction enumerator is used with functions that perform AC/DC prediction and zig-zag scan. */ 492 493enum { 494 OMX_VC_NONE = 0, 495 OMX_VC_HORIZONTAL = 1, 496 OMX_VC_VERTICAL = 2 497}; 498 499 500 501/* 6.2.1.2 Bilinear Interpolation */ 502/* The bilinear interpolation enumerator is used with motion estimation, motion compensation, and reconstruction functions. */ 503 504enum { 505 OMX_VC_INTEGER_PIXEL = 0, /* case a */ 506 OMX_VC_HALF_PIXEL_X = 1, /* case b */ 507 OMX_VC_HALF_PIXEL_Y = 2, /* case c */ 508 OMX_VC_HALF_PIXEL_XY = 3 /* case d */ 509}; 510 511 512 513/* 6.2.1.3 Neighboring Macroblock Availability */ 514/* Neighboring macroblock availability is indicated using the following flags: */ 515 516enum { 517 OMX_VC_UPPER = 1, /** above macroblock is available */ 518 OMX_VC_LEFT = 2, /** left macroblock is available */ 519 OMX_VC_CENTER = 4, 520 OMX_VC_RIGHT = 8, 521 OMX_VC_LOWER = 16, 522 OMX_VC_UPPER_LEFT = 32, /** above-left macroblock is available */ 523 OMX_VC_UPPER_RIGHT = 64, /** above-right macroblock is available */ 524 OMX_VC_LOWER_LEFT = 128, 525 OMX_VC_LOWER_RIGHT = 256 526}; 527 528 529 530/* 6.2.1.4 Video Components */ 531/* A data type that enumerates video components is defined as follows: */ 532 533typedef enum { 534 OMX_VC_LUMINANCE, /** Luminance component */ 535 OMX_VC_CHROMINANCE /** chrominance component */ 536} OMXVCM4P2VideoComponent; 537 538 539 540/* 6.2.1.5 MacroblockTypes */ 541/* A data type that enumerates macroblock types is defined as follows: */ 542 543typedef enum { 544 OMX_VC_INTER = 0, /** P picture or P-VOP */ 545 OMX_VC_INTER_Q = 1, /** P picture or P-VOP */ 546 OMX_VC_INTER4V = 2, /** P picture or P-VOP */ 547 OMX_VC_INTRA = 3, /** I and P picture, I- and P-VOP */ 548 OMX_VC_INTRA_Q = 4, /** I and P picture, I- and P-VOP */ 549 OMX_VC_INTER4V_Q = 5 /** P picture or P-VOP (H.263)*/ 550} OMXVCM4P2MacroblockType; 551 552 553 554/* 6.2.1.6 Coordinates */ 555/* Coordinates are represented as follows: */ 556 557typedef struct { 558 OMX_INT x; 559 OMX_INT y; 560} OMXVCM4P2Coordinate; 561 562 563 564/* 6.2.1.7 Motion Estimation Algorithms */ 565/* A data type that enumerates motion estimation search methods is defined as follows: */ 566 567typedef enum { 568 OMX_VC_M4P2_FAST_SEARCH = 0, /** Fast motion search */ 569 OMX_VC_M4P2_FULL_SEARCH = 1 /** Full motion search */ 570} OMXVCM4P2MEMode; 571 572 573 574/* 6.2.1.8 Motion Estimation Parameters */ 575/* A data structure containing control parameters for 576 * motion estimation functions is defined as follows: 577 */ 578 579typedef struct { 580 OMX_INT searchEnable8x8; /** enables 8x8 search */ 581 OMX_INT halfPelSearchEnable; /** enables half-pel resolution */ 582 OMX_INT searchRange; /** search range */ 583 OMX_INT rndVal; /** rounding control; 0-disabled, 1-enabled*/ 584} OMXVCM4P2MEParams; 585 586 587 588/* 6.2.1.9 Macroblock Information */ 589/* A data structure containing macroblock parameters for 590 * motion estimation functions is defined as follows: 591 */ 592 593typedef struct { 594 OMX_S32 sliceId; /* slice number */ 595 OMXVCM4P2MacroblockType mbType; /* MB type: OMX_VC_INTRA, OMX_VC_INTER, or OMX_VC_INTER4 */ 596 OMX_S32 qp; /* quantization parameter*/ 597 OMX_U32 cbpy; /* CBP Luma */ 598 OMX_U32 cbpc; /* CBP Chroma */ 599 OMXVCMotionVector pMV0[2][2]; /* motion vector, represented using 1/2-pel units, 600 * pMV0[blocky][blockx] (blocky = 0~1, blockx =0~1) 601 */ 602 OMXVCMotionVector pMVPred[2][2]; /* motion vector prediction, represented using 1/2-pel units, 603 * pMVPred[blocky][blockx] (blocky = 0~1, blockx = 0~1) 604 */ 605 OMX_U8 pPredDir[2][2]; /* AC prediction direction: 606 * OMX_VC_NONE, OMX_VC_VERTICAL, OMX_VC_HORIZONTAL 607 */ 608} OMXVCM4P2MBInfo, *OMXVCM4P2MBInfoPtr; 609 610 611 612/** 613 * Function: omxVCM4P2_FindMVpred (6.2.3.1.1) 614 * 615 * Description: 616 * Predicts a motion vector for the current block using the procedure 617 * specified in [ISO14496-2], subclause 7.6.5. The resulting predicted MV is 618 * returned in pDstMVPred. If the parameter pDstMVPredME if is not NULL then 619 * the set of three MV candidates used for prediction is also returned, 620 * otherwise pDstMVPredMEis NULL upon return. 621 * 622 * Input Arguments: 623 * 624 * pSrcMVCurMB - pointer to the MV buffer associated with the current Y 625 * macroblock; a value of NULL indicates unavailability. 626 * pSrcCandMV1 - pointer to the MV buffer containing the 4 MVs associated 627 * with the MB located to the left of the current MB; set to NULL 628 * if there is no MB to the left. 629 * pSrcCandMV2 - pointer to the MV buffer containing the 4 MVs associated 630 * with the MB located above the current MB; set to NULL if there 631 * is no MB located above the current MB. 632 * pSrcCandMV3 - pointer to the MV buffer containing the 4 MVs associated 633 * with the MB located to the right and above the current MB; set 634 * to NULL if there is no MB located to the above-right. 635 * iBlk - the index of block in the current macroblock 636 * pDstMVPredME - MV candidate return buffer; if set to NULL then 637 * prediction candidate MVs are not returned and pDstMVPredME will 638 * be NULL upon function return; if pDstMVPredME is non-NULL then it 639 * must point to a buffer containing sufficient space for three 640 * return MVs. 641 * 642 * Output Arguments: 643 * 644 * pDstMVPred - pointer to the predicted motion vector 645 * pDstMVPredME - if non-NULL upon input then pDstMVPredME points upon 646 * return to a buffer containing the three motion vector candidates 647 * used for prediction as specified in [ISO14496-2], subclause 648 * 7.6.5, otherwise if NULL upon input then pDstMVPredME is NULL 649 * upon output. 650 * 651 * Return Value: 652 * 653 * OMX_Sts_NoErr - no error 654 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 655 * conditions: 656 * - the pointer pDstMVPred is NULL 657 * - the parameter iBlk does not fall into the range 0 <= iBlk<=3 658 * 659 */ 660OMXResult omxVCM4P2_FindMVpred ( 661 const OMXVCMotionVector *pSrcMVCurMB, 662 const OMXVCMotionVector *pSrcCandMV1, 663 const OMXVCMotionVector *pSrcCandMV2, 664 const OMXVCMotionVector *pSrcCandMV3, 665 OMXVCMotionVector *pDstMVPred, 666 OMXVCMotionVector *pDstMVPredME, 667 OMX_INT iBlk 668); 669 670 671 672/** 673 * Function: omxVCM4P2_IDCT8x8blk (6.2.3.2.1) 674 * 675 * Description: 676 * Computes a 2D inverse DCT for a single 8x8 block, as defined in 677 * [ISO14496-2]. 678 * 679 * Input Arguments: 680 * 681 * pSrc - pointer to the start of the linearly arranged IDCT input buffer; 682 * must be aligned on a 16-byte boundary. According to 683 * [ISO14496-2], the input coefficient values should lie within the 684 * range [-2048, 2047]. 685 * 686 * Output Arguments: 687 * 688 * pDst - pointer to the start of the linearly arranged IDCT output buffer; 689 * must be aligned on a 16-byte boundary. 690 * 691 * Return Value: 692 * 693 * OMX_Sts_NoErr - no error 694 * OMX_Sts_BadArgErr - bad arguments: 695 * - pSrc or pDst is NULL. 696 * - pSrc or pDst is not 16-byte aligned. 697 * 698 */ 699OMXResult omxVCM4P2_IDCT8x8blk ( 700 const OMX_S16 *pSrc, 701 OMX_S16 *pDst 702); 703 704 705 706/** 707 * Function: omxVCM4P2_MEGetBufSize (6.2.4.1.1) 708 * 709 * Description: 710 * Computes the size, in bytes, of the vendor-specific specification 711 * structure for the following motion estimation functions: 712 * BlockMatch_Integer_8x8, BlockMatch_Integer_16x16, and MotionEstimationMB. 713 * 714 * Input Arguments: 715 * 716 * MEmode - motion estimation mode; available modes are defined by the 717 * enumerated type OMXVCM4P2MEMode 718 * pMEParams - motion estimation parameters 719 * 720 * Output Arguments: 721 * 722 * pSize - pointer to the number of bytes required for the specification 723 * structure 724 * 725 * Return Value: 726 * 727 * OMX_Sts_NoErr - no error 728 * OMX_Sts_BadArgErr - one or more of the following is true: 729 * - an invalid value was specified for the parameter MEmode 730 * - a negative or zero value was specified for the 731 * parameter pMEParams->searchRange 732 * 733 */ 734OMXResult omxVCM4P2_MEGetBufSize ( 735 OMXVCM4P2MEMode MEmode, 736 const OMXVCM4P2MEParams *pMEParams, 737 OMX_U32 *pSize 738); 739 740 741 742/** 743 * Function: omxVCM4P2_MEInit (6.2.4.1.2) 744 * 745 * Description: 746 * Initializes the vendor-specific specification structure required for the 747 * following motion estimation functions: BlockMatch_Integer_8x8, 748 * BlockMatch_Integer_16x16, and MotionEstimationMB. Memory for the 749 * specification structure *pMESpec must be allocated prior to calling the 750 * function, and should be aligned on a 4-byte boundary. Following 751 * initialization by this function, the vendor-specific structure *pMESpec 752 * should contain an implementation-specific representation of all motion 753 * estimation parameters received via the structure pMEParams, for example 754 * rndVal, searchRange, etc. The number of bytes required for the 755 * specification structure can be determined using the function 756 * omxVCM4P2_MEGetBufSize. 757 * 758 * Input Arguments: 759 * 760 * MEmode - motion estimation mode; available modes are defined by the 761 * enumerated type OMXVCM4P2MEMode 762 * pMEParams - motion estimation parameters 763 * pMESpec - pointer to the uninitialized ME specification structure 764 * 765 * Output Arguments: 766 * 767 * pMESpec - pointer to the initialized ME specification structure 768 * 769 * Return Value: 770 * 771 * OMX_Sts_NoErr - no error 772 * OMX_Sts_BadArgErr - one or more of the following is true: 773 * - an invalid value was specified for the parameter MEmode 774 * - a negative or zero value was specified for the 775 * parameter pMEParams->searchRange 776 * 777 */ 778OMXResult omxVCM4P2_MEInit ( 779 OMXVCM4P2MEMode MEmode, 780 const OMXVCM4P2MEParams*pMEParams, 781 void *pMESpec 782); 783 784 785 786/** 787 * Function: omxVCM4P2_BlockMatch_Integer_16x16 (6.2.4.2.1) 788 * 789 * Description: 790 * Performs a 16x16 block search; estimates motion vector and associated 791 * minimum SAD. Both the input and output motion vectors are represented using 792 * half-pixel units, and therefore a shift left or right by 1 bit may be 793 * required, respectively, to match the input or output MVs with other 794 * functions that either generate output MVs or expect input MVs represented 795 * using integer pixel units. 796 * 797 * Input Arguments: 798 * 799 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 800 * MB that corresponds to the location of the current macroblock in 801 * the current plane. 802 * refWidth - width of the reference plane 803 * pRefRect - pointer to the valid reference plane rectangle; coordinates 804 * are specified relative to the image origin. Rectangle 805 * boundaries may extend beyond image boundaries if the image has 806 * been padded. For example, if padding extends 4 pixels beyond 807 * frame border, then the value for the left border could be set to 808 * -4. 809 * pSrcCurrBuf - pointer to the current block in the current macroblock 810 * buffer extracted from the original plane (linear array, 256 811 * entries); must be aligned on a 16-byte boundary. The number of 812 * bytes between lines (step) is 16. 813 * pCurrPointPos - position of the current macroblock in the current plane 814 * pSrcPreMV - pointer to predicted motion vector; NULL indicates no 815 * predicted MV 816 * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 817 * by pSrcPreMV); may be set to NULL if unavailable. 818 * pMESpec - vendor-specific motion estimation specification structure; 819 * must have been allocated and then initialized using 820 * omxVCM4P2_MEInit prior to calling the block matching function. 821 * 822 * Output Arguments: 823 * 824 * pDstMV - pointer to estimated MV 825 * pDstSAD - pointer to minimum SAD 826 * 827 * Return Value: 828 * 829 * OMX_Sts_NoErr - no error 830 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 831 * conditions is true: 832 * - at least one of the following pointers is NULL: pSrcRefBuf, 833 * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 834 * pMESpec, or 835 * - pSrcCurrBuf is not 16-byte aligned 836 * 837 */ 838OMXResult omxVCM4P2_BlockMatch_Integer_16x16 ( 839 const OMX_U8 *pSrcRefBuf, 840 OMX_INT refWidth, 841 const OMXRect *pRefRect, 842 const OMX_U8 *pSrcCurrBuf, 843 const OMXVCM4P2Coordinate *pCurrPointPos, 844 const OMXVCMotionVector*pSrcPreMV, 845 const OMX_INT *pSrcPreSAD, 846 void *pMESpec, 847 OMXVCMotionVector*pDstMV, 848 OMX_INT *pDstSAD 849); 850 851 852 853/** 854 * Function: omxVCM4P2_BlockMatch_Integer_8x8 (6.2.4.2.2) 855 * 856 * Description: 857 * Performs an 8x8 block search; estimates motion vector and associated 858 * minimum SAD. Both the input and output motion vectors are represented 859 * using half-pixel units, and therefore a shift left or right by 1 bit may be 860 * required, respectively, to match the input or output MVs with other 861 * functions that either generate output MVs or expect input MVs represented 862 * using integer pixel units. 863 * 864 * Input Arguments: 865 * 866 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 867 * block that corresponds to the location of the current 8x8 block 868 * in the current plane. 869 * refWidth - width of the reference plane 870 * pRefRect - pointer to the valid reference plane rectangle; coordinates 871 * are specified relative to the image origin. Rectangle 872 * boundaries may extend beyond image boundaries if the image has 873 * been padded. 874 * pSrcCurrBuf - pointer to the current block in the current macroblock 875 * buffer extracted from the original plane (linear array, 128 876 * entries); must be aligned on an 8-byte boundary. The number of 877 * bytes between lines (step) is 16 bytes. 878 * pCurrPointPos - position of the current block in the current plane 879 * pSrcPreMV - pointer to predicted motion vector; NULL indicates no 880 * predicted MV 881 * pSrcPreSAD - pointer to SAD associated with the predicted MV (referenced 882 * by pSrcPreMV); may be set to NULL if unavailable. 883 * pMESpec - vendor-specific motion estimation specification structure; 884 * must have been allocated and then initialized using 885 * omxVCM4P2_MEInit prior to calling the block matching function. 886 * 887 * Output Arguments: 888 * 889 * pDstMV - pointer to estimated MV 890 * pDstSAD - pointer to minimum SAD 891 * 892 * Return Value: 893 * 894 * OMX_Sts_NoErr - no error 895 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 896 * conditions is true: 897 * - at least one of the following pointers is NULL: pSrcRefBuf, 898 * pRefRect, pSrcCurrBuff, pCurrPointPos, pDstMV, pDstSAD or 899 * pMESpec, or 900 * - pSrcCurrBuf is not 8-byte aligned 901 * 902 */ 903OMXResult omxVCM4P2_BlockMatch_Integer_8x8 ( 904 const OMX_U8 *pSrcRefBuf, 905 OMX_INT refWidth, 906 const OMXRect *pRefRect, 907 const OMX_U8 *pSrcCurrBuf, 908 const OMXVCM4P2Coordinate *pCurrPointPos, 909 const OMXVCMotionVector *pSrcPreMV, 910 const OMX_INT *pSrcPreSAD, 911 void *pMESpec, 912 OMXVCMotionVector *pDstMV, 913 OMX_INT *pDstSAD 914); 915 916 917 918/** 919 * Function: omxVCM4P2_BlockMatch_Half_16x16 (6.2.4.2.3) 920 * 921 * Description: 922 * Performs a 16x16 block match with half-pixel resolution. Returns the 923 * estimated motion vector and associated minimum SAD. This function 924 * estimates the half-pixel motion vector by interpolating the integer 925 * resolution motion vector referenced by the input parameter pSrcDstMV, i.e., 926 * the initial integer MV is generated externally. The input parameters 927 * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of 928 * 16x16 integer search prior to calling BlockMatch_Half_16x16. The function 929 * BlockMatch_Integer_16x16 may be used for integer motion estimation. 930 * 931 * Input Arguments: 932 * 933 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 934 * macroblock that corresponds to the location of the current 935 * macroblock in the current plane. 936 * refWidth - width of the reference plane 937 * pRefRect - reference plane valid region rectangle 938 * pSrcCurrBuf - pointer to the current block in the current macroblock 939 * buffer extracted from the original plane (linear array, 256 940 * entries); must be aligned on a 16-byte boundary. The number of 941 * bytes between lines (step) is 16. 942 * pSearchPointRefPos - position of the starting point for half pixel 943 * search (specified in terms of integer pixel units) in the 944 * reference plane, i.e., the reference position pointed to by the 945 * predicted motion vector. 946 * rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 947 * pSrcDstMV - pointer to the initial MV estimate; typically generated 948 * during a prior 16X16 integer search; specified in terms of 949 * half-pixel units. 950 * 951 * Output Arguments: 952 * 953 * pSrcDstMV - pointer to estimated MV 954 * pDstSAD - pointer to minimum SAD 955 * 956 * Return Value: 957 * 958 * OMX_Sts_NoErr - no error 959 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 960 * conditions is true: 961 * - at least one of the following pointers is NULL: pSrcRefBuf, 962 * pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV. 963 * - pSrcCurrBuf is not 16-byte aligned, or 964 * 965 */ 966OMXResult omxVCM4P2_BlockMatch_Half_16x16 ( 967 const OMX_U8 *pSrcRefBuf, 968 OMX_INT refWidth, 969 const OMXRect *pRefRect, 970 const OMX_U8 *pSrcCurrBuf, 971 const OMXVCM4P2Coordinate *pSearchPointRefPos, 972 OMX_INT rndVal, 973 OMXVCMotionVector *pSrcDstMV, 974 OMX_INT *pDstSAD 975); 976 977 978 979/** 980 * Function: omxVCM4P2_BlockMatch_Half_8x8 (6.2.4.2.4) 981 * 982 * Description: 983 * Performs an 8x8 block match with half-pixel resolution. Returns the 984 * estimated motion vector and associated minimum SAD. This function 985 * estimates the half-pixel motion vector by interpolating the integer 986 * resolution motion vector referenced by the input parameter pSrcDstMV, i.e., 987 * the initial integer MV is generated externally. The input parameters 988 * pSrcRefBuf and pSearchPointRefPos should be shifted by the winning MV of 989 * 8x8 integer search prior to calling BlockMatch_Half_8x8. The function 990 * BlockMatch_Integer_8x8 may be used for integer motion estimation. 991 * 992 * Input Arguments: 993 * 994 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 995 * block that corresponds to the location of the current 8x8 block 996 * in the current plane. 997 * refWidth - width of the reference plane 998 * pRefRect - reference plane valid region rectangle 999 * pSrcCurrBuf - pointer to the current block in the current macroblock 1000 * buffer extracted from the original plane (linear array, 128 1001 * entries); must be aligned on a 8-byte boundary. The number of 1002 * bytes between lines (step) is 16. 1003 * pSearchPointRefPos - position of the starting point for half pixel 1004 * search (specified in terms of integer pixel units) in the 1005 * reference plane. 1006 * rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 1007 * pSrcDstMV - pointer to the initial MV estimate; typically generated 1008 * during a prior 8x8 integer search, specified in terms of 1009 * half-pixel units. 1010 * 1011 * Output Arguments: 1012 * 1013 * pSrcDstMV - pointer to estimated MV 1014 * pDstSAD - pointer to minimum SAD 1015 * 1016 * Return Value: 1017 * 1018 * OMX_Sts_NoErr - no error 1019 * OMX_Sts_BadArgErr - bad arguments. Returned if one of the following 1020 * conditions is true: 1021 * - at least one of the following pointers is NULL: 1022 * pSrcRefBuf, pRefRect, pSrcCurrBuff, pSearchPointRefPos, pSrcDstMV 1023 * - pSrcCurrBuf is not 8-byte aligned 1024 * 1025 */ 1026OMXResult omxVCM4P2_BlockMatch_Half_8x8 ( 1027 const OMX_U8 *pSrcRefBuf, 1028 OMX_INT refWidth, 1029 const OMXRect *pRefRect, 1030 const OMX_U8 *pSrcCurrBuf, 1031 const OMXVCM4P2Coordinate *pSearchPointRefPos, 1032 OMX_INT rndVal, 1033 OMXVCMotionVector *pSrcDstMV, 1034 OMX_INT *pDstSAD 1035); 1036 1037 1038 1039/** 1040 * Function: omxVCM4P2_MotionEstimationMB (6.2.4.3.1) 1041 * 1042 * Description: 1043 * Performs motion search for a 16x16 macroblock. Selects best motion search 1044 * strategy from among inter-1MV, inter-4MV, and intra modes. Supports 1045 * integer and half pixel resolution. 1046 * 1047 * Input Arguments: 1048 * 1049 * pSrcCurrBuf - pointer to the top-left corner of the current MB in the 1050 * original picture plane; must be aligned on a 16-byte boundary. 1051 * The function does not expect source data outside the region 1052 * bounded by the MB to be available; for example it is not 1053 * necessary for the caller to guarantee the availability of 1054 * pSrcCurrBuf[-SrcCurrStep], i.e., the row of pixels above the MB 1055 * to be processed. 1056 * srcCurrStep - width of the original picture plane, in terms of full 1057 * pixels; must be a multiple of 16. 1058 * pSrcRefBuf - pointer to the reference Y plane; points to the reference 1059 * plane location corresponding to the location of the current 1060 * macroblock in the current plane; must be aligned on a 16-byte 1061 * boundary. 1062 * srcRefStep - width of the reference picture plane, in terms of full 1063 * pixels; must be a multiple of 16. 1064 * pRefRect - reference plane valid region rectangle, specified relative to 1065 * the image origin 1066 * pCurrPointPos - position of the current macroblock in the current plane 1067 * pMESpec - pointer to the vendor-specific motion estimation specification 1068 * structure; must be allocated and then initialized using 1069 * omxVCM4P2_MEInit prior to calling this function. 1070 * pMBInfo - array, of dimension four, containing pointers to information 1071 * associated with four nearby MBs: 1072 * - pMBInfo[0] - pointer to left MB information 1073 * - pMBInfo[1] - pointer to top MB information 1074 * - pMBInfo[2] - pointer to top-left MB information 1075 * - pMBInfo[3] - pointer to top-right MB information 1076 * Any pointer in the array may be set equal to NULL if the 1077 * corresponding MB doesn't exist. For each MB, the following structure 1078 * members are used: 1079 * - mbType - macroblock type, either OMX_VC_INTRA, OMX_VC_INTER, or 1080 * OMX_VC_INTER4V 1081 * - pMV0[2][2] - estimated motion vectors; represented 1082 * in 1/2 pixel units 1083 * - sliceID - number of the slice to which the MB belongs 1084 * pSrcDstMBCurr - pointer to information structure for the current MB. 1085 * The following entries should be set prior to calling the 1086 * function: sliceID - the number of the slice the to which the 1087 * current MB belongs. The structure elements cbpy and cbpc are 1088 * ignored. 1089 * 1090 * Output Arguments: 1091 * 1092 * pSrcDstMBCurr - pointer to updated information structure for the current 1093 * MB after MB-level motion estimation has been completed. The 1094 * following structure members are updated by the ME function: 1095 * - mbType - macroblock type: OMX_VC_INTRA, OMX_VC_INTER, or 1096 * OMX_VC_INTER4V. 1097 * - pMV0[2][2] - estimated motion vectors; represented in 1098 * terms of 1/2 pel units. 1099 * - pMVPred[2][2] - predicted motion vectors; represented 1100 * in terms of 1/2 pel units. 1101 * The structure members cbpy and cbpc are not updated by the function. 1102 * pDstSAD - pointer to the minimum SAD for INTER1V, or sum of minimum SADs 1103 * for INTER4V 1104 * pDstBlockSAD - pointer to an array of SAD values for each of the four 1105 * 8x8 luma blocks in the MB. The block SADs are in scan order for 1106 * each MB. 1107 * 1108 * Return Value: 1109 * 1110 * OMX_Sts_NoErr - no error 1111 * OMX_Sts_BadArgErr - bad arguments. Returned if one or more of the 1112 * following conditions is true: 1113 * - at least one of the following pointers is NULL: pSrcCurrBuf, 1114 * pSrcRefBuf, pRefRect, pCurrPointPos, pMBInter, pMBIntra, 1115 * pSrcDstMBCurr, or pDstSAD. 1116 * 1117 */ 1118OMXResult omxVCM4P2_MotionEstimationMB ( 1119 const OMX_U8 *pSrcCurrBuf, 1120 OMX_S32 srcCurrStep, 1121 const OMX_U8 *pSrcRefBuf, 1122 OMX_S32 srcRefStep, 1123 const OMXRect*pRefRect, 1124 const OMXVCM4P2Coordinate *pCurrPointPos, 1125 void *pMESpec, 1126 const OMXVCM4P2MBInfoPtr *pMBInfo, 1127 OMXVCM4P2MBInfo *pSrcDstMBCurr, 1128 OMX_U16 *pDstSAD, 1129 OMX_U16 *pDstBlockSAD 1130); 1131 1132 1133 1134/** 1135 * Function: omxVCM4P2_DCT8x8blk (6.2.4.4.1) 1136 * 1137 * Description: 1138 * Computes a 2D forward DCT for a single 8x8 block, as defined in 1139 * [ISO14496-2]. 1140 * 1141 * Input Arguments: 1142 * 1143 * pSrc - pointer to the start of the linearly arranged input buffer; must 1144 * be aligned on a 16-byte boundary. Input values (pixel 1145 * intensities) are valid in the range [-255,255]. 1146 * 1147 * Output Arguments: 1148 * 1149 * pDst - pointer to the start of the linearly arranged output buffer; must 1150 * be aligned on a 16-byte boundary. 1151 * 1152 * Return Value: 1153 * 1154 * OMX_Sts_NoErr - no error 1155 * OMX_Sts_BadArgErr - bad arguments, returned if: 1156 * - pSrc or pDst is NULL. 1157 * - pSrc or pDst is not 16-byte aligned. 1158 * 1159 */ 1160OMXResult omxVCM4P2_DCT8x8blk ( 1161 const OMX_S16 *pSrc, 1162 OMX_S16 *pDst 1163); 1164 1165 1166 1167/** 1168 * Function: omxVCM4P2_QuantIntra_I (6.2.4.4.2) 1169 * 1170 * Description: 1171 * Performs quantization on intra block coefficients. This function supports 1172 * bits_per_pixel == 8. 1173 * 1174 * Input Arguments: 1175 * 1176 * pSrcDst - pointer to the input intra block coefficients; must be aligned 1177 * on a 16-byte boundary. 1178 * QP - quantization parameter (quantizer_scale). 1179 * blockIndex - block index indicating the component type and position, 1180 * valid in the range 0 to 5, as defined in [ISO14496-2], subclause 1181 * 6.1.3.8. 1182 * shortVideoHeader - binary flag indicating presence of 1183 * short_video_header; shortVideoHeader==1 selects linear intra DC 1184 * mode, and shortVideoHeader==0 selects non linear intra DC mode. 1185 * 1186 * Output Arguments: 1187 * 1188 * pSrcDst - pointer to the output (quantized) interblock coefficients. 1189 * When shortVideoHeader==1, AC coefficients are saturated on the 1190 * interval [-127, 127], and DC coefficients are saturated on the 1191 * interval [1, 254]. When shortVideoHeader==0, AC coefficients 1192 * are saturated on the interval [-2047, 2047]. 1193 * 1194 * Return Value: 1195 * 1196 * OMX_Sts_NoErr - no error 1197 * OMX_Sts_BadArgErr - bad arguments: 1198 * - pSrcDst is NULL. 1199 * - blockIndex < 0 or blockIndex >= 10 1200 * - QP <= 0 or QP >= 32. 1201 * 1202 */ 1203OMXResult omxVCM4P2_QuantIntra_I ( 1204 OMX_S16 *pSrcDst, 1205 OMX_U8 QP, 1206 OMX_INT blockIndex, 1207 OMX_INT shortVideoHeader 1208); 1209 1210 1211 1212/** 1213 * Function: omxVCM4P2_QuantInter_I (6.2.4.4.3) 1214 * 1215 * Description: 1216 * Performs quantization on an inter coefficient block; supports 1217 * bits_per_pixel == 8. 1218 * 1219 * Input Arguments: 1220 * 1221 * pSrcDst - pointer to the input inter block coefficients; must be aligned 1222 * on a 16-byte boundary. 1223 * QP - quantization parameter (quantizer_scale) 1224 * shortVideoHeader - binary flag indicating presence of short_video_header; 1225 * shortVideoHeader==1 selects linear intra DC mode, and 1226 * shortVideoHeader==0 selects non linear intra DC mode. 1227 * 1228 * Output Arguments: 1229 * 1230 * pSrcDst - pointer to the output (quantized) interblock coefficients. 1231 * When shortVideoHeader==1, AC coefficients are saturated on the 1232 * interval [-127, 127], and DC coefficients are saturated on the 1233 * interval [1, 254]. When shortVideoHeader==0, AC coefficients 1234 * are saturated on the interval [-2047, 2047]. 1235 * 1236 * Return Value: 1237 * 1238 * OMX_Sts_NoErr - no error 1239 * OMX_Sts_BadArgErr - bad arguments: 1240 * - pSrcDst is NULL. 1241 * - QP <= 0 or QP >= 32. 1242 * 1243 */ 1244OMXResult omxVCM4P2_QuantInter_I ( 1245 OMX_S16 *pSrcDst, 1246 OMX_U8 QP, 1247 OMX_INT shortVideoHeader 1248); 1249 1250 1251 1252/** 1253 * Function: omxVCM4P2_TransRecBlockCoef_intra (6.2.4.4.4) 1254 * 1255 * Description: 1256 * Quantizes the DCT coefficients, implements intra block AC/DC coefficient 1257 * prediction, and reconstructs the current intra block texture for prediction 1258 * on the next frame. Quantized row and column coefficients are returned in 1259 * the updated coefficient buffers. 1260 * 1261 * Input Arguments: 1262 * 1263 * pSrc - pointer to the pixels of current intra block; must be aligned on 1264 * an 8-byte boundary. 1265 * pPredBufRow - pointer to the coefficient row buffer containing 1266 * ((num_mb_per_row * 2 + 1) * 8) elements of type OMX_S16. 1267 * Coefficients are organized into blocks of eight as described 1268 * below (Internal Prediction Coefficient Update Procedures). The 1269 * DC coefficient is first, and the remaining buffer locations 1270 * contain the quantized AC coefficients. Each group of eight row 1271 * buffer elements combined with one element eight elements ahead 1272 * contains the coefficient predictors of the neighboring block 1273 * that is spatially above or to the left of the block currently to 1274 * be decoded. A negative-valued DC coefficient indicates that this 1275 * neighboring block is not INTRA-coded or out of bounds, and 1276 * therefore the AC and DC coefficients are invalid. Pointer must 1277 * be aligned on an 8-byte boundary. 1278 * pPredBufCol - pointer to the prediction coefficient column buffer 1279 * containing 16 elements of type OMX_S16. Coefficients are 1280 * organized as described in section 6.2.2.5. Pointer must be 1281 * aligned on an 8-byte boundary. 1282 * pSumErr - pointer to a flag indicating whether or not AC prediction is 1283 * required; AC prediction is enabled if *pSumErr >=0, but the 1284 * value is not used for coefficient prediction, i.e., the sum of 1285 * absolute differences starts from 0 for each call to this 1286 * function. Otherwise AC prediction is disabled if *pSumErr < 0 . 1287 * blockIndex - block index indicating the component type and position, as 1288 * defined in [ISO14496-2], subclause 6.1.3.8. 1289 * curQp - quantization parameter of the macroblock to which the current 1290 * block belongs 1291 * pQpBuf - pointer to a 2-element quantization parameter buffer; pQpBuf[0] 1292 * contains the quantization parameter associated with the 8x8 1293 * block left of the current block (QPa), and pQpBuf[1] contains 1294 * the quantization parameter associated with the 8x8 block above 1295 * the current block (QPc). In the event that the corresponding 1296 * block is outside of the VOP bound, the Qp value will not affect 1297 * the intra prediction process, as described in [ISO14496-2], 1298 * sub-clause 7.4.3.3, Adaptive AC Coefficient Prediction. 1299 * srcStep - width of the source buffer; must be a multiple of 8. 1300 * dstStep - width of the reconstructed destination buffer; must be a 1301 * multiple of 16. 1302 * shortVideoHeader - binary flag indicating presence of 1303 * short_video_header; shortVideoHeader==1 selects linear intra DC 1304 * mode, and shortVideoHeader==0 selects non linear intra DC mode. 1305 * 1306 * Output Arguments: 1307 * 1308 * pDst - pointer to the quantized DCT coefficient buffer; pDst[0] contains 1309 * the predicted DC coefficient; the remaining entries contain the 1310 * quantized AC coefficients (without prediction). The pointer 1311 * pDstmust be aligned on a 16-byte boundary. 1312 * pRec - pointer to the reconstructed texture; must be aligned on an 1313 * 8-byte boundary. 1314 * pPredBufRow - pointer to the updated coefficient row buffer 1315 * pPredBufCol - pointer to the updated coefficient column buffer 1316 * pPreACPredict - if prediction is enabled, the parameter points to the 1317 * start of the buffer containing the coefficient differences for 1318 * VLC encoding. The entry pPreACPredict[0]indicates prediction 1319 * direction for the current block and takes one of the following 1320 * values: OMX_VC_NONE (prediction disabled), OMX_VC_HORIZONTAL, or 1321 * OMX_VC_VERTICAL. The entries 1322 * pPreACPredict[1]-pPreACPredict[7]contain predicted AC 1323 * coefficients. If prediction is disabled (*pSumErr<0) then the 1324 * contents of this buffer are undefined upon return from the 1325 * function 1326 * pSumErr - pointer to the value of the accumulated AC coefficient errors, 1327 * i.e., sum of the absolute differences between predicted and 1328 * unpredicted AC coefficients 1329 * 1330 * Return Value: 1331 * 1332 * OMX_Sts_NoErr - no error 1333 * OMX_Sts_BadArgErr - Bad arguments: 1334 * - At least one of the following pointers is NULL: pSrc, pDst, pRec, 1335 * pCoefBufRow, pCoefBufCol, pQpBuf, pPreACPredict, pSumErr. 1336 * - blockIndex < 0 or blockIndex >= 10; 1337 * - curQP <= 0 or curQP >= 32. 1338 * - srcStep, or dstStep <= 0 or not a multiple of 8. 1339 * - pDst is not 16-byte aligned: . 1340 * - At least one of the following pointers is not 8-byte aligned: 1341 * pSrc, pRec. 1342 * 1343 * Note: The coefficient buffers must be updated in accordance with the 1344 * update procedures defined in section in 6.2.2. 1345 * 1346 */ 1347OMXResult omxVCM4P2_TransRecBlockCoef_intra ( 1348 const OMX_U8 *pSrc, 1349 OMX_S16 *pDst, 1350 OMX_U8 *pRec, 1351 OMX_S16 *pPredBufRow, 1352 OMX_S16 *pPredBufCol, 1353 OMX_S16 *pPreACPredict, 1354 OMX_INT *pSumErr, 1355 OMX_INT blockIndex, 1356 OMX_U8 curQp, 1357 const OMX_U8 *pQpBuf, 1358 OMX_INT srcStep, 1359 OMX_INT dstStep, 1360 OMX_INT shortVideoHeader 1361); 1362 1363 1364 1365/** 1366 * Function: omxVCM4P2_TransRecBlockCoef_inter (6.2.4.4.5) 1367 * 1368 * Description: 1369 * Implements DCT, and quantizes the DCT coefficients of the inter block 1370 * while reconstructing the texture residual. There is no boundary check for 1371 * the bit stream buffer. 1372 * 1373 * Input Arguments: 1374 * 1375 * pSrc -pointer to the residuals to be encoded; must be aligned on an 1376 * 16-byte boundary. 1377 * QP - quantization parameter. 1378 * shortVideoHeader - binary flag indicating presence of short_video_header; 1379 * shortVideoHeader==1 selects linear intra DC mode, and 1380 * shortVideoHeader==0 selects non linear intra DC mode. 1381 * 1382 * Output Arguments: 1383 * 1384 * pDst - pointer to the quantized DCT coefficients buffer; must be aligned 1385 * on a 16-byte boundary. 1386 * pRec - pointer to the reconstructed texture residuals; must be aligned 1387 * on a 16-byte boundary. 1388 * 1389 * Return Value: 1390 * 1391 * OMX_Sts_NoErr - no error 1392 * OMX_Sts_BadArgErr - bad arguments: 1393 * - At least one of the following pointers is either NULL or 1394 * not 16-byte aligned: 1395 * - pSrc 1396 * - pDst 1397 * - pRec 1398 * - QP <= 0 or QP >= 32. 1399 * 1400 */ 1401OMXResult omxVCM4P2_TransRecBlockCoef_inter ( 1402 const OMX_S16 *pSrc, 1403 OMX_S16 *pDst, 1404 OMX_S16 *pRec, 1405 OMX_U8 QP, 1406 OMX_INT shortVideoHeader 1407); 1408 1409 1410 1411/** 1412 * Function: omxVCM4P2_EncodeVLCZigzag_IntraDCVLC (6.2.4.5.2) 1413 * 1414 * Description: 1415 * Performs zigzag scan and VLC encoding of AC and DC coefficients for one 1416 * intra block. Two versions of the function (DCVLC and ACVLC) are provided 1417 * in order to support the two different methods of processing DC 1418 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, "Intra DC 1419 * Coefficient Decoding for the Case of Switched VLC Encoding". 1420 * 1421 * Input Arguments: 1422 * 1423 * ppBitStream - double pointer to the current byte in the bitstream 1424 * pBitOffset - pointer to the bit position in the byte pointed by 1425 * *ppBitStream. Valid within 0 to 7. 1426 * pQDctBlkCoef - pointer to the quantized DCT coefficient 1427 * predDir - AC prediction direction, which is used to decide the zigzag 1428 * scan pattern; takes one of the following values: 1429 * - OMX_VC_NONE - AC prediction not used. 1430 * Performs classical zigzag scan. 1431 * - OMX_VC_HORIZONTAL - Horizontal prediction. 1432 * Performs alternate-vertical zigzag scan. 1433 * - OMX_VC_VERTICAL - Vertical prediction. 1434 * Performs alternate-horizontal zigzag scan. 1435 * pattern - block pattern which is used to decide whether this block is 1436 * encoded 1437 * shortVideoHeader - binary flag indicating presence of 1438 * short_video_header; escape modes 0-3 are used if 1439 * shortVideoHeader==0, and escape mode 4 is used when 1440 * shortVideoHeader==1. 1441 * videoComp - video component type (luminance, chrominance) of the current 1442 * block 1443 * 1444 * Output Arguments: 1445 * 1446 * ppBitStream - *ppBitStream is updated after the block is encoded, so 1447 * that it points to the current byte in the bit stream buffer. 1448 * pBitOffset - *pBitOffset is updated so that it points to the current bit 1449 * position in the byte pointed by *ppBitStream. 1450 * 1451 * Return Value: 1452 * 1453 * OMX_Sts_NoErr - no error 1454 * OMX_Sts_BadArgErr - Bad arguments: 1455 * - At least one of the following pointers is NULL: ppBitStream, 1456 * *ppBitStream, pBitOffset, pQDctBlkCoef. 1457 * - *pBitOffset < 0, or *pBitOffset >7. 1458 * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or 1459 * OMX_VC_VERTICAL. 1460 * - VideoComp is not one component of enum OMXVCM4P2VideoComponent. 1461 * 1462 */ 1463OMXResult omxVCM4P2_EncodeVLCZigzag_IntraDCVLC ( 1464 OMX_U8 **ppBitStream, 1465 OMX_INT *pBitOffset, 1466 const OMX_S16 *pQDctBlkCoef, 1467 OMX_U8 predDir, 1468 OMX_U8 pattern, 1469 OMX_INT shortVideoHeader, 1470 OMXVCM4P2VideoComponent videoComp 1471); 1472 1473 1474 1475/** 1476 * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2) 1477 * 1478 * Description: 1479 * Performs zigzag scan and VLC encoding of AC and DC coefficients for one 1480 * intra block. Two versions of the function (DCVLC and ACVLC) are provided 1481 * in order to support the two different methods of processing DC 1482 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC 1483 * Coefficient Decoding for the Case of Switched VLC Encoding. 1484 * 1485 * Input Arguments: 1486 * 1487 * ppBitStream - double pointer to the current byte in the bitstream 1488 * pBitOffset - pointer to the bit position in the byte pointed by 1489 * *ppBitStream. Valid within 0 to 7. 1490 * pQDctBlkCoef - pointer to the quantized DCT coefficient 1491 * predDir - AC prediction direction, which is used to decide the zigzag 1492 * scan pattern; takes one of the following values: 1493 * - OMX_VC_NONE - AC prediction not used. 1494 * Performs classical zigzag scan. 1495 * - OMX_VC_HORIZONTAL - Horizontal prediction. 1496 * Performs alternate-vertical zigzag scan. 1497 * - OMX_VC_VERTICAL - Vertical prediction. 1498 * Performs alternate-horizontal zigzag scan. 1499 * pattern - block pattern which is used to decide whether this block is 1500 * encoded 1501 * shortVideoHeader - binary flag indicating presence of 1502 * short_video_header; escape modes 0-3 are used if 1503 * shortVideoHeader==0, and escape mode 4 is used when 1504 * shortVideoHeader==1. 1505 * 1506 * Output Arguments: 1507 * 1508 * ppBitStream - *ppBitStream is updated after the block is encoded, so 1509 * that it points to the current byte in the bit stream buffer. 1510 * pBitOffset - *pBitOffset is updated so that it points to the current bit 1511 * position in the byte pointed by *ppBitStream. 1512 * 1513 * Return Value: 1514 * 1515 * OMX_Sts_NoErr - no error 1516 * OMX_Sts_BadArgErr - Bad arguments: 1517 * - At least one of the following pointers is NULL: ppBitStream, 1518 * *ppBitStream, pBitOffset, pQDctBlkCoef. 1519 * - *pBitOffset < 0, or *pBitOffset >7. 1520 * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or 1521 * OMX_VC_VERTICAL. 1522 * - VideoComp is not one component of enum OMXVCM4P2VideoComponent. 1523 * 1524 */ 1525OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC ( 1526 OMX_U8 **ppBitStream, 1527 OMX_INT *pBitOffset, 1528 const OMX_S16 *pQDctBlkCoef, 1529 OMX_U8 predDir, 1530 OMX_U8 pattern, 1531 OMX_INT shortVideoHeader 1532); 1533 1534 1535 1536/** 1537 * Function: omxVCM4P2_EncodeVLCZigzag_Inter (6.2.4.5.3) 1538 * 1539 * Description: 1540 * Performs classical zigzag scanning and VLC encoding for one inter block. 1541 * 1542 * Input Arguments: 1543 * 1544 * ppBitStream - pointer to the pointer to the current byte in the bit 1545 * stream 1546 * pBitOffset - pointer to the bit position in the byte pointed by 1547 * *ppBitStream. Valid within 0 to 7 1548 * pQDctBlkCoef - pointer to the quantized DCT coefficient 1549 * pattern - block pattern which is used to decide whether this block is 1550 * encoded 1551 * shortVideoHeader - binary flag indicating presence of 1552 * short_video_header; escape modes 0-3 are used if 1553 * shortVideoHeader==0, and escape mode 4 is used when 1554 * shortVideoHeader==1. 1555 * 1556 * Output Arguments: 1557 * 1558 * ppBitStream - *ppBitStream is updated after the block is encoded so that 1559 * it points to the current byte in the bit stream buffer. 1560 * pBitOffset - *pBitOffset is updated so that it points to the current bit 1561 * position in the byte pointed by *ppBitStream. 1562 * 1563 * Return Value: 1564 * 1565 * OMX_Sts_NoErr - no error 1566 * OMX_Sts_BadArgErr - Bad arguments 1567 * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream, 1568 * pBitOffset, pQDctBlkCoef 1569 * - *pBitOffset < 0, or *pBitOffset >7. 1570 * 1571 */ 1572OMXResult omxVCM4P2_EncodeVLCZigzag_Inter ( 1573 OMX_U8 **ppBitStream, 1574 OMX_INT *pBitOffset, 1575 const OMX_S16 *pQDctBlkCoef, 1576 OMX_U8 pattern, 1577 OMX_INT shortVideoHeader 1578); 1579 1580 1581 1582/** 1583 * Function: omxVCM4P2_EncodeMV (6.2.4.5.4) 1584 * 1585 * Description: 1586 * Predicts a motion vector for the current macroblock, encodes the 1587 * difference, and writes the output to the stream buffer. The input MVs 1588 * pMVCurMB, pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB should lie 1589 * within the ranges associated with the input parameter fcodeForward, as 1590 * described in [ISO14496-2], subclause 7.6.3. This function provides a 1591 * superset of the functionality associated with the function 1592 * omxVCM4P2_FindMVpred. 1593 * 1594 * Input Arguments: 1595 * 1596 * ppBitStream - double pointer to the current byte in the bitstream buffer 1597 * pBitOffset - index of the first free (next available) bit in the stream 1598 * buffer referenced by *ppBitStream, valid in the range 0 to 7. 1599 * pMVCurMB - pointer to the current macroblock motion vector; a value of 1600 * NULL indicates unavailability. 1601 * pSrcMVLeftMB - pointer to the source left macroblock motion vector; a 1602 * value of NULLindicates unavailability. 1603 * pSrcMVUpperMB - pointer to source upper macroblock motion vector; a 1604 * value of NULL indicates unavailability. 1605 * pSrcMVUpperRightMB - pointer to source upper right MB motion vector; a 1606 * value of NULL indicates unavailability. 1607 * fcodeForward - an integer with values from 1 to 7; used in encoding 1608 * motion vectors related to search range, as described in 1609 * [ISO14496-2], subclause 7.6.3. 1610 * MBType - macro block type, valid in the range 0 to 5 1611 * 1612 * Output Arguments: 1613 * 1614 * ppBitStream - updated pointer to the current byte in the bit stream 1615 * buffer 1616 * pBitOffset - updated index of the next available bit position in stream 1617 * buffer referenced by *ppBitStream 1618 * 1619 * Return Value: 1620 * 1621 * OMX_Sts_NoErr - no error 1622 * OMX_Sts_BadArgErr - bad arguments 1623 * - At least one of the following pointers is NULL: ppBitStream, 1624 * *ppBitStream, pBitOffset, pMVCurMB 1625 * - *pBitOffset < 0, or *pBitOffset >7. 1626 * - fcodeForward <= 0, or fcodeForward > 7, or MBType < 0. 1627 * 1628 */ 1629OMXResult omxVCM4P2_EncodeMV ( 1630 OMX_U8 **ppBitStream, 1631 OMX_INT *pBitOffset, 1632 const OMXVCMotionVector *pMVCurMB, 1633 const OMXVCMotionVector*pSrcMVLeftMB, 1634 const OMXVCMotionVector *pSrcMVUpperMB, 1635 const OMXVCMotionVector *pSrcMVUpperRightMB, 1636 OMX_INT fcodeForward, 1637 OMXVCM4P2MacroblockType MBType 1638); 1639 1640 1641 1642/** 1643 * Function: omxVCM4P2_DecodePadMV_PVOP (6.2.5.1.1) 1644 * 1645 * Description: 1646 * Decodes and pads the four motion vectors associated with a non-intra P-VOP 1647 * macroblock. For macroblocks of type OMX_VC_INTER4V, the output MV is 1648 * padded as specified in [ISO14496-2], subclause 7.6.1.6. Otherwise, for 1649 * macroblocks of types other than OMX_VC_INTER4V, the decoded MV is copied to 1650 * all four output MV buffer entries. 1651 * 1652 * Input Arguments: 1653 * 1654 * ppBitStream - pointer to the pointer to the current byte in the bit 1655 * stream buffer 1656 * pBitOffset - pointer to the bit position in the byte pointed to by 1657 * *ppBitStream. *pBitOffset is valid within [0-7]. 1658 * pSrcMVLeftMB, pSrcMVUpperMB, and pSrcMVUpperRightMB - pointers to the 1659 * motion vector buffers of the macroblocks specially at the left, 1660 * upper, and upper-right side of the current macroblock, 1661 * respectively; a value of NULL indicates unavailability. Note: 1662 * Any neighborhood macroblock outside the current VOP or video 1663 * packet or outside the current GOB (when short_video_header is 1664 * 1 ) for which gob_header_empty is 0 is treated as 1665 * transparent, according to [ISO14496-2], subclause 7.6.5. 1666 * fcodeForward - a code equal to vop_fcode_forward in MPEG-4 bit stream 1667 * syntax 1668 * MBType - the type of the current macroblock. If MBType is not equal to 1669 * OMX_VC_INTER4V, the destination motion vector buffer is still 1670 * filled with the same decoded vector. 1671 * 1672 * Output Arguments: 1673 * 1674 * ppBitStream - *ppBitStream is updated after the block is decoded, so 1675 * that it points to the current byte in the bit stream buffer 1676 * pBitOffset - *pBitOffset is updated so that it points to the current bit 1677 * position in the byte pointed by *ppBitStream 1678 * pDstMVCurMB - pointer to the motion vector buffer for the current 1679 * macroblock; contains four decoded motion vectors 1680 * 1681 * Return Value: 1682 * 1683 * OMX_Sts_NoErr - no error 1684 * OMX_Sts_BadArgErr - bad arguments: 1685 * - At least one of the following pointers is NULL: 1686 * ppBitStream, *ppBitStream, pBitOffset, pDstMVCurMB 1687 * - *pBitOffset exceeds [0,7] 1688 * - fcodeForward exceeds (0,7] 1689 * - MBType less than zero 1690 * - motion vector buffer is not 4-byte aligned. 1691 * OMX_Sts_Err - status error 1692 * 1693 */ 1694OMXResult omxVCM4P2_DecodePadMV_PVOP ( 1695 const OMX_U8 **ppBitStream, 1696 OMX_INT *pBitOffset, 1697 OMXVCMotionVector *pSrcMVLeftMB, 1698 OMXVCMotionVector*pSrcMVUpperMB, 1699 OMXVCMotionVector *pSrcMVUpperRightMB, 1700 OMXVCMotionVector*pDstMVCurMB, 1701 OMX_INT fcodeForward, 1702 OMXVCM4P2MacroblockType MBType 1703); 1704 1705 1706 1707/** 1708 * Function: omxVCM4P2_DecodeVLCZigzag_IntraDCVLC (6.2.5.2.2) 1709 * 1710 * Description: 1711 * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients 1712 * for one intra block. Two versions of the function (DCVLC and ACVLC) are 1713 * provided in order to support the two different methods of processing DC 1714 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC 1715 * Coefficient Decoding for the Case of Switched VLC Encoding. 1716 * 1717 * Input Arguments: 1718 * 1719 * ppBitStream - pointer to the pointer to the current byte in the 1720 * bitstream buffer 1721 * pBitOffset - pointer to the bit position in the current byte referenced 1722 * by *ppBitStream. The parameter *pBitOffset is valid in the 1723 * range [0-7]. 1724 * Bit Position in one byte: |Most Least| 1725 * *pBitOffset |0 1 2 3 4 5 6 7| 1726 * predDir - AC prediction direction; used to select the zigzag scan 1727 * pattern; takes one of the following values: 1728 * - OMX_VC_NONE - AC prediction not used; 1729 * performs classical zigzag scan. 1730 * - OMX_VC_HORIZONTAL - Horizontal prediction; 1731 * performs alternate-vertical zigzag scan; 1732 * - OMX_VC_VERTICAL - Vertical prediction; 1733 * performs alternate-horizontal zigzag scan. 1734 * shortVideoHeader - binary flag indicating presence of 1735 * short_video_header; escape modes 0-3 are used if 1736 * shortVideoHeader==0, and escape mode 4 is used when 1737 * shortVideoHeader==1. 1738 * videoComp - video component type (luminance or chrominance) of the 1739 * current block 1740 * 1741 * Output Arguments: 1742 * 1743 * ppBitStream - *ppBitStream is updated after the block is decoded such 1744 * that it points to the current byte in the bit stream buffer 1745 * pBitOffset - *pBitOffset is updated such that it points to the current 1746 * bit position in the byte pointed by *ppBitStream 1747 * pDst - pointer to the coefficient buffer of current block; must be 1748 * 4-byte aligned. 1749 * 1750 * Return Value: 1751 * 1752 * OMX_Sts_NoErr - no error 1753 * OMX_Sts_BadArgErr - bad arguments, if: 1754 * - At least one of the following pointers is NULL: 1755 * ppBitStream, *ppBitStream, pBitOffset, pDst 1756 * - *pBitOffset exceeds [0,7] 1757 * - preDir exceeds [0,2] 1758 * - pDst is not 4-byte aligned 1759 * OMX_Sts_Err - if: 1760 * - In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 1761 * - At least one of mark bits equals zero 1762 * - Illegal stream encountered; code cannot be located in VLC table 1763 * - Forbidden code encountered in the VLC FLC table. 1764 * - The number of coefficients is greater than 64 1765 * 1766 */ 1767OMXResult omxVCM4P2_DecodeVLCZigzag_IntraDCVLC ( 1768 const OMX_U8 **ppBitStream, 1769 OMX_INT *pBitOffset, 1770 OMX_S16 *pDst, 1771 OMX_U8 predDir, 1772 OMX_INT shortVideoHeader, 1773 OMXVCM4P2VideoComponent videoComp 1774); 1775 1776 1777 1778/** 1779 * Function: omxVCM4P2_DecodeVLCZigzag_IntraACVLC (6.2.5.2.2) 1780 * 1781 * Description: 1782 * Performs VLC decoding and inverse zigzag scan of AC and DC coefficients 1783 * for one intra block. Two versions of the function (DCVLC and ACVLC) are 1784 * provided in order to support the two different methods of processing DC 1785 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC 1786 * Coefficient Decoding for the Case of Switched VLC Encoding. 1787 * 1788 * Input Arguments: 1789 * 1790 * ppBitStream - pointer to the pointer to the current byte in the 1791 * bitstream buffer 1792 * pBitOffset - pointer to the bit position in the current byte referenced 1793 * by *ppBitStream. The parameter *pBitOffset is valid in the 1794 * range [0-7]. Bit Position in one byte: |Most Least| *pBitOffset 1795 * |0 1 2 3 4 5 6 7| 1796 * predDir - AC prediction direction; used to select the zigzag scan 1797 * pattern; takes one of the following values: OMX_VC_NONE - AC 1798 * prediction not used; performs classical zigzag scan. 1799 * OMX_VC_HORIZONTAL - Horizontal prediction; performs 1800 * alternate-vertical zigzag scan; OMX_VC_VERTICAL - Vertical 1801 * prediction; performs alternate-horizontal zigzag scan. 1802 * shortVideoHeader - binary flag indicating presence of 1803 * short_video_header; escape modes 0-3 are used if 1804 * shortVideoHeader==0, and escape mode 4 is used when 1805 * shortVideoHeader==1. 1806 * videoComp - video component type (luminance or chrominance) of the 1807 * current block 1808 * 1809 * Output Arguments: 1810 * 1811 * ppBitStream - *ppBitStream is updated after the block is decoded such 1812 * that it points to the current byte in the bit stream buffer 1813 * pBitOffset - *pBitOffset is updated such that it points to the current 1814 * bit position in the byte pointed by *ppBitStream 1815 * pDst - pointer to the coefficient buffer of current block; must be 1816 * 4-byte aligned. 1817 * 1818 * Return Value: 1819 * 1820 * OMX_Sts_NoErr - no error 1821 * OMX_Sts_BadArgErr - bad arguments At least one of the following 1822 * pointers is NULL: ppBitStream, *ppBitStream, pBitOffset, pDst, 1823 * or At least one of the following conditions is true: 1824 * *pBitOffset exceeds [0,7], preDir exceeds [0,2], or pDst is 1825 * not 4-byte aligned 1826 * OMX_Sts_Err In DecodeVLCZigzag_IntraDCVLC, dc_size > 12 At least one of 1827 * mark bits equals zero Illegal stream encountered; code cannot 1828 * be located in VLC table Forbidden code encountered in the VLC 1829 * FLC table The number of coefficients is greater than 64 1830 * 1831 */ 1832OMXResult omxVCM4P2_DecodeVLCZigzag_IntraACVLC ( 1833 const OMX_U8 **ppBitStream, 1834 OMX_INT *pBitOffset, 1835 OMX_S16 *pDst, 1836 OMX_U8 predDir, 1837 OMX_INT shortVideoHeader 1838); 1839 1840 1841 1842/** 1843 * Function: omxVCM4P2_DecodeVLCZigzag_Inter (6.2.5.2.3) 1844 * 1845 * Description: 1846 * Performs VLC decoding and inverse zigzag scan for one inter-coded block. 1847 * 1848 * Input Arguments: 1849 * 1850 * ppBitStream - double pointer to the current byte in the stream buffer 1851 * pBitOffset - pointer to the next available bit in the current stream 1852 * byte referenced by *ppBitStream. The parameter *pBitOffset is 1853 * valid within the range [0-7]. 1854 * shortVideoHeader - binary flag indicating presence of 1855 * short_video_header; escape modes 0-3 are used if 1856 * shortVideoHeader==0, and escape mode 4 is used when 1857 * shortVideoHeader==1. 1858 * 1859 * Output Arguments: 1860 * 1861 * ppBitStream - *ppBitStream is updated after the block is decoded such 1862 * that it points to the current byte in the stream buffer 1863 * pBitOffset - *pBitOffset is updated after decoding such that it points 1864 * to the next available bit in the stream byte referenced by 1865 * *ppBitStream 1866 * pDst - pointer to the coefficient buffer of current block; must be 1867 * 4-byte aligned. 1868 * 1869 * Return Value: 1870 * 1871 * OMX_Sts_BadArgErr - bad arguments: 1872 * - At least one of the following pointers is NULL: 1873 * ppBitStream, *ppBitStream, pBitOffset, pDst 1874 * - pDst is not 4-byte aligned 1875 * - *pBitOffset exceeds [0,7] 1876 * OMX_Sts_Err - status error, if: 1877 * - At least one mark bit is equal to zero 1878 * - Encountered an illegal stream code that cannot be found in the VLC table 1879 * - Encountered an illegal code in the VLC FLC table 1880 * - The number of coefficients is greater than 64 1881 * 1882 */ 1883OMXResult omxVCM4P2_DecodeVLCZigzag_Inter ( 1884 const OMX_U8 **ppBitStream, 1885 OMX_INT *pBitOffset, 1886 OMX_S16 *pDst, 1887 OMX_INT shortVideoHeader 1888); 1889 1890 1891 1892/** 1893 * Function: omxVCM4P2_QuantInvIntra_I (6.2.5.3.2) 1894 * 1895 * Description: 1896 * Performs the second inverse quantization mode on an intra/inter coded 1897 * block. Supports bits_per_pixel = 8. The output coefficients are clipped to 1898 * the range [-2048, 2047]. 1899 * 1900 * Input Arguments: 1901 * 1902 * pSrcDst - pointer to the input (quantized) intra/inter block; must be 1903 * aligned on a 16-byte boundary. 1904 * QP - quantization parameter (quantizer_scale) 1905 * videoComp - video component type of the current block. Takes one of the 1906 * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra 1907 * version only). 1908 * shortVideoHeader - binary flag indicating presence of short_video_header 1909 * (intra version only). 1910 * 1911 * Output Arguments: 1912 * 1913 * pSrcDst - pointer to the output (dequantized) intra/inter block 1914 * 1915 * Return Value: 1916 * 1917 * OMX_Sts_NoErr - no error 1918 * OMX_Sts_BadArgErr - bad arguments; one or more of the following is 1919 * true: 1920 * - pSrcDst is NULL 1921 * - QP <= 0 or QP >=31 1922 * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE. 1923 * 1924 */ 1925OMXResult omxVCM4P2_QuantInvIntra_I ( 1926 OMX_S16 *pSrcDst, 1927 OMX_INT QP, 1928 OMXVCM4P2VideoComponent videoComp, 1929 OMX_INT shortVideoHeader 1930); 1931 1932 1933 1934/** 1935 * Function: omxVCM4P2_QuantInvInter_I (6.2.5.3.2) 1936 * 1937 * Description: 1938 * Performs the second inverse quantization mode on an intra/inter coded 1939 * block. Supports bits_per_pixel = 8. The output coefficients are clipped to 1940 * the range [-2048, 2047]. 1941 * 1942 * Input Arguments: 1943 * 1944 * pSrcDst - pointer to the input (quantized) intra/inter block; must be 1945 * aligned on a 16-byte boundary. 1946 * QP - quantization parameter (quantizer_scale) 1947 * videoComp - video component type of the current block. Takes one of the 1948 * following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra 1949 * version only). 1950 * shortVideoHeader - binary flag indicating presence of short_video_header 1951 * (intra version only). 1952 * 1953 * Output Arguments: 1954 * 1955 * pSrcDst - pointer to the output (dequantized) intra/inter block 1956 * 1957 * Return Value: 1958 * 1959 * OMX_Sts_NoErr - no error 1960 * OMX_Sts_BadArgErr - bad arguments; one or more of the following is 1961 * true: 1962 * - pSrcDst is NULL 1963 * - QP <= 0 or QP >=31 1964 * - videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE. 1965 * 1966 */ 1967OMXResult omxVCM4P2_QuantInvInter_I ( 1968 OMX_S16 *pSrcDst, 1969 OMX_INT QP 1970); 1971 1972 1973 1974/** 1975 * Function: omxVCM4P2_DecodeBlockCoef_Intra (6.2.5.4.1) 1976 * 1977 * Description: 1978 * Decodes the INTRA block coefficients. Inverse quantization, inversely 1979 * zigzag positioning, and IDCT, with appropriate clipping on each step, are 1980 * performed on the coefficients. The results are then placed in the output 1981 * frame/plane on a pixel basis. Note: This function will be used only when 1982 * at least one non-zero AC coefficient of current block exists in the bit 1983 * stream. The DC only condition will be handled in another function. 1984 * 1985 * 1986 * Input Arguments: 1987 * 1988 * ppBitStream - pointer to the pointer to the current byte in the bit 1989 * stream buffer. There is no boundary check for the bit stream 1990 * buffer. 1991 * pBitOffset - pointer to the bit position in the byte pointed to by 1992 * *ppBitStream. *pBitOffset is valid within [0-7]. 1993 * step - width of the destination plane 1994 * pCoefBufRow - pointer to the coefficient row buffer; must be aligned on 1995 * an 8-byte boundary. 1996 * pCoefBufCol - pointer to the coefficient column buffer; must be aligned 1997 * on an 8-byte boundary. 1998 * curQP - quantization parameter of the macroblock which the current block 1999 * belongs to 2000 * pQPBuf - pointer to the quantization parameter buffer 2001 * blockIndex - block index indicating the component type and position as 2002 * defined in [ISO14496-2], subclause 6.1.3.8, Figure 6-5. 2003 * intraDCVLC - a code determined by intra_dc_vlc_thr and QP. This allows a 2004 * mechanism to switch between two VLC for coding of Intra DC 2005 * coefficients as per [ISO14496-2], Table 6-21. 2006 * ACPredFlag - a flag equal to ac_pred_flag (of luminance) indicating if 2007 * the ac coefficients of the first row or first column are 2008 * differentially coded for intra coded macroblock. 2009 * shortVideoHeader - binary flag indicating presence of 2010 * short_video_header; shortVideoHeader==1 selects linear intra DC 2011 * mode, and shortVideoHeader==0 selects non linear intra DC mode. 2012 * 2013 * Output Arguments: 2014 * 2015 * ppBitStream - *ppBitStream is updated after the block is decoded, so 2016 * that it points to the current byte in the bit stream buffer 2017 * pBitOffset - *pBitOffset is updated so that it points to the current bit 2018 * position in the byte pointed by *ppBitStream 2019 * pDst - pointer to the block in the destination plane; must be aligned on 2020 * an 8-byte boundary. 2021 * pCoefBufRow - pointer to the updated coefficient row buffer. 2022 * pCoefBufCol - pointer to the updated coefficient column buffer Note: 2023 * The coefficient buffers must be updated in accordance with the 2024 * update procedure defined in section 6.2.2. 2025 * 2026 * Return Value: 2027 * 2028 * OMX_Sts_NoErr - no error 2029 * OMX_Sts_BadArgErr - bad arguments, if: 2030 * - At least one of the following pointers is NULL: 2031 * ppBitStream, *ppBitStream, pBitOffset, pCoefBufRow, pCoefBufCol, 2032 * pQPBuf, pDst. 2033 * - *pBitOffset exceeds [0,7] 2034 * - curQP exceeds (1, 31) 2035 * - blockIndex exceeds [0,5] 2036 * - step is not the multiple of 8 2037 * - a pointer alignment requirement was violated. 2038 * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Intra. 2039 * 2040 */ 2041OMXResult omxVCM4P2_DecodeBlockCoef_Intra ( 2042 const OMX_U8 **ppBitStream, 2043 OMX_INT *pBitOffset, 2044 OMX_U8 *pDst, 2045 OMX_INT step, 2046 OMX_S16 *pCoefBufRow, 2047 OMX_S16 *pCoefBufCol, 2048 OMX_U8 curQP, 2049 const OMX_U8 *pQPBuf, 2050 OMX_INT blockIndex, 2051 OMX_INT intraDCVLC, 2052 OMX_INT ACPredFlag, 2053 OMX_INT shortVideoHeader 2054); 2055 2056 2057 2058/** 2059 * Function: omxVCM4P2_DecodeBlockCoef_Inter (6.2.5.4.2) 2060 * 2061 * Description: 2062 * Decodes the INTER block coefficients. This function performs inverse 2063 * quantization, inverse zigzag positioning, and IDCT (with appropriate 2064 * clipping on each step) on the coefficients. The results (residuals) are 2065 * placed in a contiguous array of 64 elements. For INTER block, the output 2066 * buffer holds the residuals for further reconstruction. 2067 * 2068 * Input Arguments: 2069 * 2070 * ppBitStream - pointer to the pointer to the current byte in the bit 2071 * stream buffer. There is no boundary check for the bit stream 2072 * buffer. 2073 * pBitOffset - pointer to the bit position in the byte pointed to by 2074 * *ppBitStream. *pBitOffset is valid within [0-7] 2075 * QP - quantization parameter 2076 * shortVideoHeader - binary flag indicating presence of 2077 * short_video_header; shortVideoHeader==1 selects linear intra DC 2078 * mode, and shortVideoHeader==0 selects non linear intra DC mode. 2079 * 2080 * Output Arguments: 2081 * 2082 * ppBitStream - *ppBitStream is updated after the block is decoded, so 2083 * that it points to the current byte in the bit stream buffer 2084 * pBitOffset - *pBitOffset is updated so that it points to the current bit 2085 * position in the byte pointed by *ppBitStream 2086 * pDst - pointer to the decoded residual buffer (a contiguous array of 64 2087 * elements of OMX_S16 data type); must be aligned on a 16-byte 2088 * boundary. 2089 * 2090 * Return Value: 2091 * 2092 * OMX_Sts_NoErr - no error 2093 * OMX_Sts_BadArgErr - bad arguments, if: 2094 * - At least one of the following pointers is Null: 2095 * ppBitStream, *ppBitStream, pBitOffset , pDst 2096 * - *pBitOffset exceeds [0,7] 2097 * - QP <= 0. 2098 * - pDst is not 16-byte aligned 2099 * OMX_Sts_Err - status error. Refer to OMX_Sts_Err of DecodeVLCZigzag_Inter . 2100 * 2101 */ 2102OMXResult omxVCM4P2_DecodeBlockCoef_Inter ( 2103 const OMX_U8 **ppBitStream, 2104 OMX_INT *pBitOffset, 2105 OMX_S16 *pDst, 2106 OMX_INT QP, 2107 OMX_INT shortVideoHeader 2108); 2109 2110 2111 2112/** 2113 * Function: omxVCM4P2_PredictReconCoefIntra (6.2.5.4.3) 2114 * 2115 * Description: 2116 * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 2117 * to the function call, prediction direction (predDir) should be selected as 2118 * specified in [ISO14496-2], subclause 7.4.3.1. 2119 * 2120 * Input Arguments: 2121 * 2122 * pSrcDst - pointer to the coefficient buffer which contains the quantized 2123 * coefficient residuals (PQF) of the current block; must be 2124 * aligned on a 4-byte boundary. The output coefficients are 2125 * saturated to the range [-2048, 2047]. 2126 * pPredBufRow - pointer to the coefficient row buffer; must be aligned on 2127 * a 4-byte boundary. 2128 * pPredBufCol - pointer to the coefficient column buffer; must be aligned 2129 * on a 4-byte boundary. 2130 * curQP - quantization parameter of the current block. curQP may equal to 2131 * predQP especially when the current block and the predictor block 2132 * are in the same macroblock. 2133 * predQP - quantization parameter of the predictor block 2134 * predDir - indicates the prediction direction which takes one of the 2135 * following values: OMX_VC_HORIZONTAL - predict horizontally 2136 * OMX_VC_VERTICAL - predict vertically 2137 * ACPredFlag - a flag indicating if AC prediction should be performed. It 2138 * is equal to ac_pred_flag in the bit stream syntax of MPEG-4 2139 * videoComp - video component type (luminance or chrominance) of the 2140 * current block 2141 * 2142 * Output Arguments: 2143 * 2144 * pSrcDst - pointer to the coefficient buffer which contains the quantized 2145 * coefficients (QF) of the current block 2146 * pPredBufRow - pointer to the updated coefficient row buffer 2147 * pPredBufCol - pointer to the updated coefficient column buffer Note: 2148 * Buffer update: Update the AC prediction buffer (both row and 2149 * column buffer). 2150 * 2151 * Return Value: 2152 * 2153 * OMX_Sts_NoErr - no error 2154 * OMX_Sts_BadArgErr - bad arguments, if: 2155 * - At least one of the pointers is NULL: 2156 * pSrcDst, pPredBufRow, or pPredBufCol. 2157 * - curQP <= 0, 2158 * - predQP <= 0, 2159 * - curQP >31, 2160 * - predQP > 31, 2161 * - preDir exceeds [1,2] 2162 * - pSrcDst, pPredBufRow, or pPredBufCol is not 4-byte aligned. 2163 * 2164 */ 2165OMXResult omxVCM4P2_PredictReconCoefIntra ( 2166 OMX_S16 *pSrcDst, 2167 OMX_S16 *pPredBufRow, 2168 OMX_S16 *pPredBufCol, 2169 OMX_INT curQP, 2170 OMX_INT predQP, 2171 OMX_INT predDir, 2172 OMX_INT ACPredFlag, 2173 OMXVCM4P2VideoComponent videoComp 2174); 2175 2176 2177 2178/** 2179 * Function: omxVCM4P2_MCReconBlock (6.2.5.5.1) 2180 * 2181 * Description: 2182 * Performs motion compensation prediction for an 8x8 block using 2183 * interpolation described in [ISO14496-2], subclause 7.6.2. 2184 * 2185 * Input Arguments: 2186 * 2187 * pSrc - pointer to the block in the reference plane. 2188 * srcStep - distance between the start of consecutive lines in the 2189 * reference plane, in bytes; must be a multiple of 8. 2190 * dstStep - distance between the start of consecutive lines in the 2191 * destination plane, in bytes; must be a multiple of 8. 2192 * pSrcResidue - pointer to a buffer containing the 16-bit prediction 2193 * residuals; must be 16-byte aligned. If the pointer is NULL, then 2194 * no prediction is done, only motion compensation, i.e., the block 2195 * is moved with interpolation. 2196 * predictType - bilinear interpolation type, as defined in section 2197 * 6.2.1.2. 2198 * rndVal - rounding control parameter: 0 - disabled; 1 - enabled. 2199 * 2200 * Output Arguments: 2201 * 2202 * pDst - pointer to the destination buffer; must be 8-byte aligned. If 2203 * prediction residuals are added then output intensities are 2204 * clipped to the range [0,255]. 2205 * 2206 * Return Value: 2207 * 2208 * OMX_Sts_NoErr - no error 2209 * OMX_Sts_BadArgErr - bad arguments; returned under any of the following 2210 * conditions: 2211 * - pDst is not 8-byte aligned. 2212 * - pSrcResidue is not 16-byte aligned. 2213 * - one or more of the following pointers is NULL: pSrc or pDst. 2214 * - either srcStep or dstStep is not a multiple of 8. 2215 * - invalid type specified for the parameter predictType. 2216 * - the parameter rndVal is not equal either to 0 or 1. 2217 * 2218 */ 2219OMXResult omxVCM4P2_MCReconBlock ( 2220 const OMX_U8 *pSrc, 2221 OMX_INT srcStep, 2222 const OMX_S16 *pSrcResidue, 2223 OMX_U8 *pDst, 2224 OMX_INT dstStep, 2225 OMX_INT predictType, 2226 OMX_INT rndVal 2227); 2228 2229 2230 2231/* 6.3.1.1 Intra 16x16 Prediction Modes */ 2232/* A data type that enumerates intra_16x16 macroblock prediction modes is defined as follows: */ 2233 2234typedef enum { 2235 OMX_VC_16X16_VERT = 0, /** Intra_16x16_Vertical */ 2236 OMX_VC_16X16_HOR = 1, /** Intra_16x16_Horizontal */ 2237 OMX_VC_16X16_DC = 2, /** Intra_16x16_DC */ 2238 OMX_VC_16X16_PLANE = 3 /** Intra_16x16_Plane */ 2239} OMXVCM4P10Intra16x16PredMode; 2240 2241 2242 2243/* 6.3.1.2 Intra 4x4 Prediction Modes */ 2244/* A data type that enumerates intra_4x4 macroblock prediction modes is defined as follows: */ 2245 2246typedef enum { 2247 OMX_VC_4X4_VERT = 0, /** Intra_4x4_Vertical */ 2248 OMX_VC_4X4_HOR = 1, /** Intra_4x4_Horizontal */ 2249 OMX_VC_4X4_DC = 2, /** Intra_4x4_DC */ 2250 OMX_VC_4X4_DIAG_DL = 3, /** Intra_4x4_Diagonal_Down_Left */ 2251 OMX_VC_4X4_DIAG_DR = 4, /** Intra_4x4_Diagonal_Down_Right */ 2252 OMX_VC_4X4_VR = 5, /** Intra_4x4_Vertical_Right */ 2253 OMX_VC_4X4_HD = 6, /** Intra_4x4_Horizontal_Down */ 2254 OMX_VC_4X4_VL = 7, /** Intra_4x4_Vertical_Left */ 2255 OMX_VC_4X4_HU = 8 /** Intra_4x4_Horizontal_Up */ 2256} OMXVCM4P10Intra4x4PredMode; 2257 2258 2259 2260/* 6.3.1.3 Chroma Prediction Modes */ 2261/* A data type that enumerates intra chroma prediction modes is defined as follows: */ 2262 2263typedef enum { 2264 OMX_VC_CHROMA_DC = 0, /** Intra_Chroma_DC */ 2265 OMX_VC_CHROMA_HOR = 1, /** Intra_Chroma_Horizontal */ 2266 OMX_VC_CHROMA_VERT = 2, /** Intra_Chroma_Vertical */ 2267 OMX_VC_CHROMA_PLANE = 3 /** Intra_Chroma_Plane */ 2268} OMXVCM4P10IntraChromaPredMode; 2269 2270 2271 2272/* 6.3.1.4 Motion Estimation Modes */ 2273/* A data type that enumerates H.264 motion estimation modes is defined as follows: */ 2274 2275typedef enum { 2276 OMX_VC_M4P10_FAST_SEARCH = 0, /** Fast motion search */ 2277 OMX_VC_M4P10_FULL_SEARCH = 1 /** Full motion search */ 2278} OMXVCM4P10MEMode; 2279 2280 2281 2282/* 6.3.1.5 Macroblock Types */ 2283/* A data type that enumerates H.264 macroblock types is defined as follows: */ 2284 2285typedef enum { 2286 OMX_VC_P_16x16 = 0, /* defined by [ISO14496-10] */ 2287 OMX_VC_P_16x8 = 1, 2288 OMX_VC_P_8x16 = 2, 2289 OMX_VC_P_8x8 = 3, 2290 OMX_VC_PREF0_8x8 = 4, 2291 OMX_VC_INTER_SKIP = 5, 2292 OMX_VC_INTRA_4x4 = 8, 2293 OMX_VC_INTRA_16x16 = 9, 2294 OMX_VC_INTRA_PCM = 10 2295} OMXVCM4P10MacroblockType; 2296 2297 2298 2299/* 6.3.1.6 Sub-Macroblock Types */ 2300/* A data type that enumerates H.264 sub-macroblock types is defined as follows: */ 2301 2302typedef enum { 2303 OMX_VC_SUB_P_8x8 = 0, /* defined by [ISO14496-10] */ 2304 OMX_VC_SUB_P_8x4 = 1, 2305 OMX_VC_SUB_P_4x8 = 2, 2306 OMX_VC_SUB_P_4x4 = 3 2307} OMXVCM4P10SubMacroblockType; 2308 2309 2310 2311/* 6.3.1.7 Variable Length Coding (VLC) Information */ 2312 2313typedef struct { 2314 OMX_U8 uTrailing_Ones; /* Trailing ones; 3 at most */ 2315 OMX_U8 uTrailing_One_Signs; /* Trailing ones signal */ 2316 OMX_U8 uNumCoeffs; /* Total number of non-zero coefs, including trailing ones */ 2317 OMX_U8 uTotalZeros; /* Total number of zero coefs */ 2318 OMX_S16 iLevels[16]; /* Levels of non-zero coefs, in reverse zig-zag order */ 2319 OMX_U8 uRuns[16]; /* Runs for levels and trailing ones, in reverse zig-zag order */ 2320} OMXVCM4P10VLCInfo; 2321 2322 2323 2324/* 6.3.1.8 Macroblock Information */ 2325 2326typedef struct { 2327 OMX_S32 sliceId; /* slice number */ 2328 OMXVCM4P10MacroblockType mbType; /* MB type */ 2329 OMXVCM4P10SubMacroblockType subMBType[4]; /* sub-block type */ 2330 OMX_S32 qpy; /* qp for luma */ 2331 OMX_S32 qpc; /* qp for chroma */ 2332 OMX_U32 cbpy; /* CBP Luma */ 2333 OMX_U32 cbpc; /* CBP Chroma */ 2334 OMXVCMotionVector pMV0[4][4]; /* motion vector, represented using 1/4-pel units, pMV0[blocky][blockx] (blocky = 0~3, blockx =0~3) */ 2335 OMXVCMotionVector pMVPred[4][4]; /* motion vector prediction, Represented using 1/4-pel units, pMVPred[blocky][blockx] (blocky = 0~3, blockx = 0~3) */ 2336 OMX_U8 pRefL0Idx[4]; /* reference picture indices */ 2337 OMXVCM4P10Intra16x16PredMode Intra16x16PredMode; /* best intra 16x16 prediction mode */ 2338 OMXVCM4P10Intra4x4PredMode pIntra4x4PredMode[16]; /* best intra 4x4 prediction mode for each block, pMV0 indexed as above */ 2339} OMXVCM4P10MBInfo, *OMXVCM4P10MBInfoPtr; 2340 2341 2342 2343/* 6.3.1.9 Motion Estimation Parameters */ 2344 2345typedef struct { 2346 OMX_S32 blockSplitEnable8x8; /* enables 16x8, 8x16, 8x8 */ 2347 OMX_S32 blockSplitEnable4x4; /* enable splitting of 8x4, 4x8, 4x4 blocks */ 2348 OMX_S32 halfSearchEnable; 2349 OMX_S32 quarterSearchEnable; 2350 OMX_S32 intraEnable4x4; /* 1=enable, 0=disable */ 2351 OMX_S32 searchRange16x16; /* integer pixel units */ 2352 OMX_S32 searchRange8x8; 2353 OMX_S32 searchRange4x4; 2354} OMXVCM4P10MEParams; 2355 2356 2357 2358/** 2359 * Function: omxVCM4P10_PredictIntra_4x4 (6.3.3.1.1) 2360 * 2361 * Description: 2362 * Perform Intra_4x4 prediction for luma samples. If the upper-right block is 2363 * not available, then duplication work should be handled inside the function. 2364 * Users need not define them outside. 2365 * 2366 * Input Arguments: 2367 * 2368 * pSrcLeft - Pointer to the buffer of 4 left pixels: 2369 * p[x, y] (x = -1, y = 0..3) 2370 * pSrcAbove - Pointer to the buffer of 8 above pixels: 2371 * p[x,y] (x = 0..7, y =-1); 2372 * must be aligned on a 4-byte boundary. 2373 * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 2374 * leftStep - Step of left pixel buffer; must be a multiple of 4. 2375 * dstStep - Step of the destination buffer; must be a multiple of 4. 2376 * predMode - Intra_4x4 prediction mode. 2377 * availability - Neighboring 4x4 block availability flag, refer to 2378 * "Neighboring Macroblock Availability" . 2379 * 2380 * Output Arguments: 2381 * 2382 * pDst - Pointer to the destination buffer; must be aligned on a 4-byte 2383 * boundary. 2384 * 2385 * Return Value: 2386 * If the function runs without error, it returns OMX_Sts_NoErr. 2387 * If one of the following cases occurs, the function returns 2388 * OMX_Sts_BadArgErr: 2389 * pDst is NULL. 2390 * dstStep < 4, or dstStep is not a multiple of 4. 2391 * leftStep is not a multiple of 4. 2392 * predMode is not in the valid range of enumeration 2393 * OMXVCM4P10Intra4x4PredMode. 2394 * predMode is OMX_VC_4x4_VERT, but availability doesn't set OMX_VC_UPPER 2395 * indicating p[x,-1] (x = 0..3) is not available. 2396 * predMode is OMX_VC_4x4_HOR, but availability doesn't set OMX_VC_LEFT 2397 * indicating p[-1,y] (y = 0..3) is not available. 2398 * predMode is OMX_VC_4x4_DIAG_DL, but availability doesn't set 2399 * OMX_VC_UPPER indicating p[x, -1] (x = 0..3) is not available. 2400 * predMode is OMX_VC_4x4_DIAG_DR, but availability doesn't set 2401 * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 2402 * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 2403 * available. 2404 * predMode is OMX_VC_4x4_VR, but availability doesn't set 2405 * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 2406 * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 2407 * available. 2408 * predMode is OMX_VC_4x4_HD, but availability doesn't set 2409 * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 2410 * p[x,-1] (x = 0..3), or p[-1,y] (y = 0..3) or p[-1,-1] is not 2411 * available. 2412 * predMode is OMX_VC_4x4_VL, but availability doesn't set OMX_VC_UPPER 2413 * indicating p[x,-1] (x = 0..3) is not available. 2414 * predMode is OMX_VC_4x4_HU, but availability doesn't set OMX_VC_LEFT 2415 * indicating p[-1,y] (y = 0..3) is not available. 2416 * availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 2417 * availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 2418 * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 2419 * either pSrcAbove or pDst is not aligned on a 4-byte boundary. 2420 * 2421 * Note: 2422 * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if 2423 * they are not used by intra prediction as implied in predMode. 2424 * 2425 */ 2426OMXResult omxVCM4P10_PredictIntra_4x4 ( 2427 const OMX_U8 *pSrcLeft, 2428 const OMX_U8 *pSrcAbove, 2429 const OMX_U8 *pSrcAboveLeft, 2430 OMX_U8 *pDst, 2431 OMX_INT leftStep, 2432 OMX_INT dstStep, 2433 OMXVCM4P10Intra4x4PredMode predMode, 2434 OMX_S32 availability 2435); 2436 2437 2438 2439/** 2440 * Function: omxVCM4P10_PredictIntra_16x16 (6.3.3.1.2) 2441 * 2442 * Description: 2443 * Perform Intra_16x16 prediction for luma samples. If the upper-right block 2444 * is not available, then duplication work should be handled inside the 2445 * function. Users need not define them outside. 2446 * 2447 * Input Arguments: 2448 * 2449 * pSrcLeft - Pointer to the buffer of 16 left pixels: p[x, y] (x = -1, y = 2450 * 0..15) 2451 * pSrcAbove - Pointer to the buffer of 16 above pixels: p[x,y] (x = 0..15, 2452 * y= -1); must be aligned on a 16-byte boundary. 2453 * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 2454 * leftStep - Step of left pixel buffer; must be a multiple of 16. 2455 * dstStep - Step of the destination buffer; must be a multiple of 16. 2456 * predMode - Intra_16x16 prediction mode, please refer to section 3.4.1. 2457 * availability - Neighboring 16x16 MB availability flag. Refer to 2458 * section 3.4.4. 2459 * 2460 * Output Arguments: 2461 * 2462 * pDst -Pointer to the destination buffer; must be aligned on a 16-byte 2463 * boundary. 2464 * 2465 * Return Value: 2466 * If the function runs without error, it returns OMX_Sts_NoErr. 2467 * If one of the following cases occurs, the function returns 2468 * OMX_Sts_BadArgErr: 2469 * pDst is NULL. 2470 * dstStep < 16. or dstStep is not a multiple of 16. 2471 * leftStep is not a multiple of 16. 2472 * predMode is not in the valid range of enumeration 2473 * OMXVCM4P10Intra16x16PredMode 2474 * predMode is OMX_VC_16X16_VERT, but availability doesn't set 2475 * OMX_VC_UPPER indicating p[x,-1] (x = 0..15) is not available. 2476 * predMode is OMX_VC_16X16_HOR, but availability doesn't set OMX_VC_LEFT 2477 * indicating p[-1,y] (y = 0..15) is not available. 2478 * predMode is OMX_VC_16X16_PLANE, but availability doesn't set 2479 * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 2480 * p[x,-1](x = 0..15), or p[-1,y] (y = 0..15), or p[-1,-1] is not 2481 * available. 2482 * availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 2483 * availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 2484 * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 2485 * either pSrcAbove or pDst is not aligned on a 16-byte boundary. 2486 * 2487 * Note: 2488 * pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointers if 2489 * they are not used by intra prediction implied in predMode. 2490 * Note: 2491 * OMX_VC_UPPER_RIGHT is not used in intra_16x16 luma prediction. 2492 * 2493 */ 2494OMXResult omxVCM4P10_PredictIntra_16x16 ( 2495 const OMX_U8 *pSrcLeft, 2496 const OMX_U8 *pSrcAbove, 2497 const OMX_U8 *pSrcAboveLeft, 2498 OMX_U8 *pDst, 2499 OMX_INT leftStep, 2500 OMX_INT dstStep, 2501 OMXVCM4P10Intra16x16PredMode predMode, 2502 OMX_S32 availability 2503); 2504 2505 2506 2507/** 2508 * Function: omxVCM4P10_PredictIntraChroma_8x8 (6.3.3.1.3) 2509 * 2510 * Description: 2511 * Performs intra prediction for chroma samples. 2512 * 2513 * Input Arguments: 2514 * 2515 * pSrcLeft - Pointer to the buffer of 8 left pixels: p[x, y] (x = -1, y= 2516 * 0..7). 2517 * pSrcAbove - Pointer to the buffer of 8 above pixels: p[x,y] (x = 0..7, y 2518 * = -1); must be aligned on an 8-byte boundary. 2519 * pSrcAboveLeft - Pointer to the above left pixels: p[x,y] (x = -1, y = -1) 2520 * leftStep - Step of left pixel buffer; must be a multiple of 8. 2521 * dstStep - Step of the destination buffer; must be a multiple of 8. 2522 * predMode - Intra chroma prediction mode, please refer to section 3.4.3. 2523 * availability - Neighboring chroma block availability flag, please refer 2524 * to "Neighboring Macroblock Availability". 2525 * 2526 * Output Arguments: 2527 * 2528 * pDst - Pointer to the destination buffer; must be aligned on an 8-byte 2529 * boundary. 2530 * 2531 * Return Value: 2532 * If the function runs without error, it returns OMX_Sts_NoErr. 2533 * If any of the following cases occurs, the function returns 2534 * OMX_Sts_BadArgErr: 2535 * pDst is NULL. 2536 * dstStep < 8 or dstStep is not a multiple of 8. 2537 * leftStep is not a multiple of 8. 2538 * predMode is not in the valid range of enumeration 2539 * OMXVCM4P10IntraChromaPredMode. 2540 * predMode is OMX_VC_CHROMA_VERT, but availability doesn't set 2541 * OMX_VC_UPPER indicating p[x,-1] (x = 0..7) is not available. 2542 * predMode is OMX_VC_CHROMA_HOR, but availability doesn't set OMX_VC_LEFT 2543 * indicating p[-1,y] (y = 0..7) is not available. 2544 * predMode is OMX_VC_CHROMA_PLANE, but availability doesn't set 2545 * OMX_VC_UPPER_LEFT or OMX_VC_UPPER or OMX_VC_LEFT indicating 2546 * p[x,-1](x = 0..7), or p[-1,y] (y = 0..7), or p[-1,-1] is not 2547 * available. 2548 * availability sets OMX_VC_UPPER, but pSrcAbove is NULL. 2549 * availability sets OMX_VC_LEFT, but pSrcLeft is NULL. 2550 * availability sets OMX_VC_UPPER_LEFT, but pSrcAboveLeft is NULL. 2551 * either pSrcAbove or pDst is not aligned on a 8-byte boundary. 2552 * 2553 * Note: pSrcAbove, pSrcAbove, pSrcAboveLeft may be invalid pointer if 2554 * they are not used by intra prediction implied in predMode. 2555 * 2556 * Note: OMX_VC_UPPER_RIGHT is not used in intra chroma prediction. 2557 * 2558 */ 2559OMXResult omxVCM4P10_PredictIntraChroma_8x8 ( 2560 const OMX_U8 *pSrcLeft, 2561 const OMX_U8 *pSrcAbove, 2562 const OMX_U8 *pSrcAboveLeft, 2563 OMX_U8 *pDst, 2564 OMX_INT leftStep, 2565 OMX_INT dstStep, 2566 OMXVCM4P10IntraChromaPredMode predMode, 2567 OMX_S32 availability 2568); 2569 2570 2571 2572/** 2573 * Function: omxVCM4P10_InterpolateLuma (6.3.3.2.1) 2574 * 2575 * Description: 2576 * Performs quarter-pixel interpolation for inter luma MB. It is assumed that 2577 * the frame is already padded when calling this function. 2578 * 2579 * Input Arguments: 2580 * 2581 * pSrc - Pointer to the source reference frame buffer 2582 * srcStep - reference frame step, in bytes; must be a multiple of roi.width 2583 * dstStep - destination frame step, in bytes; must be a multiple of 2584 * roi.width 2585 * dx - Fractional part of horizontal motion vector component in 1/4 pixel 2586 * unit; valid in the range [0,3] 2587 * dy - Fractional part of vertical motion vector y component in 1/4 pixel 2588 * unit; valid in the range [0,3] 2589 * roi - Dimension of the interpolation region; the parameters roi.width and 2590 * roi.height must be equal to either 4, 8, or 16. 2591 * 2592 * Output Arguments: 2593 * 2594 * pDst - Pointer to the destination frame buffer: 2595 * if roi.width==4, 4-byte alignment required 2596 * if roi.width==8, 8-byte alignment required 2597 * if roi.width==16, 16-byte alignment required 2598 * 2599 * Return Value: 2600 * If the function runs without error, it returns OMX_Sts_NoErr. 2601 * If one of the following cases occurs, the function returns 2602 * OMX_Sts_BadArgErr: 2603 * pSrc or pDst is NULL. 2604 * srcStep or dstStep < roi.width. 2605 * dx or dy is out of range [0,3]. 2606 * roi.width or roi.height is out of range {4, 8, 16}. 2607 * roi.width is equal to 4, but pDst is not 4 byte aligned. 2608 * roi.width is equal to 8 or 16, but pDst is not 8 byte aligned. 2609 * srcStep or dstStep is not a multiple of 8. 2610 * 2611 */ 2612OMXResult omxVCM4P10_InterpolateLuma ( 2613 const OMX_U8 *pSrc, 2614 OMX_S32 srcStep, 2615 OMX_U8 *pDst, 2616 OMX_S32 dstStep, 2617 OMX_S32 dx, 2618 OMX_S32 dy, 2619 OMXSize roi 2620); 2621 2622 2623 2624/** 2625 * Function: omxVCM4P10_InterpolateChroma (6.3.3.2.2) 2626 * 2627 * Description: 2628 * Performs 1/8-pixel interpolation for inter chroma MB. 2629 * 2630 * Input Arguments: 2631 * 2632 * pSrc -Pointer to the source reference frame buffer 2633 * srcStep -Reference frame step in bytes 2634 * dstStep -Destination frame step in bytes; must be a multiple of 2635 * roi.width. 2636 * dx -Fractional part of horizontal motion vector component in 1/8 pixel 2637 * unit; valid in the range [0,7] 2638 * dy -Fractional part of vertical motion vector component in 1/8 pixel 2639 * unit; valid in the range [0,7] 2640 * roi -Dimension of the interpolation region; the parameters roi.width and 2641 * roi.height must be equal to either 2, 4, or 8. 2642 * 2643 * Output Arguments: 2644 * 2645 * pDst -Pointer to the destination frame buffer: 2646 * if roi.width==2, 2-byte alignment required 2647 * if roi.width==4, 4-byte alignment required 2648 * if roi.width==8, 8-byte alignment required 2649 * 2650 * Return Value: 2651 * If the function runs without error, it returns OMX_Sts_NoErr. 2652 * If one of the following cases occurs, the function returns 2653 * OMX_Sts_BadArgErr: 2654 * pSrc or pDst is NULL. 2655 * srcStep or dstStep < 8. 2656 * dx or dy is out of range [0-7]. 2657 * roi.width or roi.height is out of range {2,4,8}. 2658 * roi.width is equal to 2, but pDst is not 2-byte aligned. 2659 * roi.width is equal to 4, but pDst is not 4-byte aligned. 2660 * roi.width is equal to 8, but pDst is not 8 byte aligned. 2661 * srcStep or dstStep is not a multiple of 8. 2662 * 2663 */ 2664OMXResult omxVCM4P10_InterpolateChroma ( 2665 const OMX_U8 *pSrc, 2666 OMX_S32 srcStep, 2667 OMX_U8 *pDst, 2668 OMX_S32 dstStep, 2669 OMX_S32 dx, 2670 OMX_S32 dy, 2671 OMXSize roi 2672); 2673 2674 2675 2676/** 2677 * Function: omxVCM4P10_FilterDeblockingLuma_VerEdge_I (6.3.3.3.1) 2678 * 2679 * Description: 2680 * Performs in-place deblock filtering on four vertical edges of the luma 2681 * macroblock (16x16). 2682 * 2683 * Input Arguments: 2684 * 2685 * pSrcDst - Pointer to the input macroblock; must be 16-byte aligned. 2686 * srcdstStep -Step of the arrays; must be a multiple of 16. 2687 * pAlpha -Array of size 2 of alpha thresholds (the first item is the alpha 2688 * threshold for the external vertical edge, and the second item is 2689 * for the internal vertical edge); per [ISO14496-10] alpha values 2690 * must be in the range [0,255]. 2691 * pBeta -Array of size 2 of beta thresholds (the first item is the beta 2692 * threshold for the external vertical edge, and the second item is 2693 * for the internal vertical edge); per [ISO14496-10] beta values 2694 * must be in the range [0,18]. 2695 * pThresholds -Array of size 16 of Thresholds (TC0) (values for the left 2696 * edge of each 4x4 block, arranged in vertical block order); must 2697 * be aligned on a 4-byte boundary.. Per [ISO14496-10] values must 2698 * be in the range [0,25]. 2699 * pBS -Array of size 16 of BS parameters (arranged in vertical block 2700 * order); valid in the range [0,4] with the following 2701 * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) 2702 * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned. 2703 * 2704 * Output Arguments: 2705 * 2706 * pSrcDst -Pointer to filtered output macroblock. 2707 * 2708 * Return Value: 2709 * If the function runs without error, it returns OMX_Sts_NoErr. 2710 * If one of the following cases occurs, the function returns 2711 * OMX_Sts_BadArgErr: 2712 * Either of the pointers in pSrcDst, pAlpha, pBeta, pThresholds, or pBS 2713 * is NULL. 2714 * Either pThresholds or pBS is not aligned on a 4-byte boundary. 2715 * pSrcDst is not 16-byte aligned. 2716 * srcdstStep is not a multiple of 16. 2717 * pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 2718 * pBeta[0] and/or pBeta[1] is outside the range [0,18]. 2719 * One or more entries in the table pThresholds[0..15]is outside of the 2720 * range [0,25]. 2721 * pBS is out of range, i.e., one of the following conditions is true: 2722 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or (pBS[i]==4 && 2723 * pBS[i^3]!=4) for 0<=i<=3. 2724 * 2725 */ 2726OMXResult omxVCM4P10_FilterDeblockingLuma_VerEdge_I ( 2727 OMX_U8 *pSrcDst, 2728 OMX_S32 srcdstStep, 2729 const OMX_U8 *pAlpha, 2730 const OMX_U8 *pBeta, 2731 const OMX_U8 *pThresholds, 2732 const OMX_U8 *pBS 2733); 2734 2735 2736 2737/** 2738 * Function: omxVCM4P10_FilterDeblockingLuma_HorEdge_I (6.3.3.3.2) 2739 * 2740 * Description: 2741 * Performs in-place deblock filtering on four horizontal edges of the luma 2742 * macroblock (16x16). 2743 * 2744 * Input Arguments: 2745 * 2746 * pSrcDst - pointer to the input macroblock; must be 16-byte aligned. 2747 * srcdstStep - step of the arrays; must be a multiple of 16. 2748 * pAlpha - array of size 2 of alpha thresholds (the first item is the alpha 2749 * threshold for the external vertical edge, and the second item is 2750 * for the internal horizontal edge); per [ISO14496-10] alpha 2751 * values must be in the range [0,255]. 2752 * pBeta - array of size 2 of beta thresholds (the first item is the beta 2753 * threshold for the external horizontal edge, and the second item 2754 * is for the internal horizontal edge). Per [ISO14496-10] beta 2755 * values must be in the range [0,18]. 2756 * pThresholds - array of size 16 containing thresholds, TC0, for the top 2757 * horizontal edge of each 4x4 block, arranged in horizontal block 2758 * order; must be aligned on a 4-byte boundary. Per [ISO14496 10] 2759 * values must be in the range [0,25]. 2760 * pBS - array of size 16 of BS parameters (arranged in horizontal block 2761 * order); valid in the range [0,4] with the following 2762 * restrictions: i) pBS[i]== 4 may occur only for 0<=i<=3, ii) 2763 * pBS[i]== 4 if and only if pBS[i^3]== 4. Must be 4-byte aligned. 2764 * 2765 * Output Arguments: 2766 * 2767 * pSrcDst -Pointer to filtered output macroblock. 2768 * 2769 * Return Value: 2770 * 2771 * OMX_Sts_NoErr, if the function runs without error. 2772 * 2773 * OMX_Sts_BadArgErr, if one of the following cases occurs: 2774 * - one or more of the following pointers is NULL: pSrcDst, pAlpha, 2775 * pBeta, pThresholds, or pBS. 2776 * - either pThresholds or pBS is not aligned on a 4-byte boundary. 2777 * - pSrcDst is not 16-byte aligned. 2778 * - srcdstStep is not a multiple of 16. 2779 * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 2780 * - pBeta[0] and/or pBeta[1] is outside the range [0,18]. 2781 * - One or more entries in the table pThresholds[0..15] is 2782 * outside of the range [0,25]. 2783 * - pBS is out of range, i.e., one of the following conditions is true: 2784 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 2785 * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 2786 * 2787 */ 2788OMXResult omxVCM4P10_FilterDeblockingLuma_HorEdge_I ( 2789 OMX_U8 *pSrcDst, 2790 OMX_S32 srcdstStep, 2791 const OMX_U8 *pAlpha, 2792 const OMX_U8 *pBeta, 2793 const OMX_U8 *pThresholds, 2794 const OMX_U8 *pBS 2795); 2796 2797 2798 2799/** 2800 * Function: omxVCM4P10_FilterDeblockingChroma_VerEdge_I (6.3.3.3.3) 2801 * 2802 * Description: 2803 * Performs in-place deblock filtering on four vertical edges of the chroma 2804 * macroblock (8x8). 2805 * 2806 * Input Arguments: 2807 * 2808 * pSrcDst - Pointer to the input macroblock; must be 8-byte aligned. 2809 * srcdstStep - Step of the arrays; must be a multiple of 8. 2810 * pAlpha - Array of size 2 of alpha thresholds (the first item is alpha 2811 * threshold for external vertical edge, and the second item is for 2812 * internal vertical edge); per [ISO14496-10] alpha values must be 2813 * in the range [0,255]. 2814 * pBeta - Array of size 2 of beta thresholds (the first item is the beta 2815 * threshold for the external vertical edge, and the second item is 2816 * for the internal vertical edge); per [ISO14496-10] beta values 2817 * must be in the range [0,18]. 2818 * pThresholds - Array of size 8 containing thresholds, TC0, for the left 2819 * vertical edge of each 4x2 chroma block, arranged in vertical 2820 * block order; must be aligned on a 4-byte boundary. Per 2821 * [ISO14496-10] values must be in the range [0,25]. 2822 * pBS - Array of size 16 of BS parameters (values for each 2x2 chroma 2823 * block, arranged in vertical block order). This parameter is the 2824 * same as the pBS parameter passed into FilterDeblockLuma_VerEdge; 2825 * valid in the range [0,4] with the following restrictions: i) 2826 * pBS[i]== 4 may occur only for 0<=i<=3, ii) pBS[i]== 4 if and 2827 * only if pBS[i^3]== 4. Must be 4 byte aligned. 2828 * 2829 * Output Arguments: 2830 * 2831 * pSrcDst -Pointer to filtered output macroblock. 2832 * 2833 * Return Value: 2834 * 2835 * OMX_Sts_NoErr, if the function runs without error. 2836 * 2837 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 2838 * - one or more of the following pointers is NULL: pSrcDst, pAlpha, 2839 * pBeta, pThresholds, or pBS. 2840 * - pSrcDst is not 8-byte aligned. 2841 * - srcdstStep is not a multiple of 8. 2842 * - pThresholds is not 4-byte aligned. 2843 * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 2844 * - pBeta[0] and/or pBeta[1] is outside the range [0,18]. 2845 * - One or more entries in the table pThresholds[0..7] is outside 2846 * of the range [0,25]. 2847 * - pBS is out of range, i.e., one of the following conditions is true: 2848 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 2849 * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 2850 * - pBS is not 4-byte aligned. 2851 * 2852 */ 2853OMXResult omxVCM4P10_FilterDeblockingChroma_VerEdge_I ( 2854 OMX_U8 *pSrcDst, 2855 OMX_S32 srcdstStep, 2856 const OMX_U8 *pAlpha, 2857 const OMX_U8 *pBeta, 2858 const OMX_U8 *pThresholds, 2859 const OMX_U8 *pBS 2860); 2861 2862 2863 2864/** 2865 * Function: omxVCM4P10_FilterDeblockingChroma_HorEdge_I (6.3.3.3.4) 2866 * 2867 * Description: 2868 * Performs in-place deblock filtering on the horizontal edges of the chroma 2869 * macroblock (8x8). 2870 * 2871 * Input Arguments: 2872 * 2873 * pSrcDst - pointer to the input macroblock; must be 8-byte aligned. 2874 * srcdstStep - array step; must be a multiple of 8. 2875 * pAlpha - array of size 2 containing alpha thresholds; the first element 2876 * contains the threshold for the external horizontal edge, and the 2877 * second element contains the threshold for internal horizontal 2878 * edge. Per [ISO14496-10] alpha values must be in the range 2879 * [0,255]. 2880 * pBeta - array of size 2 containing beta thresholds; the first element 2881 * contains the threshold for the external horizontal edge, and the 2882 * second element contains the threshold for the internal 2883 * horizontal edge. Per [ISO14496-10] beta values must be in the 2884 * range [0,18]. 2885 * pThresholds - array of size 8 containing thresholds, TC0, for the top 2886 * horizontal edge of each 2x4 chroma block, arranged in horizontal 2887 * block order; must be aligned on a 4-byte boundary. Per 2888 * [ISO14496-10] values must be in the range [0,25]. 2889 * pBS - array of size 16 containing BS parameters for each 2x2 chroma 2890 * block, arranged in horizontal block order; valid in the range 2891 * [0,4] with the following restrictions: i) pBS[i]== 4 may occur 2892 * only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 4. 2893 * Must be 4-byte aligned. 2894 * 2895 * Output Arguments: 2896 * 2897 * pSrcDst -Pointer to filtered output macroblock. 2898 * 2899 * Return Value: 2900 * 2901 * OMX_Sts_NoErr, if the function runs without error. 2902 * 2903 * OMX_Sts_BadArgErr, if one of the following cases occurs: 2904 * - any of the following pointers is NULL: 2905 * pSrcDst, pAlpha, pBeta, pThresholds, or pBS. 2906 * - pSrcDst is not 8-byte aligned. 2907 * - srcdstStep is not a multiple of 8. 2908 * - pThresholds is not 4-byte aligned. 2909 * - pAlpha[0] and/or pAlpha[1] is outside the range [0,255]. 2910 * - pBeta[0] and/or pBeta[1] is outside the range [0,18]. 2911 * - One or more entries in the table pThresholds[0..7] is outside 2912 * of the range [0,25]. 2913 * - pBS is out of range, i.e., one of the following conditions is true: 2914 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 2915 * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 2916 * - pBS is not 4-byte aligned. 2917 * 2918 */ 2919OMXResult omxVCM4P10_FilterDeblockingChroma_HorEdge_I ( 2920 OMX_U8 *pSrcDst, 2921 OMX_S32 srcdstStep, 2922 const OMX_U8 *pAlpha, 2923 const OMX_U8 *pBeta, 2924 const OMX_U8 *pThresholds, 2925 const OMX_U8 *pBS 2926); 2927 2928 2929 2930/** 2931 * Function: omxVCM4P10_DeblockLuma_I (6.3.3.3.5) 2932 * 2933 * Description: 2934 * This function performs in-place deblock filtering the horizontal and 2935 * vertical edges of a luma macroblock (16x16). 2936 * 2937 * Input Arguments: 2938 * 2939 * pSrcDst - pointer to the input macroblock; must be 16-byte aligned. 2940 * srcdstStep - image width; must be a multiple of 16. 2941 * pAlpha - pointer to a 2x2 table of alpha thresholds, organized as 2942 * follows: {external vertical edge, internal vertical edge, 2943 * external horizontal edge, internal horizontal edge }. Per 2944 * [ISO14496-10] alpha values must be in the range [0,255]. 2945 * pBeta - pointer to a 2x2 table of beta thresholds, organized as follows: 2946 * {external vertical edge, internal vertical edge, external 2947 * horizontal edge, internal horizontal edge }. Per [ISO14496-10] 2948 * beta values must be in the range [0,18]. 2949 * pThresholds - pointer to a 16x2 table of threshold (TC0), organized as 2950 * follows: {values for the left or above edge of each 4x4 block, 2951 * arranged in vertical block order and then in horizontal block 2952 * order}; must be aligned on a 4-byte boundary. Per [ISO14496-10] 2953 * values must be in the range [0,25]. 2954 * pBS - pointer to a 16x2 table of BS parameters arranged in scan block 2955 * order for vertical edges and then horizontal edges; valid in the 2956 * range [0,4] with the following restrictions: i) pBS[i]== 4 may 2957 * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 2958 * 4. Must be 4-byte aligned. 2959 * 2960 * Output Arguments: 2961 * 2962 * pSrcDst - pointer to filtered output macroblock. 2963 * 2964 * Return Value: 2965 * 2966 * OMX_Sts_NoErr - no error 2967 * OMX_Sts_BadArgErr - bad arguments 2968 * - one or more of the following pointers is NULL: pSrcDst, pAlpha, 2969 * pBeta, pThresholds or pBS. 2970 * - pSrcDst is not 16-byte aligned. 2971 * - either pThresholds or pBS is not aligned on a 4-byte boundary. 2972 * - one or more entries in the table pAlpha[0..3] is outside the range 2973 * [0,255]. 2974 * - one or more entries in the table pBeta[0..3] is outside the range 2975 * [0,18]. 2976 * - one or more entries in the table pThresholds[0..31]is outside of 2977 * the range [0,25]. 2978 * - pBS is out of range, i.e., one of the following conditions is true: 2979 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 2980 * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 2981 * - srcdstStep is not a multiple of 16. 2982 * 2983 */ 2984OMXResult omxVCM4P10_DeblockLuma_I ( 2985 OMX_U8 *pSrcDst, 2986 OMX_S32 srcdstStep, 2987 const OMX_U8 *pAlpha, 2988 const OMX_U8 *pBeta, 2989 const OMX_U8 *pThresholds, 2990 const OMX_U8 *pBS 2991); 2992 2993 2994 2995/** 2996 * Function: omxVCM4P10_DeblockChroma_I (6.3.3.3.6) 2997 * 2998 * Description: 2999 * Performs in-place deblocking filtering on all edges of the chroma 3000 * macroblock (16x16). 3001 * 3002 * Input Arguments: 3003 * 3004 * pSrcDst - pointer to the input macroblock; must be 8-byte aligned. 3005 * srcdstStep - step of the arrays; must be a multiple of 8. 3006 * pAlpha - pointer to a 2x2 array of alpha thresholds, organized as 3007 * follows: {external vertical edge, internal vertical edge, 3008 * external horizontal edge, internal horizontal edge }. Per 3009 * [ISO14496-10] alpha values must be in the range [0,255]. 3010 * pBeta - pointer to a 2x2 array of Beta Thresholds, organized as follows: 3011 * { external vertical edge, internal vertical edge, external 3012 * horizontal edge, internal horizontal edge }. Per [ISO14496-10] 3013 * beta values must be in the range [0,18]. 3014 * pThresholds - array of size 8x2 of Thresholds (TC0) (values for the left 3015 * or above edge of each 4x2 or 2x4 block, arranged in vertical 3016 * block order and then in horizontal block order); must be aligned 3017 * on a 4-byte boundary. Per [ISO14496-10] values must be in the 3018 * range [0,25]. 3019 * pBS - array of size 16x2 of BS parameters (arranged in scan block order 3020 * for vertical edges and then horizontal edges); valid in the 3021 * range [0,4] with the following restrictions: i) pBS[i]== 4 may 3022 * occur only for 0<=i<=3, ii) pBS[i]== 4 if and only if pBS[i^3]== 3023 * 4. Must be 4-byte aligned. 3024 * 3025 * Output Arguments: 3026 * 3027 * pSrcDst - pointer to filtered output macroblock. 3028 * 3029 * Return Value: 3030 * 3031 * OMX_Sts_NoErr - no error 3032 * OMX_Sts_BadArgErr - bad arguments 3033 * - one or more of the following pointers is NULL: pSrcDst, pAlpha, 3034 * pBeta, pThresholds, or pBS. 3035 * - pSrcDst is not 8-byte aligned. 3036 * - either pThresholds or pBS is not 4-byte aligned. 3037 * - one or more entries in the table pAlpha[0..3] is outside the range 3038 * [0,255]. 3039 * - one or more entries in the table pBeta[0..3] is outside the range 3040 * [0,18]. 3041 * - one or more entries in the table pThresholds[0..15]is outside of 3042 * the range [0,25]. 3043 * - pBS is out of range, i.e., one of the following conditions is true: 3044 * pBS[i]<0, pBS[i]>4, pBS[i]==4 for i>=4, or 3045 * (pBS[i]==4 && pBS[i^3]!=4) for 0<=i<=3. 3046 * - srcdstStep is not a multiple of 8. 3047 * 3048 */ 3049OMXResult omxVCM4P10_DeblockChroma_I ( 3050 OMX_U8 *pSrcDst, 3051 OMX_S32 srcdstStep, 3052 const OMX_U8 *pAlpha, 3053 const OMX_U8 *pBeta, 3054 const OMX_U8 *pThresholds, 3055 const OMX_U8 *pBS 3056); 3057 3058 3059 3060/** 3061 * Function: omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC (6.3.4.1.1) 3062 * 3063 * Description: 3064 * Performs CAVLC decoding and inverse raster scan for a 2x2 block of 3065 * ChromaDCLevel. The decoded coefficients in the packed position-coefficient 3066 * buffer are stored in reverse zig-zag order, i.e., the first buffer element 3067 * contains the last non-zero postion-coefficient pair of the block. Within 3068 * each position-coefficient pair, the position entry indicates the 3069 * raster-scan position of the coefficient, while the coefficient entry 3070 * contains the coefficient value. 3071 * 3072 * Input Arguments: 3073 * 3074 * ppBitStream - Double pointer to current byte in bit stream buffer 3075 * pOffset - Pointer to current bit position in the byte pointed to by 3076 * *ppBitStream; valid in the range [0,7]. 3077 * 3078 * Output Arguments: 3079 * 3080 * ppBitStream - *ppBitStream is updated after each block is decoded 3081 * pOffset - *pOffset is updated after each block is decoded 3082 * pNumCoeff - Pointer to the number of nonzero coefficients in this block 3083 * ppPosCoefBuf - Double pointer to destination residual 3084 * coefficient-position pair buffer. Buffer position 3085 * (*ppPosCoefBuf) is updated upon return, unless there are only 3086 * zero coefficients in the currently decoded block. In this case 3087 * the caller is expected to bypass the transform/dequantization of 3088 * the empty blocks. 3089 * 3090 * Return Value: 3091 * 3092 * OMX_Sts_NoErr, if the function runs without error. 3093 * 3094 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3095 * - ppBitStream or pOffset is NULL. 3096 * - ppPosCoefBuf or pNumCoeff is NULL. 3097 * OMX_Sts_Err - if one of the following is true: 3098 * - an illegal code is encountered in the bitstream 3099 * 3100 */ 3101OMXResult omxVCM4P10_DecodeChromaDcCoeffsToPairCAVLC ( 3102 const OMX_U8 **ppBitStream, 3103 OMX_S32*pOffset, 3104 OMX_U8 *pNumCoeff, 3105 OMX_U8 **ppPosCoefbuf 3106); 3107 3108 3109 3110/** 3111 * Function: omxVCM4P10_DecodeCoeffsToPairCAVLC (6.3.4.1.2) 3112 * 3113 * Description: 3114 * Performs CAVLC decoding and inverse zigzag scan for 4x4 block of 3115 * Intra16x16DCLevel, Intra16x16ACLevel, LumaLevel, and ChromaACLevel. Inverse 3116 * field scan is not supported. The decoded coefficients in the packed 3117 * position-coefficient buffer are stored in reverse zig-zag order, i.e., the 3118 * first buffer element contains the last non-zero postion-coefficient pair of 3119 * the block. Within each position-coefficient pair, the position entry 3120 * indicates the raster-scan position of the coefficient, while the 3121 * coefficient entry contains the coefficient value. 3122 * 3123 * Input Arguments: 3124 * 3125 * ppBitStream -Double pointer to current byte in bit stream buffer 3126 * pOffset - Pointer to current bit position in the byte pointed to by 3127 * *ppBitStream; valid in the range [0,7]. 3128 * sMaxNumCoeff - Maximum the number of non-zero coefficients in current 3129 * block 3130 * sVLCSelect - VLC table selector, obtained from the number of non-zero 3131 * coefficients contained in the above and left 4x4 blocks. It is 3132 * equivalent to the variable nC described in H.264 standard table 3133 * 9 5, except its value can t be less than zero. 3134 * 3135 * Output Arguments: 3136 * 3137 * ppBitStream - *ppBitStream is updated after each block is decoded. 3138 * Buffer position (*ppPosCoefBuf) is updated upon return, unless 3139 * there are only zero coefficients in the currently decoded block. 3140 * In this case the caller is expected to bypass the 3141 * transform/dequantization of the empty blocks. 3142 * pOffset - *pOffset is updated after each block is decoded 3143 * pNumCoeff - Pointer to the number of nonzero coefficients in this block 3144 * ppPosCoefBuf - Double pointer to destination residual 3145 * coefficient-position pair buffer 3146 * 3147 * Return Value: 3148 * OMX_Sts_NoErr, if the function runs without error. 3149 * 3150 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3151 * - ppBitStream or pOffset is NULL. 3152 * - ppPosCoefBuf or pNumCoeff is NULL. 3153 * - sMaxNumCoeff is not equal to either 15 or 16. 3154 * - sVLCSelect is less than 0. 3155 * 3156 * OMX_Sts_Err - if one of the following is true: 3157 * - an illegal code is encountered in the bitstream 3158 * 3159 */ 3160OMXResult omxVCM4P10_DecodeCoeffsToPairCAVLC ( 3161 const OMX_U8 **ppBitStream, 3162 OMX_S32 *pOffset, 3163 OMX_U8 *pNumCoeff, 3164 OMX_U8 **ppPosCoefbuf, 3165 OMX_INT sVLCSelect, 3166 OMX_INT sMaxNumCoeff 3167); 3168 3169 3170 3171/** 3172 * Function: omxVCM4P10_TransformDequantLumaDCFromPair (6.3.4.2.1) 3173 * 3174 * Description: 3175 * Reconstructs the 4x4 LumaDC block from the coefficient-position pair 3176 * buffer, performs integer inverse, and dequantization for 4x4 LumaDC 3177 * coefficients, and updates the pair buffer pointer to the next non-empty 3178 * block. 3179 * 3180 * Input Arguments: 3181 * 3182 * ppSrc - Double pointer to residual coefficient-position pair buffer 3183 * output by CALVC decoding 3184 * QP - Quantization parameter QpY 3185 * 3186 * Output Arguments: 3187 * 3188 * ppSrc - *ppSrc is updated to the start of next non empty block 3189 * pDst - Pointer to the reconstructed 4x4 LumaDC coefficients buffer; must 3190 * be aligned on a 8-byte boundary. 3191 * 3192 * Return Value: 3193 * OMX_Sts_NoErr, if the function runs without error. 3194 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3195 * - ppSrc or pDst is NULL. 3196 * - pDst is not 8 byte aligned. 3197 * - QP is not in the range of [0-51]. 3198 * 3199 */ 3200OMXResult omxVCM4P10_TransformDequantLumaDCFromPair ( 3201 const OMX_U8 **ppSrc, 3202 OMX_S16 *pDst, 3203 OMX_INT QP 3204); 3205 3206 3207 3208/** 3209 * Function: omxVCM4P10_TransformDequantChromaDCFromPair (6.3.4.2.2) 3210 * 3211 * Description: 3212 * Reconstruct the 2x2 ChromaDC block from coefficient-position pair buffer, 3213 * perform integer inverse transformation, and dequantization for 2x2 chroma 3214 * DC coefficients, and update the pair buffer pointer to next non-empty 3215 * block. 3216 * 3217 * Input Arguments: 3218 * 3219 * ppSrc - Double pointer to residual coefficient-position pair buffer 3220 * output by CALVC decoding 3221 * QP - Quantization parameter QpC 3222 * 3223 * Output Arguments: 3224 * 3225 * ppSrc - *ppSrc is updated to the start of next non empty block 3226 * pDst - Pointer to the reconstructed 2x2 ChromaDC coefficients buffer; 3227 * must be aligned on a 4-byte boundary. 3228 * 3229 * Return Value: 3230 * OMX_Sts_NoErr, if the function runs without error. 3231 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3232 * - ppSrc or pDst is NULL. 3233 * - pDst is not 4-byte aligned. 3234 * - QP is not in the range of [0-51]. 3235 * 3236 */ 3237OMXResult omxVCM4P10_TransformDequantChromaDCFromPair ( 3238 const OMX_U8 **ppSrc, 3239 OMX_S16 *pDst, 3240 OMX_INT QP 3241); 3242 3243 3244 3245/** 3246 * Function: omxVCM4P10_DequantTransformResidualFromPairAndAdd (6.3.4.2.3) 3247 * 3248 * Description: 3249 * Reconstruct the 4x4 residual block from coefficient-position pair buffer, 3250 * perform dequantization and integer inverse transformation for 4x4 block of 3251 * residuals with previous intra prediction or motion compensation data, and 3252 * update the pair buffer pointer to next non-empty block. If pDC == NULL, 3253 * there re 16 non-zero AC coefficients at most in the packed buffer starting 3254 * from 4x4 block position 0; If pDC != NULL, there re 15 non-zero AC 3255 * coefficients at most in the packet buffer starting from 4x4 block position 3256 * 1. 3257 * 3258 * Input Arguments: 3259 * 3260 * ppSrc - Double pointer to residual coefficient-position pair buffer 3261 * output by CALVC decoding 3262 * pPred - Pointer to the predicted 4x4 block; must be aligned on a 4-byte 3263 * boundary 3264 * predStep - Predicted frame step size in bytes; must be a multiple of 4 3265 * dstStep - Destination frame step in bytes; must be a multiple of 4 3266 * pDC - Pointer to the DC coefficient of this block, NULL if it doesn't 3267 * exist 3268 * QP - QP Quantization parameter. It should be QpC in chroma 4x4 block 3269 * decoding, otherwise it should be QpY. 3270 * AC - Flag indicating if at least one non-zero AC coefficient exists 3271 * 3272 * Output Arguments: 3273 * 3274 * pDst - pointer to the reconstructed 4x4 block data; must be aligned on a 3275 * 4-byte boundary 3276 * 3277 * Return Value: 3278 * OMX_Sts_NoErr, if the function runs without error. 3279 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3280 * - pPred or pDst is NULL. 3281 * - pPred or pDst is not 4-byte aligned. 3282 * - predStep or dstStep is not a multiple of 4. 3283 * - AC !=0 and Qp is not in the range of [0-51] or ppSrc == NULL. 3284 * - AC ==0 && pDC ==NULL. 3285 * 3286 */ 3287OMXResult omxVCM4P10_DequantTransformResidualFromPairAndAdd ( 3288 const OMX_U8 **ppSrc, 3289 const OMX_U8 *pPred, 3290 const OMX_S16 *pDC, 3291 OMX_U8 *pDst, 3292 OMX_INT predStep, 3293 OMX_INT dstStep, 3294 OMX_INT QP, 3295 OMX_INT AC 3296); 3297 3298 3299 3300/** 3301 * Function: omxVCM4P10_MEGetBufSize (6.3.5.1.1) 3302 * 3303 * Description: 3304 * Computes the size, in bytes, of the vendor-specific specification 3305 * structure for the omxVCM4P10 motion estimation functions BlockMatch_Integer 3306 * and MotionEstimationMB. 3307 * 3308 * Input Arguments: 3309 * 3310 * MEmode - motion estimation mode; available modes are defined by the 3311 * enumerated type OMXVCM4P10MEMode 3312 * pMEParams -motion estimation parameters 3313 * 3314 * Output Arguments: 3315 * 3316 * pSize - pointer to the number of bytes required for the motion 3317 * estimation specification structure 3318 * 3319 * Return Value: 3320 * OMX_Sts_NoErr, if the function runs without error. 3321 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3322 * - pMEParams or pSize is NULL. 3323 * - an invalid MEMode is specified. 3324 * 3325 */ 3326OMXResult omxVCM4P10_MEGetBufSize ( 3327 OMXVCM4P10MEMode MEmode, 3328 const OMXVCM4P10MEParams *pMEParams, 3329 OMX_U32 *pSize 3330); 3331 3332 3333 3334/** 3335 * Function: omxVCM4P10_MEInit (6.3.5.1.2) 3336 * 3337 * Description: 3338 * Initializes the vendor-specific specification structure required for the 3339 * omxVCM4P10 motion estimation functions: BlockMatch_Integer and 3340 * MotionEstimationMB. Memory for the specification structure *pMESpec must be 3341 * allocated prior to calling the function, and should be aligned on a 4-byte 3342 * boundary. The number of bytes required for the specification structure can 3343 * be determined using the function omxVCM4P10_MEGetBufSize. Following 3344 * initialization by this function, the vendor-specific structure *pMESpec 3345 * should contain an implementation-specific representation of all motion 3346 * estimation parameters received via the structure pMEParams, for example 3347 * searchRange16x16, searchRange8x8, etc. 3348 * 3349 * Input Arguments: 3350 * 3351 * MEmode - motion estimation mode; available modes are defined by the 3352 * enumerated type OMXVCM4P10MEMode 3353 * pMEParams - motion estimation parameters 3354 * pMESpec - pointer to the uninitialized ME specification structure 3355 * 3356 * Output Arguments: 3357 * 3358 * pMESpec - pointer to the initialized ME specification structure 3359 * 3360 * Return Value: 3361 * OMX_Sts_NoErr, if the function runs without error. 3362 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3363 * - pMEParams or pSize is NULL. 3364 * - an invalid value was specified for the parameter MEmode 3365 * - a negative or zero value was specified for one of the search ranges 3366 * (e.g., pMBParams >searchRange8x8, pMEParams->searchRange16x16, etc.) 3367 * - either in isolation or in combination, one or more of the enables or 3368 * search ranges in the structure *pMEParams were configured such 3369 * that the requested behavior fails to comply with [ISO14496-10]. 3370 * 3371 */ 3372OMXResult omxVCM4P10_MEInit ( 3373 OMXVCM4P10MEMode MEmode, 3374 const OMXVCM4P10MEParams *pMEParams, 3375 void *pMESpec 3376); 3377 3378 3379 3380/** 3381 * Function: omxVCM4P10_BlockMatch_Integer (6.3.5.2.1) 3382 * 3383 * Description: 3384 * Performs integer block match. Returns best MV and associated cost. 3385 * 3386 * Input Arguments: 3387 * 3388 * pSrcOrgY - Pointer to the top-left corner of the current block: 3389 * If iBlockWidth==4, 4-byte alignment required. 3390 * If iBlockWidth==8, 8-byte alignment required. 3391 * If iBlockWidth==16, 16-byte alignment required. 3392 * pSrcRefY - Pointer to the top-left corner of the co-located block in the 3393 * reference picture: 3394 * If iBlockWidth==4, 4-byte alignment required. 3395 * If iBlockWidth==8, 8-byte alignment required. 3396 * If iBlockWidth==16, 16-byte alignment required. 3397 * nSrcOrgStep - Stride of the original picture plane, expressed in terms 3398 * of integer pixels; must be a multiple of iBlockWidth. 3399 * nSrcRefStep - Stride of the reference picture plane, expressed in terms 3400 * of integer pixels 3401 * pRefRect - pointer to the valid reference rectangle inside the reference 3402 * picture plane 3403 * nCurrPointPos - position of the current block in the current plane 3404 * iBlockWidth - Width of the current block, expressed in terms of integer 3405 * pixels; must be equal to either 4, 8, or 16. 3406 * iBlockHeight - Height of the current block, expressed in terms of 3407 * integer pixels; must be equal to either 4, 8, or 16. 3408 * nLamda - Lamda factor; used to compute motion cost 3409 * pMVPred - Predicted MV; used to compute motion cost, expressed in terms 3410 * of 1/4-pel units 3411 * pMVCandidate - Candidate MV; used to initialize the motion search, 3412 * expressed in terms of integer pixels 3413 * pMESpec - pointer to the ME specification structure 3414 * 3415 * Output Arguments: 3416 * 3417 * pDstBestMV - Best MV resulting from integer search, expressed in terms 3418 * of 1/4-pel units 3419 * pBestCost - Motion cost associated with the best MV; computed as 3420 * SAD+Lamda*BitsUsedByMV 3421 * 3422 * Return Value: 3423 * OMX_Sts_NoErr, if the function runs without error. 3424 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3425 * - any of the following pointers are NULL: 3426 * pSrcOrgY, pSrcRefY, pRefRect, pMVPred, pMVCandidate, or pMESpec. 3427 * - Either iBlockWidth or iBlockHeight are values other than 4, 8, or 16. 3428 * - Any alignment restrictions are violated 3429 * 3430 */ 3431OMXResult omxVCM4P10_BlockMatch_Integer ( 3432 const OMX_U8 *pSrcOrgY, 3433 OMX_S32 nSrcOrgStep, 3434 const OMX_U8 *pSrcRefY, 3435 OMX_S32 nSrcRefStep, 3436 const OMXRect *pRefRect, 3437 const OMXVCM4P2Coordinate *pCurrPointPos, 3438 OMX_U8 iBlockWidth, 3439 OMX_U8 iBlockHeight, 3440 OMX_U32 nLamda, 3441 const OMXVCMotionVector *pMVPred, 3442 const OMXVCMotionVector *pMVCandidate, 3443 OMXVCMotionVector *pBestMV, 3444 OMX_S32 *pBestCost, 3445 void *pMESpec 3446); 3447 3448 3449 3450/** 3451 * Function: omxVCM4P10_BlockMatch_Half (6.3.5.2.2) 3452 * 3453 * Description: 3454 * Performs a half-pel block match using results from a prior integer search. 3455 * Returns the best MV and associated cost. This function estimates the 3456 * half-pixel motion vector by interpolating the integer resolution motion 3457 * vector referenced by the input parameter pSrcDstBestMV, i.e., the initial 3458 * integer MV is generated externally. The function 3459 * omxVCM4P10_BlockMatch_Integer may be used for integer motion estimation. 3460 * 3461 * Input Arguments: 3462 * 3463 * pSrcOrgY - Pointer to the current position in original picture plane: 3464 * If iBlockWidth==4, 4-byte alignment required. 3465 * If iBlockWidth==8, 8-byte alignment required. 3466 * If iBlockWidth==16, 16-byte alignment required. 3467 * pSrcRefY - Pointer to the top-left corner of the co-located block in the 3468 * reference picture: 3469 * If iBlockWidth==4, 4-byte alignment required. 3470 * If iBlockWidth==8, 8-byte alignment required. 3471 * If iBlockWidth==16, 16-byte alignment required. 3472 * nSrcOrgStep - Stride of the original picture plane in terms of full 3473 * pixels; must be a multiple of iBlockWidth. 3474 * nSrcRefStep - Stride of the reference picture plane in terms of full 3475 * pixels 3476 * iBlockWidth - Width of the current block in terms of full pixels; must 3477 * be equal to either 4, 8, or 16. 3478 * iBlockHeight - Height of the current block in terms of full pixels; must 3479 * be equal to either 4, 8, or 16. 3480 * nLamda - Lamda factor, used to compute motion cost 3481 * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to 3482 * compute motion cost 3483 * pSrcDstBestMV - The best MV resulting from a prior integer search, 3484 * represented in terms of 1/4-pel units 3485 * 3486 * Output Arguments: 3487 * 3488 * pSrcDstBestMV - Best MV resulting from the half-pel search, expressed in 3489 * terms of 1/4-pel units 3490 * pBestCost - Motion cost associated with the best MV; computed as 3491 * SAD+Lamda*BitsUsedByMV 3492 * 3493 * Return Value: 3494 * OMX_Sts_NoErr, if the function runs without error. 3495 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3496 * - any of the following pointers is NULL: pSrcOrgY, pSrcRefY, 3497 * pSrcDstBestMV, pMVPred, pBestCost 3498 * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16. 3499 * - Any alignment restrictions are violated 3500 * 3501 */ 3502OMXResult omxVCM4P10_BlockMatch_Half ( 3503 const OMX_U8 *pSrcOrgY, 3504 OMX_S32 nSrcOrgStep, 3505 const OMX_U8 *pSrcRefY, 3506 OMX_S32 nSrcRefStep, 3507 OMX_U8 iBlockWidth, 3508 OMX_U8 iBlockHeight, 3509 OMX_U32 nLamda, 3510 const OMXVCMotionVector *pMVPred, 3511 OMXVCMotionVector *pSrcDstBestMV, 3512 OMX_S32 *pBestCost 3513); 3514 3515 3516 3517/** 3518 * Function: omxVCM4P10_BlockMatch_Quarter (6.3.5.2.3) 3519 * 3520 * Description: 3521 * Performs a quarter-pel block match using results from a prior half-pel 3522 * search. Returns the best MV and associated cost. This function estimates 3523 * the quarter-pixel motion vector by interpolating the half-pel resolution 3524 * motion vector referenced by the input parameter pSrcDstBestMV, i.e., the 3525 * initial half-pel MV is generated externally. The function 3526 * omxVCM4P10_BlockMatch_Half may be used for half-pel motion estimation. 3527 * 3528 * Input Arguments: 3529 * 3530 * pSrcOrgY - Pointer to the current position in original picture plane: 3531 * If iBlockWidth==4, 4-byte alignment required. 3532 * If iBlockWidth==8, 8-byte alignment required. 3533 * If iBlockWidth==16, 16-byte alignment required. 3534 * pSrcRefY - Pointer to the top-left corner of the co-located block in the 3535 * reference picture: 3536 * If iBlockWidth==4, 4-byte alignment required. 3537 * If iBlockWidth==8, 8-byte alignment required. 3538 * If iBlockWidth==16, 16-byte alignment required. 3539 * nSrcOrgStep - Stride of the original picture plane in terms of full 3540 * pixels; must be a multiple of iBlockWidth. 3541 * nSrcRefStep - Stride of the reference picture plane in terms of full 3542 * pixels 3543 * iBlockWidth - Width of the current block in terms of full pixels; must 3544 * be equal to either 4, 8, or 16. 3545 * iBlockHeight - Height of the current block in terms of full pixels; must 3546 * be equal to either 4, 8, or 16. 3547 * nLamda - Lamda factor, used to compute motion cost 3548 * pMVPred - Predicted MV, represented in terms of 1/4-pel units; used to 3549 * compute motion cost 3550 * pSrcDstBestMV - The best MV resulting from a prior half-pel search, 3551 * represented in terms of 1/4 pel units 3552 * 3553 * Output Arguments: 3554 * 3555 * pSrcDstBestMV - Best MV resulting from the quarter-pel search, expressed 3556 * in terms of 1/4-pel units 3557 * pBestCost - Motion cost associated with the best MV; computed as 3558 * SAD+Lamda*BitsUsedByMV 3559 * 3560 * Return Value: 3561 * OMX_Sts_NoErr, if the function runs without error. 3562 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3563 * - One or more of the following pointers is NULL: 3564 * pSrcOrgY, pSrcRefY, pSrcDstBestMV, pMVPred, pBestCost 3565 * - iBlockWidth or iBlockHeight are equal to values other than 4, 8, or 16. 3566 * - Any alignment restrictions are violated 3567 * 3568 */ 3569OMXResult omxVCM4P10_BlockMatch_Quarter ( 3570 const OMX_U8 *pSrcOrgY, 3571 OMX_S32 nSrcOrgStep, 3572 const OMX_U8 *pSrcRefY, 3573 OMX_S32 nSrcRefStep, 3574 OMX_U8 iBlockWidth, 3575 OMX_U8 iBlockHeight, 3576 OMX_U32 nLamda, 3577 const OMXVCMotionVector *pMVPred, 3578 OMXVCMotionVector *pSrcDstBestMV, 3579 OMX_S32 *pBestCost 3580); 3581 3582 3583 3584/** 3585 * Function: omxVCM4P10_MotionEstimationMB (6.3.5.3.1) 3586 * 3587 * Description: 3588 * Performs MB-level motion estimation and selects best motion estimation 3589 * strategy from the set of modes supported in baseline profile [ISO14496-10]. 3590 * 3591 * Input Arguments: 3592 * 3593 * pSrcCurrBuf - Pointer to the current position in original picture plane; 3594 * 16-byte alignment required 3595 * pSrcRefBufList - Pointer to an array with 16 entries. Each entry points 3596 * to the top-left corner of the co-located MB in a reference 3597 * picture. The array is filled from low-to-high with valid 3598 * reference frame pointers; the unused high entries should be set 3599 * to NULL. Ordering of the reference frames should follow 3600 * [ISO14496-10] subclause 8.2.4 Decoding Process for Reference 3601 * Picture Lists. The entries must be 16-byte aligned. 3602 * pSrcRecBuf - Pointer to the top-left corner of the co-located MB in the 3603 * reconstructed picture; must be 16-byte aligned. 3604 * SrcCurrStep - Width of the original picture plane in terms of full 3605 * pixels; must be a multiple of 16. 3606 * SrcRefStep - Width of the reference picture plane in terms of full 3607 * pixels; must be a multiple of 16. 3608 * SrcRecStep - Width of the reconstructed picture plane in terms of full 3609 * pixels; must be a multiple of 16. 3610 * pRefRect - Pointer to the valid reference rectangle; relative to the 3611 * image origin. 3612 * pCurrPointPos - Position of the current macroblock in the current plane. 3613 * Lambda - Lagrange factor for computing the cost function 3614 * pMESpec - Pointer to the motion estimation specification structure; must 3615 * have been allocated and initialized prior to calling this 3616 * function. 3617 * pMBInter - Array, of dimension four, containing pointers to information 3618 * associated with four adjacent type INTER MBs (Left, Top, 3619 * Top-Left, Top-Right). Any pointer in the array may be set equal 3620 * to NULL if the corresponding MB doesn t exist or is not of type 3621 * INTER. 3622 * - pMBInter[0] - Pointer to left MB information 3623 * - pMBInter[1] - Pointer to top MB information 3624 * - pMBInter[2] - Pointer to top-left MB information 3625 * - pMBInter[3] - Pointer to top-right MB information 3626 * pMBIntra - Array, of dimension four, containing pointers to information 3627 * associated with four adjacent type INTRA MBs (Left, Top, 3628 * Top-Left, Top-Right). Any pointer in the array may be set equal 3629 * to NULL if the corresponding MB doesn t exist or is not of type 3630 * INTRA. 3631 * - pMBIntra[0] - Pointer to left MB information 3632 * - pMBIntra[1] - Pointer to top MB information 3633 * - pMBIntra[2] - Pointer to top-left MB information 3634 * - pMBIntra[3] - Pointer to top-right MB information 3635 * pSrcDstMBCurr - Pointer to information structure for the current MB. 3636 * The following entries should be set prior to calling the 3637 * function: sliceID - the number of the slice the to which the 3638 * current MB belongs. 3639 * 3640 * Output Arguments: 3641 * 3642 * pDstCost - Pointer to the minimum motion cost for the current MB. 3643 * pDstBlockSAD - Pointer to the array of SADs for each of the sixteen luma 3644 * 4x4 blocks in each MB. The block SADs are in scan order for 3645 * each MB. For implementations that cannot compute the SAD values 3646 * individually, the maximum possible value (0xffff) is returned 3647 * for each of the 16 block SAD entries. 3648 * pSrcDstMBCurr - Pointer to updated information structure for the current 3649 * MB after MB-level motion estimation has been completed. The 3650 * following fields are updated by the ME function. The following 3651 * parameter set quantifies the MB-level ME search results: 3652 * - MbType 3653 * - subMBType[4] 3654 * - pMV0[4][4] 3655 * - pMVPred[4][4] 3656 * - pRefL0Idx[4] 3657 * - Intra16x16PredMode 3658 * - pIntra4x4PredMode[4][4] 3659 * 3660 * Return Value: 3661 * OMX_Sts_NoErr, if the function runs without error. 3662 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3663 * - One or more of the following pointers is NULL: pSrcCurrBuf, 3664 * pSrcRefBufList, pSrcRecBuf, pRefRect, pCurrPointPos, pMESpec, 3665 * pMBInter, pMBIntra,pSrcDstMBCurr, pDstCost, pSrcRefBufList[0] 3666 * - SrcRefStep, SrcRecStep are not multiples of 16 3667 * - iBlockWidth or iBlockHeight are values other than 4, 8, or 16. 3668 * - Any alignment restrictions are violated 3669 * 3670 */ 3671OMXResult omxVCM4P10_MotionEstimationMB ( 3672 const OMX_U8 *pSrcCurrBuf, 3673 OMX_S32 SrcCurrStep, 3674 const OMX_U8 *pSrcRefBufList[15], 3675 OMX_S32 SrcRefStep, 3676 const OMX_U8 *pSrcRecBuf, 3677 OMX_S32 SrcRecStep, 3678 const OMXRect *pRefRect, 3679 const OMXVCM4P2Coordinate *pCurrPointPos, 3680 OMX_U32 Lambda, 3681 void *pMESpec, 3682 const OMXVCM4P10MBInfoPtr *pMBInter, 3683 const OMXVCM4P10MBInfoPtr *pMBIntra, 3684 OMXVCM4P10MBInfoPtr pSrcDstMBCurr, 3685 OMX_INT *pDstCost, 3686 OMX_U16 *pDstBlockSAD 3687); 3688 3689 3690 3691/** 3692 * Function: omxVCM4P10_SAD_4x (6.3.5.4.1) 3693 * 3694 * Description: 3695 * This function calculates the SAD for 4x8 and 4x4 blocks. 3696 * 3697 * Input Arguments: 3698 * 3699 * pSrcOrg -Pointer to the original block; must be aligned on a 4-byte 3700 * boundary. 3701 * iStepOrg -Step of the original block buffer; must be a multiple of 4. 3702 * pSrcRef -Pointer to the reference block 3703 * iStepRef -Step of the reference block buffer 3704 * iHeight -Height of the block; must be equal to either 4 or 8. 3705 * 3706 * Output Arguments: 3707 * 3708 * pDstSAD -Pointer of result SAD 3709 * 3710 * Return Value: 3711 * OMX_Sts_NoErr, if the function runs without error. 3712 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3713 * - One or more of the following pointers is NULL: 3714 * pSrcOrg, pSrcRef, or pDstSAD 3715 * - iHeight is not equal to either 4 or 8. 3716 * - iStepOrg is not a multiple of 4 3717 * - Any alignment restrictions are violated 3718 * 3719 */ 3720OMXResult omxVCM4P10_SAD_4x ( 3721 const OMX_U8 *pSrcOrg, 3722 OMX_U32 iStepOrg, 3723 const OMX_U8 *pSrcRef, 3724 OMX_U32 iStepRef, 3725 OMX_S32 *pDstSAD, 3726 OMX_U32 iHeight 3727); 3728 3729 3730 3731/** 3732 * Function: omxVCM4P10_SADQuar_4x (6.3.5.4.2) 3733 * 3734 * Description: 3735 * This function calculates the SAD between one block (pSrc) and the average 3736 * of the other two (pSrcRef0 and pSrcRef1) for 4x8 or 4x4 blocks. Rounding 3737 * is applied according to the convention (a+b+1)>>1. 3738 * 3739 * Input Arguments: 3740 * 3741 * pSrc - Pointer to the original block; must be aligned on a 4-byte 3742 * boundary. 3743 * pSrcRef0 - Pointer to reference block 0 3744 * pSrcRef1 - Pointer to reference block 1 3745 * iSrcStep - Step of the original block buffer; must be a multiple of 4. 3746 * iRefStep0 - Step of reference block 0 3747 * iRefStep1 - Step of reference block 1 3748 * iHeight - Height of the block; must be equal to either 4 or 8. 3749 * 3750 * Output Arguments: 3751 * 3752 * pDstSAD - Pointer of result SAD 3753 * 3754 * Return Value: 3755 * OMX_Sts_NoErr, if the function runs without error. 3756 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3757 * - iHeight is not equal to either 4 or 8. 3758 * - One or more of the following pointers is NULL: pSrc, pSrcRef0, 3759 * pSrcRef1, pDstSAD. 3760 * - iSrcStep is not a multiple of 4 3761 * - Any alignment restrictions are violated 3762 * 3763 */ 3764OMXResult omxVCM4P10_SADQuar_4x ( 3765 const OMX_U8 *pSrc, 3766 const OMX_U8 *pSrcRef0, 3767 const OMX_U8 *pSrcRef1, 3768 OMX_U32 iSrcStep, 3769 OMX_U32 iRefStep0, 3770 OMX_U32 iRefStep1, 3771 OMX_U32 *pDstSAD, 3772 OMX_U32 iHeight 3773); 3774 3775 3776 3777/** 3778 * Function: omxVCM4P10_SADQuar_8x (6.3.5.4.3) 3779 * 3780 * Description: 3781 * This function calculates the SAD between one block (pSrc) and the average 3782 * of the other two (pSrcRef0 and pSrcRef1) for 8x16, 8x8, or 8x4 blocks. 3783 * Rounding is applied according to the convention (a+b+1)>>1. 3784 * 3785 * Input Arguments: 3786 * 3787 * pSrc - Pointer to the original block; must be aligned on an 8-byte 3788 * boundary. 3789 * pSrcRef0 - Pointer to reference block 0 3790 * pSrcRef1 - Pointer to reference block 1 3791 * iSrcStep - Step of the original block buffer; must be a multiple of 8. 3792 * iRefStep0 - Step of reference block 0 3793 * iRefStep1 - Step of reference block 1 3794 * iHeight - Height of the block; must be equal either 4, 8, or 16. 3795 * 3796 * Output Arguments: 3797 * 3798 * pDstSAD - Pointer of result SAD 3799 * 3800 * Return Value: 3801 * OMX_Sts_NoErr, if the function runs without error. 3802 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3803 * - iHeight is not equal to either 4, 8, or 16. 3804 * - One or more of the following pointers is NULL: pSrc, pSrcRef0, 3805 * pSrcRef1, pDstSAD. 3806 * - iSrcStep is not a multiple of 8 3807 * - Any alignment restrictions are violated 3808 * 3809 */ 3810OMXResult omxVCM4P10_SADQuar_8x ( 3811 const OMX_U8 *pSrc, 3812 const OMX_U8 *pSrcRef0, 3813 const OMX_U8 *pSrcRef1, 3814 OMX_U32 iSrcStep, 3815 OMX_U32 iRefStep0, 3816 OMX_U32 iRefStep1, 3817 OMX_U32 *pDstSAD, 3818 OMX_U32 iHeight 3819); 3820 3821 3822 3823/** 3824 * Function: omxVCM4P10_SADQuar_16x (6.3.5.4.4) 3825 * 3826 * Description: 3827 * This function calculates the SAD between one block (pSrc) and the average 3828 * of the other two (pSrcRef0 and pSrcRef1) for 16x16 or 16x8 blocks. 3829 * Rounding is applied according to the convention (a+b+1)>>1. 3830 * 3831 * Input Arguments: 3832 * 3833 * pSrc - Pointer to the original block; must be aligned on a 16-byte 3834 * boundary. 3835 * pSrcRef0 - Pointer to reference block 0 3836 * pSrcRef1 - Pointer to reference block 1 3837 * iSrcStep - Step of the original block buffer; must be a multiple of 16 3838 * iRefStep0 - Step of reference block 0 3839 * iRefStep1 - Step of reference block 1 3840 * iHeight - Height of the block; must be equal to either 8 or 16 3841 * 3842 * Output Arguments: 3843 * 3844 * pDstSAD -Pointer of result SAD 3845 * 3846 * Return Value: 3847 * OMX_Sts_NoErr, if the function runs without error. 3848 * OMX_Sts_BadArgErr - bad arguments: if one of the following cases occurs: 3849 * - iHeight is not equal to either 8 or 16. 3850 * - One or more of the following pointers is NULL: pSrc, pSrcRef0, 3851 * pSrcRef1, pDstSAD. 3852 * - iSrcStep is not a multiple of 16 3853 * - Any alignment restrictions are violated 3854 * 3855 */ 3856OMXResult omxVCM4P10_SADQuar_16x ( 3857 const OMX_U8 *pSrc, 3858 const OMX_U8 *pSrcRef0, 3859 const OMX_U8 *pSrcRef1, 3860 OMX_U32 iSrcStep, 3861 OMX_U32 iRefStep0, 3862 OMX_U32 iRefStep1, 3863 OMX_U32 *pDstSAD, 3864 OMX_U32 iHeight 3865); 3866 3867 3868 3869/** 3870 * Function: omxVCM4P10_SATD_4x4 (6.3.5.4.5) 3871 * 3872 * Description: 3873 * This function calculates the sum of absolute transform differences (SATD) 3874 * for a 4x4 block by applying a Hadamard transform to the difference block 3875 * and then calculating the sum of absolute coefficient values. 3876 * 3877 * Input Arguments: 3878 * 3879 * pSrcOrg - Pointer to the original block; must be aligned on a 4-byte 3880 * boundary 3881 * iStepOrg - Step of the original block buffer; must be a multiple of 4 3882 * pSrcRef - Pointer to the reference block; must be aligned on a 4-byte 3883 * boundary 3884 * iStepRef - Step of the reference block buffer; must be a multiple of 4 3885 * 3886 * Output Arguments: 3887 * 3888 * pDstSAD - pointer to the resulting SAD 3889 * 3890 * Return Value: 3891 * 3892 * OMX_Sts_NoErr - no error 3893 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 3894 * conditions are true: 3895 * - at least one of the following pointers is NULL: 3896 * pSrcOrg, pSrcRef, or pDstSAD either pSrcOrg 3897 * - pSrcRef is not aligned on a 4-byte boundary 3898 * - iStepOrg <= 0 or iStepOrg is not a multiple of 4 3899 * - iStepRef <= 0 or iStepRef is not a multiple of 4 3900 * 3901 */ 3902OMXResult omxVCM4P10_SATD_4x4 ( 3903 const OMX_U8 *pSrcOrg, 3904 OMX_U32 iStepOrg, 3905 const OMX_U8 *pSrcRef, 3906 OMX_U32 iStepRef, 3907 OMX_U32 *pDstSAD 3908); 3909 3910 3911 3912/** 3913 * Function: omxVCM4P10_InterpolateHalfHor_Luma (6.3.5.5.1) 3914 * 3915 * Description: 3916 * This function performs interpolation for two horizontal 1/2-pel positions 3917 * (-1/2,0) and (1/2, 0) - around a full-pel position. 3918 * 3919 * Input Arguments: 3920 * 3921 * pSrc - Pointer to the top-left corner of the block used to interpolate in 3922 * the reconstruction frame plane. 3923 * iSrcStep - Step of the source buffer. 3924 * iDstStep - Step of the destination(interpolation) buffer; must be a 3925 * multiple of iWidth. 3926 * iWidth - Width of the current block; must be equal to either 4, 8, or 16 3927 * iHeight - Height of the current block; must be equal to 4, 8, or 16 3928 * 3929 * Output Arguments: 3930 * 3931 * pDstLeft -Pointer to the interpolation buffer of the left -pel position 3932 * (-1/2, 0) 3933 * If iWidth==4, 4-byte alignment required. 3934 * If iWidth==8, 8-byte alignment required. 3935 * If iWidth==16, 16-byte alignment required. 3936 * pDstRight -Pointer to the interpolation buffer of the right -pel 3937 * position (1/2, 0) 3938 * If iWidth==4, 4-byte alignment required. 3939 * If iWidth==8, 8-byte alignment required. 3940 * If iWidth==16, 16-byte alignment required. 3941 * 3942 * Return Value: 3943 * 3944 * OMX_Sts_NoErr - no error 3945 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 3946 * conditions are true: 3947 * - at least one of the following pointers is NULL: 3948 * pSrc, pDstLeft, or pDstRight 3949 * - iWidth or iHeight have values other than 4, 8, or 16 3950 * - iWidth==4 but pDstLeft and/or pDstRight is/are not aligned on a 4-byte boundary 3951 * - iWidth==8 but pDstLeft and/or pDstRight is/are not aligned on a 8-byte boundary 3952 * - iWidth==16 but pDstLeft and/or pDstRight is/are not aligned on a 16-byte boundary 3953 * - any alignment restrictions are violated 3954 * 3955 */ 3956OMXResult omxVCM4P10_InterpolateHalfHor_Luma ( 3957 const OMX_U8 *pSrc, 3958 OMX_U32 iSrcStep, 3959 OMX_U8 *pDstLeft, 3960 OMX_U8 *pDstRight, 3961 OMX_U32 iDstStep, 3962 OMX_U32 iWidth, 3963 OMX_U32 iHeight 3964); 3965 3966 3967 3968/** 3969 * Function: omxVCM4P10_InterpolateHalfVer_Luma (6.3.5.5.2) 3970 * 3971 * Description: 3972 * This function performs interpolation for two vertical 1/2-pel positions - 3973 * (0, -1/2) and (0, 1/2) - around a full-pel position. 3974 * 3975 * Input Arguments: 3976 * 3977 * pSrc - Pointer to top-left corner of block used to interpolate in the 3978 * reconstructed frame plane 3979 * iSrcStep - Step of the source buffer. 3980 * iDstStep - Step of the destination (interpolation) buffer; must be a 3981 * multiple of iWidth. 3982 * iWidth - Width of the current block; must be equal to either 4, 8, or 16 3983 * iHeight - Height of the current block; must be equal to either 4, 8, or 16 3984 * 3985 * Output Arguments: 3986 * 3987 * pDstUp -Pointer to the interpolation buffer of the -pel position above 3988 * the current full-pel position (0, -1/2) 3989 * If iWidth==4, 4-byte alignment required. 3990 * If iWidth==8, 8-byte alignment required. 3991 * If iWidth==16, 16-byte alignment required. 3992 * pDstDown -Pointer to the interpolation buffer of the -pel position below 3993 * the current full-pel position (0, 1/2) 3994 * If iWidth==4, 4-byte alignment required. 3995 * If iWidth==8, 8-byte alignment required. 3996 * If iWidth==16, 16-byte alignment required. 3997 * 3998 * Return Value: 3999 * 4000 * OMX_Sts_NoErr - no error 4001 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4002 * conditions are true: 4003 * - at least one of the following pointers is NULL: 4004 * pSrc, pDstUp, or pDstDown 4005 * - iWidth or iHeight have values other than 4, 8, or 16 4006 * - iWidth==4 but pDstUp and/or pDstDown is/are not aligned on a 4-byte boundary 4007 * - iWidth==8 but pDstUp and/or pDstDown is/are not aligned on a 8-byte boundary 4008 * - iWidth==16 but pDstUp and/or pDstDown is/are not aligned on a 16-byte boundary 4009 * 4010 */ 4011OMXResult omxVCM4P10_InterpolateHalfVer_Luma ( 4012 const OMX_U8 *pSrc, 4013 OMX_U32 iSrcStep, 4014 OMX_U8 *pDstUp, 4015 OMX_U8 *pDstDown, 4016 OMX_U32 iDstStep, 4017 OMX_U32 iWidth, 4018 OMX_U32 iHeight 4019); 4020 4021 4022 4023/** 4024 * Function: omxVCM4P10_Average_4x (6.3.5.5.3) 4025 * 4026 * Description: 4027 * This function calculates the average of two 4x4, 4x8 blocks. The result 4028 * is rounded according to (a+b+1)/2. 4029 * 4030 * Input Arguments: 4031 * 4032 * pPred0 - Pointer to the top-left corner of reference block 0 4033 * pPred1 - Pointer to the top-left corner of reference block 1 4034 * iPredStep0 - Step of reference block 0; must be a multiple of 4. 4035 * iPredStep1 - Step of reference block 1; must be a multiple of 4. 4036 * iDstStep - Step of the destination buffer; must be a multiple of 4. 4037 * iHeight - Height of the blocks; must be either 4 or 8. 4038 * 4039 * Output Arguments: 4040 * 4041 * pDstPred - Pointer to the destination buffer. 4-byte alignment required. 4042 * 4043 * Return Value: 4044 * 4045 * OMX_Sts_NoErr - no error 4046 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4047 * conditions are true: 4048 * - at least one of the following pointers is NULL: 4049 * pPred0, pPred1, or pDstPred 4050 * - pDstPred is not aligned on a 4-byte boundary 4051 * - iPredStep0 <= 0 or iPredStep0 is not a multiple of 4 4052 * - iPredStep1 <= 0 or iPredStep1 is not a multiple of 4 4053 * - iDstStep <= 0 or iDstStep is not a multiple of 4 4054 * - iHeight is not equal to either 4 or 8 4055 * 4056 */ 4057OMXResult omxVCM4P10_Average_4x ( 4058 const OMX_U8 *pPred0, 4059 const OMX_U8 *pPred1, 4060 OMX_U32 iPredStep0, 4061 OMX_U32 iPredStep1, 4062 OMX_U8 *pDstPred, 4063 OMX_U32 iDstStep, 4064 OMX_U32 iHeight 4065); 4066 4067 4068 4069/** 4070 * Function: omxVCM4P10_TransformQuant_ChromaDC (6.3.5.6.1) 4071 * 4072 * Description: 4073 * This function performs 2x2 Hadamard transform of chroma DC coefficients 4074 * and then quantizes the coefficients. 4075 * 4076 * Input Arguments: 4077 * 4078 * pSrcDst - Pointer to the 2x2 array of chroma DC coefficients. 8-byte 4079 * alignment required. 4080 * iQP - Quantization parameter; must be in the range [0,51]. 4081 * bIntra - Indicate whether this is an INTRA block. 1-INTRA, 0-INTER 4082 * 4083 * Output Arguments: 4084 * 4085 * pSrcDst - Pointer to transformed and quantized coefficients. 8-byte 4086 * alignment required. 4087 * 4088 * Return Value: 4089 * 4090 * OMX_Sts_NoErr - no error 4091 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4092 * conditions are true: 4093 * - at least one of the following pointers is NULL: 4094 * pSrcDst 4095 * - pSrcDst is not aligned on an 8-byte boundary 4096 * 4097 */ 4098OMXResult omxVCM4P10_TransformQuant_ChromaDC ( 4099 OMX_S16 *pSrcDst, 4100 OMX_U32 iQP, 4101 OMX_U8 bIntra 4102); 4103 4104 4105 4106/** 4107 * Function: omxVCM4P10_TransformQuant_LumaDC (6.3.5.6.2) 4108 * 4109 * Description: 4110 * This function performs a 4x4 Hadamard transform of luma DC coefficients 4111 * and then quantizes the coefficients. 4112 * 4113 * Input Arguments: 4114 * 4115 * pSrcDst - Pointer to the 4x4 array of luma DC coefficients. 16-byte 4116 * alignment required. 4117 * iQP - Quantization parameter; must be in the range [0,51]. 4118 * 4119 * Output Arguments: 4120 * 4121 * pSrcDst - Pointer to transformed and quantized coefficients. 16-byte 4122 * alignment required. 4123 * 4124 * Return Value: 4125 * 4126 * OMX_Sts_NoErr - no error 4127 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4128 * conditions are true: 4129 * - at least one of the following pointers is NULL: pSrcDst 4130 * - pSrcDst is not aligned on an 16-byte boundary 4131 * 4132 */ 4133OMXResult omxVCM4P10_TransformQuant_LumaDC ( 4134 OMX_S16 *pSrcDst, 4135 OMX_U32 iQP 4136); 4137 4138 4139 4140/** 4141 * Function: omxVCM4P10_InvTransformDequant_LumaDC (6.3.5.6.3) 4142 * 4143 * Description: 4144 * This function performs inverse 4x4 Hadamard transform and then dequantizes 4145 * the coefficients. 4146 * 4147 * Input Arguments: 4148 * 4149 * pSrc - Pointer to the 4x4 array of the 4x4 Hadamard-transformed and 4150 * quantized coefficients. 16 byte alignment required. 4151 * iQP - Quantization parameter; must be in the range [0,51]. 4152 * 4153 * Output Arguments: 4154 * 4155 * pDst - Pointer to inverse-transformed and dequantized coefficients. 4156 * 16-byte alignment required. 4157 * 4158 * Return Value: 4159 * 4160 * OMX_Sts_NoErr - no error 4161 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4162 * conditions are true: 4163 * - at least one of the following pointers is NULL: pSrc 4164 * - pSrc or pDst is not aligned on a 16-byte boundary 4165 * 4166 */ 4167OMXResult omxVCM4P10_InvTransformDequant_LumaDC ( 4168 const OMX_S16 *pSrc, 4169 OMX_S16 *pDst, 4170 OMX_U32 iQP 4171); 4172 4173 4174 4175/** 4176 * Function: omxVCM4P10_InvTransformDequant_ChromaDC (6.3.5.6.4) 4177 * 4178 * Description: 4179 * This function performs inverse 2x2 Hadamard transform and then dequantizes 4180 * the coefficients. 4181 * 4182 * Input Arguments: 4183 * 4184 * pSrc - Pointer to the 2x2 array of the 2x2 Hadamard-transformed and 4185 * quantized coefficients. 8 byte alignment required. 4186 * iQP - Quantization parameter; must be in the range [0,51]. 4187 * 4188 * Output Arguments: 4189 * 4190 * pDst - Pointer to inverse-transformed and dequantized coefficients. 4191 * 8-byte alignment required. 4192 * 4193 * Return Value: 4194 * 4195 * OMX_Sts_NoErr - no error 4196 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4197 * conditions are true: 4198 * - at least one of the following pointers is NULL: pSrc 4199 * - pSrc or pDst is not aligned on an 8-byte boundary 4200 * 4201 */ 4202OMXResult omxVCM4P10_InvTransformDequant_ChromaDC ( 4203 const OMX_S16 *pSrc, 4204 OMX_S16 *pDst, 4205 OMX_U32 iQP 4206); 4207 4208 4209 4210/** 4211 * Function: omxVCM4P10_InvTransformResidualAndAdd (6.3.5.7.1) 4212 * 4213 * Description: 4214 * This function performs inverse an 4x4 integer transformation to produce 4215 * the difference signal and then adds the difference to the prediction to get 4216 * the reconstructed signal. 4217 * 4218 * Input Arguments: 4219 * 4220 * pSrcPred - Pointer to prediction signal. 4-byte alignment required. 4221 * pDequantCoeff - Pointer to the transformed coefficients. 8-byte 4222 * alignment required. 4223 * iSrcPredStep - Step of the prediction buffer; must be a multiple of 4. 4224 * iDstReconStep - Step of the destination reconstruction buffer; must be a 4225 * multiple of 4. 4226 * bAC - Indicate whether there is AC coefficients in the coefficients 4227 * matrix. 4228 * 4229 * Output Arguments: 4230 * 4231 * pDstRecon -Pointer to the destination reconstruction buffer. 4-byte 4232 * alignment required. 4233 * 4234 * Return Value: 4235 * 4236 * OMX_Sts_NoErr - no error 4237 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4238 * conditions are true: 4239 * - at least one of the following pointers is NULL: 4240 * pSrcPred, pDequantCoeff, pDstRecon 4241 * - pSrcPred is not aligned on a 4-byte boundary 4242 * - iSrcPredStep or iDstReconStep is not a multiple of 4. 4243 * - pDequantCoeff is not aligned on an 8-byte boundary 4244 * 4245 */ 4246OMXResult omxVCM4P10_InvTransformResidualAndAdd ( 4247 const OMX_U8 *pSrcPred, 4248 const OMX_S16 *pDequantCoeff, 4249 OMX_U8 *pDstRecon, 4250 OMX_U32 iSrcPredStep, 4251 OMX_U32 iDstReconStep, 4252 OMX_U8 bAC 4253); 4254 4255 4256 4257/** 4258 * Function: omxVCM4P10_SubAndTransformQDQResidual (6.3.5.8.1) 4259 * 4260 * Description: 4261 * This function subtracts the prediction signal from the original signal to 4262 * produce the difference signal and then performs a 4x4 integer transform and 4263 * quantization. The quantized transformed coefficients are stored as 4264 * pDstQuantCoeff. This function can also output dequantized coefficients or 4265 * unquantized DC coefficients optionally by setting the pointers 4266 * pDstDeQuantCoeff, pDCCoeff. 4267 * 4268 * Input Arguments: 4269 * 4270 * pSrcOrg - Pointer to original signal. 4-byte alignment required. 4271 * pSrcPred - Pointer to prediction signal. 4-byte alignment required. 4272 * iSrcOrgStep - Step of the original signal buffer; must be a multiple of 4273 * 4. 4274 * iSrcPredStep - Step of the prediction signal buffer; must be a multiple 4275 * of 4. 4276 * pNumCoeff -Number of non-zero coefficients after quantization. If this 4277 * parameter is not required, it is set to NULL. 4278 * nThreshSAD - Zero-block early detection threshold. If this parameter is 4279 * not required, it is set to 0. 4280 * iQP - Quantization parameter; must be in the range [0,51]. 4281 * bIntra - Indicates whether this is an INTRA block, either 1-INTRA or 4282 * 0-INTER 4283 * 4284 * Output Arguments: 4285 * 4286 * pDstQuantCoeff - Pointer to the quantized transformed coefficients. 4287 * 8-byte alignment required. 4288 * pDstDeQuantCoeff - Pointer to the dequantized transformed coefficients 4289 * if this parameter is not equal to NULL. 8-byte alignment 4290 * required. 4291 * pDCCoeff - Pointer to the unquantized DC coefficient if this parameter 4292 * is not equal to NULL. 4293 * 4294 * Return Value: 4295 * 4296 * OMX_Sts_NoErr - no error 4297 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4298 * conditions are true: 4299 * - at least one of the following pointers is NULL: 4300 * pSrcOrg, pSrcPred, pNumCoeff, pDstQuantCoeff, 4301 * pDstDeQuantCoeff, pDCCoeff 4302 * - pSrcOrg is not aligned on a 4-byte boundary 4303 * - pSrcPred is not aligned on a 4-byte boundary 4304 * - iSrcOrgStep is not a multiple of 4 4305 * - iSrcPredStep is not a multiple of 4 4306 * - pDstQuantCoeff or pDstDeQuantCoeff is not aligned on an 8-byte boundary 4307 * 4308 */ 4309OMXResult omxVCM4P10_SubAndTransformQDQResidual ( 4310 const OMX_U8 *pSrcOrg, 4311 const OMX_U8 *pSrcPred, 4312 OMX_U32 iSrcOrgStep, 4313 OMX_U32 iSrcPredStep, 4314 OMX_S16 *pDstQuantCoeff, 4315 OMX_S16 *pDstDeQuantCoeff, 4316 OMX_S16 *pDCCoeff, 4317 OMX_S8 *pNumCoeff, 4318 OMX_U32 nThreshSAD, 4319 OMX_U32 iQP, 4320 OMX_U8 bIntra 4321); 4322 4323 4324 4325/** 4326 * Function: omxVCM4P10_GetVLCInfo (6.3.5.9.1) 4327 * 4328 * Description: 4329 * This function extracts run-length encoding (RLE) information from the 4330 * coefficient matrix. The results are returned in an OMXVCM4P10VLCInfo 4331 * structure. 4332 * 4333 * Input Arguments: 4334 * 4335 * pSrcCoeff - pointer to the transform coefficient matrix. 8-byte 4336 * alignment required. 4337 * pScanMatrix - pointer to the scan order definition matrix. For a luma 4338 * block the scan matrix should follow [ISO14496-10] section 8.5.4, 4339 * and should contain the values 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 4340 * 10, 7, 11, 14, 15. For a chroma block, the scan matrix should 4341 * contain the values 0, 1, 2, 3. 4342 * bAC - indicates presence of a DC coefficient; 0 = DC coefficient 4343 * present, 1= DC coefficient absent. 4344 * MaxNumCoef - specifies the number of coefficients contained in the 4345 * transform coefficient matrix, pSrcCoeff. The value should be 16 4346 * for blocks of type LUMADC, LUMAAC, LUMALEVEL, and CHROMAAC. The 4347 * value should be 4 for blocks of type CHROMADC. 4348 * 4349 * Output Arguments: 4350 * 4351 * pDstVLCInfo - pointer to structure that stores information for 4352 * run-length coding. 4353 * 4354 * Return Value: 4355 * 4356 * OMX_Sts_NoErr - no error 4357 * OMX_Sts_BadArgErr - bad arguments; returned if any of the following 4358 * conditions are true: 4359 * - at least one of the following pointers is NULL: 4360 * pSrcCoeff, pScanMatrix, pDstVLCInfo 4361 * - pSrcCoeff is not aligned on an 8-byte boundary 4362 * 4363 */ 4364OMXResult omxVCM4P10_GetVLCInfo ( 4365 const OMX_S16 *pSrcCoeff, 4366 const OMX_U8 *pScanMatrix, 4367 OMX_U8 bAC, 4368 OMX_U32 MaxNumCoef, 4369 OMXVCM4P10VLCInfo*pDstVLCInfo 4370); 4371 4372 4373 4374#ifdef __cplusplus 4375} 4376#endif 4377 4378#endif /** end of #define _OMXVC_H_ */ 4379 4380/** EOF */ 4381 4382