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  if (s->idsp.perm_type == FF_IDCT_PERM_SIMPLE) {
229  if(last_non_zero_p1 <= 1) goto end;
230  block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
231  block[0x20] = temp_block[0x10];
232  if(last_non_zero_p1 <= 4) goto end;
233  block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
234  block[0x09] = temp_block[0x03];
235  if(last_non_zero_p1 <= 7) goto end;
236  block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
237  block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
238  if(last_non_zero_p1 <= 11) goto end;
239  block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
240  block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
241  block[0x0C] = temp_block[0x05];
242  if(last_non_zero_p1 <= 16) goto end;
243  block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
244  block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
245  block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
246  block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
247  if(last_non_zero_p1 <= 24) goto end;
248  block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
249  block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
250  block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
251  block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
252  if(last_non_zero_p1 <= 32) goto end;
253  block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
254  block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
255  block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
256  block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
257  if(last_non_zero_p1 <= 40) goto end;
258  block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
259  block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
260  block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
261  block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
262  if(last_non_zero_p1 <= 48) goto end;
263  block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
264  block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
265  block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
266  block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
267  if(last_non_zero_p1 <= 56) goto end;
268  block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
269  block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
270  block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
271  block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
272  }else if(s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2){
273  if(last_non_zero_p1 <= 1) goto end;
274  block[0x04] = temp_block[0x01];
275  block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
276  if(last_non_zero_p1 <= 4) goto end;
277  block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
278  block[0x05] = temp_block[0x03];
279  if(last_non_zero_p1 <= 7) goto end;
280  block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
281  block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
282  if(last_non_zero_p1 <= 11) goto end;
283  block[0x1C] = temp_block[0x19];
284  block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
285  block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
286  if(last_non_zero_p1 <= 16) goto end;
287  block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
288  block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
289  block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
290  block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
291  if(last_non_zero_p1 <= 24) goto end;
292  block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
293  block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
294  block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
295  block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
296  if(last_non_zero_p1 <= 32) goto end;
297  block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
298  block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
299  block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
300  block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
301  if(last_non_zero_p1 <= 40) goto end;
302  block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
303  block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
304  block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
305  block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
306  if(last_non_zero_p1 <= 48) goto end;
307  block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
308  block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
309  block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
310  block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
311  if(last_non_zero_p1 <= 56) goto end;
312  block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
313  block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
314  block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
315  block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
316  } else if (s->idsp.perm_type == FF_IDCT_PERM_NONE) {
317  if(last_non_zero_p1 <= 1) goto end;
318  block[0x01] = temp_block[0x01];
319  block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
320  if(last_non_zero_p1 <= 4) goto end;
321  block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
322  block[0x03] = temp_block[0x03];
323  if(last_non_zero_p1 <= 7) goto end;
324  block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
325  block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
326  if(last_non_zero_p1 <= 11) goto end;
327  block[0x19] = temp_block[0x19];
328  block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
329  block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
330  if(last_non_zero_p1 <= 16) goto end;
331  block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
332  block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
333  block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
334  block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
335  if(last_non_zero_p1 <= 24) goto end;
336  block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
337  block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
338  block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
339  block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
340  if(last_non_zero_p1 <= 32) goto end;
341  block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
342  block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
343  block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
344  block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
345  if(last_non_zero_p1 <= 40) goto end;
346  block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
347  block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
348  block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
349  block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
350  if(last_non_zero_p1 <= 48) goto end;
351  block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
352  block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
353  block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
354  block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
355  if(last_non_zero_p1 <= 56) goto end;
356  block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
357  block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
358  block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
359  block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
360  } else if (s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE) {
361  if(last_non_zero_p1 <= 1) goto end;
362  block[0x08] = temp_block[0x01];
363  block[0x01] = temp_block[0x08]; block[0x02] = temp_block[0x10];
364  if(last_non_zero_p1 <= 4) goto end;
365  block[0x09] = temp_block[0x09]; block[0x10] = temp_block[0x02];
366  block[0x18] = temp_block[0x03];
367  if(last_non_zero_p1 <= 7) goto end;
368  block[0x11] = temp_block[0x0A]; block[0x0A] = temp_block[0x11];
369  block[0x03] = temp_block[0x18]; block[0x04] = temp_block[0x20];
370  if(last_non_zero_p1 <= 11) goto end;
371  block[0x0B] = temp_block[0x19];
372  block[0x12] = temp_block[0x12]; block[0x19] = temp_block[0x0B];
373  block[0x20] = temp_block[0x04]; block[0x28] = temp_block[0x05];
374  if(last_non_zero_p1 <= 16) goto end;
375  block[0x21] = temp_block[0x0C]; block[0x1A] = temp_block[0x13];
376  block[0x13] = temp_block[0x1A]; block[0x0C] = temp_block[0x21];
377  block[0x05] = temp_block[0x28]; block[0x06] = temp_block[0x30];
378  block[0x0D] = temp_block[0x29]; block[0x14] = temp_block[0x22];
379  if(last_non_zero_p1 <= 24) goto end;
380  block[0x1B] = temp_block[0x1B]; block[0x22] = temp_block[0x14];
381  block[0x29] = temp_block[0x0D]; block[0x30] = temp_block[0x06];
382  block[0x38] = temp_block[0x07]; block[0x31] = temp_block[0x0E];
383  block[0x2A] = temp_block[0x15]; block[0x23] = temp_block[0x1C];
384  if(last_non_zero_p1 <= 32) goto end;
385  block[0x1C] = temp_block[0x23]; block[0x15] = temp_block[0x2A];
386  block[0x0E] = temp_block[0x31]; block[0x07] = temp_block[0x38];
387  block[0x0F] = temp_block[0x39]; block[0x16] = temp_block[0x32];
388  block[0x1D] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
389  if(last_non_zero_p1 <= 40) goto end;
390  block[0x2B] = temp_block[0x1D]; block[0x32] = temp_block[0x16];
391  block[0x39] = temp_block[0x0F]; block[0x3A] = temp_block[0x17];
392  block[0x33] = temp_block[0x1E]; block[0x2C] = temp_block[0x25];
393  block[0x25] = temp_block[0x2C]; block[0x1E] = temp_block[0x33];
394  if(last_non_zero_p1 <= 48) goto end;
395  block[0x17] = temp_block[0x3A]; block[0x1F] = temp_block[0x3B];
396  block[0x26] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
397  block[0x34] = temp_block[0x26]; block[0x3B] = temp_block[0x1F];
398  block[0x3C] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
399  if(last_non_zero_p1 <= 56) goto end;
400  block[0x2E] = temp_block[0x35]; block[0x27] = temp_block[0x3C];
401  block[0x2F] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
402  block[0x3D] = temp_block[0x2F]; block[0x3E] = temp_block[0x37];
403  block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
404  } else {
405  av_log(s, AV_LOG_DEBUG, "s->idsp.perm_type: %d\n",
406  (int)s->idsp.perm_type);
407  av_assert0(s->idsp.perm_type == FF_IDCT_PERM_NONE ||
408  s->idsp.perm_type == FF_IDCT_PERM_LIBMPEG2 ||
409  s->idsp.perm_type == FF_IDCT_PERM_SIMPLE ||
410  s->idsp.perm_type == FF_IDCT_PERM_TRANSPOSE);
411  }
412  end:
413  return last_non_zero_p1 - 1;
414 }
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:65
s
#define s(width, name)
Definition: cbs_vp9.c:256
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition: mem_internal.h:129
FMT_H261
@ FMT_H261
Definition: mpegutils.h:118
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
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:113
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:29
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:64
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:32
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:31
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:67
FF_IDCT_PERM_LIBMPEG2
@ FF_IDCT_PERM_LIBMPEG2
Definition: idctdsp.h:30
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