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