1;*****************************************************************************
2;* const-a.asm: x86 global constants
3;*****************************************************************************
4;* Copyright (C) 2010-2013 x264 project
5;*
6;* Authors: Loren Merritt <lorenm@u.washington.edu>
7;*          Fiona Glaser <fiona@x264.com>
8;*          Min Chen <chenm003@163.com> <min.chen@multicorewareinc.com>
9;*          Praveen Kumar Tiwari <praveen@multicorewareinc.com>
10;* This program is free software; you can redistribute it and/or modify
11;* it under the terms of the GNU General Public License as published by
12;* the Free Software Foundation; either version 2 of the License, or
13;* (at your option) any later version.
14;*
15;* This program is distributed in the hope that it will be useful,
16;* but WITHOUT ANY WARRANTY; without even the implied warranty of
17;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18;* GNU General Public License for more details.
19;*
20;* You should have received a copy of the GNU General Public License
21;* along with this program; if not, write to the Free Software
22;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
23;*
24;* This program is also available under a commercial proprietary license.
25;* For more information, contact us at license @ x265.com.
26;*****************************************************************************
27
28%include "x86inc.asm"
29
30SECTION_RODATA 32
31
32;; 8-bit constants
33
34const pb_0,                 times 16 db 0
35const pb_1,                 times 32 db 1
36const pb_2,                 times 32 db 2
37const pb_3,                 times 16 db 3
38const pb_4,                 times 32 db 4
39const pb_8,                 times 32 db 8
40const pb_15,                times 32 db 15
41const pb_16,                times 32 db 16
42const pb_32,                times 32 db 32
43const pb_64,                times 32 db 64
44const pb_128,               times 32 db 128
45const pb_a1,                times 16 db 0xa1
46
47const pb_01,                times  8 db   0,   1
48const hsub_mul,             times 16 db   1,  -1
49const pw_swap,              times  2 db   6,   7,   4,   5,   2,   3,   0,   1
50const pb_unpackbd1,         times  2 db   0,   0,   0,   0,   1,   1,   1,   1,   2,   2,   2,   2,   3,   3,   3,   3
51const pb_unpackbd2,         times  2 db   4,   4,   4,   4,   5,   5,   5,   5,   6,   6,   6,   6,   7,   7,   7,   7
52const pb_unpackwq1,         times  1 db   0,   1,   0,   1,   0,   1,   0,   1,   2,   3,   2,   3,   2,   3,   2,   3
53const pb_unpackwq2,         times  1 db   4,   5,   4,   5,   4,   5,   4,   5,   6,   7,   6,   7,   6,   7,   6,   7
54const pb_shuf8x8c,          times  1 db   0,   0,   0,   0,   2,   2,   2,   2,   4,   4,   4,   4,   6,   6,   6,   6
55const pb_movemask,          times 16 db 0x00
56                            times 16 db 0xFF
57
58const pb_movemask_32,       times 32 db 0x00
59                            times 32 db 0xFF
60                            times 32 db 0x00
61
62const pb_0000000000000F0F,  times  2 db 0xff, 0x00
63                            times 12 db 0x00
64const pb_000000000000000F,           db 0xff
65                            times 15 db 0x00
66
67;; 16-bit constants
68
69const pw_1,                 times 16 dw 1
70const pw_2,                 times 16 dw 2
71const pw_3,                 times 16 dw 3
72const pw_7,                 times 16 dw 7
73const pw_m2,                times  8 dw -2
74const pw_4,                 times  8 dw 4
75const pw_8,                 times  8 dw 8
76const pw_16,                times 16 dw 16
77const pw_15,                times 16 dw 15
78const pw_31,                times 16 dw 31
79const pw_32,                times 16 dw 32
80const pw_64,                times  8 dw 64
81const pw_128,               times 16 dw 128
82const pw_256,               times 16 dw 256
83const pw_257,               times 16 dw 257
84const pw_512,               times 16 dw 512
85const pw_1023,              times 16 dw 1023
86const pw_1024,              times 16 dw 1024
87const pw_2048,              times 16 dw 2048
88const pw_4096,              times 16 dw 4096
89const pw_8192,              times  8 dw 8192
90const pw_00ff,              times 16 dw 0x00ff
91const pw_ff00,              times  8 dw 0xff00
92const pw_2000,              times 16 dw 0x2000
93const pw_8000,              times  8 dw 0x8000
94const pw_3fff,              times  8 dw 0x3fff
95const pw_32_0,              times  4 dw 32,
96                            times  4 dw 0
97const pw_pixel_max,         times 16 dw ((1 << BIT_DEPTH)-1)
98
99const pw_0_15,              times  2 dw   0,   1,   2,   3,   4,   5,   6,   7
100const pw_ppppmmmm,          times  1 dw   1,   1,   1,   1,  -1,  -1,  -1,  -1
101const pw_ppmmppmm,          times  1 dw   1,   1,  -1,  -1,   1,   1,  -1,  -1
102const pw_pmpmpmpm,          times 16 dw   1,  -1,   1,  -1,   1,  -1,   1,  -1
103const pw_pmmpzzzz,          times  1 dw   1,  -1,  -1,   1,   0,   0,   0,   0
104const multi_2Row,           times  1 dw   1,   2,   3,   4,   1,   2,   3,   4
105const multiH,               times  1 dw   9,  10,  11,  12,  13,  14,  15,  16
106const multiH3,              times  1 dw  25,  26,  27,  28,  29,  30,  31,  32
107const multiL,               times  1 dw   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16
108const multiH2,              times  1 dw  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32
109const pw_planar16_mul,      times  1 dw  15,  14,  13,  12,  11,  10,   9,   8,   7,   6,   5,   4,   3,   2,   1,   0
110const pw_planar32_mul,      times  1 dw  31,  30,  29,  28,  27,  26,  25,  24,  23,  22,  21,  20,  19,  18,  17,  16
111const pw_FFFFFFFFFFFFFFF0,           dw 0x00
112                            times  7 dw 0xff
113const hmul_16p,             times 16 db   1
114                            times  8 db   1,  -1
115
116
117;; 32-bit constants
118
119const pd_1,                 times  8 dd 1
120const pd_2,                 times  8 dd 2
121const pd_4,                 times  4 dd 4
122const pd_8,                 times  4 dd 8
123const pd_16,                times  8 dd 16
124const pd_31,                times  4 dd 31
125const pd_32,                times  8 dd 32
126const pd_64,                times  4 dd 64
127const pd_128,               times  4 dd 128
128const pd_256,               times  4 dd 256
129const pd_512,               times  4 dd 512
130const pd_1024,              times  4 dd 1024
131const pd_2048,              times  4 dd 2048
132const pd_ffff,              times  4 dd 0xffff
133const pd_32767,             times  4 dd 32767
134const pd_524416,            times  4 dd 524416
135const pd_n32768,            times  8 dd 0xffff8000
136const pd_n131072,           times  4 dd 0xfffe0000
137
138const trans8_shuf,          times  1 dd   0,   4,   1,   5,   2,   6,   3,   7
139
140const popcnt_table
141%assign x 0
142%rep 256
143; population count
144db ((x>>0)&1)+((x>>1)&1)+((x>>2)&1)+((x>>3)&1)+((x>>4)&1)+((x>>5)&1)+((x>>6)&1)+((x>>7)&1)
145%assign x x+1
146%endrep
147