FFmpeg
mpegvideoenc_template.c
Go to the documentation of this file.
1 /*
2  * MPEG video MMX templates
3  *
4  * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include <stdint.h>
24 
25 #include "libavutil/internal.h"
26 #include "libavutil/mem_internal.h"
27 #include "libavutil/x86/asm.h"
28 #include "libavcodec/mpegutils.h"
29 #include "libavcodec/mpegvideo.h"
30 #include "fdct.h"
31 
32 #undef MMREG_WIDTH
33 #undef MM
34 #undef MOVQ
35 #undef SPREADW
36 #undef PMAXW
37 #undef PMAX
38 #undef SAVE_SIGN
39 #undef RESTORE_SIGN
40 
41 #if COMPILE_TEMPLATE_SSE2
42 #define MMREG_WIDTH "16"
43 #define MM "%%xmm"
44 #define MOVQ "movdqa"
45 #define SPREADW(a) \
46  "pshuflw $0, "a", "a" \n\t"\
47  "punpcklwd "a", "a" \n\t"
48 #define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
49 #define PMAX(a,b) \
50  "movhlps "a", "b" \n\t"\
51  PMAXW(b, a)\
52  "pshuflw $0x0E, "a", "b" \n\t"\
53  PMAXW(b, a)\
54  "pshuflw $0x01, "a", "b" \n\t"\
55  PMAXW(b, a)
56 #else
57 #define MMREG_WIDTH "8"
58 #define MM "%%mm"
59 #define MOVQ "movq"
60 #if COMPILE_TEMPLATE_MMXEXT
61 #define SPREADW(a) "pshufw $0, "a", "a" \n\t"
62 #define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
63 #define PMAX(a,b) \
64  "pshufw $0x0E, "a", "b" \n\t"\
65  PMAXW(b, a)\
66  "pshufw $0x01, "a", "b" \n\t"\
67  PMAXW(b, a)
68 #else
69 #define SPREADW(a) \
70  "punpcklwd "a", "a" \n\t"\
71  "punpcklwd "a", "a" \n\t"
72 #define PMAXW(a,b) \
73  "psubusw "a", "b" \n\t"\
74  "paddw "a", "b" \n\t"
75 #define PMAX(a,b) \
76  "movq "a", "b" \n\t"\
77  "psrlq $32, "a" \n\t"\
78  PMAXW(b, a)\
79  "movq "a", "b" \n\t"\
80  "psrlq $16, "a" \n\t"\
81  PMAXW(b, a)
82 
83 #endif
84 #endif
85 
86 #if COMPILE_TEMPLATE_SSSE3
87 #define SAVE_SIGN(a,b) \
88  "movdqa "b", "a" \n\t"\
89  "pabsw "b", "b" \n\t"
90 #define RESTORE_SIGN(a,b) \
91  "psignw "a", "b" \n\t"
92 #else
93 #define SAVE_SIGN(a,b) \
94  "pxor "a", "a" \n\t"\
95  "pcmpgtw "b", "a" \n\t" /* block[i] <= 0 ? 0xFF : 0x00 */\
96  "pxor "a", "b" \n\t"\
97  "psubw "a", "b" \n\t" /* ABS(block[i]) */
98 #define RESTORE_SIGN(a,b) \
99  "pxor "a", "b" \n\t"\
100  "psubw "a", "b" \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
101 #endif
102 
103 static int RENAME(dct_quantize)(MpegEncContext *s,
104  int16_t *block, int n,
105  int qscale, int *overflow)
106 {
107  x86_reg last_non_zero_p1;
108  int level=0, q; //=0 is because gcc says uninitialized ...
109  const uint16_t *qmat, *bias;
110  LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
111 
112  av_assert2((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
113 
114  //s->fdct (block);
115  RENAME_FDCT(ff_fdct)(block); // cannot be anything else ...
116 
117  if(s->dct_error_sum)
118  s->denoise_dct(s, block);
119 
120  if (s->mb_intra) {
121  int dummy;
122  if (n < 4){
123  q = s->y_dc_scale;
124  bias = s->q_intra_matrix16[qscale][1];
125  qmat = s->q_intra_matrix16[qscale][0];
126  }else{
127  q = s->c_dc_scale;
128  bias = s->q_chroma_intra_matrix16[qscale][1];
129  qmat = s->q_chroma_intra_matrix16[qscale][0];
130  }
131  /* note: block[0] is assumed to be positive */
132  if (!s->h263_aic) {
133  __asm__ volatile (
134  "mul %%ecx \n\t"
135  : "=d" (level), "=a"(dummy)
136  : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
137  );
138  } else
139  /* For AIC we skip quant/dequant of INTRADC */
140  level = (block[0] + 4)>>3;
141 
142  block[0]=0; //avoid fake overflow
143 // temp_block[0] = (block[0] + (q >> 1)) / q;
144  last_non_zero_p1 = 1;
145  } else {
146  last_non_zero_p1 = 0;
147  bias = s->q_inter_matrix16[qscale][1];
148  qmat = s->q_inter_matrix16[qscale][0];
149  }
150 
151  if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
152 
153  __asm__ volatile(
154  "movd %%"FF_REG_a", "MM"3 \n\t" // last_non_zero_p1
155  SPREADW(MM"3")
156  "pxor "MM"7, "MM"7 \n\t" // 0
157  "pxor "MM"4, "MM"4 \n\t" // 0
158  MOVQ" (%2), "MM"5 \n\t" // qmat[0]
159  "pxor "MM"6, "MM"6 \n\t"
160  "psubw (%3), "MM"6 \n\t" // -bias[0]
161  "mov $-128, %%"FF_REG_a" \n\t"
162  ".p2align 4 \n\t"
163  "1: \n\t"
164  MOVQ" (%1, %%"FF_REG_a"), "MM"0 \n\t" // block[i]
165  SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
166  "psubusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
167  "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
168  "por "MM"0, "MM"4 \n\t"
169  RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
170  MOVQ" "MM"0, (%5, %%"FF_REG_a") \n\t"
171  "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
172  MOVQ" (%4, %%"FF_REG_a"), "MM"1 \n\t"
173  MOVQ" "MM"7, (%1, %%"FF_REG_a") \n\t" // 0
174  "pandn "MM"1, "MM"0 \n\t"
175  PMAXW(MM"0", MM"3")
176  "add $"MMREG_WIDTH", %%"FF_REG_a" \n\t"
177  " js 1b \n\t"
178  PMAX(MM"3", MM"0")
179  "movd "MM"3, %%"FF_REG_a" \n\t"
180  "movzbl %%al, %%eax \n\t" // last_non_zero_p1
181  : "+a" (last_non_zero_p1)
182  : "r" (block+64), "r" (qmat), "r" (bias),
183  "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
184  XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
185  "%xmm4", "%xmm5", "%xmm6", "%xmm7")
186  );
187  }else{ // FMT_H263
188  __asm__ volatile(
189  "movd %%"FF_REG_a", "MM"3 \n\t" // last_non_zero_p1
190  SPREADW(MM"3")
191  "pxor "MM"7, "MM"7 \n\t" // 0
192  "pxor "MM"4, "MM"4 \n\t" // 0
193  "mov $-128, %%"FF_REG_a" \n\t"
194  ".p2align 4 \n\t"
195  "1: \n\t"
196  MOVQ" (%1, %%"FF_REG_a"), "MM"0 \n\t" // block[i]
197  SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
198  MOVQ" (%3, %%"FF_REG_a"), "MM"6 \n\t" // bias[0]
199  "paddusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
200  MOVQ" (%2, %%"FF_REG_a"), "MM"5 \n\t" // qmat[i]
201  "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
202  "por "MM"0, "MM"4 \n\t"
203  RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
204  MOVQ" "MM"0, (%5, %%"FF_REG_a") \n\t"
205  "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
206  MOVQ" (%4, %%"FF_REG_a"), "MM"1 \n\t"
207  MOVQ" "MM"7, (%1, %%"FF_REG_a") \n\t" // 0
208  "pandn "MM"1, "MM"0 \n\t"
209  PMAXW(MM"0", MM"3")
210  "add $"MMREG_WIDTH", %%"FF_REG_a" \n\t"
211  " js 1b \n\t"
212  PMAX(MM"3", MM"0")
213  "movd "MM"3, %%"FF_REG_a" \n\t"
214  "movzbl %%al, %%eax \n\t" // last_non_zero_p1
215  : "+a" (last_non_zero_p1)
216  : "r" (block+64), "r" (qmat+64), "r" (bias+64),
217  "r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
218  XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
219  "%xmm4", "%xmm5", "%xmm6", "%xmm7")
220  );
221  }
222  __asm__ volatile(
223  "movd %1, "MM"1 \n\t" // max_qcoeff
224  SPREADW(MM"1")
225  "psubusw "MM"1, "MM"4 \n\t"
226  "packuswb "MM"4, "MM"4 \n\t"
227 #if COMPILE_TEMPLATE_SSE2
228  "packsswb "MM"4, "MM"4 \n\t"
229 #endif
230  "movd "MM"4, %0 \n\t" // *overflow
231  : "=g" (*overflow)
232  : "g" (s->max_qcoeff)
233  );
234 
235  if(s->mb_intra) block[0]= level;
236  else block[0]= temp_block[0];
237 
238  if (s->idsp.perm_type == FF_IDCT_PERM_SIMPLE) {
239  if(last_non_zero_p1 <= 1) goto end;
240  block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
241  block[0x20] = temp_block[0x10];
242  if(last_non_zero_p1 <= 4) goto end;
243  block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
244  block[0x09] = temp_block[0x03];
245  if(last_non_zero_p1 <= 7) goto end;
246  block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
247  block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
248  if(last_non_zero_p1 <= 11) goto end;
249  block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
250  block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
251  block[0x0C] = temp_block[0x05];
252  if(last_non_zero_p1 <= 16) goto end;
253  block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
254  block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
255  block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
256  block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
257  if(last_non_zero_p1 <= 24) goto end;
258  block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
259  block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
260  block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
261  block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
262  if(last_non_zero_p1 <= 32) goto end;
263  block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
264  block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
265  block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
266  block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
267  if(last_non_zero_p1 <= 40) goto end;
268  block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
269  block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
270  block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
271  block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
272  if(last_non_zero_p1 <= 48) goto end;
273  block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
274  block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
275  block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
276  block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
277  if(last_non_zero_p1 <= 56) goto end;
278  block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
279  block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
280  block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
281  block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
282  }else if(s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2){
283  if(last_non_zero_p1 <= 1) goto end;
284  block[0x04] = temp_block[0x01];
285  block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
286  if(last_non_zero_p1 <= 4) goto end;
287  block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
288  block[0x05] = temp_block[0x03];
289  if(last_non_zero_p1 <= 7) goto end;
290  block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
291  block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
292  if(last_non_zero_p1 <= 11) goto end;
293  block[0x1C] = temp_block[0x19];
294  block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
295  block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
296  if(last_non_zero_p1 <= 16) goto end;
297  block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
298  block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
299  block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
300  block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
301  if(last_non_zero_p1 <= 24) goto end;
302  block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
303  block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
304  block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
305  block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
306  if(last_non_zero_p1 <= 32) goto end;
307  block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
308  block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
309  block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
310  block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
311  if(last_non_zero_p1 <= 40) goto end;
312  block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
313  block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
314  block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
315  block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
316  if(last_non_zero_p1 <= 48) goto end;
317  block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
318  block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
319  block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
320  block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
321  if(last_non_zero_p1 <= 56) goto end;
322  block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
323  block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
324  block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
325  block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
326  } else if (s->idsp.perm_type == FF_IDCT_PERM_NONE) {
327  if(last_non_zero_p1 <= 1) goto end;
328  block[0x01] = temp_block[0x01];
329  block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
330  if(last_non_zero_p1 <= 4) goto end;
331  block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
332  block[0x03] = temp_block[0x03];
333  if(last_non_zero_p1 <= 7) goto end;
334  block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
335  block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
336  if(last_non_zero_p1 <= 11) goto end;
337  block[0x19] = temp_block[0x19];
338  block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
339  block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
340  if(last_non_zero_p1 <= 16) goto end;
341  block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
342  block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
343  block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
344  block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
345  if(last_non_zero_p1 <= 24) goto end;
346  block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
347  block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
348  block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
349  block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
350  if(last_non_zero_p1 <= 32) goto end;
351  block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
352  block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
353  block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
354  block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
355  if(last_non_zero_p1 <= 40) goto end;
356  block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
357  block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
358  block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
359  block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
360  if(last_non_zero_p1 <= 48) goto end;
361  block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
362  block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
363  block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
364  block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
365  if(last_non_zero_p1 <= 56) goto end;
366  block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
367  block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
368  block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
369  block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
370  } else if (s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE) {
371  if(last_non_zero_p1 <= 1) goto end;
372  block[0x08] = temp_block[0x01];
373  block[0x01] = temp_block[0x08]; block[0x02] = temp_block[0x10];
374  if(last_non_zero_p1 <= 4) goto end;
375  block[0x09] = temp_block[0x09]; block[0x10] = temp_block[0x02];
376  block[0x18] = temp_block[0x03];
377  if(last_non_zero_p1 <= 7) goto end;
378  block[0x11] = temp_block[0x0A]; block[0x0A] = temp_block[0x11];
379  block[0x03] = temp_block[0x18]; block[0x04] = temp_block[0x20];
380  if(last_non_zero_p1 <= 11) goto end;
381  block[0x0B] = temp_block[0x19];
382  block[0x12] = temp_block[0x12]; block[0x19] = temp_block[0x0B];
383  block[0x20] = temp_block[0x04]; block[0x28] = temp_block[0x05];
384  if(last_non_zero_p1 <= 16) goto end;
385  block[0x21] = temp_block[0x0C]; block[0x1A] = temp_block[0x13];
386  block[0x13] = temp_block[0x1A]; block[0x0C] = temp_block[0x21];
387  block[0x05] = temp_block[0x28]; block[0x06] = temp_block[0x30];
388  block[0x0D] = temp_block[0x29]; block[0x14] = temp_block[0x22];
389  if(last_non_zero_p1 <= 24) goto end;
390  block[0x1B] = temp_block[0x1B]; block[0x22] = temp_block[0x14];
391  block[0x29] = temp_block[0x0D]; block[0x30] = temp_block[0x06];
392  block[0x38] = temp_block[0x07]; block[0x31] = temp_block[0x0E];
393  block[0x2A] = temp_block[0x15]; block[0x23] = temp_block[0x1C];
394  if(last_non_zero_p1 <= 32) goto end;
395  block[0x1C] = temp_block[0x23]; block[0x15] = temp_block[0x2A];
396  block[0x0E] = temp_block[0x31]; block[0x07] = temp_block[0x38];
397  block[0x0F] = temp_block[0x39]; block[0x16] = temp_block[0x32];
398  block[0x1D] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
399  if(last_non_zero_p1 <= 40) goto end;
400  block[0x2B] = temp_block[0x1D]; block[0x32] = temp_block[0x16];
401  block[0x39] = temp_block[0x0F]; block[0x3A] = temp_block[0x17];
402  block[0x33] = temp_block[0x1E]; block[0x2C] = temp_block[0x25];
403  block[0x25] = temp_block[0x2C]; block[0x1E] = temp_block[0x33];
404  if(last_non_zero_p1 <= 48) goto end;
405  block[0x17] = temp_block[0x3A]; block[0x1F] = temp_block[0x3B];
406  block[0x26] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
407  block[0x34] = temp_block[0x26]; block[0x3B] = temp_block[0x1F];
408  block[0x3C] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
409  if(last_non_zero_p1 <= 56) goto end;
410  block[0x2E] = temp_block[0x35]; block[0x27] = temp_block[0x3C];
411  block[0x2F] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
412  block[0x3D] = temp_block[0x2F]; block[0x3E] = temp_block[0x37];
413  block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
414  } else {
415  av_log(s, AV_LOG_DEBUG, "s->idsp.perm_type: %d\n",
416  (int)s->idsp.perm_type);
417  av_assert0(s->idsp.perm_type == FF_IDCT_PERM_NONE ||
418  s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2 ||
419  s->idsp.perm_type == FF_IDCT_PERM_SIMPLE ||
420  s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE);
421  }
422  end:
423  return last_non_zero_p1 - 1;
424 }
#define PMAXW(a, b)
#define RENAME(name)
Definition: ffv1.h:196
#define MOVQ
mpegvideo header.
Undefined Behavior In the C some operations are like signed integer overflow
Definition: undefined.txt:3
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:130
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
#define PMAX(a, b)
const uint32_t ff_inverse[257]
Definition: mathtables.c:27
The exact code depends on how similar the blocks are and how related they are to the block
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:64
#define av_log(a,...)
#define RESTORE_SIGN(a, b)
#define MM
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
common internal API header
static const uint16_t inv_zigzag_direct16[64]
Definition: mpegvideoenc.c:32
#define s(width, name)
Definition: cbs_vp9.c:257
int dummy
Definition: motion.c:64
#define SAVE_SIGN(a, b)
uint8_t level
Definition: svq3.c:206
MpegEncContext.
Definition: mpegvideo.h:81
#define XMM_CLOBBERS_ONLY(...)
Definition: asm.h:99
#define SPREADW(a)
__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")
int x86_reg
Definition: asm.h:72
#define MMREG_WIDTH