Showing the changes to codec/encoder/core/src/mc.cpp (1 of 6 files). Show all
Unified · Split
| @@ -480,6 +480,99 @@ void McChroma_ssse3 (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int · 479 unmodified lines | ||
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | #endif //X86_ASM |
| 483 | + | |
| 484 | + //***************************************************************************// | |
| 485 | + // NEON implementation // | |
| 486 | + //***************************************************************************// | |
| 487 | +#if defined(HAVE_NEON) | |
| 488 | +void McHorVer20Width9Or17_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 489 | + int32_t iWidth, int32_t iHeight) { | |
| 490 | + if (iWidth == 17) | |
| 491 | + McHorVer20Width17_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 492 | + else //if (iWidth == 9) | |
| 493 | + McHorVer20Width9_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 494 | +} | |
| 495 | +void McHorVer02Height9Or17_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 496 | + int32_t iWidth, int32_t iHeight){ | |
| 497 | + if (iWidth == 16) | |
| 498 | + McHorVer02Height17_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 499 | + else //if (iWidth == 8) | |
| 500 | + McHorVer02Height9_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 501 | +} | |
| 502 | +void McHorVer22Width9Or17Height9Or17_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, | |
| 503 | + int32_t iWidth, int32_t iHeight){ | |
| 504 | + if (iWidth == 17) | |
| 505 | + McHorVer22Width17_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 506 | + else //if (iWidth == 9) | |
| 507 | + McHorVer22Width9_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 508 | +} | |
| 509 | +void EncMcHorVer11_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 510 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 511 | + McHorVer20WidthEq16_neon(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 512 | + McHorVer02WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 513 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 514 | +} | |
| 515 | +void EncMcHorVer12_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 516 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 517 | + McHorVer02WidthEq16_neon(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 518 | + McHorVer22WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 519 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 520 | +} | |
| 521 | +void EncMcHorVer13_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 522 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 523 | + McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 524 | + McHorVer02WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 525 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 526 | +} | |
| 527 | +void EncMcHorVer21_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 528 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 529 | + McHorVer20WidthEq16_neon(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 530 | + McHorVer22WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 531 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 532 | +} | |
| 533 | +void EncMcHorVer23_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 534 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 535 | + McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 536 | + McHorVer22WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 537 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 538 | +} | |
| 539 | +void EncMcHorVer31_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 540 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 541 | + McHorVer20WidthEq16_neon(pSrc, iSrcStride, pTmp, 16, iHeight); | |
| 542 | + McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, &pTmp[256], 16, iHeight); | |
| 543 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 544 | +} | |
| 545 | +void EncMcHorVer32_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 546 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 547 | + McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, pTmp, 16, iHeight); | |
| 548 | + McHorVer22WidthEq16_neon(pSrc, iSrcStride, &pTmp[256], 16, iHeight); | |
| 549 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 550 | +} | |
| 551 | +void EncMcHorVer33_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride, int32_t iHeight) { | |
| 552 | + ENFORCE_STACK_ALIGN_1D(uint8_t, pTmp, 512, 16) | |
| 553 | + McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pTmp, 16, iHeight); | |
| 554 | + McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, &pTmp[256], 16, iHeight); | |
| 555 | + PixelAvgWidthEq16_neon(pDst, iDstStride, pTmp, &pTmp[256], iHeight); | |
| 556 | +} | |
| 557 | +void EncMcChroma_neon(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride, | |
| 558 | + SMVUnitXY sMv, int32_t iWidth, int32_t iHeight) { | |
| 559 | + const int32_t kiD8x = sMv.iMvX&0x07; | |
| 560 | + const int32_t kiD8y = sMv.iMvY&0x07; | |
| 561 | + if (0 == kiD8x && 0 == kiD8y) { | |
| 562 | + if(8 == iWidth) | |
| 563 | + McCopyWidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 564 | + else // iWidth == 4 | |
| 565 | + McCopyWidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight); | |
| 566 | + } | |
| 567 | + else { | |
| 568 | + if(8 == iWidth) | |
| 569 | + McChromaWidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, (int32_t*)(g_kuiABCD[kiD8y][kiD8x]), iHeight); | |
| 570 | + else //if(4 == iWidth) | |
| 571 | + McChromaWidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, (int32_t*)(g_kuiABCD[kiD8y][kiD8x]), iHeight); | |
| 572 | + } | |
| 573 | +} | |
| 574 | +#endif | |
| 575 | + | |
| 483 | 576 | typedef void (*PixelAvgFunc) (uint8_t*, int32_t, const uint8_t*, int32_t, const uint8_t*, int32_t, int32_t); |
| 484 | 577 | void WelsInitMcFuncs (SWelsFuncPtrList* pFuncList, uint32_t uiCpuFlag) { |
| 485 | 578 | static PixelAvgFunc pfPixAvgFunc[2] = {PixelAvgWidthEq8_c, PixelAvgWidthEq16_c}; |
| @@ -498,6 +591,14 @@ void WelsInitMcFuncs (SWelsFuncPtrList* pFuncList, uint32_t uiCpuFlag) { · 12 unmodified lines | ||
| 498 | 591 | McHorVer03WidthEq16, McHorVer13WidthEq16, McHorVer23WidthEq16, McHorVer33WidthEq16 |
| 499 | 592 | }; |
| 500 | 593 | #endif |
| 594 | +#if defined(HAVE_NEON) | |
| 595 | + static PWelsLumaQuarpelMcFunc pWelsMcFuncWidthEq16_neon[16] = { //[x][y] | |
| 596 | + McCopyWidthEq16_neon, McHorVer10WidthEq16_neon, McHorVer20WidthEq16_neon, McHorVer30WidthEq16_neon, | |
| 597 | + McHorVer01WidthEq16_neon, EncMcHorVer11_neon, EncMcHorVer21_neon, EncMcHorVer31_neon, | |
| 598 | + McHorVer02WidthEq16_neon, EncMcHorVer12_neon, McHorVer22WidthEq16_neon, EncMcHorVer32_neon, | |
| 599 | + McHorVer03WidthEq16_neon, EncMcHorVer13_neon, EncMcHorVer23_neon, EncMcHorVer33_neon | |
| 600 | + }; | |
| 601 | +#endif | |
| 501 | 602 | |
| 502 | 603 | pFuncList->sMcFuncs.pfLumaHalfpelHor = McHorVer20_c; |
| 503 | 604 | pFuncList->sMcFuncs.pfLumaHalfpelVer = McHorVer02_c; |
| @@ -538,5 +639,17 @@ void WelsInitMcFuncs (SWelsFuncPtrList* pFuncList, uint32_t uiCpuFlag) { · 34 unmodified lines | ||
| 538 | 639 | } |
| 539 | 640 | |
| 540 | 641 | #endif //(X86_ASM) |
| 642 | + | |
| 643 | +#if defined(HAVE_NEON) | |
| 644 | + if (uiCpuFlag & WELS_CPU_NEON) { | |
| 645 | + pFuncList->sMcFuncs.pfLumaQuarpelMc = pWelsMcFuncWidthEq16_neon; | |
| 646 | + pFuncList->sMcFuncs.pfChromaMc = EncMcChroma_neon; | |
| 647 | + pFuncList->sMcFuncs.pfSampleAveraging[0] = PixStrideAvgWidthEq8_neon; | |
| 648 | + pFuncList->sMcFuncs.pfSampleAveraging[1] = PixStrideAvgWidthEq16_neon; | |
| 649 | + pFuncList->sMcFuncs.pfLumaHalfpelHor = McHorVer20Width9Or17_neon;//iWidth+1:8/16 | |
| 650 | + pFuncList->sMcFuncs.pfLumaHalfpelVer = McHorVer02Height9Or17_neon;//heigh+1:8/16 | |
| 651 | + pFuncList->sMcFuncs.pfLumaHalfpelCen = McHorVer22Width9Or17Height9Or17_neon;//iWidth+1/heigh+1 | |
| 652 | + } | |
| 653 | +#endif | |
| 541 | 654 | } |
| 542 | 655 | } |