History

Add ARM 32bit asm code for decoder.

Licai Guo committed 12 years ago

Commit 0fd9db21 parent fc056c715 files · +4903 −11Browse files

Showing the changes to codec/decoder/core/src/mc.cpp (1 of 15 files). Show all

Unified · Split

codec/decoder/core/src/mc.cpp+322−5
@@ -636,7 +636,7 @@ void McLuma_sse2 (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_ · 635 unmodified lines
636636 void McChroma_sse2 (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
637637 int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight) {
638638 static const PMcChromaWidthExtFunc kpMcChromaWidthFuncs[2] = {
639− McChromaWidthEq4_mmx,
639+ McChromaWidthEq4_mmx,
640640 McChromaWidthEq8_sse2
641641 };
642642 const int32_t kiD8x = iMvX & 0x07;
@@ -651,17 +651,334 @@ void McChroma_sse2 (const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int3 · 8 unmodified lines
651651 McChromaWithFragMv_c (pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight);
652652 }
653653
654−
655654 #endif //X86_ASM
656−
655+//***************************************************************************//
656+// NEON implementation //
657+//***************************************************************************//
658+#if defined(HAVE_NEON)
659+void McCopy_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
660+ int32_t iWidth, int32_t iHeight)
661+{
662+ if (16 == iWidth)
663+ McCopyWidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
664+ else if(8 == iWidth)
665+ McCopyWidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
666+ else
667+ McCopyWidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
668+ }
669+void McHorVer20_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
670+ int32_t iWidth, int32_t iHeight)
671+{
672+ if (iWidth == 16)
673+ McHorVer20WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
674+ else if (iWidth == 8)
675+ McHorVer20WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
676+ else if (iWidth == 4)
677+ McHorVer20WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
678+}
679+void McHorVer02_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
680+ int32_t iWidth, int32_t iHeight)
681+{
682+ if (iWidth == 16)
683+ McHorVer02WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
684+ else if (iWidth == 8)
685+ McHorVer02WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
686+ else if (iWidth == 4)
687+ McHorVer02WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
688+}
689+void McHorVer22_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
690+ int32_t iWidth, int32_t iHeight)
691+{
692+ if (iWidth == 16)
693+ McHorVer22WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
694+ else if (iWidth == 8)
695+ McHorVer22WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
696+ else if (iWidth == 4)
697+ McHorVer22WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
698+}
699+
700+void McHorVer01_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
701+ int32_t iWidth, int32_t iHeight)
702+{
703+ if (iWidth == 16)
704+ McHorVer01WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
705+ else if (iWidth == 8)
706+ McHorVer01WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
707+ else if (iWidth == 4)
708+ McHorVer01WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
709+}
710+void McHorVer03_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
711+ int32_t iWidth, int32_t iHeight)
712+{
713+ if (iWidth == 16)
714+ McHorVer03WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
715+ else if (iWidth == 8)
716+ McHorVer03WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
717+ else if (iWidth == 4)
718+ McHorVer03WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
719+}
720+void McHorVer10_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
721+ int32_t iWidth, int32_t iHeight)
722+{
723+ if (iWidth == 16)
724+ McHorVer10WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
725+ else if (iWidth == 8)
726+ McHorVer10WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
727+ else if (iWidth == 4)
728+ McHorVer10WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
729+}
730+void McHorVer11_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
731+ int32_t iWidth, int32_t iHeight)
732+{
733+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
734+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
735+ if (iWidth == 16)
736+ {
737+ McHorVer20WidthEq16_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
738+ McHorVer02WidthEq16_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
739+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
740+ }
741+ else if (iWidth == 8)
742+ {
743+ McHorVer20WidthEq8_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
744+ McHorVer02WidthEq8_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
745+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
746+ }
747+ else if (iWidth == 4)
748+ {
749+ McHorVer20WidthEq4_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
750+ McHorVer02WidthEq4_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
751+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
752+ }
753+}
754+void McHorVer12_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
755+ int32_t iWidth, int32_t iHeight)
756+{
757+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
758+ ENFORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 );
759+ if (iWidth == 16)
760+ {
761+ McHorVer02WidthEq16_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
762+ McHorVer22WidthEq16_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
763+ PixelAvgWidthEq16_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
764+ }
765+ else if (iWidth == 8)
766+ {
767+ McHorVer02WidthEq8_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
768+ McHorVer22WidthEq8_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
769+ PixelAvgWidthEq8_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
770+ }
771+ else if (iWidth == 4)
772+ {
773+ McHorVer02WidthEq4_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
774+ McHorVer22WidthEq4_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
775+ PixelAvgWidthEq4_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
776+ }
777+}
778+void McHorVer13_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
779+ int32_t iWidth, int32_t iHeight)
780+{
781+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
782+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
783+ if (iWidth == 16)
784+ {
785+ McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
786+ McHorVer02WidthEq16_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
787+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
788+ }
789+ else if (iWidth == 8)
790+ {
791+ McHorVer20WidthEq8_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
792+ McHorVer02WidthEq8_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
793+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
794+ }
795+ else if (iWidth == 4)
796+ {
797+ McHorVer20WidthEq4_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
798+ McHorVer02WidthEq4_neon(pSrc, iSrcStride, pVerTmp, 16, iHeight);
799+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
800+ }
801+}
802+void McHorVer21_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
803+ int32_t iWidth, int32_t iHeight)
804+{
805+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
806+ ENFORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 );
807+ if (iWidth == 16)
808+ {
809+ McHorVer20WidthEq16_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
810+ McHorVer22WidthEq16_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
811+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
812+ }
813+ else if (iWidth == 8)
814+ {
815+ McHorVer20WidthEq8_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
816+ McHorVer22WidthEq8_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
817+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
818+ }
819+ else if (iWidth == 4)
820+ {
821+ McHorVer20WidthEq4_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
822+ McHorVer22WidthEq4_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
823+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
824+ }
825+}
826+void McHorVer23_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
827+ int32_t iWidth, int32_t iHeight)
828+{
829+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
830+ ENFORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 );
831+ if (iWidth == 16)
832+ {
833+ McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
834+ McHorVer22WidthEq16_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
835+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
836+ }
837+ else if (iWidth == 8)
838+ {
839+ McHorVer20WidthEq8_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
840+ McHorVer22WidthEq8_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
841+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
842+ }
843+ else if (iWidth == 4)
844+ {
845+ McHorVer20WidthEq4_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
846+ McHorVer22WidthEq4_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
847+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pCtrTmp, iHeight);
848+ }
849+}
850+void McHorVer30_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
851+ int32_t iWidth, int32_t iHeight)
852+{
853+ if (iWidth == 16)
854+ McHorVer30WidthEq16_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
855+ else if (iWidth == 8)
856+ McHorVer30WidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
857+ else if (iWidth == 4)
858+ McHorVer30WidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
859+}
860+void McHorVer31_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
861+ int32_t iWidth, int32_t iHeight)
862+{
863+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
864+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
865+ if (iWidth == 16) {
866+ McHorVer20WidthEq16_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
867+ McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
868+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
869+ }
870+ else if (iWidth == 8){
871+ McHorVer20WidthEq8_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
872+ McHorVer02WidthEq8_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
873+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
874+ }
875+ else if (iWidth == 4)
876+ {
877+ McHorVer20WidthEq4_neon(pSrc, iSrcStride, pHorTmp, 16, iHeight);
878+ McHorVer02WidthEq4_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
879+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
880+ }
881+}
882+void McHorVer32_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
883+ int32_t iWidth, int32_t iHeight)
884+{
885+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
886+ ENFORCE_STACK_ALIGN_1D( uint8_t, pCtrTmp, 256, 16 );
887+ if (iWidth == 16)
888+ {
889+ McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
890+ McHorVer22WidthEq16_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
891+ PixelAvgWidthEq16_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
892+ }
893+ else if (iWidth == 8)
894+ {
895+ McHorVer02WidthEq8_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
896+ McHorVer22WidthEq8_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
897+ PixelAvgWidthEq8_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
898+ }
899+ else if (iWidth == 4)
900+ {
901+ McHorVer02WidthEq4_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
902+ McHorVer22WidthEq4_neon(pSrc, iSrcStride, pCtrTmp, 16, iHeight);
903+ PixelAvgWidthEq4_neon(pDst, iDstStride, pVerTmp, pCtrTmp, iHeight);
904+ }
905+}
906+void McHorVer33_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
907+ int32_t iWidth, int32_t iHeight)
908+{
909+ ENFORCE_STACK_ALIGN_1D( uint8_t, pHorTmp, 256, 16 );
910+ ENFORCE_STACK_ALIGN_1D( uint8_t, pVerTmp, 256, 16 );
911+ if (iWidth == 16)
912+ {
913+ McHorVer20WidthEq16_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
914+ McHorVer02WidthEq16_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
915+ PixelAvgWidthEq16_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
916+ }
917+ else if (iWidth == 8)
918+ {
919+ McHorVer20WidthEq8_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
920+ McHorVer02WidthEq8_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
921+ PixelAvgWidthEq8_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
922+ }
923+ else if (iWidth == 4)
924+ {
925+ McHorVer20WidthEq4_neon(pSrc+iSrcStride, iSrcStride, pHorTmp, 16, iHeight);
926+ McHorVer02WidthEq4_neon(pSrc+1, iSrcStride, pVerTmp, 16, iHeight);
927+ PixelAvgWidthEq4_neon(pDst, iDstStride, pHorTmp, pVerTmp, iHeight);
928+ }
929+}
930+
931+void McLuma_neon(const uint8_t* pSrc, int32_t iSrcStride, uint8_t* pDst, int32_t iDstStride,
932+ int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight)
933+{
934+ static PWelsMcWidthHeightFunc pWelsMcFunc[4][4] = //[x][y]
935+ {
936+ {McCopy_neon, McHorVer01_neon, McHorVer02_neon, McHorVer03_neon},
937+ {McHorVer10_neon, McHorVer11_neon, McHorVer12_neon, McHorVer13_neon},
938+ {McHorVer20_neon, McHorVer21_neon, McHorVer22_neon, McHorVer23_neon},
939+ {McHorVer30_neon, McHorVer31_neon, McHorVer32_neon, McHorVer33_neon},
940+ };
941+ // pSrc += (iMvY >> 2) * iSrcStride + (iMvX >> 2);
942+ pWelsMcFunc[iMvX&0x03][iMvY&0x03](pSrc, iSrcStride, pDst, iDstStride, iWidth, iHeight);
943+}
944+void McChroma_neon(const uint8_t *pSrc, int32_t iSrcStride, uint8_t *pDst, int32_t iDstStride,
945+ int16_t iMvX, int16_t iMvY, int32_t iWidth, int32_t iHeight)
946+{
947+ if (0 == iMvX && 0 == iMvY)
948+ {
949+ if(8 == iWidth)
950+ McCopyWidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
951+ else if(iWidth == 4)
952+ McCopyWidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, iHeight);
953+ else //here iWidth == 2
954+ McCopyWidthEq2_c(pSrc,iSrcStride,pDst,iDstStride,iHeight);
955+ }
956+ else
957+ {
958+ const int32_t kiD8x = iMvX & 0x07;
959+ const int32_t kiD8y = iMvY & 0x07;
960+ if(8 == iWidth)
961+ McChromaWidthEq8_neon(pSrc, iSrcStride, pDst, iDstStride, (int32_t*)(g_kuiABCD[kiD8y][kiD8x]), iHeight);
962+ else if(4 == iWidth)
963+ McChromaWidthEq4_neon(pSrc, iSrcStride, pDst, iDstStride, (int32_t*)(g_kuiABCD[kiD8y][kiD8x]), iHeight);
964+ else //here iWidth == 2
965+ McChromaWithFragMv_c(pSrc, iSrcStride, pDst, iDstStride, iMvX, iMvY, iWidth, iHeight);
966+ }
967+}
968+#endif
657969 void InitMcFunc (SMcFunc* pMcFunc, int32_t iCpu) {
658970 pMcFunc->pMcLumaFunc = McLuma_c;
659971 pMcFunc->pMcChromaFunc = McChroma_c;
660972
973+#ifdef HAVE_NEON
974+ pMcFunc->pMcLumaFunc = McLuma_neon;
975+ pMcFunc->pMcChromaFunc = McChroma_neon;
976+#endif
977+
661978 #if defined (X86_ASM)
662979 if (iCpu & WELS_CPU_SSE2) {
663− pMcFunc->pMcLumaFunc = McLuma_sse2;
664− pMcFunc->pMcChromaFunc = McChroma_sse2;
980+ pMcFunc->pMcLumaFunc = McLuma_sse2;
981+ pMcFunc->pMcChromaFunc = McChroma_sse2;
665982 }
666983 #endif //(X86_ASM)
667984 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t