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