~ubuntu-branches/ubuntu/saucy/x264/saucy-updates

« back to all changes in this revision

Viewing changes to common/x86/deblock-a.asm

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2012-03-15 17:37:19 UTC
  • mto: (12.2.3 sid)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: package-import@ubuntu.com-20120315173719-bpat2i6dvj0asbjn
Tags: upstream-0.120.2171+git01f7a33
ImportĀ upstreamĀ versionĀ 0.120.2171+git01f7a33

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;*****************************************************************************
2
2
;* deblock-a.asm: x86 deblocking
3
3
;*****************************************************************************
4
 
;* Copyright (C) 2005-2011 x264 project
 
4
;* Copyright (C) 2005-2012 x264 project
5
5
;*
6
6
;* Authors: Loren Merritt <lorenm@u.washington.edu>
7
7
;*          Jason Garrett-Glaser <darkshikari@gmail.com>
43
43
cextern pw_00ff
44
44
cextern pw_pixel_max
45
45
 
46
 
%ifdef HIGH_BIT_DEPTH
 
46
%if HIGH_BIT_DEPTH
47
47
; out: %4 = |%1-%2|-%3
48
48
; clobbers: %5
49
49
%macro ABS_SUB 5
306
306
    RET
307
307
%endmacro
308
308
 
309
 
%ifdef ARCH_X86_64
 
309
%if ARCH_X86_64
310
310
; in:  m0=p1, m1=p0, m2=q0, m3=q1, m8=p2, m9=q2
311
311
;      m12=alpha, m13=beta
312
312
; out: m0=p1', m3=q1', m1=p0', m2=q0'
437
437
;     %1=p0 %2=p1 %3=p2 %4=p3 %5=q0 %6=q1 %7=mask0
438
438
;     %8=mask1p %9=2 %10=p0' %11=p1' %12=p2'
439
439
%macro LUMA_INTRA_P012 12 ; p0..p3 in memory
440
 
%ifdef ARCH_X86_64
 
440
%if ARCH_X86_64
441
441
    paddw     t0, %3, %2
442
442
    mova      t2, %4
443
443
    paddw     t2, %3
504
504
    LOAD_AB t0, t1, r2d, r3d
505
505
    mova    %1, t0
506
506
    LOAD_MASK m0, m1, m2, m3, %1, t1, t0, t2, t3
507
 
%ifdef ARCH_X86_64
 
507
%if ARCH_X86_64
508
508
    mova    %2, t0        ; mask0
509
509
    psrlw   t3, %1, 2
510
510
%else
601
601
%endif
602
602
%endmacro
603
603
 
604
 
%ifdef ARCH_X86_64
 
604
%if ARCH_X86_64
605
605
;-----------------------------------------------------------------------------
606
606
; void deblock_v_luma_intra( uint16_t *pix, int stride, int alpha, int beta )
607
607
;-----------------------------------------------------------------------------
789
789
    RET
790
790
%endmacro
791
791
 
792
 
%ifndef ARCH_X86_64
 
792
%if ARCH_X86_64 == 0
793
793
INIT_MMX mmx2
794
794
DEBLOCK_LUMA
795
795
DEBLOCK_LUMA_INTRA
802
802
%endif
803
803
%endif ; HIGH_BIT_DEPTH
804
804
 
805
 
%ifndef HIGH_BIT_DEPTH
 
805
%if HIGH_BIT_DEPTH == 0
806
806
; expands to [base],...,[base+7*stride]
807
807
%define PASS8ROWS(base, base3, stride, stride3) \
808
808
    [base], [base+stride], [base+stride*2], [base3], \
1010
1010
; out: %4 = |%1-%2|>%3
1011
1011
; clobbers: %5
1012
1012
%macro DIFF_GT2 5
1013
 
%ifdef ARCH_X86_64
 
1013
%if ARCH_X86_64
1014
1014
    psubusb %5, %2, %1
1015
1015
    psubusb %4, %1, %2
1016
1016
%else
1088
1088
    mova    %4, %2
1089
1089
%endmacro
1090
1090
 
1091
 
%ifdef ARCH_X86_64
 
1091
%if ARCH_X86_64
1092
1092
;-----------------------------------------------------------------------------
1093
1093
; void deblock_v_luma( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
1094
1094
;-----------------------------------------------------------------------------
1143
1143
    lea    r8, [r7*3]
1144
1144
    lea    r6, [r0-4]
1145
1145
    lea    r5, [r0-4+r8]
1146
 
%ifdef WIN64
 
1146
%if WIN64
1147
1147
    sub   rsp, 0x98
1148
1148
    %define pix_tmp rsp+0x30
1149
1149
%else
1162
1162
    ; don't backup r6, r5, r7, r8 because deblock_v_luma_sse2 doesn't use them
1163
1163
    lea    r0, [pix_tmp+0x30]
1164
1164
    mov    r1d, 0x10
1165
 
%ifdef WIN64
 
1165
%if WIN64
1166
1166
    mov    [rsp+0x20], r4
1167
1167
%endif
1168
1168
    call   deblock_v_luma
1186
1186
    movq   m3, [pix_tmp+0x40]
1187
1187
    TRANSPOSE8x4B_STORE  PASS8ROWS(r6, r5, r7, r8)
1188
1188
 
1189
 
%ifdef WIN64
 
1189
%if WIN64
1190
1190
    add    rsp, 0x98
1191
1191
%else
1192
1192
    add    rsp, 0x68
1324
1324
 
1325
1325
 
1326
1326
%macro LUMA_INTRA_P012 4 ; p0..p3 in memory
1327
 
%ifdef ARCH_X86_64
 
1327
%if ARCH_X86_64
1328
1328
    pavgb t0, p2, p1
1329
1329
    pavgb t1, p0, q0
1330
1330
%else
1335
1335
%endif
1336
1336
    pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2
1337
1337
    mova  t5, t1
1338
 
%ifdef ARCH_X86_64
 
1338
%if ARCH_X86_64
1339
1339
    paddb t2, p2, p1
1340
1340
    paddb t3, p0, q0
1341
1341
%else
1353
1353
    pand  t2, mpb_1
1354
1354
    psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4;
1355
1355
 
1356
 
%ifdef ARCH_X86_64
 
1356
%if ARCH_X86_64
1357
1357
    pavgb t1, p2, q1
1358
1358
    psubb t2, p2, q1
1359
1359
%else
1428
1428
    %define t1 m5
1429
1429
    %define t2 m6
1430
1430
    %define t3 m7
1431
 
%ifdef ARCH_X86_64
 
1431
%if ARCH_X86_64
1432
1432
    %define p2 m8
1433
1433
    %define q2 m9
1434
1434
    %define t4 m10
1455
1455
; void deblock_v_luma_intra( uint8_t *pix, int stride, int alpha, int beta )
1456
1456
;-----------------------------------------------------------------------------
1457
1457
cglobal deblock_%1_luma_intra, 4,6,16
1458
 
%ifndef ARCH_X86_64
 
1458
%if ARCH_X86_64 == 0
1459
1459
    sub     esp, 0x60
1460
1460
%endif
1461
1461
    lea     r4, [r1*4]
1470
1470
    mova    p0, [r4+r5]
1471
1471
    mova    q0, [r0]
1472
1472
    mova    q1, [r0+r1]
1473
 
%ifdef ARCH_X86_64
 
1473
%if ARCH_X86_64
1474
1474
    pxor    mpb_0, mpb_0
1475
1475
    mova    mpb_1, [pb_1]
1476
1476
    LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
1506
1506
    LUMA_INTRA_SWAP_PQ
1507
1507
    LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5]
1508
1508
.end:
1509
 
%ifndef ARCH_X86_64
 
1509
%if ARCH_X86_64 == 0
1510
1510
    add     esp, 0x60
1511
1511
%endif
1512
1512
    RET
1513
1513
 
1514
1514
INIT_MMX cpuname
1515
 
%ifdef ARCH_X86_64
 
1515
%if ARCH_X86_64
1516
1516
;-----------------------------------------------------------------------------
1517
1517
; void deblock_h_luma_intra( uint8_t *pix, int stride, int alpha, int beta )
1518
1518
;-----------------------------------------------------------------------------
1590
1590
DEBLOCK_LUMA_INTRA v
1591
1591
INIT_XMM avx
1592
1592
DEBLOCK_LUMA_INTRA v
1593
 
%ifndef ARCH_X86_64
 
1593
%if ARCH_X86_64 == 0
1594
1594
INIT_MMX mmx2
1595
1595
DEBLOCK_LUMA_INTRA v8
1596
1596
%endif
1597
1597
%endif ; !HIGH_BIT_DEPTH
1598
1598
 
1599
 
%ifdef HIGH_BIT_DEPTH
 
1599
%if HIGH_BIT_DEPTH
1600
1600
; in: %1=p0, %2=q0, %3=p1, %4=q1, %5=mask, %6=tmp, %7=tmp
1601
1601
; out: %1=p0', %2=q0'
1602
1602
%macro CHROMA_DEBLOCK_P0_Q0_INTRA 7
1870
1870
    REP_RET
1871
1871
%endmacro ; DEBLOCK_CHROMA
1872
1872
 
1873
 
%ifndef ARCH_X86_64
 
1873
%if ARCH_X86_64 == 0
1874
1874
INIT_MMX mmx2
1875
1875
DEBLOCK_CHROMA
1876
1876
%endif
1880
1880
DEBLOCK_CHROMA
1881
1881
%endif ; HIGH_BIT_DEPTH
1882
1882
 
1883
 
%ifndef HIGH_BIT_DEPTH
 
1883
%if HIGH_BIT_DEPTH == 0
1884
1884
%macro CHROMA_V_START 0
1885
1885
    dec    r2d      ; alpha-1
1886
1886
    dec    r3d      ; beta-1
1974
1974
DEBLOCK_CHROMA
1975
1975
INIT_XMM avx
1976
1976
DEBLOCK_CHROMA
1977
 
%ifndef ARCH_X86_64
 
1977
%if ARCH_X86_64 == 0
1978
1978
INIT_MMX mmx2
1979
1979
DEBLOCK_CHROMA
1980
1980
%endif
2002
2002
 
2003
2003
INIT_XMM sse2
2004
2004
DEBLOCK_H_CHROMA_420_MBAFF
2005
 
%ifndef ARCH_X86_64
 
2005
%if ARCH_X86_64 == 0
2006
2006
INIT_MMX mmx2
2007
2007
DEBLOCK_H_CHROMA_420_MBAFF
2008
2008
%endif
2009
2009
 
2010
2010
%macro DEBLOCK_H_CHROMA_422 0
2011
2011
cglobal deblock_h_chroma_422, 5,8,8
2012
 
%ifdef ARCH_X86_64
 
2012
%if ARCH_X86_64
2013
2013
    %define cntr r7
2014
2014
%else
2015
2015
    %define cntr dword r0m
2127
2127
DEBLOCK_CHROMA_INTRA
2128
2128
INIT_MMX mmx2
2129
2129
DEBLOCK_CHROMA_INTRA_BODY
2130
 
%ifndef ARCH_X86_64
 
2130
%if ARCH_X86_64 == 0
2131
2131
DEBLOCK_CHROMA_INTRA
2132
2132
%endif
2133
2133