123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- %include "jsimdext.inc"
- %include "jdct.inc"
- %define CONST_BITS 13
- %define PASS1_BITS 2
- %define DESCALE_P1 (CONST_BITS - PASS1_BITS)
- %define DESCALE_P2 (CONST_BITS + PASS1_BITS)
- %if CONST_BITS == 13
- F_0_298 equ 2446
- F_0_390 equ 3196
- F_0_541 equ 4433
- F_0_765 equ 6270
- F_0_899 equ 7373
- F_1_175 equ 9633
- F_1_501 equ 12299
- F_1_847 equ 15137
- F_1_961 equ 16069
- F_2_053 equ 16819
- F_2_562 equ 20995
- F_3_072 equ 25172
- %else
- %define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n))
- F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS)
- F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS)
- F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS)
- F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS)
- F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS)
- F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS)
- F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS)
- F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS)
- F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS)
- F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS)
- F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS)
- F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS)
- %endif
- SECTION SEG_CONST
- alignz 32
- GLOBAL_DATA(jconst_fdct_islow_mmx)
- EXTN(jconst_fdct_islow_mmx):
- PW_F130_F054 times 2 dw (F_0_541 + F_0_765), F_0_541
- PW_F054_MF130 times 2 dw F_0_541, (F_0_541 - F_1_847)
- PW_MF078_F117 times 2 dw (F_1_175 - F_1_961), F_1_175
- PW_F117_F078 times 2 dw F_1_175, (F_1_175 - F_0_390)
- PW_MF060_MF089 times 2 dw (F_0_298 - F_0_899), -F_0_899
- PW_MF089_F060 times 2 dw -F_0_899, (F_1_501 - F_0_899)
- PW_MF050_MF256 times 2 dw (F_2_053 - F_2_562), -F_2_562
- PW_MF256_F050 times 2 dw -F_2_562, (F_3_072 - F_2_562)
- PD_DESCALE_P1 times 2 dd 1 << (DESCALE_P1 - 1)
- PD_DESCALE_P2 times 2 dd 1 << (DESCALE_P2 - 1)
- PW_DESCALE_P2X times 4 dw 1 << (PASS1_BITS - 1)
- alignz 32
- SECTION SEG_TEXT
- BITS 32
- %define data(b) (b) + 8
- %define original_ebp ebp + 0
- %define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_MMWORD
- %define WK_NUM 2
- align 32
- GLOBAL_FUNCTION(jsimd_fdct_islow_mmx)
- EXTN(jsimd_fdct_islow_mmx):
- push ebp
- mov eax, esp
- sub esp, byte 4
- and esp, byte (-SIZEOF_MMWORD)
- mov [esp], eax
- mov ebp, esp
- lea esp, [wk(0)]
- pushpic ebx
- get_GOT ebx
-
- mov edx, POINTER [data(eax)]
- mov ecx, DCTSIZE/4
- alignx 16, 7
- .rowloop:
- movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)]
- movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)]
- movq mm2, MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)]
- movq mm3, MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)]
-
-
- movq mm4, mm0
- punpcklwd mm0, mm1
- punpckhwd mm4, mm1
- movq mm5, mm2
- punpcklwd mm2, mm3
- punpckhwd mm5, mm3
- movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)]
- movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)]
- movq mm1, MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)]
- movq mm3, MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)]
-
-
- movq MMWORD [wk(0)], mm4
- movq MMWORD [wk(1)], mm2
- movq mm4, mm6
- punpcklwd mm6, mm7
- punpckhwd mm4, mm7
- movq mm2, mm1
- punpcklwd mm1, mm3
- punpckhwd mm2, mm3
- movq mm7, mm6
- punpckldq mm6, mm0
- punpckhdq mm7, mm0
- movq mm3, mm2
- punpckldq mm2, mm5
- punpckhdq mm3, mm5
- movq mm0, mm7
- movq mm5, mm6
- psubw mm7, mm2
- psubw mm6, mm3
- paddw mm0, mm2
- paddw mm5, mm3
- movq mm2, MMWORD [wk(0)]
- movq mm3, MMWORD [wk(1)]
- movq MMWORD [wk(0)], mm7
- movq MMWORD [wk(1)], mm6
- movq mm7, mm4
- punpckldq mm4, mm2
- punpckhdq mm7, mm2
- movq mm6, mm1
- punpckldq mm1, mm3
- punpckhdq mm6, mm3
- movq mm2, mm7
- movq mm3, mm4
- paddw mm7, mm1
- paddw mm4, mm6
- psubw mm2, mm1
- psubw mm3, mm6
-
- movq mm1, mm5
- movq mm6, mm0
- paddw mm5, mm7
- paddw mm0, mm4
- psubw mm1, mm7
- psubw mm6, mm4
- movq mm7, mm5
- paddw mm5, mm0
- psubw mm7, mm0
- psllw mm5, PASS1_BITS
- psllw mm7, PASS1_BITS
- movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5
- movq MMWORD [MMBLOCK(0,1,edx,SIZEOF_DCTELEM)], mm7
-
-
-
-
-
-
-
-
- movq mm4, mm1
- movq mm0, mm1
- punpcklwd mm4, mm6
- punpckhwd mm0, mm6
- movq mm1, mm4
- movq mm6, mm0
- pmaddwd mm4, [GOTOFF(ebx,PW_F130_F054)]
- pmaddwd mm0, [GOTOFF(ebx,PW_F130_F054)]
- pmaddwd mm1, [GOTOFF(ebx,PW_F054_MF130)]
- pmaddwd mm6, [GOTOFF(ebx,PW_F054_MF130)]
- paddd mm4, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm0, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm4, DESCALE_P1
- psrad mm0, DESCALE_P1
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm6, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm1, DESCALE_P1
- psrad mm6, DESCALE_P1
- packssdw mm4, mm0
- packssdw mm1, mm6
- movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4
- movq MMWORD [MMBLOCK(2,1,edx,SIZEOF_DCTELEM)], mm1
-
- movq mm5, MMWORD [wk(0)]
- movq mm7, MMWORD [wk(1)]
- movq mm0, mm2
- movq mm6, mm3
- paddw mm0, mm5
- paddw mm6, mm7
-
-
-
-
-
-
-
-
- movq mm4, mm0
- movq mm1, mm0
- punpcklwd mm4, mm6
- punpckhwd mm1, mm6
- movq mm0, mm4
- movq mm6, mm1
- pmaddwd mm4, [GOTOFF(ebx,PW_MF078_F117)]
- pmaddwd mm1, [GOTOFF(ebx,PW_MF078_F117)]
- pmaddwd mm0, [GOTOFF(ebx,PW_F117_F078)]
- pmaddwd mm6, [GOTOFF(ebx,PW_F117_F078)]
- movq MMWORD [wk(0)], mm4
- movq MMWORD [wk(1)], mm1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- movq mm4, mm2
- movq mm1, mm2
- punpcklwd mm4, mm7
- punpckhwd mm1, mm7
- movq mm2, mm4
- movq mm7, mm1
- pmaddwd mm4, [GOTOFF(ebx,PW_MF060_MF089)]
- pmaddwd mm1, [GOTOFF(ebx,PW_MF060_MF089)]
- pmaddwd mm2, [GOTOFF(ebx,PW_MF089_F060)]
- pmaddwd mm7, [GOTOFF(ebx,PW_MF089_F060)]
- paddd mm4, MMWORD [wk(0)]
- paddd mm1, MMWORD [wk(1)]
- paddd mm2, mm0
- paddd mm7, mm6
- paddd mm4, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm4, DESCALE_P1
- psrad mm1, DESCALE_P1
- paddd mm2, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm7, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm2, DESCALE_P1
- psrad mm7, DESCALE_P1
- packssdw mm4, mm1
- packssdw mm2, mm7
- movq MMWORD [MMBLOCK(3,1,edx,SIZEOF_DCTELEM)], mm4
- movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2
- movq mm1, mm3
- movq mm7, mm3
- punpcklwd mm1, mm5
- punpckhwd mm7, mm5
- movq mm3, mm1
- movq mm5, mm7
- pmaddwd mm1, [GOTOFF(ebx,PW_MF050_MF256)]
- pmaddwd mm7, [GOTOFF(ebx,PW_MF050_MF256)]
- pmaddwd mm3, [GOTOFF(ebx,PW_MF256_F050)]
- pmaddwd mm5, [GOTOFF(ebx,PW_MF256_F050)]
- paddd mm1, mm0
- paddd mm7, mm6
- paddd mm3, MMWORD [wk(0)]
- paddd mm5, MMWORD [wk(1)]
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm7, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm1, DESCALE_P1
- psrad mm7, DESCALE_P1
- paddd mm3, [GOTOFF(ebx,PD_DESCALE_P1)]
- paddd mm5, [GOTOFF(ebx,PD_DESCALE_P1)]
- psrad mm3, DESCALE_P1
- psrad mm5, DESCALE_P1
- packssdw mm1, mm7
- packssdw mm3, mm5
- movq MMWORD [MMBLOCK(1,1,edx,SIZEOF_DCTELEM)], mm1
- movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3
- add edx, byte 4*DCTSIZE*SIZEOF_DCTELEM
- dec ecx
- jnz near .rowloop
-
- mov edx, POINTER [data(eax)]
- mov ecx, DCTSIZE/4
- alignx 16, 7
- .columnloop:
- movq mm0, MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)]
- movq mm1, MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)]
- movq mm2, MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)]
- movq mm3, MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)]
-
-
- movq mm4, mm0
- punpcklwd mm0, mm1
- punpckhwd mm4, mm1
- movq mm5, mm2
- punpcklwd mm2, mm3
- punpckhwd mm5, mm3
- movq mm6, MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)]
- movq mm7, MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)]
- movq mm1, MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)]
- movq mm3, MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)]
-
-
- movq MMWORD [wk(0)], mm4
- movq MMWORD [wk(1)], mm2
- movq mm4, mm6
- punpcklwd mm6, mm7
- punpckhwd mm4, mm7
- movq mm2, mm1
- punpcklwd mm1, mm3
- punpckhwd mm2, mm3
- movq mm7, mm6
- punpckldq mm6, mm0
- punpckhdq mm7, mm0
- movq mm3, mm2
- punpckldq mm2, mm5
- punpckhdq mm3, mm5
- movq mm0, mm7
- movq mm5, mm6
- psubw mm7, mm2
- psubw mm6, mm3
- paddw mm0, mm2
- paddw mm5, mm3
- movq mm2, MMWORD [wk(0)]
- movq mm3, MMWORD [wk(1)]
- movq MMWORD [wk(0)], mm7
- movq MMWORD [wk(1)], mm6
- movq mm7, mm4
- punpckldq mm4, mm2
- punpckhdq mm7, mm2
- movq mm6, mm1
- punpckldq mm1, mm3
- punpckhdq mm6, mm3
- movq mm2, mm7
- movq mm3, mm4
- paddw mm7, mm1
- paddw mm4, mm6
- psubw mm2, mm1
- psubw mm3, mm6
-
- movq mm1, mm5
- movq mm6, mm0
- paddw mm5, mm7
- paddw mm0, mm4
- psubw mm1, mm7
- psubw mm6, mm4
- movq mm7, mm5
- paddw mm5, mm0
- psubw mm7, mm0
- paddw mm5, [GOTOFF(ebx,PW_DESCALE_P2X)]
- paddw mm7, [GOTOFF(ebx,PW_DESCALE_P2X)]
- psraw mm5, PASS1_BITS
- psraw mm7, PASS1_BITS
- movq MMWORD [MMBLOCK(0,0,edx,SIZEOF_DCTELEM)], mm5
- movq MMWORD [MMBLOCK(4,0,edx,SIZEOF_DCTELEM)], mm7
-
-
-
-
-
-
-
-
- movq mm4, mm1
- movq mm0, mm1
- punpcklwd mm4, mm6
- punpckhwd mm0, mm6
- movq mm1, mm4
- movq mm6, mm0
- pmaddwd mm4, [GOTOFF(ebx,PW_F130_F054)]
- pmaddwd mm0, [GOTOFF(ebx,PW_F130_F054)]
- pmaddwd mm1, [GOTOFF(ebx,PW_F054_MF130)]
- pmaddwd mm6, [GOTOFF(ebx,PW_F054_MF130)]
- paddd mm4, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm0, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm4, DESCALE_P2
- psrad mm0, DESCALE_P2
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm6, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm1, DESCALE_P2
- psrad mm6, DESCALE_P2
- packssdw mm4, mm0
- packssdw mm1, mm6
- movq MMWORD [MMBLOCK(2,0,edx,SIZEOF_DCTELEM)], mm4
- movq MMWORD [MMBLOCK(6,0,edx,SIZEOF_DCTELEM)], mm1
-
- movq mm5, MMWORD [wk(0)]
- movq mm7, MMWORD [wk(1)]
- movq mm0, mm2
- movq mm6, mm3
- paddw mm0, mm5
- paddw mm6, mm7
-
-
-
-
-
-
-
-
- movq mm4, mm0
- movq mm1, mm0
- punpcklwd mm4, mm6
- punpckhwd mm1, mm6
- movq mm0, mm4
- movq mm6, mm1
- pmaddwd mm4, [GOTOFF(ebx,PW_MF078_F117)]
- pmaddwd mm1, [GOTOFF(ebx,PW_MF078_F117)]
- pmaddwd mm0, [GOTOFF(ebx,PW_F117_F078)]
- pmaddwd mm6, [GOTOFF(ebx,PW_F117_F078)]
- movq MMWORD [wk(0)], mm4
- movq MMWORD [wk(1)], mm1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- movq mm4, mm2
- movq mm1, mm2
- punpcklwd mm4, mm7
- punpckhwd mm1, mm7
- movq mm2, mm4
- movq mm7, mm1
- pmaddwd mm4, [GOTOFF(ebx,PW_MF060_MF089)]
- pmaddwd mm1, [GOTOFF(ebx,PW_MF060_MF089)]
- pmaddwd mm2, [GOTOFF(ebx,PW_MF089_F060)]
- pmaddwd mm7, [GOTOFF(ebx,PW_MF089_F060)]
- paddd mm4, MMWORD [wk(0)]
- paddd mm1, MMWORD [wk(1)]
- paddd mm2, mm0
- paddd mm7, mm6
- paddd mm4, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm4, DESCALE_P2
- psrad mm1, DESCALE_P2
- paddd mm2, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm7, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm2, DESCALE_P2
- psrad mm7, DESCALE_P2
- packssdw mm4, mm1
- packssdw mm2, mm7
- movq MMWORD [MMBLOCK(7,0,edx,SIZEOF_DCTELEM)], mm4
- movq MMWORD [MMBLOCK(1,0,edx,SIZEOF_DCTELEM)], mm2
- movq mm1, mm3
- movq mm7, mm3
- punpcklwd mm1, mm5
- punpckhwd mm7, mm5
- movq mm3, mm1
- movq mm5, mm7
- pmaddwd mm1, [GOTOFF(ebx,PW_MF050_MF256)]
- pmaddwd mm7, [GOTOFF(ebx,PW_MF050_MF256)]
- pmaddwd mm3, [GOTOFF(ebx,PW_MF256_F050)]
- pmaddwd mm5, [GOTOFF(ebx,PW_MF256_F050)]
- paddd mm1, mm0
- paddd mm7, mm6
- paddd mm3, MMWORD [wk(0)]
- paddd mm5, MMWORD [wk(1)]
- paddd mm1, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm7, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm1, DESCALE_P2
- psrad mm7, DESCALE_P2
- paddd mm3, [GOTOFF(ebx,PD_DESCALE_P2)]
- paddd mm5, [GOTOFF(ebx,PD_DESCALE_P2)]
- psrad mm3, DESCALE_P2
- psrad mm5, DESCALE_P2
- packssdw mm1, mm7
- packssdw mm3, mm5
- movq MMWORD [MMBLOCK(5,0,edx,SIZEOF_DCTELEM)], mm1
- movq MMWORD [MMBLOCK(3,0,edx,SIZEOF_DCTELEM)], mm3
- add edx, byte 4*SIZEOF_DCTELEM
- dec ecx
- jnz near .columnloop
- emms
- poppic ebx
- mov esp, ebp
- pop esp
- pop ebp
- ret
- align 32
|