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