FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h264idct_msa.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
22 #include "h264dsp_mips.h"
24 
25 #define AVC_ITRANS_H(in0, in1, in2, in3, out0, out1, out2, out3) \
26 { \
27  v8i16 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
28  \
29  tmp0_m = in0 + in2; \
30  tmp1_m = in0 - in2; \
31  tmp2_m = in1 >> 1; \
32  tmp2_m = tmp2_m - in3; \
33  tmp3_m = in3 >> 1; \
34  tmp3_m = in1 + tmp3_m; \
35  \
36  BUTTERFLY_4(tmp0_m, tmp1_m, tmp2_m, tmp3_m, out0, out1, out2, out3); \
37 }
38 
39 static void avc_idct4x4_addblk_msa(uint8_t *dst, int16_t *src,
40  int32_t dst_stride)
41 {
42  v8i16 src0, src1, src2, src3;
43  v8i16 hres0, hres1, hres2, hres3;
44  v8i16 vres0, vres1, vres2, vres3;
45  v8i16 zeros = { 0 };
46 
47  LD4x4_SH(src, src0, src1, src2, src3);
48  AVC_ITRANS_H(src0, src1, src2, src3, hres0, hres1, hres2, hres3);
49  TRANSPOSE4x4_SH_SH(hres0, hres1, hres2, hres3, hres0, hres1, hres2, hres3);
50  AVC_ITRANS_H(hres0, hres1, hres2, hres3, vres0, vres1, vres2, vres3);
51  SRARI_H4_SH(vres0, vres1, vres2, vres3, 6);
52  ADDBLK_ST4x4_UB(vres0, vres1, vres2, vres3, dst, dst_stride);
53  ST_SH2(zeros, zeros, src, 8);
54 }
55 
56 static void avc_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src,
57  int32_t dst_stride)
58 {
59  int16_t dc;
60  uint32_t src0, src1, src2, src3;
61  v16u8 pred = { 0 };
62  v16i8 out;
63  v8i16 input_dc, pred_r, pred_l;
64 
65  dc = (src[0] + 32) >> 6;
66  input_dc = __msa_fill_h(dc);
67  src[0] = 0;
68 
69  LW4(dst, dst_stride, src0, src1, src2, src3);
70  INSERT_W4_UB(src0, src1, src2, src3, pred);
71  UNPCK_UB_SH(pred, pred_r, pred_l);
72 
73  pred_r += input_dc;
74  pred_l += input_dc;
75 
76  CLIP_SH2_0_255(pred_r, pred_l);
77  out = __msa_pckev_b((v16i8) pred_l, (v16i8) pred_r);
78  ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
79 }
80 
81 static void avc_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src,
82  int32_t de_q_val)
83 {
84 #define DC_DEST_STRIDE 16
85  int16_t out0, out1, out2, out3;
86  v8i16 src0, src1, src2, src3;
87  v8i16 vec0, vec1, vec2, vec3;
88  v8i16 hres0, hres1, hres2, hres3;
89  v8i16 vres0, vres1, vres2, vres3;
90  v4i32 vres0_r, vres1_r, vres2_r, vres3_r;
91  v4i32 de_q_vec = __msa_fill_w(de_q_val);
92 
93  LD4x4_SH(src, src0, src1, src2, src3);
94  TRANSPOSE4x4_SH_SH(src0, src1, src2, src3, src0, src1, src2, src3);
95  BUTTERFLY_4(src0, src2, src3, src1, vec0, vec3, vec2, vec1);
96  BUTTERFLY_4(vec0, vec1, vec2, vec3, hres0, hres3, hres2, hres1);
97  TRANSPOSE4x4_SH_SH(hres0, hres1, hres2, hres3, hres0, hres1, hres2, hres3);
98  BUTTERFLY_4(hres0, hres1, hres3, hres2, vec0, vec3, vec2, vec1);
99  BUTTERFLY_4(vec0, vec1, vec2, vec3, vres0, vres1, vres2, vres3);
100  UNPCK_R_SH_SW(vres0, vres0_r);
101  UNPCK_R_SH_SW(vres1, vres1_r);
102  UNPCK_R_SH_SW(vres2, vres2_r);
103  UNPCK_R_SH_SW(vres3, vres3_r);
104 
105  vres0_r *= de_q_vec;
106  vres1_r *= de_q_vec;
107  vres2_r *= de_q_vec;
108  vres3_r *= de_q_vec;
109 
110  SRARI_W4_SW(vres0_r, vres1_r, vres2_r, vres3_r, 8);
111  PCKEV_H2_SH(vres1_r, vres0_r, vres3_r, vres2_r, vec0, vec1);
112 
113  out0 = __msa_copy_s_h(vec0, 0);
114  out1 = __msa_copy_s_h(vec0, 1);
115  out2 = __msa_copy_s_h(vec0, 2);
116  out3 = __msa_copy_s_h(vec0, 3);
117  SH(out0, dst);
118  SH(out1, (dst + 2 * DC_DEST_STRIDE));
119  SH(out2, (dst + 8 * DC_DEST_STRIDE));
120  SH(out3, (dst + 10 * DC_DEST_STRIDE));
121  dst += DC_DEST_STRIDE;
122 
123  out0 = __msa_copy_s_h(vec0, 4);
124  out1 = __msa_copy_s_h(vec0, 5);
125  out2 = __msa_copy_s_h(vec0, 6);
126  out3 = __msa_copy_s_h(vec0, 7);
127  SH(out0, dst);
128  SH(out1, (dst + 2 * DC_DEST_STRIDE));
129  SH(out2, (dst + 8 * DC_DEST_STRIDE));
130  SH(out3, (dst + 10 * DC_DEST_STRIDE));
131  dst += (3 * DC_DEST_STRIDE);
132 
133  out0 = __msa_copy_s_h(vec1, 0);
134  out1 = __msa_copy_s_h(vec1, 1);
135  out2 = __msa_copy_s_h(vec1, 2);
136  out3 = __msa_copy_s_h(vec1, 3);
137  SH(out0, dst);
138  SH(out1, (dst + 2 * DC_DEST_STRIDE));
139  SH(out2, (dst + 8 * DC_DEST_STRIDE));
140  SH(out3, (dst + 10 * DC_DEST_STRIDE));
141  dst += DC_DEST_STRIDE;
142 
143  out0 = __msa_copy_s_h(vec1, 4);
144  out1 = __msa_copy_s_h(vec1, 5);
145  out2 = __msa_copy_s_h(vec1, 6);
146  out3 = __msa_copy_s_h(vec1, 7);
147  SH(out0, dst);
148  SH(out1, (dst + 2 * DC_DEST_STRIDE));
149  SH(out2, (dst + 8 * DC_DEST_STRIDE));
150  SH(out3, (dst + 10 * DC_DEST_STRIDE));
151 
152 #undef DC_DEST_STRIDE
153 }
154 
155 static void avc_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
156 {
157  v8i16 src0, src1, src2, src3, src4, src5, src6, src7;
158  v8i16 vec0, vec1, vec2, vec3;
159  v8i16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
160  v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
161  v4i32 tmp0_r, tmp1_r, tmp2_r, tmp3_r, tmp4_r, tmp5_r, tmp6_r, tmp7_r;
162  v4i32 tmp0_l, tmp1_l, tmp2_l, tmp3_l, tmp4_l, tmp5_l, tmp6_l, tmp7_l;
163  v4i32 vec0_r, vec1_r, vec2_r, vec3_r, vec0_l, vec1_l, vec2_l, vec3_l;
164  v4i32 res0_r, res1_r, res2_r, res3_r, res4_r, res5_r, res6_r, res7_r;
165  v4i32 res0_l, res1_l, res2_l, res3_l, res4_l, res5_l, res6_l, res7_l;
166  v16i8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
167  v16i8 zeros = { 0 };
168 
169  src[0] += 32;
170 
171  LD_SH8(src, 8, src0, src1, src2, src3, src4, src5, src6, src7);
172 
173  vec0 = src0 + src4;
174  vec1 = src0 - src4;
175  vec2 = src2 >> 1;
176  vec2 = vec2 - src6;
177  vec3 = src6 >> 1;
178  vec3 = src2 + vec3;
179 
180  BUTTERFLY_4(vec0, vec1, vec2, vec3, tmp0, tmp1, tmp2, tmp3);
181 
182  vec0 = src7 >> 1;
183  vec0 = src5 - vec0 - src3 - src7;
184  vec1 = src3 >> 1;
185  vec1 = src1 - vec1 + src7 - src3;
186  vec2 = src5 >> 1;
187  vec2 = vec2 - src1 + src7 + src5;
188  vec3 = src1 >> 1;
189  vec3 = vec3 + src3 + src5 + src1;
190  tmp4 = vec3 >> 2;
191  tmp4 += vec0;
192  tmp5 = vec2 >> 2;
193  tmp5 += vec1;
194  tmp6 = vec1 >> 2;
195  tmp6 -= vec2;
196  tmp7 = vec0 >> 2;
197  tmp7 = vec3 - tmp7;
198 
199  BUTTERFLY_8(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7,
200  res0, res1, res2, res3, res4, res5, res6, res7);
201  TRANSPOSE8x8_SH_SH(res0, res1, res2, res3, res4, res5, res6, res7,
202  res0, res1, res2, res3, res4, res5, res6, res7);
203  UNPCK_SH_SW(res0, tmp0_r, tmp0_l);
204  UNPCK_SH_SW(res1, tmp1_r, tmp1_l);
205  UNPCK_SH_SW(res2, tmp2_r, tmp2_l);
206  UNPCK_SH_SW(res3, tmp3_r, tmp3_l);
207  UNPCK_SH_SW(res4, tmp4_r, tmp4_l);
208  UNPCK_SH_SW(res5, tmp5_r, tmp5_l);
209  UNPCK_SH_SW(res6, tmp6_r, tmp6_l);
210  UNPCK_SH_SW(res7, tmp7_r, tmp7_l);
211  BUTTERFLY_4(tmp0_r, tmp0_l, tmp4_l, tmp4_r, vec0_r, vec0_l, vec1_l, vec1_r);
212 
213  vec2_r = tmp2_r >> 1;
214  vec2_l = tmp2_l >> 1;
215  vec2_r -= tmp6_r;
216  vec2_l -= tmp6_l;
217  vec3_r = tmp6_r >> 1;
218  vec3_l = tmp6_l >> 1;
219  vec3_r += tmp2_r;
220  vec3_l += tmp2_l;
221 
222  BUTTERFLY_4(vec0_r, vec1_r, vec2_r, vec3_r, tmp0_r, tmp2_r, tmp4_r, tmp6_r);
223  BUTTERFLY_4(vec0_l, vec1_l, vec2_l, vec3_l, tmp0_l, tmp2_l, tmp4_l, tmp6_l);
224 
225  vec0_r = tmp7_r >> 1;
226  vec0_l = tmp7_l >> 1;
227  vec0_r = tmp5_r - vec0_r - tmp3_r - tmp7_r;
228  vec0_l = tmp5_l - vec0_l - tmp3_l - tmp7_l;
229  vec1_r = tmp3_r >> 1;
230  vec1_l = tmp3_l >> 1;
231  vec1_r = tmp1_r - vec1_r + tmp7_r - tmp3_r;
232  vec1_l = tmp1_l - vec1_l + tmp7_l - tmp3_l;
233  vec2_r = tmp5_r >> 1;
234  vec2_l = tmp5_l >> 1;
235  vec2_r = vec2_r - tmp1_r + tmp7_r + tmp5_r;
236  vec2_l = vec2_l - tmp1_l + tmp7_l + tmp5_l;
237  vec3_r = tmp1_r >> 1;
238  vec3_l = tmp1_l >> 1;
239  vec3_r = vec3_r + tmp3_r + tmp5_r + tmp1_r;
240  vec3_l = vec3_l + tmp3_l + tmp5_l + tmp1_l;
241  tmp1_r = vec3_r >> 2;
242  tmp1_l = vec3_l >> 2;
243  tmp1_r += vec0_r;
244  tmp1_l += vec0_l;
245  tmp3_r = vec2_r >> 2;
246  tmp3_l = vec2_l >> 2;
247  tmp3_r += vec1_r;
248  tmp3_l += vec1_l;
249  tmp5_r = vec1_r >> 2;
250  tmp5_l = vec1_l >> 2;
251  tmp5_r -= vec2_r;
252  tmp5_l -= vec2_l;
253  tmp7_r = vec0_r >> 2;
254  tmp7_l = vec0_l >> 2;
255  tmp7_r = vec3_r - tmp7_r;
256  tmp7_l = vec3_l - tmp7_l;
257 
258  BUTTERFLY_4(tmp0_r, tmp0_l, tmp7_l, tmp7_r, res0_r, res0_l, res7_l, res7_r);
259  BUTTERFLY_4(tmp2_r, tmp2_l, tmp5_l, tmp5_r, res1_r, res1_l, res6_l, res6_r);
260  BUTTERFLY_4(tmp4_r, tmp4_l, tmp3_l, tmp3_r, res2_r, res2_l, res5_l, res5_r);
261  BUTTERFLY_4(tmp6_r, tmp6_l, tmp1_l, tmp1_r, res3_r, res3_l, res4_l, res4_r);
262  SRA_4V(res0_r, res0_l, res1_r, res1_l, 6);
263  SRA_4V(res2_r, res2_l, res3_r, res3_l, 6);
264  SRA_4V(res4_r, res4_l, res5_r, res5_l, 6);
265  SRA_4V(res6_r, res6_l, res7_r, res7_l, 6);
266  PCKEV_H4_SH(res0_l, res0_r, res1_l, res1_r, res2_l, res2_r, res3_l, res3_r,
267  res0, res1, res2, res3);
268  PCKEV_H4_SH(res4_l, res4_r, res5_l, res5_r, res6_l, res6_r, res7_l, res7_r,
269  res4, res5, res6, res7);
270  LD_SB8(dst, dst_stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7);
271  ILVR_B4_SH(zeros, dst0, zeros, dst1, zeros, dst2, zeros, dst3,
272  tmp0, tmp1, tmp2, tmp3);
273  ILVR_B4_SH(zeros, dst4, zeros, dst5, zeros, dst6, zeros, dst7,
274  tmp4, tmp5, tmp6, tmp7);
275  ADD4(res0, tmp0, res1, tmp1, res2, tmp2, res3, tmp3,
276  res0, res1, res2, res3);
277  ADD4(res4, tmp4, res5, tmp5, res6, tmp6, res7, tmp7,
278  res4, res5, res6, res7);
279  CLIP_SH4_0_255(res0, res1, res2, res3);
280  CLIP_SH4_0_255(res4, res5, res6, res7);
281  PCKEV_B4_SB(res1, res0, res3, res2, res5, res4, res7, res6,
282  dst0, dst1, dst2, dst3);
283  ST8x4_UB(dst0, dst1, dst, dst_stride);
284  dst += (4 * dst_stride);
285  ST8x4_UB(dst2, dst3, dst, dst_stride);
286 }
287 
288 static void avc_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src,
289  int32_t dst_stride)
290 {
291  int32_t dc_val;
292  v16i8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
293  v8i16 dst0_r, dst1_r, dst2_r, dst3_r, dst4_r, dst5_r, dst6_r, dst7_r;
294  v8i16 dc;
295  v16i8 zeros = { 0 };
296 
297  dc_val = (src[0] + 32) >> 6;
298  dc = __msa_fill_h(dc_val);
299 
300  src[0] = 0;
301 
302  LD_SB8(dst, dst_stride, dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7);
303  ILVR_B4_SH(zeros, dst0, zeros, dst1, zeros, dst2, zeros, dst3,
304  dst0_r, dst1_r, dst2_r, dst3_r);
305  ILVR_B4_SH(zeros, dst4, zeros, dst5, zeros, dst6, zeros, dst7,
306  dst4_r, dst5_r, dst6_r, dst7_r);
307  ADD4(dst0_r, dc, dst1_r, dc, dst2_r, dc, dst3_r, dc,
308  dst0_r, dst1_r, dst2_r, dst3_r);
309  ADD4(dst4_r, dc, dst5_r, dc, dst6_r, dc, dst7_r, dc,
310  dst4_r, dst5_r, dst6_r, dst7_r);
311  CLIP_SH4_0_255(dst0_r, dst1_r, dst2_r, dst3_r);
312  CLIP_SH4_0_255(dst4_r, dst5_r, dst6_r, dst7_r);
313  PCKEV_B4_SB(dst1_r, dst0_r, dst3_r, dst2_r, dst5_r, dst4_r, dst7_r, dst6_r,
314  dst0, dst1, dst2, dst3);
315  ST8x4_UB(dst0, dst1, dst, dst_stride);
316  dst += (4 * dst_stride);
317  ST8x4_UB(dst2, dst3, dst, dst_stride);
318 }
319 
320 void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src,
321  int32_t dst_stride)
322 {
323  avc_idct4x4_addblk_msa(dst, src, dst_stride);
324  memset(src, 0, 16 * sizeof(dctcoef));
325 }
326 
328  int32_t dst_stride)
329 {
330  avc_idct8_addblk_msa(dst, src, dst_stride);
331  memset(src, 0, 64 * sizeof(dctcoef));
332 }
333 
335  int32_t dst_stride)
336 {
337  avc_idct4x4_addblk_dc_msa(dst, src, dst_stride);
338 }
339 
341  int32_t dst_stride)
342 {
343  avc_idct8_dc_addblk_msa(dst, src, dst_stride);
344 }
345 
347  const int32_t *blk_offset,
348  int16_t *block, int32_t dst_stride,
349  const uint8_t nzc[15 * 8])
350 {
351  int32_t i;
352 
353  for (i = 0; i < 16; i++) {
354  int32_t nnz = nzc[scan8[i]];
355 
356  if (nnz) {
357  if (nnz == 1 && ((dctcoef *) block)[i * 16])
358  ff_h264_idct4x4_addblk_dc_msa(dst + blk_offset[i],
359  block + i * 16 * sizeof(pixel),
360  dst_stride);
361  else
362  ff_h264_idct_add_msa(dst + blk_offset[i],
363  block + i * 16 * sizeof(pixel),
364  dst_stride);
365  }
366  }
367 }
368 
369 void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset,
370  int16_t *block, int32_t dst_stride,
371  const uint8_t nzc[15 * 8])
372 {
373  int32_t cnt;
374 
375  for (cnt = 0; cnt < 16; cnt += 4) {
376  int32_t nnz = nzc[scan8[cnt]];
377 
378  if (nnz) {
379  if (nnz == 1 && ((dctcoef *) block)[cnt * 16])
380  ff_h264_idct8_dc_addblk_msa(dst + blk_offset[cnt],
381  block + cnt * 16 * sizeof(pixel),
382  dst_stride);
383  else
384  ff_h264_idct8_addblk_msa(dst + blk_offset[cnt],
385  block + cnt * 16 * sizeof(pixel),
386  dst_stride);
387  }
388  }
389 }
390 
392  const int32_t *blk_offset,
393  int16_t *block, int32_t dst_stride,
394  const uint8_t nzc[15 * 8])
395 {
396  int32_t i, j;
397 
398  for (j = 1; j < 3; j++) {
399  for (i = (j * 16); i < (j * 16 + 4); i++) {
400  if (nzc[scan8[i]])
401  ff_h264_idct_add_msa(dst[j - 1] + blk_offset[i],
402  block + i * 16 * sizeof(pixel),
403  dst_stride);
404  else if (((dctcoef *) block)[i * 16])
405  ff_h264_idct4x4_addblk_dc_msa(dst[j - 1] + blk_offset[i],
406  block + i * 16 * sizeof(pixel),
407  dst_stride);
408  }
409  }
410 }
411 
413  const int32_t *blk_offset,
414  int16_t *block, int32_t dst_stride,
415  const uint8_t nzc[15 * 8])
416 {
417  int32_t i, j;
418 
419  for (j = 1; j < 3; j++) {
420  for (i = (j * 16); i < (j * 16 + 4); i++) {
421  if (nzc[scan8[i]])
422  ff_h264_idct_add_msa(dst[j - 1] + blk_offset[i],
423  block + i * 16 * sizeof(pixel),
424  dst_stride);
425  else if (((dctcoef *) block)[i * 16])
426  ff_h264_idct4x4_addblk_dc_msa(dst[j - 1] + blk_offset[i],
427  block + i * 16 * sizeof(pixel),
428  dst_stride);
429  }
430  }
431 
432  for (j = 1; j < 3; j++) {
433  for (i = (j * 16 + 4); i < (j * 16 + 8); i++) {
434  if (nzc[scan8[i + 4]])
435  ff_h264_idct_add_msa(dst[j - 1] + blk_offset[i + 4],
436  block + i * 16 * sizeof(pixel),
437  dst_stride);
438  else if (((dctcoef *) block)[i * 16])
439  ff_h264_idct4x4_addblk_dc_msa(dst[j - 1] + blk_offset[i + 4],
440  block + i * 16 * sizeof(pixel),
441  dst_stride);
442  }
443  }
444 }
445 
447  const int32_t *blk_offset,
448  int16_t *block,
449  int32_t dst_stride,
450  const uint8_t nzc[15 * 8])
451 {
452  int32_t i;
453 
454  for (i = 0; i < 16; i++) {
455  if (nzc[scan8[i]])
456  ff_h264_idct_add_msa(dst + blk_offset[i],
457  block + i * 16 * sizeof(pixel), dst_stride);
458  else if (((dctcoef *) block)[i * 16])
459  ff_h264_idct4x4_addblk_dc_msa(dst + blk_offset[i],
460  block + i * 16 * sizeof(pixel),
461  dst_stride);
462  }
463 }
464 
465 void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src,
466  int32_t de_qval)
467 {
468  avc_deq_idct_luma_dc_msa(dst, src, de_qval);
469 }
#define ADDBLK_ST4x4_UB(in0, in1, in2, in3, pdst, stride)
void ff_h264_idct_add8_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_msa.c:391
static void avc_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:288
#define SRARI_W4_SW(...)
static void avc_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_q_val)
Definition: h264idct_msa.c:81
static void avc_idct4x4_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:39
#define AVC_ITRANS_H(in0, in1, in2, in3, out0, out1, out2, out3)
Definition: h264idct_msa.c:25
#define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride)
#define SRA_4V(in0, in1, in2, in3, shift)
uint8_t
#define ST_SH2(...)
#define UNPCK_UB_SH(in, out0, out1)
#define SRARI_H4_SH(...)
#define LD_SB8(...)
#define CLIP_SH2_0_255(in0, in1)
#define BUTTERFLY_4(in0, in1, in2, in3, out0, out1, out2, out3)
void ff_h264_idct8_dc_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:340
#define UNPCK_R_SH_SW(in, out)
#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, out3)
void ff_h264_idct_add_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:320
void ff_h264_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:327
void ff_h264_idct_add8_422_msa(uint8_t **dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_msa.c:412
void ff_h264_idct_add16_intra_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_msa.c:446
#define LD4x4_SH(psrc, out0, out1, out2, out3)
#define TRANSPOSE8x8_SH_SH(...)
#define CLIP_SH4_0_255(in0, in1, in2, in3)
static const uint8_t scan8[16 *3+3]
Definition: h264.h:1007
#define LD_SH8(...)
void ff_h264_deq_idct_luma_dc_msa(int16_t *dst, int16_t *src, int32_t de_qval)
Definition: h264idct_msa.c:465
void ff_h264_idct8_add4_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_msa.c:369
int32_t
#define DC_DEST_STRIDE
#define PCKEV_H2_SH(...)
#define PCKEV_B4_SB(...)
#define BUTTERFLY_8(in0, in1, in2, in3, in4, in5, in6, in7,out0, out1, out2, out3, out4, out5, out6, out7)
#define INSERT_W4_UB(...)
void ff_h264_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:334
static const float pred[4]
Definition: siprdata.h:259
static void avc_idct4x4_addblk_dc_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:56
#define src1
Definition: h264pred.c:139
#define UNPCK_SH_SW(in, out0, out1)
AVS_Value src
Definition: avisynth_c.h:482
static void avc_idct8_addblk_msa(uint8_t *dst, int16_t *src, int32_t dst_stride)
Definition: h264idct_msa.c:155
#define dctcoef
#define ILVR_B4_SH(...)
#define src0
Definition: h264pred.c:138
#define SH(val, pdst)
uint8_t pixel
Definition: tiny_ssim.c:42
#define LW4(psrc, stride, out0, out1, out2, out3)
#define ST8x4_UB(in0, in1, pdst, stride)
void ff_h264_idct_add16_msa(uint8_t *dst, const int32_t *blk_offset, int16_t *block, int32_t dst_stride, const uint8_t nzc[15 *8])
Definition: h264idct_msa.c:346
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> dc
#define TRANSPOSE4x4_SH_SH(in0, in1, in2, in3, out0, out1, out2, out3)
#define PCKEV_H4_SH(...)
static int16_t block[64]
Definition: dct-test.c:110