summaryrefslogtreecommitdiff
blob: 671406180773c676771567882f13a7fe80de3a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
Fix from upstream cvs:

2004-12-12  Dan Dennedy <dan@dennedy.org>

	* *_x86_64.S: apply patch from Dean Kolosiek to fix linker
	  compatibility.

--- libdv-0.104/libdv/encode_x86_64.S
+++ libdv-0.104/libdv/encode_x86_64.S
@@ -47,7 +47,8 @@
 
 	mov	$63, %rcx                        # loop counter
 
-	mov	vlc_encode_lookup(%rip), %r11
+	mov	vlc_encode_lookup@GOTPCREL(%rip), %r11
+	mov	(%r11),%r11
 
 	pxor	%mm0, %mm0
 	pxor	%mm2, %mm2
@@ -129,7 +130,8 @@
 	add	$2, %rdi           /* skip the DC coefficient */
 	mov	$63, %rcx
 
-	mov	vlc_num_bits_lookup(%rip), %r11
+	mov	vlc_num_bits_lookup@GOTPCREL(%rip), %r11
+	mov	(%r11),%r11
 	
 vlc_num_bits_block_x86_loop:
 	movw	(%rdi), %ax        /* get the next coeffiecient */
--- libdv-0.104/libdv/idct_block_mmx_x86_64.S
+++ libdv-0.104/libdv/idct_block_mmx_x86_64.S
@@ -22,7 +22,7 @@
 /* void _dv_idct_88(dv_coeff_t *block) */
 	/* argument block=rdi */
 	
-	lea	 preSC(%rip), %r11
+	mov	 preSC@GOTPCREL(%rip), %r11
 
 /* 
  *	column 0: even part
--- libdv-0.104/libdv/quant_x86_64.S
+++ libdv-0.104/libdv/quant_x86_64.S
@@ -73,10 +73,10 @@
 	/*  pq = dv_quant_shifts[qno + dv_quant_offset[class]]; */
 	mov	%rsi,%rax	/* qno */
 	mov	%rdx,%r12	/* class */
-	lea	dv_quant_offset(%rip),%rcx
+	mov	dv_quant_offset@GOTPCREL(%rip),%rcx
 	movzbq	(%rcx,%r12,1),%rcx   /* dv_quant_offset[class] */
 	add	%rcx,%rax                       /* qno + */
-	lea	dv_quant_shifts(%rip),%r11
+	mov	dv_quant_shifts@GOTPCREL(%rip),%r11
 	lea	(%r11,%rax,4),%r11	/* r11 is pq = dv_quant_shifts[...] */
 
 	/* extra = (class == 3); */
@@ -217,10 +217,10 @@
 	mov	%rsi,%rax	/* qno */
 	mov	%rdx,%r12	/* class */
 
-	lea	dv_quant_offset(%rip),%rcx
+	mov	dv_quant_offset@GOTPCREL(%rip),%rcx
 	movzbq	(%rcx,%r12,1),%rcx
 	add	%rcx,%rax
-	lea	dv_quant_shifts(%rip),%r11
+	mov	dv_quant_shifts@GOTPCREL(%rip),%r11
 	lea	(%r11,%rax,4),%r11	/* r11 is pq */
 
 	/* extra = (class == 3); */
--- libdv-0.104/libdv/vlc_x86_64.S
+++ libdv-0.104/libdv/vlc_x86_64.S
@@ -16,28 +16,28 @@
 	/* klass = dv_vlc_classes[maxbits][(bits & (dv_vlc_class_index_mask[maxbits])) >> */
 	/*         (dv_vlc_class_index_rshift[maxbits])];  */
 /*	xor  %rbp,%rbp */
-	lea  dv_vlc_class_index_mask(%rip),%r11            /* use %rip for PIC code */
+	mov  dv_vlc_class_index_mask@GOTPCREL(%rip),%r11    /* use %rip for PIC code */
  	mov  (%r11,%rbx,4),%ebp           /* int32 */      /* dv_vlc_class_index_mask[maxbits] */
 	and  %eax,%ebp                                     /* bits & */
-	lea  dv_vlc_class_index_rshift(%rip),%rcx
+	mov  dv_vlc_class_index_rshift@GOTPCREL(%rip),%rcx
 	mov  (%rcx,%rbx,4),%ecx           /* int32 */      /* dv_vlc_class_index_rshift[maxbits] */
 	sar  %cl,%ebp                                      /* >> */
-	lea  dv_vlc_classes(%rip),%rcx
+	mov  dv_vlc_classes@GOTPCREL(%rip),%rcx
 	mov  (%rcx,%rbx,8),%rcx           /* ptr */        /* dv_vlc_classes[maxbits], a pointer */
 	movsbq  (%rcx,%rbp,1),%rbp        /* int8 */       /* klass = */
 
 	/* *result = dv_vlc_lookups[klass][(bits & (dv_vlc_index_mask[klass])) >> */
 	/*           (dv_vlc_index_rshift[klass])];   */
 /*	xor  %rbx,%rbx */
-	lea  dv_vlc_index_mask(%rip),%r11
+	mov  dv_vlc_index_mask@GOTPCREL(%rip),%r11
 	mov  (%r11,%rbp,4),%ebx          /* int32 */       /* (dv_vlc_index_mask[klass]) */
 /*	xor  %rcx,%rcx */
-	lea  dv_vlc_index_rshift(%rip),%r11
+	mov  dv_vlc_index_rshift@GOTPCREL(%rip),%r11
 	mov  (%r11,%rbp,4),%ecx          /* int32 */       /* dv_vlc_index_rshift[klass] */
 	and  %eax,%ebx                                     /* bits &  */
 	sar  %cl,%ebx                                      /* >> */
 
-	lea  dv_vlc_lookups(%rip),%r11
+	mov  dv_vlc_lookups@GOTPCREL(%rip),%r11
 	mov  (%r11,%rbp,8),%rbp          /* ptr */         /* dv_vlc_lookups[klass] */
 	mov  (%rbp,%rbx,4),%ebp          /* int32 */       /* *result = */
 
@@ -57,7 +57,7 @@
 	mov  %ebp,%ecx
 	sar  $8,%ecx
 	and  $0xff,%ecx                /* result->len */
-	lea  sign_mask(%rip),%rbx
+	mov  sign_mask@GOTPCREL(%rip),%rbx
 	mov  (%rbx,%rcx,4),%ebx        /* int32 */
 	and  %ebx,%eax
 	neg  %eax
@@ -109,17 +109,17 @@
 	mov  %rax,%rbp
 	and  $0xfe00,%ebp
 	sar  $9,%ebp
-	lea  dv_vlc_class_lookup5(%rip),%r11
+	mov  dv_vlc_class_lookup5@GOTPCREL(%rip),%r11
 	movsbq  (%r11,%rbp),%rbp        /* int8 klass */
 
-	lea  dv_vlc_index_mask(%rip),%rbx
+	mov  dv_vlc_index_mask@GOTPCREL(%rip),%rbx
 	mov  (%rbx,%rbp,4),%ebx         /* int32 */
-	lea  dv_vlc_index_rshift(%rip),%rcx
+	mov  dv_vlc_index_rshift@GOTPCREL(%rip),%rcx
 	mov  (%rcx,%rbp,4),%ecx         /* int32 */
 	and  %eax,%ebx
 	sar  %cl,%ebx			/* %rbx is klass */
 
-	lea  dv_vlc_lookups(%rip),%r11
+	mov  dv_vlc_lookups@GOTPCREL(%rip),%r11
 	mov  (%r11,%rbp,8),%rbp         /* ptr */
 	mov  (%rbp,%rbx,4),%ebp         /* int32 */
 
@@ -138,7 +138,7 @@
 	mov  %ebp,%ecx
 	sar  $8,%ecx
 	and  $0xff,%ecx
-	lea  sign_mask(%rip),%r11
+	mov  sign_mask@GOTPCREL(%rip),%r11
 	mov  (%r11,%rcx,4),%ecx        /* int32 */
 	and  %ecx,%eax
 	neg  %eax
@@ -253,7 +253,7 @@
 
 	/* Attempt to use the shortcut first.  If it hits, then
 	   this vlc term has been decoded. */
-	lea	dv_vlc_class1_shortcut(%rip),%r10
+	mov	dv_vlc_class1_shortcut@GOTPCREL(%rip),%r10
 	mov	(%r10,%rcx,4),%r11d    /* record32 dv_vlc_tab_t */
 	test	$0x80,%r11d
 	
@@ -267,17 +267,17 @@
 
 	/* %rax is bits */
 	
-	lea  dv_vlc_class_lookup5(%rip),%r10
+	mov  dv_vlc_class_lookup5@GOTPCREL(%rip),%r10
 	movsbq  (%r10,%rcx,1),%rcx     /* int8 */
 
 /*	xor  %r12,%r12 */
-	lea  dv_vlc_index_mask(%rip),%r10
+	mov  dv_vlc_index_mask@GOTPCREL(%rip),%r10
 	mov  (%r10,%rcx,4),%r12d       /* int32 */
 	
-	lea  dv_vlc_lookups(%rip),%r10
+	mov  dv_vlc_lookups@GOTPCREL(%rip),%r10
 	mov  (%r10,%rcx,8),%r11       /* ptr->record32 */
 	
-	lea  dv_vlc_index_rshift(%rip),%r10
+	mov  dv_vlc_index_rshift@GOTPCREL(%rip),%r10
 	mov  (%r10,%rcx,4),%ecx        /* int32 */
 	
 	and  %eax,%r12d
@@ -303,7 +303,7 @@
 	mov  %r11d,%ecx
 	sar  $8,%ecx
 	and  $0xff,%ecx
-	lea  sign_mask(%rip),%r10
+	mov  sign_mask@GOTPCREL(%rip),%r10
 	mov  (%r10,%rcx,4),%ecx      /* int32 */
 	and  %ecx,%eax
 	neg  %eax
@@ -388,7 +388,8 @@
 	mov	%r11,%rsi        /* bits */
 	mov	%rax,%rdi        /* bits_left */
 	lea	vlc(%rip),%rdx   /* *vlc */
-	call	dv_decode_vlc
+	mov	dv_decode_vlc@GOTPCREL(%rip),%r11
+	call	*%r11
 	pop	%rdx
 	pop	%rsi
 	pop	%rdi
@@ -473,7 +474,7 @@
 	movl	%r11d,dv_macroblock_t_eob_count(%r13) /* int32 */
 
 	/* mb->i = (seg->i + dv_super_map_vertical[m]) % (seg->isPAL?12:10); */
-	lea	dv_super_map_vertical(%rip),%r11
+	mov	dv_super_map_vertical@GOTPCREL(%rip),%r11
 	movl	(%r11,%rax,4),%r11d                     /* int32 */
 /*	xor	%rcx,%rcx */
 	movl	dv_videosegment_t_i(%r12),%ecx          /* int32 */
@@ -493,7 +494,7 @@
 	movl	%r11d,dv_macroblock_t_i(%r13)         /* int32 */
 
 	/*  mb->j = dv_super_map_horizontal[m]; */		
-	lea	dv_super_map_horizontal(%rip),%r11
+	mov	dv_super_map_horizontal@GOTPCREL(%rip),%r11
 	movl	(%r11,%rax,4),%r11d                   /* int32 */
 	movl	%r11d,dv_macroblock_t_j(%r13)         /* int32 */
 
@@ -546,7 +547,8 @@
 
 	/* bl->reorder = &dv_reorder[bl->dct_mode][1]; */
 	shl	$6,%rax                          /* *64 */
-	lea	(dv_reorder+1)(%rip),%rcx
+	mov	dv_reorder@GOTPCREL(%rip),%rcx
+	add	$1,%rcx
 	add	%rcx,%rax
 	mov	%rax,dv_block_t_reorder(%r15)    /* ptr */
 
@@ -557,13 +559,13 @@
 	/* bl->offset= mb_start + dv_parse_bit_start[b]; */
 /*	xor	%rcx,%rcx */
 	movl	mb_start(%rip),%ecx             /* int32 */
-	lea	dv_parse_bit_start(%rip),%rax
+	mov	dv_parse_bit_start@GOTPCREL(%rip),%rax
 	mov	(%rax,%r12,4),%eax              /* int32 */
 	add	%rcx,%rax
 	movl	%eax,dv_block_t_offset(%r15)    /* int32 */
 
 	/* bl->end= mb_start + dv_parse_bit_end[b]; */
-	lea	dv_parse_bit_end(%rip),%rax
+	mov	dv_parse_bit_end@GOTPCREL(%rip),%rax
 	mov	(%rax,%r12,4),%eax            /* int32 */
 	add	%ecx,%eax
 	mov	%eax,dv_block_t_end(%r15)     /* int32 */
@@ -603,7 +605,8 @@
 	mov	dv_videosegment_t_bs(%rdi),%rdi   /* passed in rdi was seg, now passing seg->bs */
 	mov	%r13,%rsi                         /* mb */
 	mov	%r15,%rdx                         /* bl */
-	call	dv_parse_ac_coeffs_pass0
+	mov     dv_parse_ac_coeffs_pass0@GOTPCREL(%rip),%r11
+	call	*%r11
 	pop	%rdi
 	pop	%rsi
 	pop	%rdx
@@ -635,10 +638,12 @@
 	mov	%rsi,%rax	            /* quality */
 	and	$DV_QUALITY_AC_MASK,%rax
 	cmp	$DV_QUALITY_AC_2,%rax
+
+	jne	done
+	mov	dv_parse_ac_coeffs@GOTPCREL(%rip),%r11
+	jmp	*%r11
 	
-	jz	dv_parse_ac_coeffs
-	
-	mov	$0,%rax
+done:	mov	$0,%rax
 	
 	ret