FFmpeg  4.4.9
mpegvideo_mmi.c
Go to the documentation of this file.
1 /*
2  * Loongson SIMD optimized mpegvideo
3  *
4  * Copyright (c) 2015 Loongson Technology Corporation Limited
5  * Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
6  * Zhang Shuangshuang <zhangshuangshuang@ict.ac.cn>
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg 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 GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #include "mpegvideo_mips.h"
26 #include "libavutil/avassert.h"
28 
30  int n, int qscale)
31 {
32  int64_t level, qmul, qadd, nCoeffs;
33  double ftmp[6];
34  mips_reg addr[1];
35  DECLARE_VAR_ALL64;
36 
37  qmul = qscale << 1;
38  av_assert2(s->block_last_index[n]>=0 || s->h263_aic);
39 
40  if (!s->h263_aic) {
41  if (n<4)
42  level = block[0] * s->y_dc_scale;
43  else
44  level = block[0] * s->c_dc_scale;
45  qadd = (qscale-1) | 1;
46  } else {
47  qadd = 0;
48  level = block[0];
49  }
50 
51  if(s->ac_pred)
52  nCoeffs = 63;
53  else
54  nCoeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
55 
56  __asm__ volatile (
57  "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
58  "packsswh %[qmul], %[qmul], %[qmul] \n\t"
59  "packsswh %[qmul], %[qmul], %[qmul] \n\t"
60  "packsswh %[qadd], %[qadd], %[qadd] \n\t"
61  "packsswh %[qadd], %[qadd], %[qadd] \n\t"
62  "psubh %[ftmp0], %[ftmp0], %[qadd] \n\t"
63  "xor %[ftmp5], %[ftmp5], %[ftmp5] \n\t"
64  ".p2align 4 \n\t"
65 
66  "1: \n\t"
67  PTR_ADDU "%[addr0], %[block], %[nCoeffs] \n\t"
68  MMI_LDC1(%[ftmp1], %[addr0], 0x00)
69  MMI_LDC1(%[ftmp2], %[addr0], 0x08)
70  "mov.d %[ftmp3], %[ftmp1] \n\t"
71  "mov.d %[ftmp4], %[ftmp2] \n\t"
72  "pmullh %[ftmp1], %[ftmp1], %[qmul] \n\t"
73  "pmullh %[ftmp2], %[ftmp2], %[qmul] \n\t"
74  "pcmpgth %[ftmp3], %[ftmp3], %[ftmp5] \n\t"
75  "pcmpgth %[ftmp4], %[ftmp4], %[ftmp5] \n\t"
76  "xor %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
77  "xor %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
78  "paddh %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
79  "paddh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
80  "xor %[ftmp3], %[ftmp3], %[ftmp1] \n\t"
81  "xor %[ftmp4], %[ftmp4], %[ftmp2] \n\t"
82  "pcmpeqh %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
83  "pcmpeqh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
84  "pandn %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
85  "pandn %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
86  PTR_ADDIU "%[nCoeffs], %[nCoeffs], 0x10 \n\t"
87  MMI_SDC1(%[ftmp1], %[addr0], 0x00)
88  MMI_SDC1(%[ftmp2], %[addr0], 0x08)
89  "blez %[nCoeffs], 1b \n\t"
90  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
91  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
92  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
93  RESTRICT_ASM_ALL64
94  [addr0]"=&r"(addr[0])
95  : [block]"r"((mips_reg)(block+nCoeffs)),
96  [nCoeffs]"r"((mips_reg)(2*(-nCoeffs))),
97  [qmul]"f"(qmul), [qadd]"f"(qadd)
98  : "memory"
99  );
100 
101  block[0] = level;
102 }
103 
105  int n, int qscale)
106 {
107  int64_t qmul, qadd, nCoeffs;
108  double ftmp[6];
109  mips_reg addr[1];
110  DECLARE_VAR_ALL64;
111 
112  qmul = qscale << 1;
113  qadd = (qscale - 1) | 1;
114  av_assert2(s->block_last_index[n]>=0 || s->h263_aic);
115  nCoeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
116 
117  __asm__ volatile (
118  "packsswh %[qmul], %[qmul], %[qmul] \n\t"
119  "packsswh %[qmul], %[qmul], %[qmul] \n\t"
120  "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
121  "packsswh %[qadd], %[qadd], %[qadd] \n\t"
122  "packsswh %[qadd], %[qadd], %[qadd] \n\t"
123  "psubh %[ftmp0], %[ftmp0], %[qadd] \n\t"
124  "xor %[ftmp5], %[ftmp5], %[ftmp5] \n\t"
125  ".p2align 4 \n\t"
126  "1: \n\t"
127  PTR_ADDU "%[addr0], %[block], %[nCoeffs] \n\t"
128  MMI_LDC1(%[ftmp1], %[addr0], 0x00)
129  MMI_LDC1(%[ftmp2], %[addr0], 0x08)
130  "mov.d %[ftmp3], %[ftmp1] \n\t"
131  "mov.d %[ftmp4], %[ftmp2] \n\t"
132  "pmullh %[ftmp1], %[ftmp1], %[qmul] \n\t"
133  "pmullh %[ftmp2], %[ftmp2], %[qmul] \n\t"
134  "pcmpgth %[ftmp3], %[ftmp3], %[ftmp5] \n\t"
135  "pcmpgth %[ftmp4], %[ftmp4], %[ftmp5] \n\t"
136  "xor %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
137  "xor %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
138  "paddh %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
139  "paddh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
140  "xor %[ftmp3], %[ftmp3], %[ftmp1] \n\t"
141  "xor %[ftmp4], %[ftmp4], %[ftmp2] \n\t"
142  "pcmpeqh %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
143  "pcmpeqh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
144  "pandn %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
145  "pandn %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
146  PTR_ADDIU "%[nCoeffs], %[nCoeffs], 0x10 \n\t"
147  MMI_SDC1(%[ftmp1], %[addr0], 0x00)
148  MMI_SDC1(%[ftmp2], %[addr0], 0x08)
149  "blez %[nCoeffs], 1b \n\t"
150  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
151  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
152  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
153  RESTRICT_ASM_ALL64
154  [addr0]"=&r"(addr[0])
155  : [block]"r"((mips_reg)(block+nCoeffs)),
156  [nCoeffs]"r"((mips_reg)(2*(-nCoeffs))),
157  [qmul]"f"(qmul), [qadd]"f"(qadd)
158  : "memory"
159  );
160 }
161 
163  int n, int qscale)
164 {
165  int64_t nCoeffs;
166  const uint16_t *quant_matrix;
167  int block0;
168  double ftmp[10];
169  uint64_t tmp[1];
170  mips_reg addr[1];
171  DECLARE_VAR_ALL64;
172  DECLARE_VAR_ADDRT;
173 
174  av_assert2(s->block_last_index[n]>=0);
175  nCoeffs = s->intra_scantable.raster_end[s->block_last_index[n]] + 1;
176 
177  if (n<4)
178  block0 = block[0] * s->y_dc_scale;
179  else
180  block0 = block[0] * s->c_dc_scale;
181 
182  /* XXX: only mpeg1 */
183  quant_matrix = s->intra_matrix;
184 
185  __asm__ volatile (
186  "dli %[tmp0], 0x0f \n\t"
187  "pcmpeqh %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
188  "dmtc1 %[tmp0], %[ftmp4] \n\t"
189  "dmtc1 %[qscale], %[ftmp1] \n\t"
190  "psrlh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
191  "packsswh %[ftmp1], %[ftmp1], %[ftmp1] \n\t"
192  "packsswh %[ftmp1], %[ftmp1], %[ftmp1] \n\t"
193  "or %[addr0], %[nCoeffs], $0 \n\t"
194  ".p2align 4 \n\t"
195 
196  "1: \n\t"
197  MMI_LDXC1(%[ftmp2], %[addr0], %[block], 0x00)
198  MMI_LDXC1(%[ftmp3], %[addr0], %[block], 0x08)
199  "mov.d %[ftmp4], %[ftmp2] \n\t"
200  "mov.d %[ftmp5], %[ftmp3] \n\t"
201  MMI_LDXC1(%[ftmp6], %[addr0], %[quant], 0x00)
202  MMI_LDXC1(%[ftmp7], %[addr0], %[quant], 0x08)
203  "pmullh %[ftmp6], %[ftmp6], %[ftmp1] \n\t"
204  "pmullh %[ftmp7], %[ftmp7], %[ftmp1] \n\t"
205  "xor %[ftmp8], %[ftmp8], %[ftmp8] \n\t"
206  "xor %[ftmp9], %[ftmp9], %[ftmp9] \n\t"
207  "pcmpgth %[ftmp8], %[ftmp8], %[ftmp2] \n\t"
208  "pcmpgth %[ftmp9], %[ftmp9], %[ftmp3] \n\t"
209  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
210  "xor %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
211  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
212  "psubh %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
213  "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
214  "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
215  "xor %[ftmp6], %[ftmp6], %[ftmp6] \n\t"
216  "xor %[ftmp7], %[ftmp7], %[ftmp7] \n\t"
217  "pcmpeqh %[ftmp6], %[ftmp6], %[ftmp4] \n\t"
218  "dli %[tmp0], 0x03 \n\t"
219  "pcmpeqh %[ftmp7], %[ftmp7], %[ftmp5] \n\t"
220  "dmtc1 %[tmp0], %[ftmp4] \n\t"
221  "psrah %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
222  "psrah %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
223  "psubh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
224  "psubh %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
225  "or %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
226  "or %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
227  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
228  "xor %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
229  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
230  "psubh %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
231  "pandn %[ftmp6], %[ftmp6], %[ftmp2] \n\t"
232  "pandn %[ftmp7], %[ftmp7], %[ftmp3] \n\t"
233  MMI_SDXC1(%[ftmp6], %[addr0], %[block], 0x00)
234  MMI_SDXC1(%[ftmp7], %[addr0], %[block], 0x08)
235  PTR_ADDIU "%[addr0], %[addr0], 0x10 \n\t"
236  "bltz %[addr0], 1b \n\t"
237  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
238  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
239  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
240  [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
241  [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
242  [tmp0]"=&r"(tmp[0]),
243  RESTRICT_ASM_ALL64
244  RESTRICT_ASM_ADDRT
245  [addr0]"=&r"(addr[0])
246  : [block]"r"((mips_reg)(block+nCoeffs)),
247  [quant]"r"((mips_reg)(quant_matrix+nCoeffs)),
248  [nCoeffs]"r"((mips_reg)(2*(-nCoeffs))),
249  [qscale]"r"(qscale)
250  : "memory"
251  );
252 
253  block[0] = block0;
254 }
255 
257  int n, int qscale)
258 {
259  int64_t nCoeffs;
260  const uint16_t *quant_matrix;
261  double ftmp[10];
262  uint64_t tmp[1];
263  mips_reg addr[1];
264  DECLARE_VAR_ALL64;
265  DECLARE_VAR_ADDRT;
266 
267  av_assert2(s->block_last_index[n] >= 0);
268  nCoeffs = s->intra_scantable.raster_end[s->block_last_index[n]] + 1;
269  quant_matrix = s->inter_matrix;
270 
271  __asm__ volatile (
272  "dli %[tmp0], 0x0f \n\t"
273  "pcmpeqh %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
274  "dmtc1 %[tmp0], %[ftmp4] \n\t"
275  "dmtc1 %[qscale], %[ftmp1] \n\t"
276  "psrlh %[ftmp0], %[ftmp0], %[ftmp4] \n\t"
277  "packsswh %[ftmp1], %[ftmp1], %[ftmp1] \n\t"
278  "packsswh %[ftmp1], %[ftmp1], %[ftmp1] \n\t"
279  "or %[addr0], %[nCoeffs], $0 \n\t"
280  ".p2align 4 \n\t"
281 
282  "1: \n\t"
283  MMI_LDXC1(%[ftmp2], %[addr0], %[block], 0x00)
284  MMI_LDXC1(%[ftmp3], %[addr0], %[block], 0x08)
285  "mov.d %[ftmp4], %[ftmp2] \n\t"
286  "mov.d %[ftmp5], %[ftmp3] \n\t"
287  MMI_LDXC1(%[ftmp6], %[addr0], %[quant], 0x00)
288  MMI_LDXC1(%[ftmp7], %[addr0], %[quant], 0x08)
289  "pmullh %[ftmp6], %[ftmp6], %[ftmp1] \n\t"
290  "pmullh %[ftmp7], %[ftmp7], %[ftmp1] \n\t"
291  "xor %[ftmp8], %[ftmp8], %[ftmp8] \n\t"
292  "xor %[ftmp9], %[ftmp9], %[ftmp9] \n\t"
293  "pcmpgth %[ftmp8], %[ftmp8], %[ftmp2] \n\t"
294  "pcmpgth %[ftmp9], %[ftmp9], %[ftmp3] \n\t"
295  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
296  "xor %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
297  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
298  "psubh %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
299  "paddh %[ftmp2], %[ftmp2], %[ftmp2] \n\t"
300  "paddh %[ftmp3], %[ftmp3], %[ftmp3] \n\t"
301  "paddh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
302  "paddh %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
303  "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
304  "pmullh %[ftmp3], %[ftmp3], %[ftmp7] \n\t"
305  "xor %[ftmp6], %[ftmp6], %[ftmp6] \n\t"
306  "xor %[ftmp7], %[ftmp7], %[ftmp7] \n\t"
307  "pcmpeqh %[ftmp6], %[ftmp6], %[ftmp4] \n\t"
308  "dli %[tmp0], 0x04 \n\t"
309  "pcmpeqh %[ftmp7], %[ftmp7], %[ftmp5] \n\t"
310  "dmtc1 %[tmp0], %[ftmp4] \n\t"
311  "psrah %[ftmp2], %[ftmp2], %[ftmp4] \n\t"
312  "psrah %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
313  "psubh %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
314  "psubh %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
315  "or %[ftmp2], %[ftmp2], %[ftmp0] \n\t"
316  "or %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
317  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
318  "xor %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
319  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
320  "psubh %[ftmp3], %[ftmp3], %[ftmp9] \n\t"
321  "pandn %[ftmp6], %[ftmp6], %[ftmp2] \n\t"
322  "pandn %[ftmp7], %[ftmp7], %[ftmp3] \n\t"
323  MMI_SDXC1(%[ftmp6], %[addr0], %[block], 0x00)
324  MMI_SDXC1(%[ftmp7], %[addr0], %[block], 0x08)
325  PTR_ADDIU "%[addr0], %[addr0], 0x10 \n\t"
326  "bltz %[addr0], 1b \n\t"
327  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
328  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
329  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
330  [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
331  [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
332  [tmp0]"=&r"(tmp[0]),
333  RESTRICT_ASM_ALL64
334  RESTRICT_ASM_ADDRT
335  [addr0]"=&r"(addr[0])
336  : [block]"r"((mips_reg)(block+nCoeffs)),
337  [quant]"r"((mips_reg)(quant_matrix+nCoeffs)),
338  [nCoeffs]"r"((mips_reg)(2*(-nCoeffs))),
339  [qscale]"r"(qscale)
340  : "memory"
341  );
342 }
343 
345  int n, int qscale)
346 {
347  uint64_t nCoeffs;
348  const uint16_t *quant_matrix;
349  int block0;
350  double ftmp[10];
351  uint64_t tmp[1];
352  mips_reg addr[1];
353  DECLARE_VAR_ALL64;
354  DECLARE_VAR_ADDRT;
355 
356  av_assert2(s->block_last_index[n]>=0);
357 
358  if (s->alternate_scan)
359  nCoeffs = 63;
360  else
361  nCoeffs = s->intra_scantable.raster_end[s->block_last_index[n]];
362 
363  if (n < 4)
364  block0 = block[0] * s->y_dc_scale;
365  else
366  block0 = block[0] * s->c_dc_scale;
367 
368  quant_matrix = s->intra_matrix;
369 
370  __asm__ volatile (
371  "dli %[tmp0], 0x0f \n\t"
372  "pcmpeqh %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
373  "mtc1 %[tmp0], %[ftmp3] \n\t"
374  "mtc1 %[qscale], %[ftmp9] \n\t"
375  "psrlh %[ftmp0], %[ftmp0], %[ftmp3] \n\t"
376  "packsswh %[ftmp9], %[ftmp9], %[ftmp9] \n\t"
377  "packsswh %[ftmp9], %[ftmp9], %[ftmp9] \n\t"
378  "or %[addr0], %[nCoeffs], $0 \n\t"
379  ".p2align 4 \n\t"
380 
381  "1: \n\t"
382  MMI_LDXC1(%[ftmp1], %[addr0], %[block], 0x00)
383  MMI_LDXC1(%[ftmp2], %[addr0], %[block], 0x08)
384  "mov.d %[ftmp3], %[ftmp1] \n\t"
385  "mov.d %[ftmp4], %[ftmp2] \n\t"
386  MMI_LDXC1(%[ftmp5], %[addr0], %[quant], 0x00)
387  MMI_LDXC1(%[ftmp6], %[addr0], %[quant], 0x08)
388  "pmullh %[ftmp5], %[ftmp5], %[ftmp9] \n\t"
389  "pmullh %[ftmp6], %[ftmp6], %[ftmp9] \n\t"
390  "xor %[ftmp7], %[ftmp7], %[ftmp7] \n\t"
391  "xor %[ftmp8], %[ftmp8], %[ftmp8] \n\t"
392  "pcmpgth %[ftmp7], %[ftmp7], %[ftmp1] \n\t"
393  "pcmpgth %[ftmp8], %[ftmp8], %[ftmp2] \n\t"
394  "xor %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
395  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
396  "psubh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
397  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
398  "pmullh %[ftmp1], %[ftmp1], %[ftmp5] \n\t"
399  "pmullh %[ftmp2], %[ftmp2], %[ftmp6] \n\t"
400  "xor %[ftmp5], %[ftmp5], %[ftmp5] \n\t"
401  "xor %[ftmp6], %[ftmp6], %[ftmp6] \n\t"
402  "pcmpeqh %[ftmp5], %[ftmp5], %[ftmp3] \n\t"
403  "dli %[tmp0], 0x03 \n\t"
404  "pcmpeqh %[ftmp6] , %[ftmp6], %[ftmp4] \n\t"
405  "mtc1 %[tmp0], %[ftmp3] \n\t"
406  "psrah %[ftmp1], %[ftmp1], %[ftmp3] \n\t"
407  "psrah %[ftmp2], %[ftmp2], %[ftmp3] \n\t"
408  "xor %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
409  "xor %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
410  "psubh %[ftmp1], %[ftmp1], %[ftmp7] \n\t"
411  "psubh %[ftmp2], %[ftmp2], %[ftmp8] \n\t"
412  "pandn %[ftmp5], %[ftmp5], %[ftmp1] \n\t"
413  "pandn %[ftmp6], %[ftmp6], %[ftmp2] \n\t"
414  MMI_SDXC1(%[ftmp5], %[addr0], %[block], 0x00)
415  MMI_SDXC1(%[ftmp6], %[addr0], %[block], 0x08)
416  PTR_ADDIU "%[addr0], %[addr0], 0x10 \n\t"
417  "blez %[addr0], 1b \n\t"
418  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
419  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
420  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
421  [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
422  [ftmp8]"=&f"(ftmp[8]), [ftmp9]"=&f"(ftmp[9]),
423  [tmp0]"=&r"(tmp[0]),
424  RESTRICT_ASM_ALL64
425  RESTRICT_ASM_ADDRT
426  [addr0]"=&r"(addr[0])
427  : [block]"r"((mips_reg)(block+nCoeffs)),
428  [quant]"r"((mips_reg)(quant_matrix+nCoeffs)),
429  [nCoeffs]"r"((mips_reg)(2*(-nCoeffs))),
430  [qscale]"r"(qscale)
431  : "memory"
432  );
433 
434  block[0]= block0;
435 }
436 
438 {
439  const int intra = s->mb_intra;
440  int *sum = s->dct_error_sum[intra];
441  uint16_t *offset = s->dct_offset[intra];
442  double ftmp[8];
443  mips_reg addr[1];
444  DECLARE_VAR_ALL64;
445 
446  s->dct_count[intra]++;
447 
448  __asm__ volatile(
449  "xor %[ftmp0], %[ftmp0], %[ftmp0] \n\t"
450  "1: \n\t"
451  MMI_LDC1(%[ftmp1], %[block], 0x00)
452  "xor %[ftmp2], %[ftmp2], %[ftmp2] \n\t"
453  MMI_LDC1(%[ftmp3], %[block], 0x08)
454  "xor %[ftmp4], %[ftmp4], %[ftmp4] \n\t"
455  "pcmpgth %[ftmp2], %[ftmp2], %[ftmp1] \n\t"
456  "pcmpgth %[ftmp4], %[ftmp4], %[ftmp3] \n\t"
457  "xor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
458  "xor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
459  "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
460  "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
461  MMI_LDC1(%[ftmp6], %[offset], 0x00)
462  "mov.d %[ftmp5], %[ftmp1] \n\t"
463  "psubush %[ftmp1], %[ftmp1], %[ftmp6] \n\t"
464  MMI_LDC1(%[ftmp6], %[offset], 0x08)
465  "mov.d %[ftmp7], %[ftmp3] \n\t"
466  "psubush %[ftmp3], %[ftmp3], %[ftmp6] \n\t"
467  "xor %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
468  "xor %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
469  "psubh %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
470  "psubh %[ftmp3], %[ftmp3], %[ftmp4] \n\t"
471  MMI_SDC1(%[ftmp1], %[block], 0x00)
472  MMI_SDC1(%[ftmp3], %[block], 0x08)
473  "mov.d %[ftmp1], %[ftmp5] \n\t"
474  "mov.d %[ftmp3], %[ftmp7] \n\t"
475  "punpcklhw %[ftmp5], %[ftmp5], %[ftmp0] \n\t"
476  "punpckhhw %[ftmp1], %[ftmp1], %[ftmp0] \n\t"
477  "punpcklhw %[ftmp7], %[ftmp7], %[ftmp0] \n\t"
478  "punpckhhw %[ftmp3], %[ftmp3], %[ftmp0] \n\t"
479  MMI_LDC1(%[ftmp2], %[sum], 0x00)
480  "paddw %[ftmp5], %[ftmp5], %[ftmp2] \n\t"
481  MMI_LDC1(%[ftmp2], %[sum], 0x08)
482  "paddw %[ftmp1], %[ftmp1], %[ftmp2] \n\t"
483  MMI_LDC1(%[ftmp2], %[sum], 0x10)
484  "paddw %[ftmp7], %[ftmp7], %[ftmp2] \n\t"
485  MMI_LDC1(%[ftmp2], %[sum], 0x18)
486  "paddw %[ftmp3], %[ftmp3], %[ftmp2] \n\t"
487  MMI_SDC1(%[ftmp5], %[sum], 0x00)
488  MMI_SDC1(%[ftmp1], %[sum], 0x08)
489  MMI_SDC1(%[ftmp7], %[sum], 0x10)
490  MMI_SDC1(%[ftmp3], %[sum], 0x18)
491  PTR_ADDIU "%[block], %[block], 0x10 \n\t"
492  PTR_ADDIU "%[sum], %[sum], 0x20 \n\t"
493  PTR_SUBU "%[addr0], %[block1], %[block] \n\t"
494  PTR_ADDIU "%[offset], %[offset], 0x10 \n\t"
495  "bgtz %[addr0], 1b \n\t"
496  : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
497  [ftmp2]"=&f"(ftmp[2]), [ftmp3]"=&f"(ftmp[3]),
498  [ftmp4]"=&f"(ftmp[4]), [ftmp5]"=&f"(ftmp[5]),
499  [ftmp6]"=&f"(ftmp[6]), [ftmp7]"=&f"(ftmp[7]),
500  RESTRICT_ASM_ALL64
501  [addr0]"=&r"(addr[0]),
502  [block]"+&r"(block), [sum]"+&r"(sum),
503  [offset]"+&r"(offset)
504  : [block1]"r"(block+64)
505  : "memory"
506  );
507 }
#define PTR_SUBU
Definition: asmdefs.h:50
#define PTR_ADDIU
Definition: asmdefs.h:48
#define mips_reg
Definition: asmdefs.h:44
#define PTR_ADDU
Definition: asmdefs.h:47
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
#define s(width, name)
Definition: cbs_vp9.c:257
long long int64_t
Definition: coverity.c:34
void ff_dct_unquantize_mpeg1_inter_mmi(MpegEncContext *s, int16_t *block, int n, int qscale)
void ff_dct_unquantize_mpeg1_intra_mmi(MpegEncContext *s, int16_t *block, int n, int qscale)
void ff_dct_unquantize_h263_inter_mmi(MpegEncContext *s, int16_t *block, int n, int qscale)
void ff_dct_unquantize_h263_intra_mmi(MpegEncContext *s, int16_t *block, int n, int qscale)
Definition: mpegvideo_mmi.c:29
void ff_denoise_dct_mmi(MpegEncContext *s, int16_t *block)
void ff_dct_unquantize_mpeg2_intra_mmi(MpegEncContext *s, int16_t *block, int n, int qscale)
MpegEncContext.
Definition: mpegvideo.h:81
uint8_t level
Definition: svq3.c:206
static uint8_t tmp[11]
Definition: aes_ctr.c:27
static int16_t block[64]
Definition: dct.c:116
static int16_t block1[64]
Definition: dct.c:117
static const uint8_t offset[127][2]
Definition: vf_spp.c:107
const uint8_t * quant