FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hevcpred_msa.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil@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 
21 #include "libavcodec/hevcdec.h"
23 #include "hevcpred_mips.h"
24 
25 static const int8_t intra_pred_angle_up[17] = {
26  -32, -26, -21, -17, -13, -9, -5, -2, 0, 2, 5, 9, 13, 17, 21, 26, 32
27 };
28 
29 static const int8_t intra_pred_angle_low[16] = {
30  32, 26, 21, 17, 13, 9, 5, 2, 0, -2, -5, -9, -13, -17, -21, -26
31 };
32 
33 #define HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1, \
34  mul_val_h0, mul_val_h1, mul_val_h2, mul_val_h3, \
35  res0, res1, mul_val_b0, mul_val_b1, round) \
36 { \
37  v8i16 res0_m, res1_m, res2_m, res3_m; \
38  \
39  MUL4(mul_val_h0, vec0, mul_val_h2, vec0, mul_val_h0, vec1, \
40  mul_val_h2, vec1, res0_m, res1_m, res2_m, res3_m); \
41  \
42  res0_m += mul_val_h1 * tmp0; \
43  res1_m += mul_val_h3 * tmp0; \
44  res2_m += mul_val_h1 * tmp0; \
45  res3_m += mul_val_h3 * tmp0; \
46  \
47  res0_m += mul_val_b0 * src0_r; \
48  res1_m += mul_val_b0 * src0_l; \
49  res2_m += (mul_val_b0 - 1) * src0_r; \
50  res3_m += (mul_val_b0 - 1) * src0_l; \
51  \
52  res0_m += mul_val_b1 * tmp1; \
53  res1_m += mul_val_b1 * tmp1; \
54  res2_m += (mul_val_b1 + 1) * tmp1; \
55  res3_m += (mul_val_b1 + 1) * tmp1; \
56  \
57  SRARI_H4_SH(res0_m, res1_m, res2_m, res3_m, round); \
58  PCKEV_B2_SH(res1_m, res0_m, res3_m, res2_m, res0, res1); \
59 }
60 
61 static void hevc_intra_pred_vert_4x4_msa(const uint8_t *src_top,
62  const uint8_t *src_left,
63  uint8_t *dst, int32_t stride,
64  int32_t flag)
65 {
66  uint32_t col;
67  uint32_t src_data;
68  v8i16 vec0, vec1, vec2;
69  v16i8 zero = { 0 };
70 
71  src_data = LW(src_top);
72  SW4(src_data, src_data, src_data, src_data, dst, stride);
73 
74  if (0 == flag) {
75  src_data = LW(src_left);
76 
77  vec2 = (v8i16) __msa_insert_w((v4i32) vec2, 0, src_data);
78 
79  vec0 = __msa_fill_h(src_left[-1]);
80  vec1 = __msa_fill_h(src_top[0]);
81 
82  vec2 = (v8i16) __msa_ilvr_b(zero, (v16i8) vec2);
83  vec2 -= vec0;
84  vec2 >>= 1;
85  vec2 += vec1;
86  vec2 = CLIP_SH_0_255(vec2);
87 
88  for (col = 0; col < 4; col++) {
89  dst[stride * col] = (uint8_t) vec2[col];
90  }
91  }
92 }
93 
94 static void hevc_intra_pred_vert_8x8_msa(const uint8_t *src_top,
95  const uint8_t *src_left,
96  uint8_t *dst, int32_t stride,
97  int32_t flag)
98 {
99  uint8_t *tmp_dst = dst;
100  uint32_t row;
101  uint16_t val0, val1, val2, val3;
102  uint64_t src_data1;
103  v8i16 vec0, vec1, vec2;
104  v16i8 zero = { 0 };
105 
106  src_data1 = LD(src_top);
107 
108  for (row = 8; row--;) {
109  SD(src_data1, tmp_dst);
110  tmp_dst += stride;
111  }
112 
113  if (0 == flag) {
114  src_data1 = LD(src_left);
115 
116  vec2 = (v8i16) __msa_insert_d((v2i64) zero, 0, src_data1);
117 
118  vec0 = __msa_fill_h(src_left[-1]);
119  vec1 = __msa_fill_h(src_top[0]);
120 
121  vec2 = (v8i16) __msa_ilvr_b(zero, (v16i8) vec2);
122  vec2 -= vec0;
123  vec2 >>= 1;
124  vec2 += vec1;
125  vec2 = CLIP_SH_0_255(vec2);
126 
127  val0 = vec2[0];
128  val1 = vec2[1];
129  val2 = vec2[2];
130  val3 = vec2[3];
131 
132  dst[0] = val0;
133  dst[stride] = val1;
134  dst[2 * stride] = val2;
135  dst[3 * stride] = val3;
136 
137  val0 = vec2[4];
138  val1 = vec2[5];
139  val2 = vec2[6];
140  val3 = vec2[7];
141 
142  dst[4 * stride] = val0;
143  dst[5 * stride] = val1;
144  dst[6 * stride] = val2;
145  dst[7 * stride] = val3;
146  }
147 }
148 
149 static void hevc_intra_pred_vert_16x16_msa(const uint8_t *src_top,
150  const uint8_t *src_left,
151  uint8_t *dst, int32_t stride,
152  int32_t flag)
153 {
154  int32_t col;
155  uint8_t *tmp_dst = dst;
156  uint32_t row;
157  v16u8 src;
158  v8i16 vec0, vec1, vec2, vec3;
159 
160  src = LD_UB(src_top);
161 
162  for (row = 16; row--;) {
163  ST_UB(src, tmp_dst);
164  tmp_dst += stride;
165  }
166 
167  if (0 == flag) {
168  src = LD_UB(src_left);
169 
170  vec0 = __msa_fill_h(src_left[-1]);
171  vec1 = __msa_fill_h(src_top[0]);
172 
173  UNPCK_UB_SH(src, vec2, vec3);
174  SUB2(vec2, vec0, vec3, vec0, vec2, vec3);
175 
176  vec2 >>= 1;
177  vec3 >>= 1;
178 
179  ADD2(vec2, vec1, vec3, vec1, vec2, vec3);
180  CLIP_SH2_0_255(vec2, vec3);
181 
182  src = (v16u8) __msa_pckev_b((v16i8) vec3, (v16i8) vec2);
183 
184  for (col = 0; col < 16; col++) {
185  dst[stride * col] = src[col];
186  }
187  }
188 }
189 
190 static void hevc_intra_pred_horiz_4x4_msa(const uint8_t *src_top,
191  const uint8_t *src_left,
192  uint8_t *dst, int32_t stride,
193  int32_t flag)
194 {
195  uint32_t val0, val1, val2, val3;
196  v16i8 src0;
197  v8i16 src0_r, src_top_val, src_left_val;
198  v16i8 zero = { 0 };
199 
200  val0 = src_left[0] * 0x01010101;
201  val1 = src_left[1] * 0x01010101;
202  val2 = src_left[2] * 0x01010101;
203  val3 = src_left[3] * 0x01010101;
204  SW4(val0, val1, val2, val3, dst, stride);
205 
206  if (0 == flag) {
207  val0 = LW(src_top);
208  src0 = (v16i8) __msa_insert_w((v4i32) src0, 0, val0);
209  src_top_val = __msa_fill_h(src_top[-1]);
210  src_left_val = __msa_fill_h(src_left[0]);
211 
212  src0_r = (v8i16) __msa_ilvr_b(zero, src0);
213 
214  src0_r -= src_top_val;
215  src0_r >>= 1;
216  src0_r += src_left_val;
217  src0_r = CLIP_SH_0_255(src0_r);
218  src0 = __msa_pckev_b((v16i8) src0_r, (v16i8) src0_r);
219  val0 = __msa_copy_s_w((v4i32) src0, 0);
220  SW(val0, dst);
221  }
222 }
223 
224 static void hevc_intra_pred_horiz_8x8_msa(const uint8_t *src_top,
225  const uint8_t *src_left,
226  uint8_t *dst, int32_t stride,
227  int32_t flag)
228 {
229  uint64_t val0, val1, val2, val3;
230  v16i8 src0;
231  v8i16 src0_r, src_top_val, src_left_val;
232  v16i8 zero = { 0 };
233 
234  val0 = src_left[0] * 0x0101010101010101;
235  val1 = src_left[1] * 0x0101010101010101;
236  val2 = src_left[2] * 0x0101010101010101;
237  val3 = src_left[3] * 0x0101010101010101;
238  SD4(val0, val1, val2, val3, dst, stride);
239 
240  val0 = src_left[4] * 0x0101010101010101;
241  val1 = src_left[5] * 0x0101010101010101;
242  val2 = src_left[6] * 0x0101010101010101;
243  val3 = src_left[7] * 0x0101010101010101;
244  SD4(val0, val1, val2, val3, dst + 4 * stride, stride);
245 
246  if (0 == flag) {
247  val0 = LD(src_top);
248  src0 = (v16i8) __msa_insert_d((v2i64) src0, 0, val0);
249  src_top_val = __msa_fill_h(src_top[-1]);
250  src_left_val = __msa_fill_h(src_left[0]);
251 
252  src0_r = (v8i16) __msa_ilvr_b(zero, src0);
253 
254  src0_r -= src_top_val;
255  src0_r >>= 1;
256  src0_r += src_left_val;
257  src0_r = CLIP_SH_0_255(src0_r);
258  src0 = __msa_pckev_b((v16i8) src0_r, (v16i8) src0_r);
259  val0 = __msa_copy_s_d((v2i64) src0, 0);
260  SD(val0, dst);
261  }
262 }
263 
264 static void hevc_intra_pred_horiz_16x16_msa(const uint8_t *src_top,
265  const uint8_t *src_left,
266  uint8_t *dst, int32_t stride,
267  int32_t flag)
268 {
269  uint8_t *tmp_dst = dst;
270  uint32_t row;
271  uint8_t inp0, inp1, inp2, inp3;
272  v16i8 src0, src1, src2, src3;
273  v8i16 src0_r, src0_l, src_left_val, src_top_val;
274 
275  src_left_val = __msa_fill_h(src_left[0]);
276 
277  for (row = 4; row--;) {
278  inp0 = src_left[0];
279  inp1 = src_left[1];
280  inp2 = src_left[2];
281  inp3 = src_left[3];
282  src_left += 4;
283 
284  src0 = __msa_fill_b(inp0);
285  src1 = __msa_fill_b(inp1);
286  src2 = __msa_fill_b(inp2);
287  src3 = __msa_fill_b(inp3);
288 
289  ST_SB4(src0, src1, src2, src3, tmp_dst, stride);
290  tmp_dst += (4 * stride);
291  }
292 
293  if (0 == flag) {
294  src0 = LD_SB(src_top);
295  src_top_val = __msa_fill_h(src_top[-1]);
296 
297  UNPCK_UB_SH(src0, src0_r, src0_l);
298  SUB2(src0_r, src_top_val, src0_l, src_top_val, src0_r, src0_l);
299 
300  src0_r >>= 1;
301  src0_l >>= 1;
302 
303  ADD2(src0_r, src_left_val, src0_l, src_left_val, src0_r, src0_l);
304  CLIP_SH2_0_255(src0_r, src0_l);
305  src0 = __msa_pckev_b((v16i8) src0_l, (v16i8) src0_r);
306  ST_SB(src0, dst);
307  }
308 }
309 
310 static void hevc_intra_pred_horiz_32x32_msa(const uint8_t *src_top,
311  const uint8_t *src_left,
312  uint8_t *dst, int32_t stride)
313 {
314  uint32_t row;
315  uint8_t inp0, inp1, inp2, inp3;
316  v16i8 src0, src1, src2, src3;
317 
318  for (row = 0; row < 8; row++) {
319  inp0 = src_left[row * 4];
320  inp1 = src_left[row * 4 + 1];
321  inp2 = src_left[row * 4 + 2];
322  inp3 = src_left[row * 4 + 3];
323 
324  src0 = __msa_fill_b(inp0);
325  src1 = __msa_fill_b(inp1);
326  src2 = __msa_fill_b(inp2);
327  src3 = __msa_fill_b(inp3);
328 
329  ST_SB2(src0, src0, dst, 16);
330  dst += stride;
331  ST_SB2(src1, src1, dst, 16);
332  dst += stride;
333  ST_SB2(src2, src2, dst, 16);
334  dst += stride;
335  ST_SB2(src3, src3, dst, 16);
336  dst += stride;
337  }
338 }
339 
340 static void hevc_intra_pred_dc_4x4_msa(const uint8_t *src_top,
341  const uint8_t *src_left,
342  uint8_t *dst, int32_t stride,
343  int32_t flag)
344 {
345  uint8_t *tmp_dst = dst;
346  uint32_t addition = 0;
347  uint32_t val0, val1, val2;
348  v16i8 src = { 0 };
349  v16u8 store;
350  v16i8 zero = { 0 };
351  v8u16 sum, vec0, vec1;
352 
353  val0 = LW(src_top);
354  val1 = LW(src_left);
355  INSERT_W2_SB(val0, val1, src);
356  sum = __msa_hadd_u_h((v16u8) src, (v16u8) src);
357  sum = (v8u16) __msa_hadd_u_w(sum, sum);
358  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
359  sum = (v8u16) __msa_srari_w((v4i32) sum, 3);
360  addition = __msa_copy_u_w((v4i32) sum, 0);
361  store = (v16u8) __msa_fill_b(addition);
362  val0 = __msa_copy_u_w((v4i32) store, 0);
363  SW4(val0, val0, val0, val0, dst, stride)
364 
365  if (0 == flag) {
366  ILVR_B2_UH(zero, store, zero, src, vec0, vec1);
367 
368  vec1 += vec0;
369  vec0 += vec0;
370  vec1 += vec0;
371 
372  vec1 = (v8u16) __msa_srari_h((v8i16) vec1, 2);
373  store = (v16u8) __msa_pckev_b((v16i8) vec1, (v16i8) vec1);
374  val1 = (src_left[0] + 2 * addition + src_top[0] + 2) >> 2;
375  store = (v16u8) __msa_insert_b((v16i8) store, 0, val1);
376  val0 = __msa_copy_u_w((v4i32) store, 0);
377  SW(val0, tmp_dst);
378 
379  val0 = src_left[1];
380  val1 = src_left[2];
381  val2 = src_left[3];
382 
383  addition *= 3;
384 
385  ADD2(val0, addition, val1, addition, val0, val1);
386  val2 += addition;
387 
388  val0 += 2;
389  val1 += 2;
390  val2 += 2;
391  val0 >>= 2;
392  val1 >>= 2;
393  val2 >>= 2;
394 
395  tmp_dst[stride * 1] = val0;
396  tmp_dst[stride * 2] = val1;
397  tmp_dst[stride * 3] = val2;
398  }
399 }
400 
401 static void hevc_intra_pred_dc_8x8_msa(const uint8_t *src_top,
402  const uint8_t *src_left,
403  uint8_t *dst, int32_t stride,
404  int32_t flag)
405 {
406  uint8_t *tmp_dst = dst;
407  uint32_t row, col, val;
408  uint32_t addition = 0;
409  uint64_t val0, val1;
410  v16u8 src = { 0 };
411  v16u8 store;
412  v8u16 sum, vec0, vec1;
413  v16i8 zero = { 0 };
414 
415  val0 = LD(src_top);
416  val1 = LD(src_left);
417  INSERT_D2_UB(val0, val1, src);
418  sum = __msa_hadd_u_h((v16u8) src, (v16u8) src);
419  sum = (v8u16) __msa_hadd_u_w(sum, sum);
420  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
421  sum = (v8u16) __msa_pckev_w((v4i32) sum, (v4i32) sum);
422  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
423  sum = (v8u16) __msa_srari_w((v4i32) sum, 4);
424  addition = __msa_copy_u_w((v4i32) sum, 0);
425  store = (v16u8) __msa_fill_b(addition);
426  val0 = __msa_copy_u_d((v2i64) store, 0);
427 
428  for (row = 8; row--;) {
429  SD(val0, dst);
430  dst += stride;
431  }
432 
433  if (0 == flag) {
434  ILVR_B2_UH(zero, store, zero, src, vec0, vec1);
435 
436  vec1 += vec0;
437  vec0 += vec0;
438  vec1 += vec0;
439  vec1 = (v8u16) __msa_srari_h((v8i16) vec1, 2);
440  store = (v16u8) __msa_pckev_b((v16i8) vec1, (v16i8) vec1);
441  val = (src_left[0] + 2 * addition + src_top[0] + 2) >> 2;
442  store = (v16u8) __msa_insert_b((v16i8) store, 0, val);
443  val0 = __msa_copy_u_d((v2i64) store, 0);
444  SD(val0, tmp_dst);
445 
446  val0 = LD(src_left);
447  src = (v16u8) __msa_insert_d((v2i64) src, 0, val0);
448  vec1 = (v8u16) __msa_ilvr_b(zero, (v16i8) src);
449  vec0 = (v8u16) __msa_fill_h(addition);
450  vec0 *= 3;
451  vec1 += vec0;
452  vec1 = (v8u16) __msa_srari_h((v8i16) vec1, 2);
453 
454  for (col = 1; col < 8; col++) {
455  tmp_dst[stride * col] = vec1[col];
456  }
457  }
458 }
459 
460 static void hevc_intra_pred_dc_16x16_msa(const uint8_t *src_top,
461  const uint8_t *src_left,
462  uint8_t *dst, int32_t stride,
463  int32_t flag)
464 {
465  uint8_t *tmp_dst = dst;
466  uint32_t row, col, val;
467  uint32_t addition = 0;
468  v16u8 src_above1, store, src_left1;
469  v8u16 sum, sum_above, sum_left;
470  v8u16 vec0, vec1, vec2;
471  v16i8 zero = { 0 };
472 
473  src_above1 = LD_UB(src_top);
474  src_left1 = LD_UB(src_left);
475 
476  HADD_UB2_UH(src_above1, src_left1, sum_above, sum_left);
477  sum = sum_above + sum_left;
478  sum = (v8u16) __msa_hadd_u_w(sum, sum);
479  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
480  sum = (v8u16) __msa_pckev_w((v4i32) sum, (v4i32) sum);
481  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
482  sum = (v8u16) __msa_srari_w((v4i32) sum, 5);
483  addition = __msa_copy_u_w((v4i32) sum, 0);
484  store = (v16u8) __msa_fill_b(addition);
485 
486  for (row = 16; row--;) {
487  ST_UB(store, dst);
488  dst += stride;
489  }
490 
491  if (0 == flag) {
492  vec0 = (v8u16) __msa_ilvr_b(zero, (v16i8) store);
493  ILVRL_B2_UH(zero, src_above1, vec1, vec2);
494  ADD2(vec1, vec0, vec2, vec0, vec1, vec2);
495  vec0 += vec0;
496  ADD2(vec1, vec0, vec2, vec0, vec1, vec2);
497  SRARI_H2_UH(vec1, vec2, 2);
498  store = (v16u8) __msa_pckev_b((v16i8) vec2, (v16i8) vec1);
499  val = (src_left[0] + 2 * addition + src_top[0] + 2) >> 2;
500  store = (v16u8) __msa_insert_b((v16i8) store, 0, val);
501  ST_UB(store, tmp_dst);
502 
503  ILVRL_B2_UH(zero, src_left1, vec1, vec2);
504  vec0 = (v8u16) __msa_fill_h(addition);
505  vec0 *= 3;
506  ADD2(vec1, vec0, vec2, vec0, vec1, vec2);
507  SRARI_H2_UH(vec1, vec2, 2);
508  store = (v16u8) __msa_pckev_b((v16i8) vec2, (v16i8) vec1);
509 
510  for (col = 1; col < 16; col++) {
511  tmp_dst[stride * col] = store[col];
512  }
513  }
514 }
515 
516 static void hevc_intra_pred_dc_32x32_msa(const uint8_t *src_top,
517  const uint8_t *src_left,
518  uint8_t *dst, int32_t stride)
519 {
520  uint32_t row;
521  v16u8 src_above1, src_above2, store, src_left1, src_left2;
522  v8u16 sum_above1, sum_above2;
523  v8u16 sum_left1, sum_left2;
524  v8u16 sum, sum_above, sum_left;
525 
526  LD_UB2(src_top, 16, src_above1, src_above2);
527  LD_UB2(src_left, 16, src_left1, src_left2);
528  HADD_UB2_UH(src_above1, src_above2, sum_above1, sum_above2);
529  HADD_UB2_UH(src_left1, src_left2, sum_left1, sum_left2);
530  sum_above = sum_above1 + sum_above2;
531  sum_left = sum_left1 + sum_left2;
532  sum = sum_above + sum_left;
533  sum = (v8u16) __msa_hadd_u_w(sum, sum);
534  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
535  sum = (v8u16) __msa_pckev_w((v4i32) sum, (v4i32) sum);
536  sum = (v8u16) __msa_hadd_u_d((v4u32) sum, (v4u32) sum);
537  sum = (v8u16) __msa_srari_w((v4i32) sum, 6);
538  store = (v16u8) __msa_splati_b((v16i8) sum, 0);
539 
540  for (row = 16; row--;) {
541  ST_UB2(store, store, dst, 16);
542  dst += stride;
543  ST_UB2(store, store, dst, 16);
544  dst += stride;
545  }
546 }
547 
548 static void hevc_intra_pred_plane_4x4_msa(const uint8_t *src_top,
549  const uint8_t *src_left,
550  uint8_t *dst, int32_t stride)
551 {
552  uint32_t src0, src1;
553  v16i8 src_vec0, src_vec1;
554  v8i16 src_vec0_r, src1_r, tmp0, tmp1, mul_val1;
555  v8i16 vec0, vec1, vec2, vec3, res0, res1, res2, res3;
556  v8i16 mul_val0 = { 3, 2, 1, 0, 1, 2, 3, 4 };
557  v16i8 zero = { 0 };
558 
559  src0 = LW(src_top);
560  src1 = LW(src_left);
561 
562  mul_val1 = (v8i16) __msa_pckod_d((v2i64) mul_val0, (v2i64) mul_val0);
563 
564  src_vec0 = (v16i8) __msa_insert_w((v4i32) zero, 0, src0);
565  src_vec1 = (v16i8) __msa_insert_w((v4i32) zero, 0, src1);
566 
567  ILVR_B2_SH(zero, src_vec0, zero, src_vec1, src_vec0_r, src1_r);
568  SPLATI_H4_SH(src1_r, 0, 1, 2, 3, vec0, vec1, vec2, vec3);
569 
570  tmp0 = __msa_fill_h(src_top[4]);
571  tmp1 = __msa_fill_h(src_left[4]);
572 
573  MUL4(mul_val0, vec0, mul_val0, vec1, mul_val0, vec2, mul_val0, vec3,
574  res0, res1, res2, res3);
575 
576  res0 += mul_val1 * tmp0;
577  res1 += mul_val1 * tmp0;
578  res2 += mul_val1 * tmp0;
579  res3 += mul_val1 * tmp0;
580 
581  res0 += 3 * src_vec0_r;
582  res1 += 2 * src_vec0_r;
583  res2 += src_vec0_r;
584  res0 += tmp1;
585  res1 += 2 * tmp1;
586  res2 += 3 * tmp1;
587  res3 += 4 * tmp1;
588 
589  PCKEV_D2_SH(res1, res0, res3, res2, res0, res1);
590  SRARI_H2_SH(res0, res1, 3);
591  src_vec0 = __msa_pckev_b((v16i8) res1, (v16i8) res0);
592  ST4x4_UB(src_vec0, src_vec0, 0, 1, 2, 3, dst, stride);
593 }
594 
595 static void hevc_intra_pred_plane_8x8_msa(const uint8_t *src_top,
596  const uint8_t *src_left,
597  uint8_t *dst, int32_t stride)
598 {
599  uint64_t src0, src1;
600  v16i8 src_vec0, src_vec1, src_vec2, src_vec3;
601  v8i16 src_vec0_r, src_vec1_r;
602  v8i16 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7;
603  v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
604  v8i16 tmp0, tmp1, tmp2;
605  v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
606  v8i16 mul_val0 = { 7, 6, 5, 4, 3, 2, 1, 0 };
607  v16i8 zero = { 0 };
608 
609  src0 = LD(src_top);
610  src1 = LD(src_left);
611 
612  src_vec0 = (v16i8) __msa_insert_d((v2i64) zero, 0, src0);
613  src_vec1 = (v16i8) __msa_insert_d((v2i64) zero, 0, src1);
614 
615  ILVR_B2_SH(zero, src_vec0, zero, src_vec1, src_vec0_r, src_vec1_r);
616  SPLATI_H4_SH(src_vec1_r, 0, 1, 2, 3, vec0, vec1, vec2, vec3);
617  SPLATI_H4_SH(src_vec1_r, 4, 5, 6, 7, vec4, vec5, vec6, vec7);
618 
619  tmp0 = __msa_fill_h(src_top[8]);
620  tmp1 = __msa_fill_h(src_left[8]);
621 
622  MUL4(mul_val0, vec0, mul_val0, vec1, mul_val0, vec2, mul_val0, vec3,
623  res0, res1, res2, res3);
624  MUL4(mul_val0, vec4, mul_val0, vec5, mul_val0, vec6, mul_val0, vec7,
625  res4, res5, res6, res7);
626 
627  tmp2 = mul_val1 * tmp0;
628  res0 += tmp2;
629  res1 += tmp2;
630  res2 += tmp2;
631  res3 += tmp2;
632  res4 += tmp2;
633  res5 += tmp2;
634  res6 += tmp2;
635  res7 += tmp2;
636 
637  res0 += 7 * src_vec0_r;
638  res1 += 6 * src_vec0_r;
639  res2 += 5 * src_vec0_r;
640  res3 += 4 * src_vec0_r;
641  res4 += 3 * src_vec0_r;
642  res5 += 2 * src_vec0_r;
643  res6 += src_vec0_r;
644 
645  res0 += tmp1;
646  res1 += 2 * tmp1;
647  res2 += 3 * tmp1;
648  res3 += 4 * tmp1;
649  res4 += 5 * tmp1;
650  res5 += 6 * tmp1;
651  res6 += 7 * tmp1;
652  res7 += 8 * tmp1;
653 
654  SRARI_H4_SH(res0, res1, res2, res3, 4);
655  SRARI_H4_SH(res4, res5, res6, res7, 4);
656  PCKEV_B4_SB(res1, res0, res3, res2, res5, res4, res7, res6,
657  src_vec0, src_vec1, src_vec2, src_vec3);
658 
659  ST8x8_UB(src_vec0, src_vec1, src_vec2, src_vec3, dst, stride);
660 }
661 
662 static void hevc_intra_pred_plane_16x16_msa(const uint8_t *src_top,
663  const uint8_t *src_left,
664  uint8_t *dst, int32_t stride)
665 {
666  v16u8 src0, src1;
667  v8i16 src0_r, src1_r, src0_l, src1_l;
668  v8i16 vec0, vec1;
669  v8i16 res0, res1, tmp0, tmp1;
670  v8i16 mul_val2, mul_val3;
671  v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
672  v8i16 mul_val0 = { 15, 14, 13, 12, 11, 10, 9, 8 };
673 
674  src0 = LD_UB(src_top);
675  src1 = LD_UB(src_left);
676 
677  UNPCK_UB_SH(src0, src0_r, src0_l);
678  UNPCK_UB_SH(src1, src1_r, src1_l);
679 
680  mul_val2 = mul_val0 - 8;
681  mul_val3 = mul_val1 + 8;
682 
683  tmp0 = __msa_fill_h(src_top[16]);
684  tmp1 = __msa_fill_h(src_left[16]);
685 
686  SPLATI_H2_SH(src1_r, 0, 1, vec0, vec1);
687  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
688  mul_val0, mul_val1, mul_val2, mul_val3,
689  res0, res1, 15, 1, 5);
690  ST_SH2(res0, res1, dst, stride);
691  dst += (2 * stride);
692 
693  SPLATI_H2_SH(src1_r, 2, 3, vec0, vec1);
694  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
695  mul_val0, mul_val1, mul_val2, mul_val3,
696  res0, res1, 13, 3, 5);
697  ST_SH2(res0, res1, dst, stride);
698  dst += (2 * stride);
699 
700  SPLATI_H2_SH(src1_r, 4, 5, vec0, vec1);
701  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
702  mul_val0, mul_val1, mul_val2, mul_val3,
703  res0, res1, 11, 5, 5);
704  ST_SH2(res0, res1, dst, stride);
705  dst += (2 * stride);
706 
707  SPLATI_H2_SH(src1_r, 6, 7, vec0, vec1);
708  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
709  mul_val0, mul_val1, mul_val2, mul_val3,
710  res0, res1, 9, 7, 5);
711  ST_SH2(res0, res1, dst, stride);
712  dst += (2 * stride);
713 
714  SPLATI_H2_SH(src1_l, 0, 1, vec0, vec1);
715  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
716  mul_val0, mul_val1, mul_val2, mul_val3,
717  res0, res1, 7, 9, 5);
718  ST_SH2(res0, res1, dst, stride);
719  dst += (2 * stride);
720 
721  SPLATI_H2_SH(src1_l, 2, 3, vec0, vec1);
722  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
723  mul_val0, mul_val1, mul_val2, mul_val3,
724  res0, res1, 5, 11, 5);
725  ST_SH2(res0, res1, dst, stride);
726  dst += (2 * stride);
727 
728  SPLATI_H2_SH(src1_l, 4, 5, vec0, vec1);
729  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
730  mul_val0, mul_val1, mul_val2, mul_val3,
731  res0, res1, 3, 13, 5);
732  ST_SH2(res0, res1, dst, stride);
733  dst += (2 * stride);
734 
735  SPLATI_H2_SH(src1_l, 6, 7, vec0, vec1);
736  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
737  mul_val0, mul_val1, mul_val2, mul_val3,
738  res0, res1, 1, 15, 5);
739  ST_SH2(res0, res1, dst, stride);
740 }
741 
742 static void process_intra_upper_16x16_msa(const uint8_t *src_top,
743  const uint8_t *src_left,
744  uint8_t *dst, int32_t stride,
745  uint8_t offset)
746 {
747  v16i8 src0, src1;
748  v8i16 src0_r, src1_r, src0_l, src1_l;
749  v8i16 vec0, vec1, res0, res1;
750  v8i16 tmp0, tmp1;
751  v8i16 mul_val2, mul_val3;
752  v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
753  v8i16 mul_val0 = { 31, 30, 29, 28, 27, 26, 25, 24 };
754 
755  tmp0 = __msa_fill_h(src_top[32 - offset]);
756  tmp1 = __msa_fill_h(src_left[32]);
757 
758  src0 = LD_SB(src_top);
759  src1 = LD_SB(src_left);
760 
761  UNPCK_UB_SH(src0, src0_r, src0_l);
762  UNPCK_UB_SH(src1, src1_r, src1_l);
763 
764  mul_val1 += offset;
765  mul_val0 -= offset;
766  mul_val2 = mul_val0 - 8;
767  mul_val3 = mul_val1 + 8;
768 
769  SPLATI_H2_SH(src1_r, 0, 1, vec0, vec1);
770  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
771  mul_val0, mul_val1, mul_val2, mul_val3,
772  res0, res1, 31, 1, 6);
773  ST_SH2(res0, res1, dst, stride);
774  dst += (2 * stride);
775 
776  SPLATI_H2_SH(src1_r, 2, 3, vec0, vec1);
777  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
778  mul_val0, mul_val1, mul_val2, mul_val3,
779  res0, res1, 29, 3, 6);
780  ST_SH2(res0, res1, dst, stride);
781  dst += (2 * stride);
782 
783  SPLATI_H2_SH(src1_r, 4, 5, vec0, vec1);
784  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
785  mul_val0, mul_val1, mul_val2, mul_val3,
786  res0, res1, 27, 5, 6);
787  ST_SH2(res0, res1, dst, stride);
788  dst += (2 * stride);
789 
790  SPLATI_H2_SH(src1_r, 6, 7, vec0, vec1);
791  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
792  mul_val0, mul_val1, mul_val2, mul_val3,
793  res0, res1, 25, 7, 6);
794  ST_SH2(res0, res1, dst, stride);
795  dst += (2 * stride);
796 
797  SPLATI_H2_SH(src1_l, 0, 1, vec0, vec1);
798  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
799  mul_val0, mul_val1, mul_val2, mul_val3,
800  res0, res1, 23, 9, 6);
801  ST_SH2(res0, res1, dst, stride);
802  dst += (2 * stride);
803 
804  SPLATI_H2_SH(src1_l, 2, 3, vec0, vec1);
805  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
806  mul_val0, mul_val1, mul_val2, mul_val3,
807  res0, res1, 21, 11, 6);
808  ST_SH2(res0, res1, dst, stride);
809  dst += (2 * stride);
810 
811  SPLATI_H2_SH(src1_l, 4, 5, vec0, vec1);
812  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
813  mul_val0, mul_val1, mul_val2, mul_val3,
814  res0, res1, 19, 13, 6);
815  ST_SH2(res0, res1, dst, stride);
816  dst += (2 * stride);
817 
818  SPLATI_H2_SH(src1_l, 6, 7, vec0, vec1);
819  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
820  mul_val0, mul_val1, mul_val2, mul_val3,
821  res0, res1, 17, 15, 6);
822  ST_SH2(res0, res1, dst, stride);
823 }
824 
825 static void process_intra_lower_16x16_msa(const uint8_t *src_top,
826  const uint8_t *src_left,
827  uint8_t *dst, int32_t stride,
828  uint8_t offset)
829 {
830  v16i8 src0, src1;
831  v8i16 src0_r, src1_r, src0_l, src1_l;
832  v8i16 vec0, vec1, res0, res1, tmp0, tmp1;
833  v8i16 mul_val2, mul_val3;
834  v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
835  v8i16 mul_val0 = { 31, 30, 29, 28, 27, 26, 25, 24 };
836 
837  tmp0 = __msa_fill_h(src_top[32 - offset]);
838  tmp1 = __msa_fill_h(src_left[16]);
839 
840  src0 = LD_SB(src_top);
841  src1 = LD_SB(src_left);
842 
843  UNPCK_UB_SH(src0, src0_r, src0_l);
844  UNPCK_UB_SH(src1, src1_r, src1_l);
845 
846  mul_val1 += offset;
847  mul_val0 -= offset;
848  mul_val2 = mul_val0 - 8;
849  mul_val3 = mul_val1 + 8;
850 
851  SPLATI_H2_SH(src1_r, 0, 1, vec0, vec1);
852  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
853  mul_val0, mul_val1, mul_val2, mul_val3,
854  res0, res1, 15, 17, 6);
855  ST_SH2(res0, res1, dst, stride);
856  dst += (2 * stride);
857 
858  SPLATI_H2_SH(src1_r, 2, 3, vec0, vec1);
859  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
860  mul_val0, mul_val1, mul_val2, mul_val3,
861  res0, res1, 13, 19, 6);
862  ST_SH2(res0, res1, dst, stride);
863  dst += (2 * stride);
864 
865  SPLATI_H2_SH(src1_r, 4, 5, vec0, vec1);
866  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
867  mul_val0, mul_val1, mul_val2, mul_val3,
868  res0, res1, 11, 21, 6);
869  ST_SH2(res0, res1, dst, stride);
870  dst += (2 * stride);
871 
872  SPLATI_H2_SH(src1_r, 6, 7, vec0, vec1);
873  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
874  mul_val0, mul_val1, mul_val2, mul_val3,
875  res0, res1, 9, 23, 6);
876  ST_SH2(res0, res1, dst, stride);
877  dst += (2 * stride);
878 
879  SPLATI_H2_SH(src1_l, 0, 1, vec0, vec1);
880  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
881  mul_val0, mul_val1, mul_val2, mul_val3,
882  res0, res1, 7, 25, 6);
883  ST_SH2(res0, res1, dst, stride);
884  dst += (2 * stride);
885 
886  SPLATI_H2_SH(src1_l, 2, 3, vec0, vec1);
887  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
888  mul_val0, mul_val1, mul_val2, mul_val3,
889  res0, res1, 5, 27, 6);
890  ST_SH2(res0, res1, dst, stride);
891  dst += (2 * stride);
892 
893  SPLATI_H2_SH(src1_l, 4, 5, vec0, vec1);
894  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
895  mul_val0, mul_val1, mul_val2, mul_val3,
896  res0, res1, 3, 29, 6);
897  ST_SH2(res0, res1, dst, stride);
898  dst += (2 * stride);
899 
900  SPLATI_H2_SH(src1_l, 6, 7, vec0, vec1);
901  HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,
902  mul_val0, mul_val1, mul_val2, mul_val3,
903  res0, res1, 1, 31, 6);
904  ST_SH2(res0, res1, dst, stride);
905 }
906 
907 static void hevc_intra_pred_plane_32x32_msa(const uint8_t *src_top,
908  const uint8_t *src_left,
909  uint8_t *dst, int32_t stride)
910 {
911  process_intra_upper_16x16_msa(src_top, src_left, dst, stride, 0);
912  process_intra_upper_16x16_msa((src_top + 16), src_left,
913  (dst + 16), stride, 16);
914  dst += (16 * stride);
915  src_left += 16;
916 
917  process_intra_lower_16x16_msa(src_top, src_left, dst, stride, 0);
918  process_intra_lower_16x16_msa((src_top + 16), src_left,
919  (dst + 16), stride, 16);
920 }
921 
923  const uint8_t *src_left,
924  uint8_t *dst,
925  int32_t stride,
926  int32_t mode)
927 {
928  int16_t inv_angle[] = { -256, -315, -390, -482, -630, -910, -1638, -4096 };
929  uint8_t ref_array[3 * 32 + 4];
930  uint8_t *ref_tmp = ref_array + 4;
931  const uint8_t *ref;
932  int32_t last;
933  int32_t h_cnt, idx0, fact_val0, idx1, fact_val1;
934  int32_t idx2, fact_val2, idx3, fact_val3;
935  int32_t angle, angle_loop;
936  int32_t inv_angle_val, offset;
937  uint64_t tmp0;
938  v16i8 top0, top1, top2, top3;
939  v16i8 dst_val0;
940  v16i8 zero = { 0 };
941  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
942  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
943 
944  angle = intra_pred_angle_up[mode - 18];
945  inv_angle_val = inv_angle[mode - 18];
946  last = (angle) >> 3;
947  angle_loop = angle;
948 
949  ref = src_top - 1;
950  if (angle < 0 && last < -1) {
951  inv_angle_val = inv_angle[mode - 18];
952 
953  tmp0 = LD(ref);
954  SD(tmp0, ref_tmp);
955 
956  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
957  offset = -1 + ((h_cnt * inv_angle_val + 128) >> 8);
958  ref_tmp[h_cnt] = src_left[offset];
959  }
960 
961  ref = ref_tmp;
962  }
963 
964  idx0 = angle_loop >> 5;
965  fact_val0 = angle_loop & 31;
966  angle_loop += angle;
967 
968  idx1 = angle_loop >> 5;
969  fact_val1 = angle_loop & 31;
970  angle_loop += angle;
971 
972  idx2 = angle_loop >> 5;
973  fact_val2 = angle_loop & 31;
974  angle_loop += angle;
975 
976  idx3 = angle_loop >> 5;
977  fact_val3 = angle_loop & 31;
978 
979  top0 = LD_SB(ref + idx0 + 1);
980  top1 = LD_SB(ref + idx1 + 1);
981  top2 = LD_SB(ref + idx2 + 1);
982  top3 = LD_SB(ref + idx3 + 1);
983 
984  fact0 = __msa_fill_h(fact_val0);
985  fact1 = __msa_fill_h(32 - fact_val0);
986 
987  fact2 = __msa_fill_h(fact_val1);
988  fact3 = __msa_fill_h(32 - fact_val1);
989 
990  fact4 = __msa_fill_h(fact_val2);
991  fact5 = __msa_fill_h(32 - fact_val2);
992 
993  fact6 = __msa_fill_h(fact_val3);
994  fact7 = __msa_fill_h(32 - fact_val3);
995 
996  ILVR_D2_SH(fact2, fact0, fact6, fact4, fact0, fact2);
997  ILVR_D2_SH(fact3, fact1, fact7, fact5, fact1, fact3);
998  ILVR_B4_SH(zero, top0, zero, top1, zero, top2, zero, top3,
999  diff0, diff2, diff4, diff6);
1000  SLDI_B4_0_SH(diff0, diff2, diff4, diff6, diff1, diff3, diff5, diff7, 2);
1001  ILVR_D2_SH(diff2, diff0, diff6, diff4, diff0, diff2);
1002  ILVR_D2_SH(diff3, diff1, diff7, diff5, diff1, diff3);
1003  MUL2(diff1, fact0, diff3, fact2, diff1, diff3);
1004 
1005  diff1 += diff0 * fact1;
1006  diff3 += diff2 * fact3;
1007 
1008  SRARI_H2_SH(diff1, diff3, 5);
1009  dst_val0 = __msa_pckev_b((v16i8) diff3, (v16i8) diff1);
1010  ST4x4_UB(dst_val0, dst_val0, 0, 1, 2, 3, dst, stride);
1011 }
1012 
1014  const uint8_t *src_left,
1015  uint8_t *dst,
1016  int32_t stride,
1017  int32_t mode)
1018 {
1019  int16_t inv_angle[] = { -256, -315, -390, -482, -630, -910, -1638, -4096 };
1020  uint8_t ref_array[3 * 32 + 4];
1021  uint8_t *ref_tmp = ref_array + 8;
1022  const uint8_t *ref;
1023  const uint8_t *src_left_tmp = src_left - 1;
1024  int32_t last, offset;
1025  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1;
1026  int32_t idx2, fact_val2, idx3, fact_val3;
1027  int32_t angle, angle_loop;
1028  int32_t inv_angle_val, inv_angle_val_loop;
1029  int32_t tmp0, tmp1, tmp2;
1030  v16i8 top0, top1, top2, top3;
1031  v16u8 dst_val0, dst_val1;
1032  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
1033  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1034 
1035  angle = intra_pred_angle_up[mode - 18];
1036  inv_angle_val = inv_angle[mode - 18];
1037  last = (angle) >> 2;
1038  angle_loop = angle;
1039 
1040  ref = src_top - 1;
1041  if (last < -1) {
1042  inv_angle_val_loop = inv_angle_val * last;
1043 
1044  tmp0 = LW(ref);
1045  tmp1 = LW(ref + 4);
1046  tmp2 = LW(ref + 8);
1047  SW(tmp0, ref_tmp);
1048  SW(tmp1, ref_tmp + 4);
1049  SW(tmp2, ref_tmp + 8);
1050 
1051  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1052  offset = (inv_angle_val_loop + 128) >> 8;
1053  ref_tmp[h_cnt] = src_left_tmp[offset];
1054  inv_angle_val_loop += inv_angle_val;
1055  }
1056  ref = ref_tmp;
1057  }
1058 
1059  for (v_cnt = 0; v_cnt < 2; v_cnt++) {
1060  idx0 = (angle_loop) >> 5;
1061  fact_val0 = (angle_loop) & 31;
1062  angle_loop += angle;
1063 
1064  idx1 = (angle_loop) >> 5;
1065  fact_val1 = (angle_loop) & 31;
1066  angle_loop += angle;
1067 
1068  idx2 = (angle_loop) >> 5;
1069  fact_val2 = (angle_loop) & 31;
1070  angle_loop += angle;
1071 
1072  idx3 = (angle_loop) >> 5;
1073  fact_val3 = (angle_loop) & 31;
1074  angle_loop += angle;
1075 
1076  top0 = LD_SB(ref + idx0 + 1);
1077  top1 = LD_SB(ref + idx1 + 1);
1078  top2 = LD_SB(ref + idx2 + 1);
1079  top3 = LD_SB(ref + idx3 + 1);
1080 
1081  fact0 = __msa_fill_h(fact_val0);
1082  fact1 = __msa_fill_h(32 - fact_val0);
1083  fact2 = __msa_fill_h(fact_val1);
1084  fact3 = __msa_fill_h(32 - fact_val1);
1085  fact4 = __msa_fill_h(fact_val2);
1086  fact5 = __msa_fill_h(32 - fact_val2);
1087  fact6 = __msa_fill_h(fact_val3);
1088  fact7 = __msa_fill_h(32 - fact_val3);
1089 
1090  UNPCK_UB_SH(top0, diff0, diff1);
1091  UNPCK_UB_SH(top1, diff2, diff3);
1092  UNPCK_UB_SH(top2, diff4, diff5);
1093  UNPCK_UB_SH(top3, diff6, diff7);
1094 
1095  SLDI_B2_SH(diff1, diff3, diff0, diff2, diff1, diff3, 2);
1096  SLDI_B2_SH(diff5, diff7, diff4, diff6, diff5, diff7, 2);
1097  MUL4(diff1, fact0, diff3, fact2, diff5, fact4, diff7, fact6,
1098  diff1, diff3, diff5, diff7);
1099 
1100  diff1 += diff0 * fact1;
1101  diff3 += diff2 * fact3;
1102  diff5 += diff4 * fact5;
1103  diff7 += diff6 * fact7;
1104 
1105  SRARI_H4_SH(diff1, diff3, diff5, diff7, 5);
1106  PCKEV_B2_UB(diff3, diff1, diff7, diff5, dst_val0, dst_val1);
1107  ST8x4_UB(dst_val0, dst_val1, dst, stride);
1108  dst += (4 * stride);
1109  }
1110 }
1111 
1113  const uint8_t *src_left,
1114  uint8_t *dst,
1115  int32_t stride,
1116  int32_t mode)
1117 {
1118  int16_t inv_angle[] = { -256, -315, -390, -482, -630, -910, -1638, -4096 };
1119  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1;
1120  int32_t idx2, fact_val2, idx3, fact_val3;
1121  int32_t tmp0;
1122  int32_t angle, angle_loop, offset;
1123  int32_t inv_angle_val, inv_angle_val_loop;
1124  uint8_t ref_array[3 * 32 + 4];
1125  uint8_t *ref_tmp = ref_array + 16;
1126  const uint8_t *ref;
1127  const uint8_t *src_left_tmp = src_left - 1;
1128  int32_t last;
1129  v16u8 top0, top1, top2, top3, top4, top5, top6, top7;
1130  v16i8 dst0, dst1, dst2, dst3;
1131  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
1132  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1133  v8i16 diff8, diff9, diff10, diff11, diff12, diff13, diff14, diff15;
1134 
1135  angle = intra_pred_angle_up[mode - 18];
1136  inv_angle_val = inv_angle[mode - 18];
1137  last = angle >> 1;
1138  angle_loop = angle;
1139 
1140  ref = src_top - 1;
1141  if (last < -1) {
1142  inv_angle_val_loop = inv_angle_val * last;
1143 
1144  top0 = LD_UB(ref);
1145  tmp0 = LW(ref + 16);
1146  ST_UB(top0, ref_tmp);
1147  SW(tmp0, ref_tmp + 16);
1148 
1149  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1150  offset = (inv_angle_val_loop + 128) >> 8;
1151  ref_tmp[h_cnt] = src_left_tmp[offset];
1152  inv_angle_val_loop += inv_angle_val;
1153  }
1154  ref = ref_tmp;
1155  }
1156 
1157  for (v_cnt = 4; v_cnt--;) {
1158  idx0 = (angle_loop) >> 5;
1159  fact_val0 = (angle_loop) & 31;
1160  angle_loop += angle;
1161 
1162  idx1 = (angle_loop) >> 5;
1163  fact_val1 = (angle_loop) & 31;
1164  angle_loop += angle;
1165 
1166  idx2 = (angle_loop) >> 5;
1167  fact_val2 = (angle_loop) & 31;
1168  angle_loop += angle;
1169 
1170  idx3 = (angle_loop) >> 5;
1171  fact_val3 = (angle_loop) & 31;
1172  angle_loop += angle;
1173 
1174  LD_UB2(ref + idx0 + 1, 16, top0, top1);
1175  LD_UB2(ref + idx1 + 1, 16, top2, top3);
1176  LD_UB2(ref + idx2 + 1, 16, top4, top5);
1177  LD_UB2(ref + idx3 + 1, 16, top6, top7);
1178 
1179  fact0 = __msa_fill_h(fact_val0);
1180  fact1 = __msa_fill_h(32 - fact_val0);
1181  fact2 = __msa_fill_h(fact_val1);
1182  fact3 = __msa_fill_h(32 - fact_val1);
1183  fact4 = __msa_fill_h(fact_val2);
1184  fact5 = __msa_fill_h(32 - fact_val2);
1185  fact6 = __msa_fill_h(fact_val3);
1186  fact7 = __msa_fill_h(32 - fact_val3);
1187 
1188  SLDI_B2_UB(top1, top3, top0, top2, top1, top3, 1);
1189  SLDI_B2_UB(top5, top7, top4, top6, top5, top7, 1);
1190  UNPCK_UB_SH(top0, diff0, diff1);
1191  UNPCK_UB_SH(top1, diff2, diff3);
1192  UNPCK_UB_SH(top2, diff4, diff5);
1193  UNPCK_UB_SH(top3, diff6, diff7);
1194  UNPCK_UB_SH(top4, diff8, diff9);
1195  UNPCK_UB_SH(top5, diff10, diff11);
1196  UNPCK_UB_SH(top6, diff12, diff13);
1197  UNPCK_UB_SH(top7, diff14, diff15);
1198 
1199  MUL4(diff2, fact0, diff3, fact0, diff6, fact2, diff7, fact2,
1200  diff2, diff3, diff6, diff7);
1201  MUL4(diff10, fact4, diff11, fact4, diff14, fact6, diff15, fact6,
1202  diff10, diff11, diff14, diff15);
1203 
1204  diff2 += diff0 * fact1;
1205  diff3 += diff1 * fact1;
1206  diff6 += diff4 * fact3;
1207  diff7 += diff5 * fact3;
1208  diff10 += diff8 * fact5;
1209  diff11 += diff9 * fact5;
1210  diff14 += diff12 * fact7;
1211  diff15 += diff13 * fact7;
1212 
1213  SRARI_H4_SH(diff2, diff3, diff6, diff7, 5);
1214  SRARI_H4_SH(diff10, diff11, diff14, diff15, 5);
1215  PCKEV_B4_SB(diff3, diff2, diff7, diff6, diff11, diff10, diff15, diff14,
1216  dst0, dst1, dst2, dst3);
1217  ST_SB4(dst0, dst1, dst2, dst3, dst, stride);
1218  dst += (4 * stride);
1219  }
1220 }
1221 
1223  const uint8_t *src_left,
1224  uint8_t *dst,
1225  int32_t stride,
1226  int32_t mode)
1227 {
1228  int16_t inv_angle[] = { -256, -315, -390, -482, -630, -910, -1638, -4096 };
1229  uint8_t ref_array[3 * 32 + 4];
1230  uint8_t *ref_tmp;
1231  const uint8_t *ref;
1232  const uint8_t *src_left_tmp = src_left - 1;
1233  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1;
1234  int32_t tmp0, tmp1, tmp2, tmp3;
1235  int32_t angle, angle_loop;
1236  int32_t inv_angle_val, inv_angle_val_loop;
1237  int32_t last, offset;
1238  v16u8 top0, top1, top2, top3, top4, top5, top6, top7;
1239  v16i8 dst0, dst1, dst2, dst3;
1240  v8i16 fact0, fact1, fact2, fact3;
1241  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1242  v8i16 diff8, diff9, diff10, diff11, diff12, diff13, diff14, diff15;
1243 
1244  ref_tmp = ref_array + 32;
1245 
1246  angle = intra_pred_angle_up[mode - 18];
1247  inv_angle_val = inv_angle[mode - 18];
1248  last = angle;
1249  angle_loop = angle;
1250 
1251  ref = src_top - 1;
1252  if (last < -1) {
1253  inv_angle_val_loop = inv_angle_val * last;
1254  LD_UB2(ref, 16, top0, top1);
1255  tmp0 = ref[32];
1256  tmp1 = ref[33];
1257  tmp2 = ref[34];
1258  tmp3 = ref[35];
1259 
1260  ST_UB2(top0, top1, ref_tmp, 16);
1261  ref_tmp[32] = tmp0;
1262  ref_tmp[33] = tmp1;
1263  ref_tmp[34] = tmp2;
1264  ref_tmp[35] = tmp3;
1265 
1266  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1267  offset = (inv_angle_val_loop + 128) >> 8;
1268  ref_tmp[h_cnt] = src_left_tmp[offset];
1269  inv_angle_val_loop += inv_angle_val;
1270  }
1271 
1272  ref = ref_tmp;
1273  }
1274 
1275  for (v_cnt = 16; v_cnt--;) {
1276  idx0 = (angle_loop) >> 5;
1277  fact_val0 = (angle_loop) & 31;
1278  angle_loop += angle;
1279 
1280  idx1 = (angle_loop) >> 5;
1281  fact_val1 = (angle_loop) & 31;
1282  angle_loop += angle;
1283 
1284  top0 = LD_UB(ref + idx0 + 1);
1285  top4 = LD_UB(ref + idx1 + 1);
1286  top1 = LD_UB(ref + idx0 + 17);
1287  top5 = LD_UB(ref + idx1 + 17);
1288  top3 = LD_UB(ref + idx0 + 33);
1289  top7 = LD_UB(ref + idx1 + 33);
1290 
1291  fact0 = __msa_fill_h(fact_val0);
1292  fact1 = __msa_fill_h(32 - fact_val0);
1293  fact2 = __msa_fill_h(fact_val1);
1294  fact3 = __msa_fill_h(32 - fact_val1);
1295 
1296  top2 = top1;
1297  top6 = top5;
1298 
1299  SLDI_B2_UB(top1, top3, top0, top2, top1, top3, 1);
1300  SLDI_B2_UB(top5, top7, top4, top6, top5, top7, 1);
1301  UNPCK_UB_SH(top0, diff0, diff1);
1302  UNPCK_UB_SH(top1, diff2, diff3);
1303  UNPCK_UB_SH(top2, diff4, diff5);
1304  UNPCK_UB_SH(top3, diff6, diff7);
1305  UNPCK_UB_SH(top4, diff8, diff9);
1306  UNPCK_UB_SH(top5, diff10, diff11);
1307  UNPCK_UB_SH(top6, diff12, diff13);
1308  UNPCK_UB_SH(top7, diff14, diff15);
1309 
1310  MUL4(diff2, fact0, diff3, fact0, diff6, fact0, diff7, fact0,
1311  diff2, diff3, diff6, diff7);
1312  MUL4(diff10, fact2, diff11, fact2, diff14, fact2, diff15, fact2,
1313  diff10, diff11, diff14, diff15);
1314 
1315  diff2 += diff0 * fact1;
1316  diff3 += diff1 * fact1;
1317  diff6 += diff4 * fact1;
1318  diff7 += diff5 * fact1;
1319  diff10 += diff8 * fact3;
1320  diff11 += diff9 * fact3;
1321  diff14 += diff12 * fact3;
1322  diff15 += diff13 * fact3;
1323 
1324  SRARI_H4_SH(diff2, diff3, diff6, diff7, 5);
1325  SRARI_H4_SH(diff10, diff11, diff14, diff15, 5);
1326  PCKEV_B4_SB(diff3, diff2, diff7, diff6, diff11, diff10, diff15, diff14,
1327  dst0, dst1, dst2, dst3);
1328 
1329  ST_SB2(dst0, dst1, dst, 16);
1330  dst += stride;
1331  ST_SB2(dst2, dst3, dst, 16);
1332  dst += stride;
1333  }
1334 }
1335 
1337  const uint8_t *src_left,
1338  uint8_t *dst,
1339  int32_t stride,
1340  int32_t mode)
1341 {
1342  int16_t inv_angle[] = { -4096, -1638, -910, -630, -482, -390, -315 };
1343  uint8_t ref_array[3 * 32 + 4];
1344  uint8_t *ref_tmp = ref_array + 4;
1345  const uint8_t *ref;
1346  int32_t last, offset;
1347  int32_t h_cnt, idx0, fact_val0, idx1, fact_val1;
1348  int32_t idx2, fact_val2, idx3, fact_val3;
1349  int32_t angle, angle_loop, inv_angle_val;
1350  uint64_t tmp0;
1351  v16i8 dst_val0, dst_val1;
1352  v16u8 top0, top1, top2, top3;
1353  v16u8 zero = { 0 };
1354  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1355  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
1356 
1357  angle = intra_pred_angle_low[mode - 2];
1358  last = angle >> 3;
1359  angle_loop = angle;
1360 
1361  ref = src_left - 1;
1362  if (last < -1) {
1363  inv_angle_val = inv_angle[mode - 11];
1364 
1365  tmp0 = LD(ref);
1366  SD(tmp0, ref_tmp);
1367 
1368  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1369  offset = -1 + ((h_cnt * inv_angle_val + 128) >> 8);
1370  ref_tmp[h_cnt] = src_top[offset];
1371  }
1372 
1373  ref = ref_tmp;
1374  }
1375 
1376  idx0 = angle_loop >> 5;
1377  fact_val0 = angle_loop & 31;
1378  angle_loop += angle;
1379 
1380  idx1 = angle_loop >> 5;
1381  fact_val1 = angle_loop & 31;
1382  angle_loop += angle;
1383 
1384  idx2 = angle_loop >> 5;
1385  fact_val2 = angle_loop & 31;
1386  angle_loop += angle;
1387 
1388  idx3 = angle_loop >> 5;
1389  fact_val3 = angle_loop & 31;
1390 
1391  top0 = LD_UB(ref + idx0 + 1);
1392  top1 = LD_UB(ref + idx1 + 1);
1393  top2 = LD_UB(ref + idx2 + 1);
1394  top3 = LD_UB(ref + idx3 + 1);
1395 
1396  fact0 = __msa_fill_h(fact_val0);
1397  fact1 = __msa_fill_h(32 - fact_val0);
1398  fact2 = __msa_fill_h(fact_val1);
1399  fact3 = __msa_fill_h(32 - fact_val1);
1400  fact4 = __msa_fill_h(fact_val2);
1401  fact5 = __msa_fill_h(32 - fact_val2);
1402  fact6 = __msa_fill_h(fact_val3);
1403  fact7 = __msa_fill_h(32 - fact_val3);
1404 
1405  ILVR_D2_SH(fact2, fact0, fact6, fact4, fact0, fact2);
1406  ILVR_D2_SH(fact3, fact1, fact7, fact5, fact1, fact3);
1407  ILVR_B4_SH(zero, top0, zero, top1, zero, top2, zero, top3,
1408  diff0, diff2, diff4, diff6);
1409  SLDI_B4_0_SH(diff0, diff2, diff4, diff6, diff1, diff3, diff5, diff7, 2);
1410  ILVR_D2_SH(diff2, diff0, diff6, diff4, diff0, diff2);
1411  ILVR_D2_SH(diff3, diff1, diff7, diff5, diff1, diff3);
1412  MUL2(diff1, fact0, diff3, fact2, diff1, diff3);
1413 
1414  diff1 += diff0 * fact1;
1415  diff3 += diff2 * fact3;
1416 
1417  SRARI_H2_SH(diff1, diff3, 5);
1418  PCKEV_B2_SB(diff1, diff1, diff3, diff3, dst_val0, dst_val1);
1419 
1420  diff0 = (v8i16) __msa_pckev_b(dst_val1, dst_val0);
1421  diff1 = (v8i16) __msa_pckod_b(dst_val1, dst_val0);
1422 
1423  diff2 = (v8i16) __msa_pckev_w((v4i32) diff1, (v4i32) diff0);
1424 
1425  dst_val0 = __msa_pckev_b((v16i8) diff2, (v16i8) diff2);
1426  dst_val1 = __msa_pckod_b((v16i8) diff2, (v16i8) diff2);
1427 
1428  ST4x2_UB(dst_val0, dst, stride);
1429  dst += (2 * stride);
1430  ST4x2_UB(dst_val1, dst, stride);
1431 }
1432 
1434  const uint8_t *src_left,
1435  uint8_t *dst,
1436  int32_t stride,
1437  int32_t mode)
1438 {
1439  int16_t inv_angle[] = { -4096, -1638, -910, -630, -482, -390, -315 };
1440  uint8_t ref_array[3 * 32 + 4];
1441  uint8_t *ref_tmp = ref_array + 8;
1442  const uint8_t *ref;
1443  const uint8_t *src_top_tmp = src_top - 1;
1444  uint8_t *dst_org;
1445  int32_t last, offset, tmp0, tmp1, tmp2;
1446  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1;
1447  int32_t idx2, fact_val2, idx3, fact_val3;
1448  int32_t angle, angle_loop, inv_angle_val;
1449  v16i8 top0, top1, top2, top3;
1450  v16i8 dst_val0, dst_val1, dst_val2, dst_val3;
1451  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1452  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
1453 
1454  angle = intra_pred_angle_low[mode - 2];
1455  last = (angle) >> 2;
1456  angle_loop = angle;
1457 
1458  ref = src_left - 1;
1459  if (last < -1) {
1460  inv_angle_val = inv_angle[mode - 11];
1461 
1462  tmp0 = LW(ref);
1463  tmp1 = LW(ref + 4);
1464  tmp2 = LW(ref + 8);
1465  SW(tmp0, ref_tmp);
1466  SW(tmp1, ref_tmp + 4);
1467  SW(tmp2, ref_tmp + 8);
1468 
1469  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1470  offset = (h_cnt * inv_angle_val + 128) >> 8;
1471  ref_tmp[h_cnt] = src_top_tmp[offset];
1472  }
1473 
1474  ref = ref_tmp;
1475  }
1476 
1477  for (v_cnt = 0; v_cnt < 2; v_cnt++) {
1478  dst_org = dst;
1479 
1480  idx0 = angle_loop >> 5;
1481  fact_val0 = angle_loop & 31;
1482  angle_loop += angle;
1483 
1484  idx1 = angle_loop >> 5;
1485  fact_val1 = angle_loop & 31;
1486  angle_loop += angle;
1487 
1488  idx2 = angle_loop >> 5;
1489  fact_val2 = angle_loop & 31;
1490  angle_loop += angle;
1491 
1492  idx3 = angle_loop >> 5;
1493  fact_val3 = angle_loop & 31;
1494  angle_loop += angle;
1495 
1496  top0 = LD_SB(ref + idx0 + 1);
1497  top1 = LD_SB(ref + idx1 + 1);
1498  top2 = LD_SB(ref + idx2 + 1);
1499  top3 = LD_SB(ref + idx3 + 1);
1500 
1501  fact0 = __msa_fill_h(fact_val0);
1502  fact1 = __msa_fill_h(32 - fact_val0);
1503  fact2 = __msa_fill_h(fact_val1);
1504  fact3 = __msa_fill_h(32 - fact_val1);
1505  fact4 = __msa_fill_h(fact_val2);
1506  fact5 = __msa_fill_h(32 - fact_val2);
1507  fact6 = __msa_fill_h(fact_val3);
1508  fact7 = __msa_fill_h(32 - fact_val3);
1509 
1510  UNPCK_UB_SH(top0, diff0, diff1);
1511  UNPCK_UB_SH(top1, diff2, diff3);
1512  UNPCK_UB_SH(top2, diff4, diff5);
1513  UNPCK_UB_SH(top3, diff6, diff7);
1514  SLDI_B2_SH(diff1, diff3, diff0, diff2, diff1, diff3, 2);
1515  SLDI_B2_SH(diff5, diff7, diff4, diff6, diff5, diff7, 2);
1516  MUL4(diff1, fact0, diff3, fact2, diff5, fact4, diff7, fact6,
1517  diff1, diff3, diff5, diff7);
1518 
1519  diff1 += diff0 * fact1;
1520  diff3 += diff2 * fact3;
1521  diff5 += diff4 * fact5;
1522  diff7 += diff6 * fact7;
1523 
1524  SRARI_H4_SH(diff1, diff3, diff5, diff7, 5);
1525  PCKEV_B4_SB(diff1, diff1, diff3, diff3, diff5, diff5, diff7, diff7,
1526  dst_val0, dst_val1, dst_val2, dst_val3);
1527  ILVR_B2_SH(dst_val1, dst_val0, dst_val3, dst_val2, diff0, diff1);
1528  ILVRL_H2_SH(diff1, diff0, diff3, diff4);
1529  ST4x8_UB(diff3, diff4, dst_org, stride);
1530  dst += 4;
1531  }
1532 }
1533 
1535  const uint8_t *src_left,
1536  uint8_t *dst,
1537  int32_t stride,
1538  int32_t mode)
1539 {
1540  int16_t inv_angle[] = { -4096, -1638, -910, -630, -482, -390, -315 };
1541  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1;
1542  int32_t idx2, fact_val2, idx3, fact_val3, tmp0;
1543  v16i8 top0, top1, dst_val0, top2, top3, dst_val1;
1544  v16i8 top4, top5, dst_val2, top6, top7, dst_val3;
1545  v8i16 fact0, fact1, fact2, fact3, fact4, fact5, fact6, fact7;
1546  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1547  v8i16 diff8, diff9, diff10, diff11, diff12, diff13, diff14, diff15;
1548  int32_t angle, angle_loop, inv_angle_val, offset;
1549  uint8_t ref_array[3 * 32 + 4];
1550  uint8_t *ref_tmp = ref_array + 16;
1551  const uint8_t *ref, *src_top_tmp = src_top - 1;
1552  uint8_t *dst_org;
1553  int32_t last;
1554 
1555  angle = intra_pred_angle_low[mode - 2];
1556  last = (angle) >> 1;
1557  angle_loop = angle;
1558 
1559  ref = src_left - 1;
1560  if (last < -1) {
1561  inv_angle_val = inv_angle[mode - 11];
1562 
1563  top0 = LD_SB(ref);
1564  tmp0 = LW(ref + 16);
1565  ST_SB(top0, ref_tmp);
1566  SW(tmp0, ref_tmp + 16);
1567 
1568  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1569  offset = (h_cnt * inv_angle_val + 128) >> 8;
1570  ref_tmp[h_cnt] = src_top_tmp[offset];
1571  }
1572 
1573  ref = ref_tmp;
1574  }
1575 
1576  for (v_cnt = 0; v_cnt < 4; v_cnt++) {
1577  dst_org = dst;
1578 
1579  idx0 = angle_loop >> 5;
1580  fact_val0 = angle_loop & 31;
1581  angle_loop += angle;
1582 
1583  idx1 = angle_loop >> 5;
1584  fact_val1 = angle_loop & 31;
1585  angle_loop += angle;
1586 
1587  idx2 = angle_loop >> 5;
1588  fact_val2 = angle_loop & 31;
1589  angle_loop += angle;
1590 
1591  idx3 = angle_loop >> 5;
1592  fact_val3 = angle_loop & 31;
1593  angle_loop += angle;
1594 
1595  LD_SB2(ref + idx0 + 1, 16, top0, top1);
1596  LD_SB2(ref + idx1 + 1, 16, top2, top3);
1597  LD_SB2(ref + idx2 + 1, 16, top4, top5);
1598  LD_SB2(ref + idx3 + 1, 16, top6, top7);
1599 
1600  fact0 = __msa_fill_h(fact_val0);
1601  fact1 = __msa_fill_h(32 - fact_val0);
1602  fact2 = __msa_fill_h(fact_val1);
1603  fact3 = __msa_fill_h(32 - fact_val1);
1604  fact4 = __msa_fill_h(fact_val2);
1605  fact5 = __msa_fill_h(32 - fact_val2);
1606  fact6 = __msa_fill_h(fact_val3);
1607  fact7 = __msa_fill_h(32 - fact_val3);
1608 
1609  SLDI_B2_SB(top1, top3, top0, top2, top1, top3, 1);
1610  SLDI_B2_SB(top5, top7, top4, top6, top5, top7, 1);
1611 
1612  UNPCK_UB_SH(top0, diff0, diff1);
1613  UNPCK_UB_SH(top1, diff2, diff3);
1614  UNPCK_UB_SH(top2, diff4, diff5);
1615  UNPCK_UB_SH(top3, diff6, diff7);
1616  UNPCK_UB_SH(top4, diff8, diff9);
1617  UNPCK_UB_SH(top5, diff10, diff11);
1618  UNPCK_UB_SH(top6, diff12, diff13);
1619  UNPCK_UB_SH(top7, diff14, diff15);
1620 
1621  MUL4(diff2, fact0, diff3, fact0, diff6, fact2, diff7, fact2,
1622  diff2, diff3, diff6, diff7);
1623  MUL4(diff10, fact4, diff11, fact4, diff14, fact6, diff15, fact6,
1624  diff10, diff11, diff14, diff15);
1625 
1626  diff2 += diff0 * fact1;
1627  diff3 += diff1 * fact1;
1628  diff6 += diff4 * fact3;
1629  diff7 += diff5 * fact3;
1630  diff10 += diff8 * fact5;
1631  diff11 += diff9 * fact5;
1632  diff14 += diff12 * fact7;
1633  diff15 += diff13 * fact7;
1634 
1635  SRARI_H4_SH(diff2, diff3, diff6, diff7, 5);
1636  SRARI_H4_SH(diff10, diff11, diff14, diff15, 5);
1637  PCKEV_B4_SB(diff3, diff2, diff7, diff6, diff11, diff10, diff15, diff14,
1638  dst_val0, dst_val1, dst_val2, dst_val3);
1639  ILVR_B2_SH(dst_val1, dst_val0, dst_val3, dst_val2, diff0, diff1);
1640  ILVL_B2_SH(dst_val1, dst_val0, dst_val3, dst_val2, diff2, diff3);
1641  ILVRL_H2_SH(diff1, diff0, diff4, diff5);
1642  ILVRL_H2_SH(diff3, diff2, diff6, diff7);
1643  ST4x8_UB(diff4, diff5, dst_org, stride);
1644  dst_org += (8 * stride);
1645  ST4x8_UB(diff6, diff7, dst_org, stride);
1646  dst += 4;
1647  }
1648 }
1649 
1651  const uint8_t *src_left,
1652  uint8_t *dst,
1653  int32_t stride,
1654  int32_t mode)
1655 {
1656  int16_t inv_angle[] = { -4096, -1638, -910, -630, -482, -390, -315 };
1657  int32_t h_cnt, v_cnt, idx0, fact_val0, idx1, fact_val1, tmp0;
1658  v16i8 top0, top1, dst_val0, top2, top3, dst_val1;
1659  v16i8 top4, top5, dst_val2, top6, top7, dst_val3;
1660  v8i16 fact0, fact1, fact2, fact3;
1661  v8i16 diff0, diff1, diff2, diff3, diff4, diff5, diff6, diff7;
1662  v8i16 diff8, diff9, diff10, diff11, diff12, diff13, diff14, diff15;
1663  int32_t angle, angle_loop, inv_angle_val, offset;
1664  uint8_t ref_array[3 * 32 + 4];
1665  uint8_t *ref_tmp = ref_array + 32;
1666  const uint8_t *ref, *src_top_tmp = src_top - 1;
1667  uint8_t *dst_org;
1668  int32_t last;
1669 
1670  angle = intra_pred_angle_low[mode - 2];
1671  last = angle;
1672  angle_loop = angle;
1673 
1674  ref = src_left - 1;
1675  if (last < -1) {
1676  inv_angle_val = inv_angle[mode - 11];
1677 
1678  LD_SB2(ref, 16, top0, top1);
1679  tmp0 = LW(ref + 32);
1680  ST_SB2(top0, top1, ref_tmp, 16);
1681  SW(tmp0, ref_tmp + 32);
1682 
1683  for (h_cnt = last; h_cnt <= -1; h_cnt++) {
1684  offset = (h_cnt * inv_angle_val + 128) >> 8;
1685  ref_tmp[h_cnt] = src_top_tmp[offset];
1686  }
1687 
1688  ref = ref_tmp;
1689  }
1690 
1691  for (v_cnt = 0; v_cnt < 16; v_cnt++) {
1692  dst_org = dst;
1693  idx0 = angle_loop >> 5;
1694  fact_val0 = angle_loop & 31;
1695  angle_loop += angle;
1696 
1697  idx1 = angle_loop >> 5;
1698  fact_val1 = angle_loop & 31;
1699  angle_loop += angle;
1700 
1701  top0 = LD_SB(ref + idx0 + 1);
1702  top4 = LD_SB(ref + idx1 + 1);
1703  top1 = LD_SB(ref + idx0 + 17);
1704  top5 = LD_SB(ref + idx1 + 17);
1705  top3 = LD_SB(ref + idx0 + 33);
1706  top7 = LD_SB(ref + idx1 + 33);
1707 
1708  fact0 = __msa_fill_h(fact_val0);
1709  fact1 = __msa_fill_h(32 - fact_val0);
1710  fact2 = __msa_fill_h(fact_val1);
1711  fact3 = __msa_fill_h(32 - fact_val1);
1712 
1713  top2 = top1;
1714  top6 = top5;
1715 
1716  SLDI_B2_SB(top1, top3, top0, top2, top1, top3, 1);
1717  SLDI_B2_SB(top5, top7, top4, top6, top5, top7, 1);
1718 
1719  UNPCK_UB_SH(top0, diff0, diff1);
1720  UNPCK_UB_SH(top1, diff2, diff3);
1721  UNPCK_UB_SH(top2, diff4, diff5);
1722  UNPCK_UB_SH(top3, diff6, diff7);
1723  UNPCK_UB_SH(top4, diff8, diff9);
1724  UNPCK_UB_SH(top5, diff10, diff11);
1725  UNPCK_UB_SH(top6, diff12, diff13);
1726  UNPCK_UB_SH(top7, diff14, diff15);
1727 
1728  MUL4(diff2, fact0, diff3, fact0, diff6, fact0, diff7, fact0,
1729  diff2, diff3, diff6, diff7);
1730  MUL4(diff10, fact2, diff11, fact2, diff14, fact2, diff15, fact2,
1731  diff10, diff11, diff14, diff15);
1732 
1733  diff2 += diff0 * fact1;
1734  diff3 += diff1 * fact1;
1735  diff6 += diff4 * fact1;
1736  diff7 += diff5 * fact1;
1737  diff10 += diff8 * fact3;
1738  diff11 += diff9 * fact3;
1739  diff14 += diff12 * fact3;
1740  diff15 += diff13 * fact3;
1741 
1742  SRARI_H4_SH(diff2, diff3, diff6, diff7, 5);
1743  SRARI_H4_SH(diff10, diff11, diff14, diff15, 5);
1744  PCKEV_B4_SB(diff3, diff2, diff7, diff6, diff11, diff10, diff15, diff14,
1745  dst_val0, dst_val1, dst_val2, dst_val3);
1746  ILVRL_B2_SH(dst_val2, dst_val0, diff0, diff1);
1747  ILVRL_B2_SH(dst_val3, dst_val1, diff2, diff3);
1748 
1749  ST2x4_UB(diff0, 0, dst_org, stride);
1750  dst_org += (4 * stride);
1751  ST2x4_UB(diff0, 4, dst_org, stride);
1752  dst_org += (4 * stride);
1753  ST2x4_UB(diff1, 0, dst_org, stride);
1754  dst_org += (4 * stride);
1755  ST2x4_UB(diff1, 4, dst_org, stride);
1756  dst_org += (4 * stride);
1757 
1758  ST2x4_UB(diff2, 0, dst_org, stride);
1759  dst_org += (4 * stride);
1760  ST2x4_UB(diff2, 4, dst_org, stride);
1761  dst_org += (4 * stride);
1762  ST2x4_UB(diff3, 0, dst_org, stride);
1763  dst_org += (4 * stride);
1764  ST2x4_UB(diff3, 4, dst_org, stride);
1765  dst_org += (4 * stride);
1766 
1767  dst += 2;
1768  }
1769 }
1770 
1772  int32_t dst_stride)
1773 {
1774  uint32_t row;
1775  v16u8 src1, src2;
1776 
1777  src1 = LD_UB(src);
1778  src2 = LD_UB(src + 16);
1779 
1780  for (row = 32; row--;) {
1781  ST_UB2(src1, src2, dst, 16);
1782  dst += dst_stride;
1783  }
1784 }
1785 
1787  const uint8_t *src_top,
1788  const uint8_t *src_left,
1789  ptrdiff_t stride)
1790 {
1791  hevc_intra_pred_plane_4x4_msa(src_top, src_left, dst, stride);
1792 }
1793 
1795  const uint8_t *src_top,
1796  const uint8_t *src_left,
1797  ptrdiff_t stride)
1798 {
1799  hevc_intra_pred_plane_8x8_msa(src_top, src_left, dst, stride);
1800 }
1801 
1803  const uint8_t *src_top,
1804  const uint8_t *src_left,
1805  ptrdiff_t stride)
1806 {
1807  hevc_intra_pred_plane_16x16_msa(src_top, src_left, dst, stride);
1808 }
1809 
1811  const uint8_t *src_top,
1812  const uint8_t *src_left,
1813  ptrdiff_t stride)
1814 {
1815  hevc_intra_pred_plane_32x32_msa(src_top, src_left, dst, stride);
1816 }
1817 
1818 void ff_hevc_intra_pred_dc_msa(uint8_t *dst, const uint8_t *src_top,
1819  const uint8_t *src_left,
1820  ptrdiff_t stride, int log2, int c_idx)
1821 {
1822  switch (log2) {
1823  case 2:
1824  hevc_intra_pred_dc_4x4_msa(src_top, src_left, dst, stride, c_idx);
1825  break;
1826 
1827  case 3:
1828  hevc_intra_pred_dc_8x8_msa(src_top, src_left, dst, stride, c_idx);
1829  break;
1830 
1831  case 4:
1832  hevc_intra_pred_dc_16x16_msa(src_top, src_left, dst, stride, c_idx);
1833  break;
1834 
1835  case 5:
1836  hevc_intra_pred_dc_32x32_msa(src_top, src_left, dst, stride);
1837  break;
1838  }
1839 }
1840 
1842  const uint8_t *src_top,
1843  const uint8_t *src_left,
1844  ptrdiff_t stride, int c_idx, int mode)
1845 {
1846  if (mode == 10) {
1847  hevc_intra_pred_horiz_4x4_msa(src_top, src_left, dst, stride, c_idx);
1848  } else if (mode == 26) {
1849  hevc_intra_pred_vert_4x4_msa(src_top, src_left, dst, stride, c_idx);
1850  } else if (mode >= 18) {
1851  hevc_intra_pred_angular_upper_4width_msa(src_top, src_left,
1852  dst, stride, mode);
1853  } else {
1854  hevc_intra_pred_angular_lower_4width_msa(src_top, src_left,
1855  dst, stride, mode);
1856  }
1857 }
1858 
1860  const uint8_t *src_top,
1861  const uint8_t *src_left,
1862  ptrdiff_t stride, int c_idx, int mode)
1863 {
1864  if (mode == 10) {
1865  hevc_intra_pred_horiz_8x8_msa(src_top, src_left, dst, stride, c_idx);
1866  } else if (mode == 26) {
1867  hevc_intra_pred_vert_8x8_msa(src_top, src_left, dst, stride, c_idx);
1868  } else if (mode >= 18) {
1869  hevc_intra_pred_angular_upper_8width_msa(src_top, src_left,
1870  dst, stride, mode);
1871  } else {
1872  hevc_intra_pred_angular_lower_8width_msa(src_top, src_left,
1873  dst, stride, mode);
1874  }
1875 }
1876 
1878  const uint8_t *src_top,
1879  const uint8_t *src_left,
1880  ptrdiff_t stride, int c_idx, int mode)
1881 {
1882  if (mode == 10) {
1883  hevc_intra_pred_horiz_16x16_msa(src_top, src_left, dst, stride, c_idx);
1884  } else if (mode == 26) {
1885  hevc_intra_pred_vert_16x16_msa(src_top, src_left, dst, stride, c_idx);
1886  } else if (mode >= 18) {
1888  dst, stride, mode);
1889  } else {
1891  dst, stride, mode);
1892  }
1893 }
1894 
1896  const uint8_t *src_top,
1897  const uint8_t *src_left,
1898  ptrdiff_t stride, int c_idx, int mode)
1899 {
1900  if (mode == 10) {
1901  hevc_intra_pred_horiz_32x32_msa(src_top, src_left, dst, stride);
1902  } else if (mode == 26) {
1903  intra_predict_vert_32x32_msa(src_top, dst, stride);
1904  } else if (mode >= 18) {
1906  dst, stride, mode);
1907  } else {
1909  dst, stride, mode);
1910  }
1911 }
1912 
1913 void ff_intra_pred_8_16x16_msa(HEVCContext *s, int x0, int y0, int c_idx)
1914 {
1915  v16u8 vec0;
1916  HEVCLocalContext *lc = s->HEVClc;
1917  int i;
1918  int hshift = s->ps.sps->hshift[c_idx];
1919  int vshift = s->ps.sps->vshift[c_idx];
1920  int size_in_luma_h = 16 << hshift;
1921  int size_in_tbs_h = size_in_luma_h >> s->ps.sps->log2_min_tb_size;
1922  int size_in_luma_v = 16 << vshift;
1923  int size_in_tbs_v = size_in_luma_v >> s->ps.sps->log2_min_tb_size;
1924  int x = x0 >> hshift;
1925  int y = y0 >> vshift;
1926  int x_tb = (x0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
1927  int y_tb = (y0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
1928 
1929  int cur_tb_addr =
1930  s->ps.pps->min_tb_addr_zs[(y_tb) * (s->ps.sps->tb_mask + 2) + (x_tb)];
1931 
1932  ptrdiff_t stride = s->frame->linesize[c_idx] / sizeof(uint8_t);
1933  uint8_t *src = (uint8_t *) s->frame->data[c_idx] + x + y * stride;
1934 
1935  int min_pu_width = s->ps.sps->min_pu_width;
1936 
1937  enum IntraPredMode mode = c_idx ? lc->tu.intra_pred_mode_c :
1938  lc->tu.intra_pred_mode;
1939  uint32_t a;
1940  uint8_t left_array[2 * 32 + 1];
1941  uint8_t filtered_left_array[2 * 32 + 1];
1942  uint8_t top_array[2 * 32 + 1];
1943  uint8_t filtered_top_array[2 * 32 + 1];
1944 
1945  uint8_t *left = left_array + 1;
1946  uint8_t *top = top_array + 1;
1947  uint8_t *filtered_left = filtered_left_array + 1;
1948  uint8_t *filtered_top = filtered_top_array + 1;
1949  int cand_bottom_left = lc->na.cand_bottom_left
1950  && cur_tb_addr >
1951  s->ps.pps->min_tb_addr_zs[((y_tb + size_in_tbs_v) & s->ps.sps->tb_mask) *
1952  (s->ps.sps->tb_mask + 2) + (x_tb - 1)];
1953  int cand_left = lc->na.cand_left;
1954  int cand_up_left = lc->na.cand_up_left;
1955  int cand_up = lc->na.cand_up;
1956  int cand_up_right = lc->na.cand_up_right
1957  && cur_tb_addr >
1958  s->ps.pps->min_tb_addr_zs[(y_tb - 1) * (s->ps.sps->tb_mask + 2) +
1959  ((x_tb + size_in_tbs_h) & s->ps.sps->tb_mask)];
1960 
1961  int bottom_left_size =
1962  (((y0 + 2 * size_in_luma_v) >
1963  (s->ps.sps->height) ? (s->ps.sps->height) : (y0 +
1964  2 * size_in_luma_v)) -
1965  (y0 + size_in_luma_v)) >> vshift;
1966  int top_right_size =
1967  (((x0 + 2 * size_in_luma_h) >
1968  (s->ps.sps->width) ? (s->ps.sps->width) : (x0 + 2 * size_in_luma_h)) -
1969  (x0 + size_in_luma_h)) >> hshift;
1970 
1971  if (s->ps.pps->constrained_intra_pred_flag == 1) {
1972  int size_in_luma_pu_v = ((size_in_luma_v) >> s->ps.sps->log2_min_pu_size);
1973  int size_in_luma_pu_h = ((size_in_luma_h) >> s->ps.sps->log2_min_pu_size);
1974  int on_pu_edge_x = !(x0 & ((1 << s->ps.sps->log2_min_pu_size) - 1));
1975  int on_pu_edge_y = !(y0 & ((1 << s->ps.sps->log2_min_pu_size) - 1));
1976  if (!size_in_luma_pu_h)
1977  size_in_luma_pu_h++;
1978  if (cand_bottom_left == 1 && on_pu_edge_x) {
1979  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
1980  int y_bottom_pu =
1981  ((y0 + size_in_luma_v) >> s->ps.sps->log2_min_pu_size);
1982  int max =
1983  ((size_in_luma_pu_v) >
1984  (s->ps.sps->min_pu_height -
1985  y_bottom_pu) ? (s->ps.sps->min_pu_height -
1986  y_bottom_pu) : (size_in_luma_pu_v));
1987  cand_bottom_left = 0;
1988  for (i = 0; i < max; i += 2)
1989  cand_bottom_left |=
1990  ((s->ref->tab_mvf[(x_left_pu) +
1991  (y_bottom_pu +
1992  i) * min_pu_width]).pred_flag ==
1993  PF_INTRA);
1994  }
1995  if (cand_left == 1 && on_pu_edge_x) {
1996  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
1997  int y_left_pu = ((y0) >> s->ps.sps->log2_min_pu_size);
1998  int max =
1999  ((size_in_luma_pu_v) >
2000  (s->ps.sps->min_pu_height -
2001  y_left_pu) ? (s->ps.sps->min_pu_height -
2002  y_left_pu) : (size_in_luma_pu_v));
2003  cand_left = 0;
2004  for (i = 0; i < max; i += 2)
2005  cand_left |=
2006  ((s->ref->tab_mvf[(x_left_pu) +
2007  (y_left_pu +
2008  i) * min_pu_width]).pred_flag ==
2009  PF_INTRA);
2010  }
2011  if (cand_up_left == 1) {
2012  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
2013  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2014  cand_up_left =
2015  (s->ref->tab_mvf[(x_left_pu) +
2016  (y_top_pu) * min_pu_width]).pred_flag ==
2017  PF_INTRA;
2018  }
2019  if (cand_up == 1 && on_pu_edge_y) {
2020  int x_top_pu = ((x0) >> s->ps.sps->log2_min_pu_size);
2021  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2022  int max =
2023  ((size_in_luma_pu_h) >
2024  (s->ps.sps->min_pu_width -
2025  x_top_pu) ? (s->ps.sps->min_pu_width -
2026  x_top_pu) : (size_in_luma_pu_h));
2027  cand_up = 0;
2028  for (i = 0; i < max; i += 2)
2029  cand_up |=
2030  ((s->ref->tab_mvf[(x_top_pu + i) +
2031  (y_top_pu) *
2032  min_pu_width]).pred_flag == PF_INTRA);
2033  }
2034  if (cand_up_right == 1 && on_pu_edge_y) {
2035  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2036  int x_right_pu =
2037  ((x0 + size_in_luma_h) >> s->ps.sps->log2_min_pu_size);
2038  int max =
2039  ((size_in_luma_pu_h) >
2040  (s->ps.sps->min_pu_width -
2041  x_right_pu) ? (s->ps.sps->min_pu_width -
2042  x_right_pu) : (size_in_luma_pu_h));
2043  cand_up_right = 0;
2044  for (i = 0; i < max; i += 2)
2045  cand_up_right |=
2046  ((s->ref->tab_mvf[(x_right_pu + i) +
2047  (y_top_pu) *
2048  min_pu_width]).pred_flag == PF_INTRA);
2049  }
2050 
2051  vec0 = (v16u8) __msa_ldi_b(128);
2052 
2053  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2054 
2055  ST_UB4(vec0, vec0, vec0, vec0, top, 16);
2056 
2057  top[-1] = 128;
2058  }
2059  if (cand_up_left) {
2060  left[-1] = src[(-1) + stride * (-1)];
2061  top[-1] = left[-1];
2062  }
2063  if (cand_up) {
2064  vec0 = LD_UB(src - stride);
2065  ST_UB(vec0, top);
2066  }
2067  if (cand_up_right) {
2068  vec0 = LD_UB(src - stride + 16);
2069  ST_UB(vec0, (top + 16));
2070 
2071  do {
2072  uint32_t pix =
2073  ((src[(16 + top_right_size - 1) + stride * (-1)]) *
2074  0x01010101U);
2075  for (i = 0; i < (16 - top_right_size); i += 4)
2076  ((((union unaligned_32 *) (top + 16 + top_right_size +
2077  i))->l) = (pix));
2078  } while (0);
2079  }
2080  if (cand_left)
2081  for (i = 0; i < 16; i++)
2082  left[i] = src[(-1) + stride * (i)];
2083  if (cand_bottom_left) {
2084  for (i = 16; i < 16 + bottom_left_size; i++)
2085  left[i] = src[(-1) + stride * (i)];
2086  do {
2087  uint32_t pix =
2088  ((src[(-1) + stride * (16 + bottom_left_size - 1)]) *
2089  0x01010101U);
2090  for (i = 0; i < (16 - bottom_left_size); i += 4)
2091  ((((union unaligned_32 *) (left + 16 + bottom_left_size +
2092  i))->l) = (pix));
2093  } while (0);
2094  }
2095 
2096  if (s->ps.pps->constrained_intra_pred_flag == 1) {
2097  if (cand_bottom_left || cand_left || cand_up_left || cand_up
2098  || cand_up_right) {
2099  int size_max_x =
2100  x0 + ((2 * 16) << hshift) <
2101  s->ps.sps->width ? 2 * 16 : (s->ps.sps->width - x0) >> hshift;
2102  int size_max_y =
2103  y0 + ((2 * 16) << vshift) <
2104  s->ps.sps->height ? 2 * 16 : (s->ps.sps->height - y0) >> vshift;
2105  int j = 16 + (cand_bottom_left ? bottom_left_size : 0) - 1;
2106  if (!cand_up_right) {
2107  size_max_x = x0 + ((16) << hshift) < s->ps.sps->width ?
2108  16 : (s->ps.sps->width - x0) >> hshift;
2109  }
2110  if (!cand_bottom_left) {
2111  size_max_y = y0 + ((16) << vshift) < s->ps.sps->height ?
2112  16 : (s->ps.sps->height - y0) >> vshift;
2113  }
2114  if (cand_bottom_left || cand_left || cand_up_left) {
2115  while (j > -1
2116  &&
2117  !((s->ref->tab_mvf[(((x0 +
2118  ((-1) << hshift)) >> s->ps.sps->
2119  log2_min_pu_size)) + (((y0 +
2120  ((j) <<
2121  vshift))
2122  >> s->ps.sps->
2123  log2_min_pu_size))
2124  * min_pu_width]).pred_flag ==
2125  PF_INTRA))
2126  j--;
2127  if (!
2128  ((s->ref->tab_mvf[(((x0 +
2129  ((-1) << hshift)) >> s->ps.sps->
2130  log2_min_pu_size)) + (((y0 + ((j)
2131  <<
2132  vshift))
2133  >> s->ps.sps->
2134  log2_min_pu_size))
2135  * min_pu_width]).pred_flag == PF_INTRA)) {
2136  j = 0;
2137  while (j < size_max_x
2138  &&
2139  !((s->ref->tab_mvf[(((x0 +
2140  ((j) << hshift)) >> s->ps.sps->
2141  log2_min_pu_size)) + (((y0 +
2142  ((-1) <<
2143  vshift))
2144  >> s->
2145  ps.sps->
2146  log2_min_pu_size))
2147  * min_pu_width]).pred_flag ==
2148  PF_INTRA))
2149  j++;
2150  for (i = j; i > (j) - (j + 1); i--)
2151  if (!
2152  ((s->ref->tab_mvf[(((x0 +
2153  ((i -
2154  1) << hshift)) >> s->ps.sps->
2155  log2_min_pu_size)) + (((y0 +
2156  ((-1) <<
2157  vshift))
2158  >> s->
2159  ps.sps->
2160  log2_min_pu_size))
2161  * min_pu_width]).pred_flag ==
2162  PF_INTRA))
2163  top[i - 1] = top[i];
2164  left[-1] = top[-1];
2165  }
2166  } else {
2167  j = 0;
2168  while (j < size_max_x
2169  &&
2170  !((s->ref->tab_mvf[(((x0 +
2171  ((j) << hshift)) >> s->ps.sps->
2172  log2_min_pu_size)) + (((y0 + ((-1)
2173  <<
2174  vshift))
2175  >> s->ps.sps->
2176  log2_min_pu_size))
2177  * min_pu_width]).pred_flag ==
2178  PF_INTRA))
2179  j++;
2180  if (j > 0)
2181  if (x0 > 0) {
2182  for (i = j; i > (j) - (j + 1); i--)
2183  if (!
2184  ((s->ref->tab_mvf[(((x0 +
2185  ((i -
2186  1) << hshift)) >>
2187  s->ps.sps->log2_min_pu_size))
2188  + (((y0 + ((-1)
2189  << vshift))
2190  >>
2191  s->ps.sps->log2_min_pu_size))
2192  *
2193  min_pu_width]).pred_flag ==
2194  PF_INTRA))
2195  top[i - 1] = top[i];
2196  } else {
2197  for (i = j; i > (j) - (j); i--)
2198  if (!
2199  ((s->ref->tab_mvf[(((x0 +
2200  ((i -
2201  1) << hshift)) >>
2202  s->ps.sps->log2_min_pu_size))
2203  + (((y0 + ((-1)
2204  << vshift))
2205  >>
2206  s->ps.sps->log2_min_pu_size))
2207  *
2208  min_pu_width]).pred_flag ==
2209  PF_INTRA))
2210  top[i - 1] = top[i];
2211  top[-1] = top[0];
2212  }
2213  left[-1] = top[-1];
2214  }
2215  left[-1] = top[-1];
2216  if (cand_bottom_left || cand_left) {
2217  a = ((left[-1]) * 0x01010101U);
2218  for (i = 0; i < (0) + (size_max_y); i += 4)
2219  if (!
2220  ((s->ref->tab_mvf[(((x0 +
2221  ((-1) << hshift)) >> s->ps.sps->
2222  log2_min_pu_size)) + (((y0 +
2223  ((i) <<
2224  vshift))
2225  >> s->ps.sps->
2226  log2_min_pu_size))
2227  * min_pu_width]).pred_flag ==
2228  PF_INTRA))
2229  ((((union unaligned_32 *) (&left[i]))->l) = (a));
2230  else
2231  a = ((left[i + 3]) * 0x01010101U);
2232  }
2233  if (!cand_left) {
2234  vec0 = (v16u8) __msa_fill_b(left[-1]);
2235 
2236  ST_UB(vec0, left);
2237  }
2238  if (!cand_bottom_left) {
2239 
2240  vec0 = (v16u8) __msa_fill_b(left[15]);
2241 
2242  ST_UB(vec0, (left + 16));
2243  }
2244  if (x0 != 0 && y0 != 0) {
2245  a = ((left[size_max_y - 1]) * 0x01010101U);
2246  for (i = (size_max_y - 1);
2247  i > (size_max_y - 1) - (size_max_y); i -= 4)
2248  if (!
2249  ((s->ref->tab_mvf[(((x0 +
2250  ((-1) << hshift)) >> s->ps.sps->
2251  log2_min_pu_size)) + (((y0 +
2252  ((i -
2253  3) <<
2254  vshift))
2255  >> s->ps.sps->
2256  log2_min_pu_size))
2257  * min_pu_width]).pred_flag ==
2258  PF_INTRA))
2259  ((((union unaligned_32 *) (&left[i - 3]))->l) = (a));
2260  else
2261  a = ((left[i - 3]) * 0x01010101U);
2262  if (!
2263  ((s->ref->tab_mvf[(((x0 +
2264  ((-1) << hshift)) >> s->ps.sps->
2265  log2_min_pu_size)) + (((y0 + ((-1)
2266  <<
2267  vshift))
2268  >> s->ps.sps->
2269  log2_min_pu_size))
2270  * min_pu_width]).pred_flag == PF_INTRA))
2271  left[-1] = left[0];
2272  } else if (x0 == 0) {
2273  do {
2274  uint32_t pix = ((0) * 0x01010101U);
2275  for (i = 0; i < (size_max_y); i += 4)
2276  ((((union unaligned_32 *) (left + i))->l) = (pix));
2277  } while (0);
2278  } else {
2279  a = ((left[size_max_y - 1]) * 0x01010101U);
2280  for (i = (size_max_y - 1);
2281  i > (size_max_y - 1) - (size_max_y); i -= 4)
2282  if (!
2283  ((s->ref->tab_mvf[(((x0 +
2284  ((-1) << hshift)) >> s->ps.sps->
2285  log2_min_pu_size)) + (((y0 +
2286  ((i -
2287  3) <<
2288  vshift))
2289  >> s->ps.sps->
2290  log2_min_pu_size))
2291  * min_pu_width]).pred_flag ==
2292  PF_INTRA))
2293  ((((union unaligned_32 *) (&left[i - 3]))->l) = (a));
2294  else
2295  a = ((left[i - 3]) * 0x01010101U);
2296  }
2297  top[-1] = left[-1];
2298  if (y0 != 0) {
2299  a = ((left[-1]) * 0x01010101U);
2300  for (i = 0; i < (0) + (size_max_x); i += 4)
2301  if (!
2302  ((s->ref->tab_mvf[(((x0 +
2303  ((i) << hshift)) >> s->ps.sps->
2304  log2_min_pu_size)) + (((y0 + ((-1)
2305  <<
2306  vshift))
2307  >> s->ps.sps->
2308  log2_min_pu_size))
2309  * min_pu_width]).pred_flag ==
2310  PF_INTRA))
2311  ((((union unaligned_32 *) (&top[i]))->l) = (a));
2312  else
2313  a = ((top[i + 3]) * 0x01010101U);
2314  }
2315  }
2316  }
2317 
2318  if (!cand_bottom_left) {
2319  if (cand_left) {
2320  vec0 = (v16u8) __msa_fill_b(left[15]);
2321 
2322  ST_UB(vec0, (left + 16));
2323 
2324  } else if (cand_up_left) {
2325  vec0 = (v16u8) __msa_fill_b(left[-1]);
2326 
2327  ST_UB2(vec0, vec0, left, 16);
2328 
2329  cand_left = 1;
2330  } else if (cand_up) {
2331  left[-1] = top[0];
2332 
2333  vec0 = (v16u8) __msa_fill_b(left[-1]);
2334 
2335  ST_UB2(vec0, vec0, left, 16);
2336 
2337  cand_up_left = 1;
2338  cand_left = 1;
2339  } else if (cand_up_right) {
2340  vec0 = (v16u8) __msa_fill_b(top[16]);
2341 
2342  ST_UB(vec0, top);
2343 
2344  left[-1] = top[16];
2345 
2346  ST_UB2(vec0, vec0, left, 16);
2347 
2348  cand_up = 1;
2349  cand_up_left = 1;
2350  cand_left = 1;
2351  } else {
2352  left[-1] = 128;
2353  vec0 = (v16u8) __msa_ldi_b(128);
2354 
2355  ST_UB2(vec0, vec0, top, 16);
2356  ST_UB2(vec0, vec0, left, 16);
2357  }
2358  }
2359 
2360  if (!cand_left) {
2361  vec0 = (v16u8) __msa_fill_b(left[16]);
2362  ST_UB(vec0, left);
2363  }
2364  if (!cand_up_left) {
2365  left[-1] = left[0];
2366  }
2367  if (!cand_up) {
2368  vec0 = (v16u8) __msa_fill_b(left[-1]);
2369  ST_UB(vec0, top);
2370  }
2371  if (!cand_up_right) {
2372  vec0 = (v16u8) __msa_fill_b(top[15]);
2373  ST_UB(vec0, (top + 16));
2374  }
2375 
2376  top[-1] = left[-1];
2377 
2378 
2380  && (c_idx == 0 || s->ps.sps->chroma_format_idc == 3)) {
2381  if (mode != INTRA_DC && 16 != 4) {
2382  int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
2383  int min_dist_vert_hor =
2384  (((((int) (mode - 26U)) >=
2385  0 ? ((int) (mode - 26U)) : (-((int) (mode - 26U))))) >
2386  ((((int) (mode - 10U)) >=
2387  0 ? ((int) (mode - 10U)) : (-((int) (mode - 10U)))))
2388  ? ((((int) (mode - 10U)) >=
2389  0 ? ((int) (mode - 10U)) : (-((int) (mode - 10U)))))
2390  : ((((int) (mode - 26U)) >=
2391  0 ? ((int) (mode - 26U)) : (-((int) (mode - 26U))))));
2392  if (min_dist_vert_hor > intra_hor_ver_dist_thresh[4 - 3]) {
2393  filtered_left[2 * 16 - 1] = left[2 * 16 - 1];
2394  filtered_top[2 * 16 - 1] = top[2 * 16 - 1];
2395  for (i = 2 * 16 - 2; i >= 0; i--)
2396  filtered_left[i] = (left[i + 1] + 2 * left[i] +
2397  left[i - 1] + 2) >> 2;
2398  filtered_top[-1] =
2399  filtered_left[-1] =
2400  (left[0] + 2 * left[-1] + top[0] + 2) >> 2;
2401  for (i = 2 * 16 - 2; i >= 0; i--)
2402  filtered_top[i] = (top[i + 1] + 2 * top[i] +
2403  top[i - 1] + 2) >> 2;
2404  left = filtered_left;
2405  top = filtered_top;
2406  }
2407  }
2408  }
2409 
2410  switch (mode) {
2411  case INTRA_PLANAR:
2412  s->hpc.pred_planar[4 - 2] ((uint8_t *) src, (uint8_t *) top,
2413  (uint8_t *) left, stride);
2414  break;
2415  case INTRA_DC:
2416  s->hpc.pred_dc((uint8_t *) src, (uint8_t *) top,
2417  (uint8_t *) left, stride, 4, c_idx);
2418  break;
2419  default:
2420  s->hpc.pred_angular[4 - 2] ((uint8_t *) src, (uint8_t *) top,
2421  (uint8_t *) left, stride, c_idx, mode);
2422  break;
2423  }
2424 }
2425 
2426 void ff_intra_pred_8_32x32_msa(HEVCContext *s, int x0, int y0, int c_idx)
2427 {
2428  v16u8 vec0, vec1;
2429  v8i16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
2430  v8i16 res0, res1, res2, res3;
2431  v8i16 mul_val0 = { 63, 62, 61, 60, 59, 58, 57, 56 };
2432  v8i16 mul_val1 = { 1, 2, 3, 4, 5, 6, 7, 8 };
2433  HEVCLocalContext *lc = s->HEVClc;
2434  int i;
2435  int hshift = s->ps.sps->hshift[c_idx];
2436  int vshift = s->ps.sps->vshift[c_idx];
2437  int size_in_luma_h = 32 << hshift;
2438  int size_in_tbs_h = size_in_luma_h >> s->ps.sps->log2_min_tb_size;
2439  int size_in_luma_v = 32 << vshift;
2440  int size_in_tbs_v = size_in_luma_v >> s->ps.sps->log2_min_tb_size;
2441  int x = x0 >> hshift;
2442  int y = y0 >> vshift;
2443  int x_tb = (x0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
2444  int y_tb = (y0 >> s->ps.sps->log2_min_tb_size) & s->ps.sps->tb_mask;
2445 
2446  int cur_tb_addr =
2447  s->ps.pps->min_tb_addr_zs[(y_tb) * (s->ps.sps->tb_mask + 2) + (x_tb)];
2448 
2449  ptrdiff_t stride = s->frame->linesize[c_idx] / sizeof(uint8_t);
2450  uint8_t *src = (uint8_t *) s->frame->data[c_idx] + x + y * stride;
2451 
2452  int min_pu_width = s->ps.sps->min_pu_width;
2453 
2454  enum IntraPredMode mode = c_idx ? lc->tu.intra_pred_mode_c :
2455  lc->tu.intra_pred_mode;
2456  uint32_t a;
2457  uint8_t left_array[2 * 32 + 1];
2458  uint8_t filtered_left_array[2 * 32 + 1];
2459  uint8_t top_array[2 * 32 + 1];
2460  uint8_t filtered_top_array[2 * 32 + 1];
2461 
2462  uint8_t *left = left_array + 1;
2463  uint8_t *top = top_array + 1;
2464  uint8_t *filtered_left = filtered_left_array + 1;
2465  uint8_t *filtered_top = filtered_top_array + 1;
2466  int cand_bottom_left = lc->na.cand_bottom_left
2467  && cur_tb_addr >
2468  s->ps.pps->min_tb_addr_zs[((y_tb + size_in_tbs_v) & s->ps.sps->tb_mask) *
2469  (s->ps.sps->tb_mask + 2) + (x_tb - 1)];
2470  int cand_left = lc->na.cand_left;
2471  int cand_up_left = lc->na.cand_up_left;
2472  int cand_up = lc->na.cand_up;
2473  int cand_up_right = lc->na.cand_up_right
2474  && cur_tb_addr >
2475  s->ps.pps->min_tb_addr_zs[(y_tb - 1) * (s->ps.sps->tb_mask + 2) +
2476  ((x_tb + size_in_tbs_h) & s->ps.sps->tb_mask)];
2477 
2478  int bottom_left_size =
2479  (((y0 + 2 * size_in_luma_v) >
2480  (s->ps.sps->height) ? (s->ps.sps->height) : (y0 +
2481  2 * size_in_luma_v)) -
2482  (y0 + size_in_luma_v)) >> vshift;
2483  int top_right_size =
2484  (((x0 + 2 * size_in_luma_h) >
2485  (s->ps.sps->width) ? (s->ps.sps->width) : (x0 + 2 * size_in_luma_h)) -
2486  (x0 + size_in_luma_h)) >> hshift;
2487 
2488  if (s->ps.pps->constrained_intra_pred_flag == 1) {
2489  int size_in_luma_pu_v = ((size_in_luma_v) >> s->ps.sps->log2_min_pu_size);
2490  int size_in_luma_pu_h = ((size_in_luma_h) >> s->ps.sps->log2_min_pu_size);
2491  int on_pu_edge_x = !(x0 & ((1 << s->ps.sps->log2_min_pu_size) - 1));
2492  int on_pu_edge_y = !(y0 & ((1 << s->ps.sps->log2_min_pu_size) - 1));
2493  if (!size_in_luma_pu_h)
2494  size_in_luma_pu_h++;
2495  if (cand_bottom_left == 1 && on_pu_edge_x) {
2496  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
2497  int y_bottom_pu =
2498  ((y0 + size_in_luma_v) >> s->ps.sps->log2_min_pu_size);
2499  int max =
2500  ((size_in_luma_pu_v) >
2501  (s->ps.sps->min_pu_height -
2502  y_bottom_pu) ? (s->ps.sps->min_pu_height -
2503  y_bottom_pu) : (size_in_luma_pu_v));
2504  cand_bottom_left = 0;
2505  for (i = 0; i < max; i += 2)
2506  cand_bottom_left |=
2507  ((s->ref->tab_mvf[(x_left_pu) +
2508  (y_bottom_pu +
2509  i) * min_pu_width]).pred_flag ==
2510  PF_INTRA);
2511  }
2512  if (cand_left == 1 && on_pu_edge_x) {
2513  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
2514  int y_left_pu = ((y0) >> s->ps.sps->log2_min_pu_size);
2515  int max =
2516  ((size_in_luma_pu_v) >
2517  (s->ps.sps->min_pu_height -
2518  y_left_pu) ? (s->ps.sps->min_pu_height -
2519  y_left_pu) : (size_in_luma_pu_v));
2520  cand_left = 0;
2521  for (i = 0; i < max; i += 2)
2522  cand_left |=
2523  ((s->ref->tab_mvf[(x_left_pu) +
2524  (y_left_pu +
2525  i) * min_pu_width]).pred_flag ==
2526  PF_INTRA);
2527  }
2528  if (cand_up_left == 1) {
2529  int x_left_pu = ((x0 - 1) >> s->ps.sps->log2_min_pu_size);
2530  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2531  cand_up_left =
2532  (s->ref->tab_mvf[(x_left_pu) +
2533  (y_top_pu) * min_pu_width]).pred_flag ==
2534  PF_INTRA;
2535  }
2536  if (cand_up == 1 && on_pu_edge_y) {
2537  int x_top_pu = ((x0) >> s->ps.sps->log2_min_pu_size);
2538  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2539  int max =
2540  ((size_in_luma_pu_h) >
2541  (s->ps.sps->min_pu_width -
2542  x_top_pu) ? (s->ps.sps->min_pu_width -
2543  x_top_pu) : (size_in_luma_pu_h));
2544  cand_up = 0;
2545  for (i = 0; i < max; i += 2)
2546  cand_up |=
2547  ((s->ref->tab_mvf[(x_top_pu + i) +
2548  (y_top_pu) *
2549  min_pu_width]).pred_flag == PF_INTRA);
2550  }
2551  if (cand_up_right == 1 && on_pu_edge_y) {
2552  int y_top_pu = ((y0 - 1) >> s->ps.sps->log2_min_pu_size);
2553  int x_right_pu =
2554  ((x0 + size_in_luma_h) >> s->ps.sps->log2_min_pu_size);
2555  int max =
2556  ((size_in_luma_pu_h) >
2557  (s->ps.sps->min_pu_width -
2558  x_right_pu) ? (s->ps.sps->min_pu_width -
2559  x_right_pu) : (size_in_luma_pu_h));
2560  cand_up_right = 0;
2561  for (i = 0; i < max; i += 2)
2562  cand_up_right |=
2563  ((s->ref->tab_mvf[(x_right_pu + i) +
2564  (y_top_pu) *
2565  min_pu_width]).pred_flag == PF_INTRA);
2566  }
2567  vec0 = (v16u8) __msa_ldi_b(128);
2568 
2569  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2570  ST_UB4(vec0, vec0, vec0, vec0, top, 16);
2571 
2572  top[-1] = 128;
2573  }
2574  if (cand_up_left) {
2575  left[-1] = src[(-1) + stride * (-1)];
2576  top[-1] = left[-1];
2577  }
2578  if (cand_up) {
2579  LD_UB2(src - stride, 16, vec0, vec1);
2580  ST_UB2(vec0, vec1, top, 16);
2581  }
2582 
2583  if (cand_up_right) {
2584  LD_UB2(src - stride + 32, 16, vec0, vec1);
2585  ST_UB2(vec0, vec1, (top + 32), 16);
2586  do {
2587  uint32_t pix =
2588  ((src[(32 + top_right_size - 1) + stride * (-1)]) *
2589  0x01010101U);
2590  for (i = 0; i < (32 - top_right_size); i += 4)
2591  ((((union unaligned_32 *) (top + 32 + top_right_size +
2592  i))->l) = (pix));
2593  } while (0);
2594  }
2595  if (cand_left)
2596  for (i = 0; i < 32; i++)
2597  left[i] = src[(-1) + stride * (i)];
2598  if (cand_bottom_left) {
2599  for (i = 32; i < 32 + bottom_left_size; i++)
2600  left[i] = src[(-1) + stride * (i)];
2601  do {
2602  uint32_t pix =
2603  ((src[(-1) + stride * (32 + bottom_left_size - 1)]) *
2604  0x01010101U);
2605  for (i = 0; i < (32 - bottom_left_size); i += 4)
2606  ((((union unaligned_32 *) (left + 32 + bottom_left_size +
2607  i))->l) = (pix));
2608  } while (0);
2609  }
2610 
2611  if (s->ps.pps->constrained_intra_pred_flag == 1) {
2612  if (cand_bottom_left || cand_left || cand_up_left || cand_up
2613  || cand_up_right) {
2614  int size_max_x =
2615  x0 + ((2 * 32) << hshift) <
2616  s->ps.sps->width ? 2 * 32 : (s->ps.sps->width - x0) >> hshift;
2617  int size_max_y =
2618  y0 + ((2 * 32) << vshift) <
2619  s->ps.sps->height ? 2 * 32 : (s->ps.sps->height - y0) >> vshift;
2620  int j = 32 + (cand_bottom_left ? bottom_left_size : 0) - 1;
2621  if (!cand_up_right) {
2622  size_max_x = x0 + ((32) << hshift) < s->ps.sps->width ?
2623  32 : (s->ps.sps->width - x0) >> hshift;
2624  }
2625  if (!cand_bottom_left) {
2626  size_max_y = y0 + ((32) << vshift) < s->ps.sps->height ?
2627  32 : (s->ps.sps->height - y0) >> vshift;
2628  }
2629  if (cand_bottom_left || cand_left || cand_up_left) {
2630  while (j > -1
2631  &&
2632  !((s->ref->tab_mvf[(((x0 +
2633  ((-1) << hshift)) >> s->ps.sps->
2634  log2_min_pu_size)) + (((y0 +
2635  ((j) <<
2636  vshift))
2637  >> s->ps.sps->
2638  log2_min_pu_size))
2639  * min_pu_width]).pred_flag ==
2640  PF_INTRA))
2641  j--;
2642  if (!
2643  ((s->ref->tab_mvf[(((x0 +
2644  ((-1) << hshift)) >> s->ps.sps->
2645  log2_min_pu_size)) + (((y0 + ((j)
2646  <<
2647  vshift))
2648  >> s->ps.sps->
2649  log2_min_pu_size))
2650  * min_pu_width]).pred_flag == PF_INTRA)) {
2651  j = 0;
2652  while (j < size_max_x
2653  &&
2654  !((s->ref->tab_mvf[(((x0 +
2655  ((j) << hshift)) >> s->ps.sps->
2656  log2_min_pu_size)) + (((y0 +
2657  ((-1) <<
2658  vshift))
2659  >> s->
2660  ps.sps->
2661  log2_min_pu_size))
2662  * min_pu_width]).pred_flag ==
2663  PF_INTRA))
2664  j++;
2665  for (i = j; i > (j) - (j + 1); i--)
2666  if (!
2667  ((s->ref->tab_mvf[(((x0 +
2668  ((i -
2669  1) << hshift)) >> s->ps.sps->
2670  log2_min_pu_size)) + (((y0 +
2671  ((-1) <<
2672  vshift))
2673  >> s->
2674  ps.sps->
2675  log2_min_pu_size))
2676  * min_pu_width]).pred_flag ==
2677  PF_INTRA))
2678  top[i - 1] = top[i];
2679  left[-1] = top[-1];
2680  }
2681  } else {
2682  j = 0;
2683  while (j < size_max_x
2684  &&
2685  !((s->ref->tab_mvf[(((x0 +
2686  ((j) << hshift)) >> s->ps.sps->
2687  log2_min_pu_size)) + (((y0 + ((-1)
2688  <<
2689  vshift))
2690  >> s->ps.sps->
2691  log2_min_pu_size))
2692  * min_pu_width]).pred_flag ==
2693  PF_INTRA))
2694  j++;
2695  if (j > 0)
2696  if (x0 > 0) {
2697  for (i = j; i > (j) - (j + 1); i--)
2698  if (!
2699  ((s->ref->tab_mvf[(((x0 +
2700  ((i -
2701  1) << hshift)) >>
2702  s->ps.sps->log2_min_pu_size))
2703  + (((y0 + ((-1)
2704  << vshift))
2705  >>
2706  s->ps.sps->log2_min_pu_size))
2707  *
2708  min_pu_width]).pred_flag ==
2709  PF_INTRA))
2710  top[i - 1] = top[i];
2711  } else {
2712  for (i = j; i > (j) - (j); i--)
2713  if (!
2714  ((s->ref->tab_mvf[(((x0 +
2715  ((i -
2716  1) << hshift)) >>
2717  s->ps.sps->log2_min_pu_size))
2718  + (((y0 + ((-1)
2719  << vshift))
2720  >>
2721  s->ps.sps->log2_min_pu_size))
2722  *
2723  min_pu_width]).pred_flag ==
2724  PF_INTRA))
2725  top[i - 1] = top[i];
2726  top[-1] = top[0];
2727  }
2728  left[-1] = top[-1];
2729  }
2730  left[-1] = top[-1];
2731  if (cand_bottom_left || cand_left) {
2732  a = ((left[-1]) * 0x01010101U);
2733  for (i = 0; i < (0) + (size_max_y); i += 4)
2734  if (!
2735  ((s->ref->tab_mvf[(((x0 +
2736  ((-1) << hshift)) >> s->ps.sps->
2737  log2_min_pu_size)) + (((y0 +
2738  ((i) <<
2739  vshift))
2740  >> s->ps.sps->
2741  log2_min_pu_size))
2742  * min_pu_width]).pred_flag ==
2743  PF_INTRA))
2744  ((((union unaligned_32 *) (&left[i]))->l) = (a));
2745  else
2746  a = ((left[i + 3]) * 0x01010101U);
2747  }
2748  if (!cand_left) {
2749  vec0 = (v16u8) __msa_fill_b(left[-1]);
2750 
2751  ST_UB2(vec0, vec0, left, 16);
2752  }
2753  if (!cand_bottom_left) {
2754  vec0 = (v16u8) __msa_fill_b(left[31]);
2755 
2756  ST_UB2(vec0, vec0, (left + 32), 16);
2757  }
2758  if (x0 != 0 && y0 != 0) {
2759  a = ((left[size_max_y - 1]) * 0x01010101U);
2760  for (i = (size_max_y - 1);
2761  i > (size_max_y - 1) - (size_max_y); i -= 4)
2762  if (!
2763  ((s->ref->tab_mvf[(((x0 +
2764  ((-1) << hshift)) >> s->ps.sps->
2765  log2_min_pu_size)) + (((y0 +
2766  ((i -
2767  3) <<
2768  vshift))
2769  >> s->ps.sps->
2770  log2_min_pu_size))
2771  * min_pu_width]).pred_flag ==
2772  PF_INTRA))
2773  ((((union unaligned_32 *) (&left[i - 3]))->l) = (a));
2774  else
2775  a = ((left[i - 3]) * 0x01010101U);
2776  if (!
2777  ((s->ref->tab_mvf[(((x0 +
2778  ((-1) << hshift)) >> s->ps.sps->
2779  log2_min_pu_size)) + (((y0 + ((-1)
2780  <<
2781  vshift))
2782  >> s->ps.sps->
2783  log2_min_pu_size))
2784  * min_pu_width]).pred_flag == PF_INTRA))
2785  left[-1] = left[0];
2786  } else if (x0 == 0) {
2787  do {
2788  uint32_t pix = ((0) * 0x01010101U);
2789  for (i = 0; i < (size_max_y); i += 4)
2790  ((((union unaligned_32 *) (left + i))->l) = (pix));
2791  } while (0);
2792  } else {
2793  a = ((left[size_max_y - 1]) * 0x01010101U);
2794  for (i = (size_max_y - 1);
2795  i > (size_max_y - 1) - (size_max_y); i -= 4)
2796  if (!
2797  ((s->ref->tab_mvf[(((x0 +
2798  ((-1) << hshift)) >> s->ps.sps->
2799  log2_min_pu_size)) + (((y0 +
2800  ((i -
2801  3) <<
2802  vshift))
2803  >> s->ps.sps->
2804  log2_min_pu_size))
2805  * min_pu_width]).pred_flag ==
2806  PF_INTRA))
2807  ((((union unaligned_32 *) (&left[i - 3]))->l) = (a));
2808  else
2809  a = ((left[i - 3]) * 0x01010101U);
2810  }
2811  top[-1] = left[-1];
2812  if (y0 != 0) {
2813  a = ((left[-1]) * 0x01010101U);
2814  for (i = 0; i < (0) + (size_max_x); i += 4)
2815  if (!
2816  ((s->ref->tab_mvf[(((x0 +
2817  ((i) << hshift)) >> s->ps.sps->
2818  log2_min_pu_size)) + (((y0 + ((-1)
2819  <<
2820  vshift))
2821  >> s->ps.sps->
2822  log2_min_pu_size))
2823  * min_pu_width]).pred_flag ==
2824  PF_INTRA))
2825  ((((union unaligned_32 *) (&top[i]))->l) = (a));
2826  else
2827  a = ((top[i + 3]) * 0x01010101U);
2828  }
2829  }
2830  }
2831 
2832  if (!cand_bottom_left) {
2833  if (cand_left) {
2834  vec0 = (v16u8) __msa_fill_b(left[31]);
2835 
2836  ST_UB2(vec0, vec0, (left + 32), 16);
2837  } else if (cand_up_left) {
2838  vec0 = (v16u8) __msa_fill_b(left[-1]);
2839 
2840  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2841 
2842  cand_left = 1;
2843  } else if (cand_up) {
2844  left[-1] = top[0];
2845 
2846  vec0 = (v16u8) __msa_fill_b(left[-1]);
2847 
2848  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2849 
2850  cand_up_left = 1;
2851  cand_left = 1;
2852  } else if (cand_up_right) {
2853  vec0 = (v16u8) __msa_fill_b(top[32]);
2854 
2855  ST_UB2(vec0, vec0, top, 16);
2856 
2857  left[-1] = top[32];
2858 
2859  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2860 
2861  cand_up = 1;
2862  cand_up_left = 1;
2863  cand_left = 1;
2864  } else {
2865  left[-1] = 128;
2866 
2867  vec0 = (v16u8) __msa_ldi_b(128);
2868 
2869  ST_UB4(vec0, vec0, vec0, vec0, top, 16);
2870  ST_UB4(vec0, vec0, vec0, vec0, left, 16);
2871  }
2872  }
2873 
2874  if (!cand_left) {
2875  vec0 = (v16u8) __msa_fill_b(left[32]);
2876 
2877  ST_UB2(vec0, vec0, left, 16);
2878  }
2879  if (!cand_up_left) {
2880  left[-1] = left[0];
2881  }
2882  if (!cand_up) {
2883  vec0 = (v16u8) __msa_fill_b(left[-1]);
2884 
2885  ST_UB2(vec0, vec0, top, 16);
2886  }
2887  if (!cand_up_right) {
2888  vec0 = (v16u8) __msa_fill_b(top[31]);
2889 
2890  ST_UB2(vec0, vec0, (top + 32), 16);
2891  }
2892 
2893  top[-1] = left[-1];
2894 
2895 
2897  && (c_idx == 0 || s->ps.sps->chroma_format_idc == 3)) {
2898  if (mode != INTRA_DC && 32 != 4) {
2899  int intra_hor_ver_dist_thresh[] = { 7, 1, 0 };
2900  int min_dist_vert_hor =
2901  (((((int) (mode - 26U)) >=
2902  0 ? ((int) (mode - 26U)) : (-((int) (mode - 26U))))) >
2903  ((((int) (mode - 10U)) >=
2904  0 ? ((int) (mode - 10U)) : (-((int) (mode - 10U)))))
2905  ? ((((int) (mode - 10U)) >=
2906  0 ? ((int) (mode - 10U)) : (-((int) (mode - 10U)))))
2907  : ((((int) (mode - 26U)) >=
2908  0 ? ((int) (mode - 26U)) : (-((int) (mode - 26U))))));
2909  if (min_dist_vert_hor > intra_hor_ver_dist_thresh[5 - 3]) {
2910  int threshold = 1 << (8 - 5);
2912  && c_idx == 0
2913  && ((top[-1] + top[63] - 2 * top[31]) >=
2914  0 ? (top[-1] + top[63] -
2915  2 * top[31]) : (-(top[-1] + top[63] -
2916  2 * top[31]))) < threshold
2917  && ((left[-1] + left[63] - 2 * left[31]) >=
2918  0 ? (left[-1] + left[63] -
2919  2 * left[31]) : (-(left[-1] + left[63] -
2920  2 * left[31]))) < threshold) {
2921 
2922 
2923  filtered_top[-1] = top[-1];
2924  filtered_top[63] = top[63];
2925 
2926 
2927  for (i = 0; i < 63; i++) {
2928  filtered_top[i] =
2929  ((63 - i) * top[-1] + (i + 1) * top[63] + 32) >> 6;
2930  }
2931 
2932  tmp0 = __msa_fill_h(top[-1]);
2933  tmp1 = __msa_fill_h(top[63]);
2934 
2935  tmp2 = mul_val0 - 8;
2936  tmp3 = mul_val0 - 16;
2937  tmp4 = mul_val0 - 24;
2938  tmp5 = mul_val1 + 8;
2939  tmp6 = mul_val1 + 16;
2940  tmp7 = mul_val1 + 24;
2941 
2942  res0 = mul_val0 * tmp0;
2943  res1 = tmp2 * tmp0;
2944  res2 = tmp3 * tmp0;
2945  res3 = tmp4 * tmp0;
2946  res0 += mul_val1 * tmp1;
2947  res1 += tmp5 * tmp1;
2948  res2 += tmp6 * tmp1;
2949  res3 += tmp7 * tmp1;
2950 
2951  res0 = __msa_srari_h(res0, 6);
2952  res1 = __msa_srari_h(res1, 6);
2953  res2 = __msa_srari_h(res2, 6);
2954  res3 = __msa_srari_h(res3, 6);
2955 
2956  vec0 = (v16u8) __msa_pckev_b((v16i8) res1, (v16i8) res0);
2957  vec1 = (v16u8) __msa_pckev_b((v16i8) res3, (v16i8) res2);
2958 
2959  ST_UB2(vec0, vec1, filtered_top, 16);
2960 
2961  res0 = mul_val0 - 32;
2962  tmp2 = mul_val0 - 40;
2963  tmp3 = mul_val0 - 48;
2964  tmp4 = mul_val0 - 56;
2965  res3 = mul_val1 + 32;
2966  tmp5 = mul_val1 + 40;
2967  tmp6 = mul_val1 + 48;
2968  tmp7 = mul_val1 + 56;
2969 
2970  res0 = res0 * tmp0;
2971  res1 = tmp2 * tmp0;
2972  res2 = tmp3 * tmp0;
2973  res0 += res3 * tmp1;
2974  res3 = tmp4 * tmp0;
2975  res1 += tmp5 * tmp1;
2976  res2 += tmp6 * tmp1;
2977  res3 += tmp7 * tmp1;
2978 
2979  res0 = __msa_srari_h(res0, 6);
2980  res1 = __msa_srari_h(res1, 6);
2981  res2 = __msa_srari_h(res2, 6);
2982  res3 = __msa_srari_h(res3, 6);
2983 
2984  vec0 = (v16u8) __msa_pckev_b((v16i8) res1, (v16i8) res0);
2985  vec1 = (v16u8) __msa_pckev_b((v16i8) res3, (v16i8) res2);
2986 
2987  ST_UB2(vec0, vec1, (filtered_top + 32), 16);
2988 
2989  filtered_top[63] = top[63];
2990 
2991  tmp0 = __msa_fill_h(left[-1]);
2992  tmp1 = __msa_fill_h(left[63]);
2993 
2994  tmp2 = mul_val0 - 8;
2995  tmp3 = mul_val0 - 16;
2996  tmp4 = mul_val0 - 24;
2997  tmp5 = mul_val1 + 8;
2998  tmp6 = mul_val1 + 16;
2999  tmp7 = mul_val1 + 24;
3000 
3001  res0 = mul_val0 * tmp0;
3002  res1 = tmp2 * tmp0;
3003  res2 = tmp3 * tmp0;
3004  res3 = tmp4 * tmp0;
3005  res0 += mul_val1 * tmp1;
3006  res1 += tmp5 * tmp1;
3007  res2 += tmp6 * tmp1;
3008  res3 += tmp7 * tmp1;
3009 
3010  res0 = __msa_srari_h(res0, 6);
3011  res1 = __msa_srari_h(res1, 6);
3012  res2 = __msa_srari_h(res2, 6);
3013  res3 = __msa_srari_h(res3, 6);
3014 
3015  vec0 = (v16u8) __msa_pckev_b((v16i8) res1, (v16i8) res0);
3016  vec1 = (v16u8) __msa_pckev_b((v16i8) res3, (v16i8) res2);
3017 
3018  ST_UB2(vec0, vec1, left, 16);
3019 
3020  res0 = mul_val0 - 32;
3021  tmp2 = mul_val0 - 40;
3022  tmp3 = mul_val0 - 48;
3023  tmp4 = mul_val0 - 56;
3024  res3 = mul_val1 + 32;
3025  tmp5 = mul_val1 + 40;
3026  tmp6 = mul_val1 + 48;
3027  tmp7 = mul_val1 + 56;
3028 
3029  res0 = res0 * tmp0;
3030  res1 = tmp2 * tmp0;
3031  res2 = tmp3 * tmp0;
3032  res0 += res3 * tmp1;
3033  res3 = tmp4 * tmp0;
3034  res1 += tmp5 * tmp1;
3035  res2 += tmp6 * tmp1;
3036  res3 += tmp7 * tmp1;
3037 
3038  res0 = __msa_srari_h(res0, 6);
3039  res1 = __msa_srari_h(res1, 6);
3040  res2 = __msa_srari_h(res2, 6);
3041  res3 = __msa_srari_h(res3, 6);
3042 
3043  vec0 = (v16u8) __msa_pckev_b((v16i8) res1, (v16i8) res0);
3044  vec1 = (v16u8) __msa_pckev_b((v16i8) res3, (v16i8) res2);
3045 
3046  ST_UB2(vec0, vec1, (left + 32), 16);
3047 
3048  left[63] = tmp1[0];
3049 
3050  top = filtered_top;
3051  } else {
3052  filtered_left[2 * 32 - 1] = left[2 * 32 - 1];
3053  filtered_top[2 * 32 - 1] = top[2 * 32 - 1];
3054  for (i = 2 * 32 - 2; i >= 0; i--)
3055  filtered_left[i] = (left[i + 1] + 2 * left[i] +
3056  left[i - 1] + 2) >> 2;
3057  filtered_top[-1] =
3058  filtered_left[-1] =
3059  (left[0] + 2 * left[-1] + top[0] + 2) >> 2;
3060  for (i = 2 * 32 - 2; i >= 0; i--)
3061  filtered_top[i] = (top[i + 1] + 2 * top[i] +
3062  top[i - 1] + 2) >> 2;
3063  left = filtered_left;
3064  top = filtered_top;
3065  }
3066  }
3067  }
3068  }
3069 
3070  switch (mode) {
3071  case INTRA_PLANAR:
3072  s->hpc.pred_planar[3] ((uint8_t *) src, (uint8_t *) top,
3073  (uint8_t *) left, stride);
3074  break;
3075  case INTRA_DC:
3076  s->hpc.pred_dc((uint8_t *) src, (uint8_t *) top,
3077  (uint8_t *) left, stride, 5, c_idx);
3078  break;
3079  default:
3080  s->hpc.pred_angular[3] ((uint8_t *) src, (uint8_t *) top,
3081  (uint8_t *) left, stride, c_idx, mode);
3082  break;
3083  }
3084 }
const HEVCPPS * pps
Definition: hevc_ps.h:402
const char const char void * val
Definition: avisynth_c.h:771
void ff_hevc_intra_pred_planar_2_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride)
HEVCPredContext hpc
Definition: hevcdec.h:437
const char * s
Definition: avisynth_c.h:768
NeighbourAvailable na
Definition: hevcdec.h:372
#define flag(name)
Definition: cbs_h2645.c:345
HEVCFrame * ref
Definition: hevcdec.h:423
#define ILVRL_B2_SH(...)
static void hevc_intra_pred_horiz_4x4_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:190
#define SLDI_B2_SH(...)
MvField * tab_mvf
Definition: hevcdec.h:314
int vshift[3]
Definition: hevc_ps.h:309
#define LW(psrc)
#define MUL2(in0, in1, in2, in3, out0, out1)
#define SD
Definition: ccaption_dec.c:819
#define LD_SB(...)
#define ST_SB(...)
static const int8_t intra_pred_angle_up[17]
Definition: hevcpred_msa.c:25
#define ST_SB2(...)
HEVCParamSets ps
Definition: hevcdec.h:408
static void hevc_intra_pred_dc_8x8_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:401
#define SPLATI_H2_SH(...)
#define src
Definition: vp8dsp.c:254
static void hevc_intra_pred_vert_8x8_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:94
int width
Definition: hevc_ps.h:295
#define LD_SB2(...)
#define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride)
#define log2(x)
Definition: libm.h:404
int chroma_format_idc
Definition: hevc_ps.h:227
static void hevc_intra_pred_plane_32x32_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:907
uint8_t
#define ST_SH2(...)
#define UNPCK_UB_SH(in, out0, out1)
#define LD_UB2(...)
#define SRARI_H4_SH(...)
#define CLIP_SH_0_255(in)
#define SPLATI_H4_SH(...)
#define SLDI_B4_0_SH(...)
#define ILVRL_H2_SH(...)
void ff_hevc_intra_pred_dc_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride, int log2, int c_idx)
#define CLIP_SH2_0_255(in0, in1)
#define PCKEV_B2_SB(...)
#define MUL4(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, out3)
#define U(x)
Definition: vp56_arith.h:37
#define ILVRL_B2_UH(...)
#define HEVC_PRED_PLANAR_16x2(src0_r, src0_l, tmp0, tmp1, vec0, vec1,mul_val_h0, mul_val_h1, mul_val_h2, mul_val_h3,res0, res1, mul_val_b0, mul_val_b1, round)
Definition: hevcpred_msa.c:33
void(* pred_dc)(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int log2_size, int c_idx)
Definition: hevcpred.h:36
int min_pu_height
Definition: hevc_ps.h:305
static const int8_t intra_pred_angle_low[16]
Definition: hevcpred_msa.c:29
static void hevc_intra_pred_horiz_8x8_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:224
static void hevc_intra_pred_angular_lower_16width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
static void intra_predict_vert_32x32_msa(const uint8_t *src, uint8_t *dst, int32_t dst_stride)
#define zero
Definition: regdef.h:64
#define ILVR_B2_SH(...)
#define SW4(in0, in1, in2, in3, pdst, stride)
static const uint8_t offset[127][2]
Definition: vf_spp.c:92
static void hevc_intra_pred_angular_lower_4width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
static void hevc_intra_pred_horiz_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:264
int intra_pred_mode
Definition: hevcdec.h:291
const HEVCSPS * sps
Definition: hevc_ps.h:401
#define SRARI_H2_SH(...)
#define SLDI_B2_UB(...)
static void hevc_intra_pred_plane_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:662
#define PCKEV_D2_SH(...)
#define SRARI_H2_UH(...)
int hshift[3]
Definition: hevc_ps.h:308
static void hevc_intra_pred_plane_4x4_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:548
int32_t
#define PCKEV_B4_SB(...)
static void hevc_intra_pred_angular_lower_32width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
int intra_pred_mode_c
Definition: hevcdec.h:292
int height
Definition: hevc_ps.h:296
#define ST_UB(...)
static void hevc_intra_pred_angular_upper_8width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
#define ST2x4_UB(in, stidx, pdst, stride)
uint8_t constrained_intra_pred_flag
Definition: hevc_ps.h:328
int tb_mask
Definition: hevc_ps.h:306
#define ST_UB2(...)
#define ILVL_B2_SH(...)
#define ST_UB4(...)
IntraPredMode
Definition: hevcdec.h:173
static void hevc_intra_pred_horiz_32x32_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:310
#define ILVR_B2_UH(...)
#define src1
Definition: h264pred.c:139
void ff_hevc_intra_pred_planar_1_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:232
unsigned int log2_min_pu_size
Definition: hevc_ps.h:282
static void hevc_intra_pred_angular_upper_32width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
TransformUnit tu
Definition: hevcdec.h:355
#define HADD_UB2_UH(...)
void(* pred_angular[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride, int c_idx, int mode)
Definition: hevcpred.h:38
static void hevc_intra_pred_vert_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:149
#define ILVR_B4_SH(...)
void ff_intra_pred_8_32x32_msa(HEVCContext *s, int x0, int y0, int c_idx)
static void hevc_intra_pred_plane_8x8_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:595
AVFrame * frame
Definition: hevcdec.h:403
static void hevc_intra_pred_dc_4x4_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:340
unsigned int log2_min_tb_size
Definition: hevc_ps.h:279
#define src0
Definition: h264pred.c:138
#define ADD2(in0, in1, in2, in3, out0, out1)
#define LD(psrc)
#define INSERT_W2_SB(...)
static void hevc_intra_pred_vert_4x4_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:61
#define SD4(in0, in1, in2, in3, pdst, stride)
static void hevc_intra_pred_dc_32x32_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride)
Definition: hevcpred_msa.c:516
void ff_hevc_intra_pred_planar_3_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride)
void ff_intra_pred_8_16x16_msa(HEVCContext *s, int x0, int y0, int c_idx)
#define SW(val, pdst)
HEVCLocalContext * HEVClc
Definition: hevcdec.h:390
#define ST_SB4(...)
static void process_intra_lower_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, uint8_t offset)
Definition: hevcpred_msa.c:825
void ff_pred_intra_pred_angular_1_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride, int c_idx, int mode)
static void hevc_intra_pred_angular_upper_16width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:215
#define ST4x8_UB(in0, in1, pdst, stride)
#define INSERT_D2_UB(...)
int
GLint GLenum GLboolean GLsizei stride
Definition: opengl_enc.c:105
void ff_pred_intra_pred_angular_2_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride, int c_idx, int mode)
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:107
#define SUB2(in0, in1, in2, in3, out0, out1)
static void hevc_intra_pred_angular_lower_8width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
#define ST8x4_UB(in0, in1, pdst, stride)
void ff_hevc_intra_pred_planar_0_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride)
#define ST8x8_UB(in0, in1, in2, in3, pdst, stride)
uint8_t sps_strong_intra_smoothing_enable_flag
Definition: hevc_ps.h:275
#define LD_UB(...)
void ff_pred_intra_pred_angular_3_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride, int c_idx, int mode)
void ff_pred_intra_pred_angular_0_msa(uint8_t *dst, const uint8_t *src_top, const uint8_t *src_left, ptrdiff_t stride, int c_idx, int mode)
int min_pu_width
Definition: hevc_ps.h:304
static void hevc_intra_pred_dc_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t flag)
Definition: hevcpred_msa.c:460
void(* pred_planar[4])(uint8_t *src, const uint8_t *top, const uint8_t *left, ptrdiff_t stride)
Definition: hevcpred.h:34
static void process_intra_upper_16x16_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, uint8_t offset)
Definition: hevcpred_msa.c:742
#define stride
int * min_tb_addr_zs
MinTbAddrZS.
Definition: hevc_ps.h:387
#define ST4x2_UB(in, pdst, stride)
int intra_smoothing_disabled_flag
Definition: hevc_ps.h:291
#define ILVR_D2_SH(...)
#define PCKEV_B2_UB(...)
#define SLDI_B2_SB(...)
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83
static void hevc_intra_pred_angular_upper_4width_msa(const uint8_t *src_top, const uint8_t *src_left, uint8_t *dst, int32_t stride, int32_t mode)
Definition: hevcpred_msa.c:922