1/** 2 * 3 * File Name: armVC.h 4 * OpenMAX DL: v1.0.2 5 * Revision: 12290 6 * Date: Wednesday, April 9, 2008 7 * 8 * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. 9 * 10 * 11 * 12 * File: armVideo.h 13 * Brief: Declares API's/Basic Data types used across the OpenMAX Video domain 14 * 15 */ 16 17 18#ifndef _armVideo_H_ 19#define _armVideo_H_ 20 21#include "omxVC.h" 22#include "armCOMM_Bitstream.h" 23 24/** 25 * ARM specific state structure to hold Motion Estimation information. 26 */ 27 28struct m4p2_MESpec 29{ 30 OMXVCM4P2MEParams MEParams; 31 OMXVCM4P2MEMode MEMode; 32}; 33 34struct m4p10_MESpec 35{ 36 OMXVCM4P10MEParams MEParams; 37 OMXVCM4P10MEMode MEMode; 38}; 39 40typedef struct m4p2_MESpec ARMVCM4P2_MESpec; 41typedef struct m4p10_MESpec ARMVCM4P10_MESpec; 42 43/** 44 * Function: armVCM4P2_CompareMV 45 * 46 * Description: 47 * Performs comparision of motion vectors and SAD's to decide the 48 * best MV and SAD 49 * 50 * Remarks: 51 * 52 * Parameters: 53 * [in] mvX x coordinate of the candidate motion vector 54 * [in] mvY y coordinate of the candidate motion vector 55 * [in] candSAD Candidate SAD 56 * [in] bestMVX x coordinate of the best motion vector 57 * [in] bestMVY y coordinate of the best motion vector 58 * [in] bestSAD best SAD 59 * 60 * Return Value: 61 * OMX_INT -- 1 to indicate that the current sad is the best 62 * 0 to indicate that it is NOT the best SAD 63 */ 64 65OMX_INT armVCM4P2_CompareMV ( 66 OMX_S16 mvX, 67 OMX_S16 mvY, 68 OMX_INT candSAD, 69 OMX_S16 bestMVX, 70 OMX_S16 bestMVY, 71 OMX_INT bestSAD); 72 73/** 74 * Function: armVCM4P2_ACDCPredict 75 * 76 * Description: 77 * Performs adaptive DC/AC coefficient prediction for an intra block. Prior 78 * to the function call, prediction direction (predDir) should be selected 79 * as specified in subclause 7.4.3.1 of ISO/IEC 14496-2. 80 * 81 * Remarks: 82 * 83 * Parameters: 84 * [in] pSrcDst pointer to the coefficient buffer which contains 85 * the quantized coefficient residuals (PQF) of the 86 * current block 87 * [in] pPredBufRow pointer to the coefficient row buffer 88 * [in] pPredBufCol pointer to the coefficient column buffer 89 * [in] curQP quantization parameter of the current block. curQP 90 * may equal to predQP especially when the current 91 * block and the predictor block are in the same 92 * macroblock. 93 * [in] predQP quantization parameter of the predictor block 94 * [in] predDir indicates the prediction direction which takes one 95 * of the following values: 96 * OMX_VIDEO_HORIZONTAL predict horizontally 97 * OMX_VIDEO_VERTICAL predict vertically 98 * [in] ACPredFlag a flag indicating if AC prediction should be 99 * performed. It is equal to ac_pred_flag in the bit 100 * stream syntax of MPEG-4 101 * [in] videoComp video component type (luminance, chrominance or 102 * alpha) of the current block 103 * [in] flag This flag defines the if one wants to use this functions to 104 * calculate PQF (set 1, prediction) or QF (set 0, reconstruction) 105 * [out] pPreACPredict pointer to the predicted coefficients buffer. 106 * Filled ONLY if it is not NULL 107 * [out] pSrcDst pointer to the coefficient buffer which contains 108 * the quantized coefficients (QF) of the current 109 * block 110 * [out] pPredBufRow pointer to the updated coefficient row buffer 111 * [out] pPredBufCol pointer to the updated coefficient column buffer 112 * [out] pSumErr pointer to the updated sum of the difference 113 * between predicted and unpredicted coefficients 114 * If this is NULL, do not update 115 * 116 * Return Value: 117 * Standard OMXResult result. See enumeration for possible result codes. 118 * 119 */ 120 121OMXResult armVCM4P2_ACDCPredict( 122 OMX_S16 * pSrcDst, 123 OMX_S16 * pPreACPredict, 124 OMX_S16 * pPredBufRow, 125 OMX_S16 * pPredBufCol, 126 OMX_INT curQP, 127 OMX_INT predQP, 128 OMX_INT predDir, 129 OMX_INT ACPredFlag, 130 OMXVCM4P2VideoComponent videoComp, 131 OMX_U8 flag, 132 OMX_INT *pSumErr 133); 134 135/** 136 * Function: armVCM4P2_SetPredDir 137 * 138 * Description: 139 * Performs detecting the prediction direction 140 * 141 * Remarks: 142 * 143 * Parameters: 144 * [in] blockIndex block index indicating the component type and 145 * position as defined in subclause 6.1.3.8, of ISO/IEC 146 * 14496-2. Furthermore, indexes 6 to 9 indicate the 147 * alpha blocks spatially corresponding to luminance 148 * blocks 0 to 3 in the same macroblock. 149 * [in] pCoefBufRow pointer to the coefficient row buffer 150 * [in] pQpBuf pointer to the quantization parameter buffer 151 * [out] predQP quantization parameter of the predictor block 152 * [out] predDir indicates the prediction direction which takes one 153 * of the following values: 154 * OMX_VIDEO_HORIZONTAL predict horizontally 155 * OMX_VIDEO_VERTICAL predict vertically 156 * 157 * Return Value: 158 * Standard OMXResult result. See enumeration for possible result codes. 159 * 160 */ 161 162OMXResult armVCM4P2_SetPredDir( 163 OMX_INT blockIndex, 164 OMX_S16 *pCoefBufRow, 165 OMX_S16 *pCoefBufCol, 166 OMX_INT *predDir, 167 OMX_INT *predQP, 168 const OMX_U8 *pQpBuf 169); 170 171/** 172 * Function: armVCM4P2_EncodeVLCZigzag_Intra 173 * 174 * Description: 175 * Performs zigzag scanning and VLC encoding for one intra block. 176 * 177 * Remarks: 178 * 179 * Parameters: 180 * [in] ppBitStream pointer to the pointer to the current byte in 181 * the bit stream 182 * [in] pBitOffset pointer to the bit position in the byte pointed 183 * by *ppBitStream. Valid within 0 to 7. 184 * [in] pQDctBlkCoef pointer to the quantized DCT coefficient 185 * [in] predDir AC prediction direction, which is used to decide 186 * the zigzag scan pattern. This takes one of the 187 * following values: 188 * OMX_VIDEO_NONE AC prediction not used. 189 * Performs classical zigzag 190 * scan. 191 * OMX_VIDEO_HORIZONTAL Horizontal prediction. 192 * Performs alternate-vertical 193 * zigzag scan. 194 * OMX_VIDEO_VERTICAL Vertical prediction. 195 * Performs alternate-horizontal 196 * zigzag scan. 197 * [in] pattern block pattern which is used to decide whether 198 * this block is encoded 199 * [in] start start indicates whether the encoding begins with 0th element 200 * or 1st. 201 * [out] ppBitStream *ppBitStream is updated after the block is encoded, 202 * so that it points to the current byte in the bit 203 * stream buffer. 204 * [out] pBitOffset *pBitOffset is updated so that it points to the 205 * current bit position in the byte pointed by 206 * *ppBitStream. 207 * 208 * Return Value: 209 * Standard OMXResult result. See enumeration for possible result codes. 210 * 211 */ 212 213OMXResult armVCM4P2_EncodeVLCZigzag_Intra( 214 OMX_U8 **ppBitStream, 215 OMX_INT *pBitOffset, 216 const OMX_S16 *pQDctBlkCoef, 217 OMX_U8 predDir, 218 OMX_U8 pattern, 219 OMX_INT shortVideoHeader, 220 OMX_U8 start 221); 222 223/** 224 * Function: armVCM4P2_DecodeVLCZigzag_Intra 225 * 226 * Description: 227 * Performs VLC decoding and inverse zigzag scan for one intra coded block. 228 * 229 * Remarks: 230 * 231 * Parameters: 232 * [in] ppBitStream pointer to the pointer to the current byte in 233 * the bitstream buffer 234 * [in] pBitOffset pointer to the bit position in the byte pointed 235 * to by *ppBitStream. *pBitOffset is valid within 236 * [0-7]. 237 * [in] predDir AC prediction direction which is used to decide 238 * the zigzag scan pattern. It takes one of the 239 * following values: 240 * OMX_VIDEO_NONE AC prediction not used; 241 * perform classical zigzag scan; 242 * OMX_VIDEO_HORIZONTAL Horizontal prediction; 243 * perform alternate-vertical 244 * zigzag scan; 245 * OMX_VIDEO_VERTICAL Vertical prediction; 246 * thus perform 247 * alternate-horizontal 248 * zigzag scan. 249 * [in] videoComp video component type (luminance, chrominance or 250 * alpha) of the current block 251 * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0, 252 * and escape mode 4 is used when shortVideoHeader==1. 253 * [in] start start indicates whether the encoding begins with 0th element 254 * or 1st. 255 * [out] ppBitStream *ppBitStream is updated after the block is 256 * decoded, so that it points to the current byte 257 * in the bit stream buffer 258 * [out] pBitOffset *pBitOffset is updated so that it points to the 259 * current bit position in the byte pointed by 260 * *ppBitStream 261 * [out] pDst pointer to the coefficient buffer of current 262 * block. Should be 32-bit aligned 263 * 264 * Return Value: 265 * Standard OMXResult result. See enumeration for possible result codes. 266 * 267 */ 268 269OMXResult armVCM4P2_DecodeVLCZigzag_Intra( 270 const OMX_U8 ** ppBitStream, 271 OMX_INT * pBitOffset, 272 OMX_S16 * pDst, 273 OMX_U8 predDir, 274 OMX_INT shortVideoHeader, 275 OMX_U8 start 276); 277 278/** 279 * Function: armVCM4P2_FillVLDBuffer 280 * 281 * Description: 282 * Performs filling of the coefficient buffer according to the run, level 283 * and sign, also updates the index 284 * 285 * Parameters: 286 * [in] storeRun Stored Run value (count of zeros) 287 * [in] storeLevel Stored Level value (non-zero value) 288 * [in] sign Flag indicating the sign of level 289 * [in] last status of the last flag 290 * [in] pIndex pointer to coefficient index in 8x8 matrix 291 * [out] pIndex pointer to updated coefficient index in 8x8 292 * matrix 293 * [in] pZigzagTable pointer to the zigzag tables 294 * [out] pDst pointer to the coefficient buffer of current 295 * block. Should be 32-bit aligned 296 * Return Value: 297 * Standard OMXResult result. See enumeration for possible result codes. 298 * 299 */ 300 301OMXResult armVCM4P2_FillVLDBuffer( 302 OMX_U32 storeRun, 303 OMX_S16 * pDst, 304 OMX_S16 storeLevel, 305 OMX_U8 sign, 306 OMX_U8 last, 307 OMX_U8 * index, 308 const OMX_U8 * pZigzagTable 309); 310 311/** 312 * Function: armVCM4P2_GetVLCBits 313 * 314 * Description: 315 * Performs escape mode decision based on the run, run+, level, level+ and 316 * last combinations. 317 * 318 * Remarks: 319 * 320 * Parameters: 321 * [in] ppBitStream pointer to the pointer to the current byte in 322 * the bit stream 323 * [in] pBitOffset pointer to the bit position in the byte pointed 324 * by *ppBitStream. Valid within 0 to 7 325 * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0, 326 * and escape mode 4 is used when shortVideoHeader==1. 327 * [in] start start indicates whether the encoding begins with 328 * 0th element or 1st. 329 * [in/out] pLast pointer to last status flag 330 * [in] runBeginSingleLevelEntriesL0 The run value from which level 331 * will be equal to 1: last == 0 332 * [in] IndexBeginSingleLevelEntriesL0 Array index in the VLC table 333 * pointing to the 334 * runBeginSingleLevelEntriesL0 335 * [in] runBeginSingleLevelEntriesL1 The run value from which level 336 * will be equal to 1: last == 1 337 * [in] IndexBeginSingleLevelEntriesL1 Array index in the VLC table 338 * pointing to the 339 * runBeginSingleLevelEntriesL0 340 * [in] pRunIndexTableL0 Run Index table defined in 341 * armVCM4P2_Huff_Tables_VLC.c for last == 0 342 * [in] pVlcTableL0 VLC table for last == 0 343 * [in] pRunIndexTableL1 Run Index table defined in 344 * armVCM4P2_Huff_Tables_VLC.c for last == 1 345 * [in] pVlcTableL1 VLC table for last == 1 346 * [in] pLMAXTableL0 Level MAX table defined in 347 * armVCM4P2_Huff_Tables_VLC.c for last == 0 348 * [in] pLMAXTableL1 Level MAX table defined in 349 * armVCM4P2_Huff_Tables_VLC.c for last == 1 350 * [in] pRMAXTableL0 Run MAX table defined in 351 * armVCM4P2_Huff_Tables_VLC.c for last == 0 352 * [in] pRMAXTableL1 Run MAX table defined in 353 * armVCM4P2_Huff_Tables_VLC.c for last == 1 354 * [out]pDst pointer to the coefficient buffer of current 355 * block. Should be 32-bit aligned 356 * 357 * Return Value: 358 * Standard OMXResult result. See enumeration for possible result codes. 359 * 360 */ 361 362OMXResult armVCM4P2_GetVLCBits ( 363 const OMX_U8 **ppBitStream, 364 OMX_INT * pBitOffset, 365 OMX_S16 * pDst, 366 OMX_INT shortVideoHeader, 367 OMX_U8 start, 368 OMX_U8 * pLast, 369 OMX_U8 runBeginSingleLevelEntriesL0, 370 OMX_U8 maxIndexForMultipleEntriesL0, 371 OMX_U8 maxRunForMultipleEntriesL1, 372 OMX_U8 maxIndexForMultipleEntriesL1, 373 const OMX_U8 * pRunIndexTableL0, 374 const ARM_VLC32 *pVlcTableL0, 375 const OMX_U8 * pRunIndexTableL1, 376 const ARM_VLC32 *pVlcTableL1, 377 const OMX_U8 * pLMAXTableL0, 378 const OMX_U8 * pLMAXTableL1, 379 const OMX_U8 * pRMAXTableL0, 380 const OMX_U8 * pRMAXTableL1, 381 const OMX_U8 * pZigzagTable 382); 383 384/** 385 * Function: armVCM4P2_PutVLCBits 386 * 387 * Description: 388 * Checks the type of Escape Mode and put encoded bits for 389 * quantized DCT coefficients. 390 * 391 * Remarks: 392 * 393 * Parameters: 394 * [in] ppBitStream pointer to the pointer to the current byte in 395 * the bit stream 396 * [in] pBitOffset pointer to the bit position in the byte pointed 397 * by *ppBitStream. Valid within 0 to 7 398 * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0, 399 * and escape mode 4 is used when shortVideoHeader==1. 400 * [in] start start indicates whether the encoding begins with 401 * 0th element or 1st. 402 * [in] maxStoreRunL0 Max store possible (considering last and inter/intra) 403 * for last = 0 404 * [in] maxStoreRunL1 Max store possible (considering last and inter/intra) 405 * for last = 1 406 * [in] maxRunForMultipleEntriesL0 407 * The run value after which level 408 * will be equal to 1: 409 * (considering last and inter/intra status) for last = 0 410 * [in] maxRunForMultipleEntriesL1 411 * The run value after which level 412 * will be equal to 1: 413 * (considering last and inter/intra status) for last = 1 414 * [in] pRunIndexTableL0 Run Index table defined in 415 * armVCM4P2_Huff_Tables_VLC.c for last == 0 416 * [in] pVlcTableL0 VLC table for last == 0 417 * [in] pRunIndexTableL1 Run Index table defined in 418 * armVCM4P2_Huff_Tables_VLC.c for last == 1 419 * [in] pVlcTableL1 VLC table for last == 1 420 * [in] pLMAXTableL0 Level MAX table defined in 421 * armVCM4P2_Huff_Tables_VLC.c for last == 0 422 * [in] pLMAXTableL1 Level MAX table defined in 423 * armVCM4P2_Huff_Tables_VLC.c for last == 1 424 * [in] pRMAXTableL0 Run MAX table defined in 425 * armVCM4P2_Huff_Tables_VLC.c for last == 0 426 * [in] pRMAXTableL1 Run MAX table defined in 427 * armVCM4P2_Huff_Tables_VLC.c for last == 1 428 * [out] pQDctBlkCoef pointer to the quantized DCT coefficient 429 * [out] ppBitStream *ppBitStream is updated after the block is encoded 430 * so that it points to the current byte in the bit 431 * stream buffer. 432 * [out] pBitOffset *pBitOffset is updated so that it points to the 433 * current bit position in the byte pointed by 434 * *ppBitStream. 435 * 436 * Return Value: 437 * Standard OMXResult result. See enumeration for possible result codes. 438 * 439 */ 440 441 442OMXResult armVCM4P2_PutVLCBits ( 443 OMX_U8 **ppBitStream, 444 OMX_INT * pBitOffset, 445 const OMX_S16 *pQDctBlkCoef, 446 OMX_INT shortVideoHeader, 447 OMX_U8 start, 448 OMX_U8 maxStoreRunL0, 449 OMX_U8 maxStoreRunL1, 450 OMX_U8 maxRunForMultipleEntriesL0, 451 OMX_U8 maxRunForMultipleEntriesL1, 452 const OMX_U8 * pRunIndexTableL0, 453 const ARM_VLC32 *pVlcTableL0, 454 const OMX_U8 * pRunIndexTableL1, 455 const ARM_VLC32 *pVlcTableL1, 456 const OMX_U8 * pLMAXTableL0, 457 const OMX_U8 * pLMAXTableL1, 458 const OMX_U8 * pRMAXTableL0, 459 const OMX_U8 * pRMAXTableL1, 460 const OMX_U8 * pZigzagTable 461); 462/** 463 * Function: armVCM4P2_FillVLCBuffer 464 * 465 * Description: 466 * Performs calculating the VLC bits depending on the escape type and insert 467 * the same in the bitstream 468 * 469 * Remarks: 470 * 471 * Parameters: 472 * [in] ppBitStream pointer to the pointer to the current byte in 473 * the bit stream 474 * [in] pBitOffset pointer to the bit position in the byte pointed 475 * by *ppBitStream. Valid within 0 to 7 476 * [in] run Run value (count of zeros) to be encoded 477 * [in] level Level value (non-zero value) to be encoded 478 * [in] runPlus Calculated as runPlus = run - (RMAX + 1) 479 * [in] levelPlus Calculated as 480 * levelPlus = sign(level)*[abs(level) - LMAX] 481 * [in] fMode Flag indicating the escape modes 482 * [in] last status of the last flag 483 * [in] maxRunForMultipleEntries 484 * The run value after which level will be equal to 1: 485 * (considering last and inter/intra status) 486 * [in] pRunIndexTable Run Index table defined in 487 * armVCM4P2_Huff_tables_VLC.h 488 * [in] pVlcTable VLC table defined in armVCM4P2_Huff_tables_VLC.h 489 * [out] ppBitStream *ppBitStream is updated after the block is encoded 490 * so that it points to the current byte in the bit 491 * stream buffer. 492 * [out] pBitOffset *pBitOffset is updated so that it points to the 493 * current bit position in the byte pointed by 494 * *ppBitStream. 495 * 496 * Return Value: 497 * Standard OMXResult result. See enumeration for possible result codes. 498 * 499 */ 500 501OMXResult armVCM4P2_FillVLCBuffer ( 502 OMX_U8 **ppBitStream, 503 OMX_INT * pBitOffset, 504 OMX_U32 run, 505 OMX_S16 level, 506 OMX_U32 runPlus, 507 OMX_S16 levelPlus, 508 OMX_U8 fMode, 509 OMX_U8 last, 510 OMX_U8 maxRunForMultipleEntries, 511 const OMX_U8 *pRunIndexTable, 512 const ARM_VLC32 *pVlcTable 513); 514 515/** 516 * Function: armVCM4P2_CheckVLCEscapeMode 517 * 518 * Description: 519 * Performs escape mode decision based on the run, run+, level, level+ and 520 * last combinations. 521 * 522 * Remarks: 523 * 524 * Parameters: 525 * [in] run Run value (count of zeros) to be encoded 526 * [in] level Level value (non-zero value) to be encoded 527 * [in] runPlus Calculated as runPlus = run - (RMAX + 1) 528 * [in] levelPlus Calculated as 529 * levelPlus = sign(level)*[abs(level) - LMAX] 530 * [in] maxStoreRun Max store possible (considering last and inter/intra) 531 * [in] maxRunForMultipleEntries 532 * The run value after which level 533 * will be equal to 1: 534 * (considering last and inter/intra status) 535 * [in] shortVideoHeader binary flag indicating presence of short_video_header; escape modes 0-3 are used if shortVideoHeader==0, 536 * and escape mode 4 is used when shortVideoHeader==1. 537 * [in] pRunIndexTable Run Index table defined in 538 * armVCM4P2_Huff_Tables_VLC.c 539 * (considering last and inter/intra status) 540 * 541 * 542 * Return Value: 543 * Returns an Escape mode which can take values from 0 to 3 544 * 0 --> no escape mode, 1 --> escape type 1, 545 * 1 --> escape type 2, 3 --> escape type 3, check section 7.4.1.3 546 * in the MPEG ISO standard. 547 * 548 */ 549 550OMX_U8 armVCM4P2_CheckVLCEscapeMode( 551 OMX_U32 run, 552 OMX_U32 runPlus, 553 OMX_S16 level, 554 OMX_S16 levelPlus, 555 OMX_U8 maxStoreRun, 556 OMX_U8 maxRunForMultipleEntries, 557 OMX_INT shortVideoHeader, 558 const OMX_U8 *pRunIndexTable 559); 560 561 562/** 563 * Function: armVCM4P2_BlockMatch_Integer 564 * 565 * Description: 566 * Performs a 16x16 block search; estimates motion vector and associated minimum SAD. 567 * Both the input and output motion vectors are represented using half-pixel units, and 568 * therefore a shift left or right by 1 bit may be required, respectively, to match the 569 * input or output MVs with other functions that either generate output MVs or expect 570 * input MVs represented using integer pixel units. 571 * 572 * Remarks: 573 * 574 * Parameters: 575 * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB that 576 * corresponds to the location of the current macroblock in the current 577 * plane. 578 * [in] refWidth width of the reference plane 579 * [in] pRefRect pointer to the valid rectangular in reference plane. Relative to image origin. 580 * It's not limited to the image boundary, but depended on the padding. For example, 581 * if you pad 4 pixels outside the image border, then the value for left border 582 * can be -4 583 * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane (linear array, 584 * 256 entries); must be aligned on an 8-byte boundary. 585 * [in] pCurrPointPos position of the current macroblock in the current plane 586 * [in] pSrcPreMV pointer to predicted motion vector; NULL indicates no predicted MV 587 * [in] pSrcPreSAD pointer to SAD associated with the predicted MV (referenced by pSrcPreMV) 588 * [in] searchRange search range for 16X16 integer block,the units of it is full pixel,the search range 589 * is the same in all directions.It is in inclusive of the boundary and specified in 590 * terms of integer pixel units. 591 * [in] pMESpec vendor-specific motion estimation specification structure; must have been allocated 592 * and then initialized using omxVCM4P2_MEInit prior to calling the block matching 593 * function. 594 * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8. 595 * [out] pDstMV pointer to estimated MV 596 * [out] pDstSAD pointer to minimum SAD 597 * 598 * Return Value: 599 * OMX_Sts_NoErr �C no error. 600 * OMX_Sts_BadArgErr �C bad arguments 601 * 602 */ 603 604OMXResult armVCM4P2_BlockMatch_Integer( 605 const OMX_U8 *pSrcRefBuf, 606 OMX_INT refWidth, 607 const OMXRect *pRefRect, 608 const OMX_U8 *pSrcCurrBuf, 609 const OMXVCM4P2Coordinate *pCurrPointPos, 610 const OMXVCMotionVector *pSrcPreMV, 611 const OMX_INT *pSrcPreSAD, 612 void *pMESpec, 613 OMXVCMotionVector *pDstMV, 614 OMX_INT *pDstSAD, 615 OMX_U8 BlockSize 616); 617 618/** 619 * Function: armVCM4P2_BlockMatch_Half 620 * 621 * Description: 622 * Performs a 16x16 block match with half-pixel resolution. Returns the estimated 623 * motion vector and associated minimum SAD. This function estimates the half-pixel 624 * motion vector by interpolating the integer resolution motion vector referenced 625 * by the input parameter pSrcDstMV, i.e., the initial integer MV is generated 626 * externally. The input parameters pSrcRefBuf and pSearchPointRefPos should be 627 * shifted by the winning MV of 16x16 integer search prior to calling BlockMatch_Half_16x16. 628 * The function BlockMatch_Integer_16x16 may be used for integer motion estimation. 629 * 630 * Remarks: 631 * 632 * Parameters: 633 * [in] pSrcRefBuf pointer to the reference Y plane; points to the reference MB 634 * that corresponds to the location of the current macroblock in 635 * the current plane. 636 * [in] refWidth width of the reference plane 637 * [in] pRefRect reference plane valid region rectangle 638 * [in] pSrcCurrBuf pointer to the current macroblock extracted from original plane 639 * (linear array, 256 entries); must be aligned on an 8-byte boundary. 640 * [in] pSearchPointRefPos position of the starting point for half pixel search (specified 641 * in terms of integer pixel units) in the reference plane. 642 * [in] rndVal rounding control bit for half pixel motion estimation; 643 * 0=rounding control disabled; 1=rounding control enabled 644 * [in] pSrcDstMV pointer to the initial MV estimate; typically generated during a prior 645 * 16X16 integer search and its unit is half pixel. 646 * [in] BlockSize MacroBlock Size i.e either 16x16 or 8x8. 647 * [out]pSrcDstMV pointer to estimated MV 648 * [out]pDstSAD pointer to minimum SAD 649 * 650 * Return Value: 651 * OMX_Sts_NoErr �C no error 652 * OMX_Sts_BadArgErr �C bad arguments 653 * 654 */ 655 656OMXResult armVCM4P2_BlockMatch_Half( 657 const OMX_U8 *pSrcRefBuf, 658 OMX_INT refWidth, 659 const OMXRect *pRefRect, 660 const OMX_U8 *pSrcCurrBuf, 661 const OMXVCM4P2Coordinate *pSearchPointRefPos, 662 OMX_INT rndVal, 663 OMXVCMotionVector *pSrcDstMV, 664 OMX_INT *pDstSAD, 665 OMX_U8 BlockSize 666); 667/** 668 * Function: armVCM4P2_PadMV 669 * 670 * Description: 671 * Performs motion vector padding for a macroblock. 672 * 673 * Remarks: 674 * 675 * Parameters: 676 * [in] pSrcDstMV pointer to motion vector buffer of the current 677 * macroblock 678 * [in] pTransp pointer to transparent status buffer of the 679 * current macroblock 680 * [out] pSrcDstMV pointer to motion vector buffer in which the 681 * motion vectors have been padded 682 * Return Value: 683 * Standard OMXResult result. See enumeration for possible result codes. 684 * 685 */ 686 687OMXResult armVCM4P2_PadMV( 688 OMXVCMotionVector * pSrcDstMV, 689 OMX_U8 * pTransp 690); 691 692/* 693 * H.264 Specific Declarations 694 */ 695/* Defines */ 696#define ARM_M4P10_Q_OFFSET (15) 697 698 699/* Dequant tables */ 700 701extern const OMX_U8 armVCM4P10_PosToVCol4x4[16]; 702extern const OMX_U8 armVCM4P10_PosToVCol2x2[4]; 703extern const OMX_U8 armVCM4P10_VMatrix[6][3]; 704extern const OMX_U32 armVCM4P10_MFMatrix[6][3]; 705 706 707/* 708 * Description: 709 * This function perform the work required by the OpenMAX 710 * DecodeCoeffsToPair function and DecodeChromaDCCoeffsToPair. 711 * Since most of the code is common we share it here. 712 * 713 * Parameters: 714 * [in] ppBitStream Double pointer to current byte in bit stream buffer 715 * [in] pOffset Pointer to current bit position in the byte pointed 716 * to by *ppBitStream 717 * [in] sMaxNumCoeff Maximum number of non-zero coefficients in current 718 * block (4,15 or 16) 719 * [in] nTable Table number (0 to 4) according to the five columns 720 * of Table 9-5 in the H.264 spec 721 * [out] ppBitStream *ppBitStream is updated after each block is decoded 722 * [out] pOffset *pOffset is updated after each block is decoded 723 * [out] pNumCoeff Pointer to the number of nonzero coefficients in 724 * this block 725 * [out] ppPosCoefbuf Double pointer to destination residual 726 * coefficient-position pair buffer 727 * Return Value: 728 * Standard omxError result. See enumeration for possible result codes. 729 730 */ 731 732OMXResult armVCM4P10_DecodeCoeffsToPair( 733 const OMX_U8** ppBitStream, 734 OMX_S32* pOffset, 735 OMX_U8* pNumCoeff, 736 OMX_U8**ppPosCoefbuf, 737 OMX_INT nTable, 738 OMX_INT sMaxNumCoeff 739 ); 740 741/* 742 * Description: 743 * Perform DC style intra prediction, averaging upper and left block 744 * 745 * Parameters: 746 * [in] pSrcLeft Pointer to the buffer of 16 left coefficients: 747 * p[x, y] (x = -1, y = 0..3) 748 * [in] pSrcAbove Pointer to the buffer of 16 above coefficients: 749 * p[x,y] (x = 0..3, y = -1) 750 * [in] leftStep Step of left coefficient buffer 751 * [in] dstStep Step of the destination buffer 752 * [in] availability Neighboring 16x16 MB availability flag 753 * [out] pDst Pointer to the destination buffer 754 * 755 * Return Value: 756 * None 757 */ 758 759void armVCM4P10_PredictIntraDC4x4( 760 const OMX_U8* pSrcLeft, 761 const OMX_U8 *pSrcAbove, 762 OMX_U8* pDst, 763 OMX_INT leftStep, 764 OMX_INT dstStep, 765 OMX_S32 availability 766); 767 768/* 769 * Description 770 * Unpack a 4x4 block of coefficient-residual pair values 771 * 772 * Parameters: 773 * [in] ppSrc Double pointer to residual coefficient-position pair 774 * buffer output by CALVC decoding 775 * [out] ppSrc *ppSrc is updated to the start of next non empty block 776 * [out] pDst Pointer to unpacked 4x4 block 777 */ 778 779void armVCM4P10_UnpackBlock4x4( 780 const OMX_U8 **ppSrc, 781 OMX_S16* pDst 782); 783 784/* 785 * Description 786 * Unpack a 2x2 block of coefficient-residual pair values 787 * 788 * Parameters: 789 * [in] ppSrc Double pointer to residual coefficient-position pair 790 * buffer output by CALVC decoding 791 * [out] ppSrc *ppSrc is updated to the start of next non empty block 792 * [out] pDst Pointer to unpacked 4x4 block 793 */ 794 795void armVCM4P10_UnpackBlock2x2( 796 const OMX_U8 **ppSrc, 797 OMX_S16* pDst 798); 799 800/* 801 * Description 802 * Deblock one boundary pixel 803 * 804 * Parameters: 805 * [in] pQ0 Pointer to pixel q0 806 * [in] Step Step between pixels q0 and q1 807 * [in] tC0 Edge threshold value 808 * [in] alpha alpha threshold value 809 * [in] beta beta threshold value 810 * [in] bS deblocking strength 811 * [in] ChromaFlag True for chroma blocks 812 * [out] pQ0 Deblocked pixels 813 * 814 */ 815 816void armVCM4P10_DeBlockPixel( 817 OMX_U8 *pQ0, /* pointer to the pixel q0 */ 818 int Step, /* step between pixels q0 and q1 */ 819 int tC0, /* edge threshold value */ 820 int alpha, /* alpha */ 821 int beta, /* beta */ 822 int bS, /* deblocking strength */ 823 int ChromaFlag 824); 825 826/** 827 * Function: armVCM4P10_InterpolateHalfHor_Luma 828 * 829 * Description: 830 * This function performs interpolation for horizontal 1/2-pel positions 831 * 832 * Remarks: 833 * 834 * [in] pSrc Pointer to top-left corner of block used to interpolate 835 in the reconstructed frame plane 836 * [in] iSrcStep Step of the source buffer. 837 * [in] iDstStep Step of the destination(interpolation) buffer. 838 * [in] iWidth Width of the current block 839 * [in] iHeight Height of the current block 840 * [out] pDst Pointer to the interpolation buffer of the 1/2-pel 841 * 842 * Return Value: 843 * Standard OMXResult value. 844 * 845 */ 846 847OMXResult armVCM4P10_InterpolateHalfHor_Luma( 848 const OMX_U8* pSrc, 849 OMX_U32 iSrcStep, 850 OMX_U8* pDst, 851 OMX_U32 iDstStep, 852 OMX_U32 iWidth, 853 OMX_U32 iHeight 854); 855 856/** 857 * Function: armVCM4P10_InterpolateHalfVer_Luma 858 * 859 * Description: 860 * This function performs interpolation for vertical 1/2-pel positions 861 * around a full-pel position. 862 * 863 * Remarks: 864 * 865 * [in] pSrc Pointer to top-left corner of block used to interpolate 866 * in the reconstructed frame plane 867 * [in] iSrcStep Step of the source buffer. 868 * [in] iDstStep Step of the destination(interpolation) buffer. 869 * [in] iWidth Width of the current block 870 * [in] iHeight Height of the current block 871 * [out] pDst Pointer to the interpolation buffer of the 1/2-pel 872 * 873 * Return Value: 874 * Standard OMXResult value. 875 * 876 */ 877 878OMXResult armVCM4P10_InterpolateHalfVer_Luma( 879 const OMX_U8* pSrc, 880 OMX_U32 iSrcStep, 881 OMX_U8* pDst, 882 OMX_U32 iDstStep, 883 OMX_U32 iWidth, 884 OMX_U32 iHeight 885); 886 887/** 888 * Function: armVCM4P10_InterpolateHalfDiag_Luma 889 * 890 * Description: 891 * This function performs interpolation for (1/2, 1/2) positions 892 * around a full-pel position. 893 * 894 * Remarks: 895 * 896 * [in] pSrc Pointer to top-left corner of block used to interpolate 897 * in the reconstructed frame plane 898 * [in] iSrcStep Step of the source buffer. 899 * [in] iDstStep Step of the destination(interpolation) buffer. 900 * [in] iWidth Width of the current block 901 * [in] iHeight Height of the current block 902 * [out] pDst Pointer to the interpolation buffer of the (1/2,1/2)-pel 903 * 904 * Return Value: 905 * Standard OMXResult value. 906 * 907 */ 908 909OMXResult armVCM4P10_InterpolateHalfDiag_Luma( 910 const OMX_U8* pSrc, 911 OMX_U32 iSrcStep, 912 OMX_U8* pDst, 913 OMX_U32 iDstStep, 914 OMX_U32 iWidth, 915 OMX_U32 iHeight 916); 917 918/* 919 * Description: 920 * Transform Residual 4x4 Coefficients 921 * 922 * Parameters: 923 * [in] pSrc Source 4x4 block 924 * [out] pDst Destination 4x4 block 925 * 926 */ 927 928void armVCM4P10_TransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc); 929 930/* 931 * Description: 932 * Forward Transform Residual 4x4 Coefficients 933 * 934 * Parameters: 935 * [in] pSrc Source 4x4 block 936 * [out] pDst Destination 4x4 block 937 * 938 */ 939 940void armVCM4P10_FwdTransformResidual4x4(OMX_S16* pDst, OMX_S16 *pSrc); 941 942OMX_INT armVCM4P10_CompareMotionCostToMV ( 943 OMX_S16 mvX, 944 OMX_S16 mvY, 945 OMXVCMotionVector diffMV, 946 OMX_INT candSAD, 947 OMXVCMotionVector *bestMV, 948 OMX_U32 nLamda, 949 OMX_S32 *pBestCost); 950 951/** 952 * Function: armVCCOMM_SAD 953 * 954 * Description: 955 * This function calculate the SAD for NxM blocks. 956 * 957 * Remarks: 958 * 959 * [in] pSrcOrg Pointer to the original block 960 * [in] iStepOrg Step of the original block buffer 961 * [in] pSrcRef Pointer to the reference block 962 * [in] iStepRef Step of the reference block buffer 963 * [in] iHeight Height of the block 964 * [in] iWidth Width of the block 965 * [out] pDstSAD Pointer of result SAD 966 * 967 * Return Value: 968 * Standard OMXResult value. 969 * 970 */ 971OMXResult armVCCOMM_SAD( 972 const OMX_U8* pSrcOrg, 973 OMX_U32 iStepOrg, 974 const OMX_U8* pSrcRef, 975 OMX_U32 iStepRef, 976 OMX_S32* pDstSAD, 977 OMX_U32 iHeight, 978 OMX_U32 iWidth); 979 980/** 981 * Function: armVCCOMM_Average 982 * 983 * Description: 984 * This function calculates the average of two blocks and stores the result. 985 * 986 * Remarks: 987 * 988 * [in] pPred0 Pointer to the top-left corner of reference block 0 989 * [in] pPred1 Pointer to the top-left corner of reference block 1 990 * [in] iPredStep0 Step of reference block 0 991 * [in] iPredStep1 Step of reference block 1 992 * [in] iDstStep Step of the destination buffer 993 * [in] iWidth Width of the blocks 994 * [in] iHeight Height of the blocks 995 * [out] pDstPred Pointer to the destination buffer 996 * 997 * Return Value: 998 * Standard OMXResult value. 999 * 1000 */ 1001 OMXResult armVCCOMM_Average ( 1002 const OMX_U8* pPred0, 1003 const OMX_U8* pPred1, 1004 OMX_U32 iPredStep0, 1005 OMX_U32 iPredStep1, 1006 OMX_U8* pDstPred, 1007 OMX_U32 iDstStep, 1008 OMX_U32 iWidth, 1009 OMX_U32 iHeight 1010); 1011 1012/** 1013 * Function: armVCM4P10_SADQuar 1014 * 1015 * Description: 1016 * This function calculates the SAD between one block (pSrc) and the 1017 * average of the other two (pSrcRef0 and pSrcRef1) 1018 * 1019 * Remarks: 1020 * 1021 * [in] pSrc Pointer to the original block 1022 * [in] pSrcRef0 Pointer to reference block 0 1023 * [in] pSrcRef1 Pointer to reference block 1 1024 * [in] iSrcStep Step of the original block buffer 1025 * [in] iRefStep0 Step of reference block 0 1026 * [in] iRefStep1 Step of reference block 1 1027 * [in] iHeight Height of the block 1028 * [in] iWidth Width of the block 1029 * [out] pDstSAD Pointer of result SAD 1030 * 1031 * Return Value: 1032 * Standard OMXResult value. 1033 * 1034 */ 1035OMXResult armVCM4P10_SADQuar( 1036 const OMX_U8* pSrc, 1037 const OMX_U8* pSrcRef0, 1038 const OMX_U8* pSrcRef1, 1039 OMX_U32 iSrcStep, 1040 OMX_U32 iRefStep0, 1041 OMX_U32 iRefStep1, 1042 OMX_U32* pDstSAD, 1043 OMX_U32 iHeight, 1044 OMX_U32 iWidth 1045); 1046 1047/** 1048 * Function: armVCM4P10_Interpolate_Chroma 1049 * 1050 * Description: 1051 * This function performs interpolation for chroma components. 1052 * 1053 * Remarks: 1054 * 1055 * [in] pSrc Pointer to top-left corner of block used to 1056 * interpolate in the reconstructed frame plane 1057 * [in] iSrcStep Step of the source buffer. 1058 * [in] iDstStep Step of the destination(interpolation) buffer. 1059 * [in] iWidth Width of the current block 1060 * [in] iHeight Height of the current block 1061 * [in] dx Fractional part of horizontal motion vector 1062 * component in 1/8 pixel unit (0~7) 1063 * [in] dy Fractional part of vertical motion vector 1064 * component in 1/8 pixel unit (0~7) 1065 * [out] pDst Pointer to the interpolation buffer 1066 * 1067 * Return Value: 1068 * Standard OMXResult value. 1069 * 1070 */ 1071 OMXResult armVCM4P10_Interpolate_Chroma( 1072 OMX_U8 *pSrc, 1073 OMX_U32 iSrcStep, 1074 OMX_U8 *pDst, 1075 OMX_U32 iDstStep, 1076 OMX_U32 iWidth, 1077 OMX_U32 iHeight, 1078 OMX_U32 dx, 1079 OMX_U32 dy 1080); 1081 1082/** 1083 * Function: armVCM4P10_Interpolate_Luma 1084 * 1085 * Description: 1086 * This function performs interpolation for luma components. 1087 * 1088 * Remarks: 1089 * 1090 * [in] pSrc Pointer to top-left corner of block used to 1091 * interpolate in the reconstructed frame plane 1092 * [in] iSrcStep Step of the source buffer. 1093 * [in] iDstStep Step of the destination(interpolation) buffer. 1094 * [in] iWidth Width of the current block 1095 * [in] iHeight Height of the current block 1096 * [in] dx Fractional part of horizontal motion vector 1097 * component in 1/4 pixel unit (0~3) 1098 * [in] dy Fractional part of vertical motion vector 1099 * component in 1/4 pixel unit (0~3) 1100 * [out] pDst Pointer to the interpolation buffer 1101 * 1102 * Return Value: 1103 * Standard OMXResult value. 1104 * 1105 */ 1106 1107 OMXResult armVCM4P10_Interpolate_Luma( 1108 const OMX_U8 *pSrc, 1109 OMX_U32 iSrcStep, 1110 OMX_U8 *pDst, 1111 OMX_U32 iDstStep, 1112 OMX_U32 iWidth, 1113 OMX_U32 iHeight, 1114 OMX_U32 dx, 1115 OMX_U32 dy 1116); 1117 1118/** 1119 * Function: omxVCH264_DequantTransformACFromPair_U8_S16_C1_DLx 1120 * 1121 * Description: 1122 * Reconstruct the 4x4 residual block from coefficient-position pair buffer, 1123 * perform dequantisation and integer inverse transformation for 4x4 block of 1124 * residuals and update the pair buffer pointer to next non-empty block. 1125 * 1126 * Remarks: 1127 * 1128 * Parameters: 1129 * [in] ppSrc Double pointer to residual coefficient-position 1130 * pair buffer output by CALVC decoding 1131 * [in] pDC Pointer to the DC coefficient of this block, NULL 1132 * if it doesn't exist 1133 * [in] QP Quantization parameter 1134 * [in] AC Flag indicating if at least one non-zero coefficient exists 1135 * [out] pDst pointer to the reconstructed 4x4 block data 1136 * 1137 * Return Value: 1138 * Standard omxError result. See enumeration for possible result codes. 1139 * 1140 */ 1141 1142OMXResult armVCM4P10_DequantTransformACFromPair_U8_S16_C1_DLx( 1143 OMX_U8 **ppSrc, 1144 OMX_S16 *pDst, 1145 OMX_INT QP, 1146 OMX_S16* pDC, 1147 int AC 1148); 1149 1150#endif /*_armVideo_H_*/ 1151 1152/*End of File*/ 1153 1154