Fix RGBA and ABGR pack/unpack on big endian cpu
[platform/upstream/gst-plugins-base.git] / gst-libs / gst / video / video-orc.orc
1 .function video_orc_blend_little
2 .flags 1d
3 .dest 4 d guint8
4 .source 4 s guint8
5 .temp 4 t
6 .temp 2 tw
7 .temp 1 tb
8 .temp 4 a
9 .temp 8 d_wide
10 .temp 8 s_wide
11 .temp 8 a_wide
12 .const 4 a_alpha 0x000000ff
13
14 loadl t, s
15 convlw tw, t
16 convwb tb, tw
17 splatbl a, tb
18 x4 convubw a_wide, a
19 x4 shruw a_wide, a_wide, 8
20 x4 convubw s_wide, t
21 loadl t, d
22 x4 convubw d_wide, t
23 x4 subw s_wide, s_wide, d_wide
24 x4 mullw s_wide, s_wide, a_wide
25 x4 div255w s_wide, s_wide
26 x4 addw d_wide, d_wide, s_wide
27 x4 convwb t, d_wide
28 orl t, t, a_alpha
29 storel d, t
30
31 .function video_orc_blend_big
32 .flags 1d
33 .dest 4 d guint8
34 .source 4 s guint8
35 .temp 4 t
36 .temp 4 t2
37 .temp 2 tw
38 .temp 1 tb
39 .temp 4 a
40 .temp 8 d_wide
41 .temp 8 s_wide
42 .temp 8 a_wide
43 .const 4 a_alpha 0xff000000
44
45 loadl t, s
46 shrul t2, t, 24
47 convlw tw, t2
48 convwb tb, tw
49 splatbl a, tb
50 x4 convubw a_wide, a
51 x4 shruw a_wide, a_wide, 8
52 x4 convubw s_wide, t
53 loadl t, d
54 x4 convubw d_wide, t
55 x4 subw s_wide, s_wide, d_wide
56 x4 mullw s_wide, s_wide, a_wide
57 x4 div255w s_wide, s_wide
58 x4 addw d_wide, d_wide, s_wide
59 x4 convwb t, d_wide
60 orl t, t, a_alpha
61 storel d, t
62
63 .function video_orc_unpack_I420
64 .dest 4 d guint8
65 .source 1 y guint8
66 .source 1 u guint8
67 .source 1 v guint8
68 .const 1 c255 255
69 .temp 2 uv
70 .temp 2 ay
71 .temp 1 tu
72 .temp 1 tv
73
74 loadupdb tu, u
75 loadupdb tv, v
76 mergebw uv, tu, tv
77 mergebw ay, c255, y
78 mergewl d, ay, uv
79
80
81 .function video_orc_pack_I420
82 .dest 2 y guint8
83 .dest 1 u guint8
84 .dest 1 v guint8
85 .source 8 ayuv guint8
86 .temp 4 ay
87 .temp 4 uv
88 .temp 2 uu
89 .temp 2 vv
90 .temp 1 t1
91 .temp 1 t2
92
93 x2 splitlw uv, ay, ayuv
94 x2 select1wb y, ay
95 x2 splitwb vv, uu, uv
96 select0wb u, uu
97 select0wb v, vv
98
99 .function video_orc_pack_Y
100 .dest 1 y guint8
101 .source 4 ayuv guint8
102 .temp 2 ay
103
104 select0lw ay, ayuv
105 select1wb y, ay
106
107 .function video_orc_unpack_YUY2
108 .dest 8 ayuv guint8
109 .source 4 yuy2 guint8
110 .const 2 c255 0xff
111 .temp 2 yy
112 .temp 2 uv
113 .temp 4 ayay
114 .temp 4 uvuv
115
116 x2 splitwb uv, yy, yuy2
117 x2 mergebw ayay, c255, yy
118 mergewl uvuv, uv, uv
119 x2 mergewl ayuv, ayay, uvuv
120
121
122 .function video_orc_pack_YUY2
123 .dest 4 yuy2 guint8
124 .source 8 ayuv guint8
125 .temp 2 yy
126 .temp 2 uv
127 .temp 4 ayay
128 .temp 4 uvuv
129
130 x2 splitlw uvuv, ayay, ayuv
131 select0lw uv, uvuv
132 x2 select1wb yy, ayay
133 x2 mergebw yuy2, yy, uv
134
135
136 .function video_orc_pack_UYVY
137 .dest 4 yuy2 guint8
138 .source 8 ayuv guint8
139 .temp 2 yy
140 .temp 2 uv
141 .temp 4 ayay
142 .temp 4 uvuv
143
144 x2 splitlw uvuv, ayay, ayuv
145 select0lw uv, uvuv
146 x2 select1wb yy, ayay
147 x2 mergebw yuy2, uv, yy
148
149
150 .function video_orc_unpack_UYVY
151 .dest 8 ayuv guint8
152 .source 4 uyvy guint8
153 .const 2 c255 0xff
154 .temp 2 yy
155 .temp 2 uv
156 .temp 4 ayay
157 .temp 4 uvuv
158
159 x2 splitwb yy, uv, uyvy
160 x2 mergebw ayay, c255, yy
161 mergewl uvuv, uv, uv
162 x2 mergewl ayuv, ayay, uvuv
163
164
165 .function video_orc_pack_VYUY
166 .dest 4 vyuy guint8
167 .source 8 ayuv guint8
168 .temp 2 yy
169 .temp 2 vu
170 .temp 4 ayay
171 .temp 4 uvuv
172
173 x2 splitlw uvuv, ayay, ayuv
174 select0lw vu, uvuv
175 x2 select1wb yy, ayay
176 swapw vu, vu
177 x2 mergebw vyuy, vu, yy
178
179
180 .function video_orc_unpack_VYUY
181 .dest 8 ayuv guint8
182 .source 4 vyuy guint8
183 .const 2 c255 0xff
184 .temp 2 yy
185 .temp 2 uv
186 .temp 4 ayay
187 .temp 4 uvuv
188
189 x2 splitwb yy, uv, vyuy
190 swapw uv, uv
191 x2 mergebw ayay, c255, yy
192 mergewl uvuv, uv, uv
193 x2 mergewl ayuv, ayay, uvuv
194
195
196 .function video_orc_unpack_YVYU
197 .dest 8 ayuv guint8
198 .source 4 uyvy guint8
199 .const 2 c255 0xff
200 .temp 2 yy
201 .temp 2 uv
202 .temp 4 ayay
203 .temp 4 uvuv
204
205 x2 splitwb uv, yy, uyvy
206 swapw uv, uv
207 x2 mergebw ayay, c255, yy
208 mergewl uvuv, uv, uv
209 x2 mergewl ayuv, ayay, uvuv
210
211
212 .function video_orc_pack_YVYU
213 .dest 4 yuy2 guint8
214 .source 8 ayuv guint8
215 .temp 2 yy
216 .temp 2 uv
217 .temp 4 ayay
218 .temp 4 uvuv
219
220 x2 splitlw uvuv, ayay, ayuv
221 select0lw uv, uvuv
222 x2 select1wb yy, ayay
223 swapw uv, uv
224 x2 mergebw yuy2, yy, uv
225
226
227 .function video_orc_unpack_YUV9
228 .dest 8 d guint8
229 .source 2 y guint8
230 .source 1 u guint8
231 .source 1 v guint8
232 .const 1 c255 255
233 .temp 2 tuv
234 .temp 4 ay
235 .temp 4 uv
236 .temp 1 tu
237 .temp 1 tv
238
239 loadupdb tu, u
240 loadupdb tv, v
241 mergebw tuv, tu, tv
242 mergewl uv, tuv, tuv
243 x2 mergebw ay, c255, y
244 x2 mergewl d, ay, uv
245
246
247 .function video_orc_unpack_Y42B
248 .dest 8 ayuv guint8
249 .source 2 yy guint8
250 .source 1 u guint8
251 .source 1 v guint8
252 .const 1 c255 255
253 .temp 2 uv
254 .temp 2 ay
255 .temp 4 uvuv
256 .temp 4 ayay
257
258 mergebw uv, u, v
259 x2 mergebw ayay, c255, yy
260 mergewl uvuv, uv, uv
261 x2 mergewl ayuv, ayay, uvuv
262
263 .function video_orc_pack_Y42B
264 .dest 2 y guint8
265 .dest 1 u guint8
266 .dest 1 v guint8
267 .source 8 ayuv guint8
268 .temp 4 ayay
269 .temp 4 uvuv
270 .temp 2 uv
271
272 x2 splitlw uvuv, ayay, ayuv
273 select0lw uv, uvuv
274 splitwb v, u, uv
275 x2 select1wb y, ayay
276
277
278 .function video_orc_unpack_Y444
279 .dest 4 ayuv guint8
280 .source 1 y guint8
281 .source 1 u guint8
282 .source 1 v guint8
283 .const 1 c255 255
284 .temp 2 uv
285 .temp 2 ay
286
287 mergebw uv, u, v
288 mergebw ay, c255, y
289 mergewl ayuv, ay, uv
290
291
292 .function video_orc_pack_Y444
293 .dest 1 y guint8
294 .dest 1 u guint8
295 .dest 1 v guint8
296 .source 4 ayuv guint8
297 .temp 2 ay
298 .temp 2 uv
299
300 splitlw uv, ay, ayuv
301 splitwb v, u, uv
302 select1wb y, ay
303
304 .function video_orc_unpack_GRAY8
305 .dest 4 ayuv guint8
306 .source 1 y guint8
307 .const 1 c255 255
308 .const 2 c0x8080 0x8080
309 .temp 2 ay
310
311 mergebw ay, c255, y
312 mergewl ayuv, ay, c0x8080
313
314
315 .function video_orc_pack_GRAY8
316 .dest 1 y guint8
317 .source 4 ayuv guint8
318 .temp 2 ay
319
320 select0lw ay, ayuv
321 select1wb y, ay
322
323
324 .function video_orc_unpack_BGRA
325 .dest 4 argb guint8
326 .source 4 bgra guint8
327
328 swapl argb, bgra
329
330 .function video_orc_pack_BGRA
331 .dest 4 bgra guint8
332 .source 4 argb guint8
333
334 swapl bgra, argb
335
336 .function video_orc_pack_RGBA_le
337 .dest 4 rgba guint8
338 .source 4 argb guint8
339 .temp 4 a
340 .temp 4 r
341
342 loadl r, argb
343 shrul a, r, 8
344 shll r, r, 24
345 orl rgba, r, a
346
347 .function video_orc_unpack_RGBA_le
348 .dest 4 argb guint8
349 .source 4 rgba guint8
350 .temp 4 a
351 .temp 4 r
352
353 loadl r, rgba
354 shll a, r, 8
355 shrul r, r, 24
356 orl argb, r, a
357
358 .function video_orc_pack_RGBA_be
359 .dest 4 rgba guint8
360 .source 4 argb guint8
361 .temp 4 a
362 .temp 4 r
363
364 loadl r, argb
365 shrul a, r, 24
366 shll r, r, 8
367 orl rgba, r, a
368
369 .function video_orc_unpack_RGBA_be
370 .dest 4 argb guint8
371 .source 4 rgba guint8
372 .temp 4 a
373 .temp 4 r
374
375 loadl r, rgba
376 shll a, r, 24
377 shrul r, r, 8
378 orl argb, r, a
379
380
381 .function video_orc_unpack_ABGR_le
382 .dest 4 argb guint8
383 .source 4 abgr guint8
384 .temp 4 a
385 .temp 4 r
386
387 swapl r, abgr
388 shll a, r, 8
389 shrul r, r, 24
390 orl argb, r, a
391
392 .function video_orc_pack_ABGR_le
393 .dest 4 abgr guint8
394 .source 4 argb guint8
395 .temp 4 a
396 .temp 4 r
397
398 swapl r, argb
399 shll a, r, 8
400 shrul r, r, 24
401 orl abgr, r, a
402
403 .function video_orc_unpack_ABGR_be
404 .dest 4 argb guint8
405 .source 4 abgr guint8
406 .temp 4 a
407 .temp 4 r
408
409 swapl r, abgr
410 shll a, r, 24
411 shrul r, r, 8
412 orl argb, r, a
413
414 .function video_orc_pack_ABGR_be
415 .dest 4 abgr guint8
416 .source 4 argb guint8
417 .temp 4 a
418 .temp 4 r
419
420 swapl r, argb
421 shll a, r, 24
422 shrul r, r, 8
423 orl abgr, r, a
424
425
426 .function video_orc_unpack_NV12
427 .dest 8 d guint8
428 .source 2 y guint8
429 .source 2 uv guint8
430 .const 1 c255 255
431 .temp 4 ay
432 .temp 4 uvuv
433
434 mergewl uvuv, uv, uv
435 x2 mergebw ay, c255, y
436 x2 mergewl d, ay, uvuv
437
438 .function video_orc_pack_NV12
439 .dest 2 y guint8
440 .dest 2 uv guint8
441 .source 8 ayuv guint8
442 .temp 4 ay
443 .temp 4 uvuv
444
445 x2 splitlw uvuv, ay, ayuv
446 x2 select1wb y, ay
447 select0lw uv, uvuv
448
449 .function video_orc_unpack_NV21
450 .dest 8 d guint8
451 .source 2 y guint8
452 .source 2 vu guint8
453 .const 1 c255 255
454 .temp 2 uv
455 .temp 4 ay
456 .temp 4 uvuv
457
458 swapw uv, vu
459 mergewl uvuv, uv, uv
460 x2 mergebw ay, c255, y
461 x2 mergewl d, ay, uvuv
462
463
464 .function video_orc_pack_NV21
465 .dest 2 y guint8
466 .dest 2 vu guint8
467 .source 8 ayuv guint8
468 .temp 4 ay
469 .temp 4 uvuv
470 .temp 2 uv
471
472 x2 splitlw uvuv, ay, ayuv
473 x2 select1wb y, ay
474 select0lw uv, uvuv
475 swapw vu, uv
476
477 .function video_orc_unpack_NV24
478 .dest 4 d guint8
479 .source 1 y guint8
480 .source 2 uv guint8
481 .const 1 c255 255
482 .temp 2 ay
483
484 mergebw ay, c255, y
485 mergewl d, ay, uv
486
487 .function video_orc_pack_NV24
488 .dest 1 y guint8
489 .dest 2 uv guint8
490 .source 4 ayuv guint8
491 .temp 2 ay
492
493 splitlw uv, ay, ayuv
494 select1wb y, ay
495
496 .function video_orc_unpack_A420
497 .dest 4 d guint8
498 .source 1 y guint8
499 .source 1 u guint8
500 .source 1 v guint8
501 .source 1 a guint8
502 .temp 2 uv
503 .temp 2 ay
504 .temp 1 tu
505 .temp 1 tv
506
507 loadupdb tu, u
508 loadupdb tv, v
509 mergebw uv, tu, tv
510 mergebw ay, a, y
511 mergewl d, ay, uv
512
513 .function video_orc_pack_A420
514 .dest 2 y guint8
515 .dest 1 u guint8
516 .dest 1 v guint8
517 .dest 2 a guint8
518 .source 8 ayuv guint8
519 .temp 4 ay
520 .temp 4 uv
521 .temp 2 uu
522 .temp 2 vv
523
524 x2 splitlw uv, ay, ayuv
525 x2 select1wb y, ay
526 x2 select0wb a, ay
527 x2 splitwb vv, uu, uv
528 select0wb u, uu
529 select0wb v, vv
530
531 .function video_orc_pack_AY
532 .dest 1 y guint8
533 .dest 1 a guint8
534 .source 4 ayuv guint8
535 .temp 2 ay
536
537 select0lw ay, ayuv
538 select1wb y, ay
539 select0wb a, ay
540
541 .function video_orc_unpack_RGB15_le
542 .dest 4 argb guint32
543 .source 2 rgb15 guint16
544 .temp 2 t
545 .temp 2 r
546 .temp 2 g
547 .temp 2 b
548 .temp 4 ag
549 .temp 4 rb
550
551 loadw t, rgb15
552 andw r, t, 0x7c00
553 andw g, t, 0x03e0
554 andw b, t, 0x001f
555 shlw b, b, 5
556 mulhsw r, r, 0x0210
557 mulhsw g, g, 0x4200
558 mulhsw b, b, 0x4200
559 mergewl ag, 0xff, g
560 mergewl rb, r, b
561 shll rb, rb, 8
562 orl argb, ag, rb
563
564 .function video_orc_unpack_RGB15_be
565 .dest 4 argb guint32
566 .source 2 rgb15 guint16
567 .temp 2 t
568 .temp 2 r
569 .temp 2 g
570 .temp 2 b
571 .temp 4 ag
572 .temp 4 rb
573
574 loadw t, rgb15
575 andw r, t, 0x7c00
576 andw g, t, 0x03e0
577 andw b, t, 0x001f
578 shlw b, b, 5
579 mulhsw r, r, 0x0210
580 mulhsw g, g, 0x4200
581 mulhsw b, b, 0x4200
582 mergewl ag, 0xff, g
583 mergewl rb, r, b
584 shll ag, ag, 8
585 orl argb, ag, rb
586
587 .function video_orc_unpack_RGB15_le_trunc
588 .dest 4 argb guint32
589 .source 2 rgb15 guint16
590 .temp 2 t
591 .temp 2 r
592 .temp 2 g
593 .temp 2 b
594 .temp 4 ag
595 .temp 4 rb
596
597 loadw t, rgb15
598 andw r, t, 0x7c00
599 andw g, t, 0x03e0
600 andw b, t, 0x001f
601 shruw r, r, 7
602 shruw g, g, 2
603 shlw b, b, 3
604 mergewl ag, 0xff, g
605 mergewl rb, r, b
606 shll rb, rb, 8
607 orl argb, ag, rb
608
609 .function video_orc_unpack_RGB15_be_trunc
610 .dest 4 argb guint32
611 .source 2 rgb15 guint16
612 .temp 2 t
613 .temp 2 r
614 .temp 2 g
615 .temp 2 b
616 .temp 4 ag
617 .temp 4 rb
618
619 loadw t, rgb15
620 andw r, t, 0x7c00
621 andw g, t, 0x03e0
622 andw b, t, 0x001f
623 shruw r, r, 7
624 shruw g, g, 2
625 shlw b, b, 3
626 mergewl ag, 0xff, g
627 mergewl rb, r, b
628 shll ag, ag, 8
629 orl argb, ag, rb
630
631 .function video_orc_pack_RGB15_le
632 .dest 2 rgb15 guint16
633 .source 4 argb guint32
634 .temp 4 t
635 .temp 4 r
636 .temp 4 g
637 .temp 4 b
638 .temp 4 t2
639
640 loadl t, argb
641 andl r, t, 0xf800
642 andl g, t, 0xf80000
643 andl b, t, 0xf8000000
644 shrul r, r, 1
645 shrul g, g, 14
646 shrul b, b, 27
647 orl t2, r, g
648 orl t2, t2, b
649 select0lw rgb15, t2
650
651 .function video_orc_pack_RGB15_be
652 .dest 2 rgb15 guint16
653 .source 4 argb guint32
654 .temp 4 t
655 .temp 4 r
656 .temp 4 g
657 .temp 4 b
658 .temp 4 t2
659
660 loadl t, argb
661 andl r, t, 0xf80000
662 andl g, t, 0xf800
663 andl b, t, 0xf8
664 shrul r, r, 9
665 shrul g, g, 6
666 shrul b, b, 3
667 orl t2, r, g
668 orl t2, t2, b
669 select1lw rgb15, t2
670
671 .function video_orc_unpack_BGR15_le
672 .dest 4 argb guint32
673 .source 2 bgr15 guint16
674 .temp 2 t
675 .temp 2 r
676 .temp 2 g
677 .temp 2 b
678 .temp 4 ag
679 .temp 4 rb
680
681 loadw t, bgr15
682 andw b, t, 0x7c00
683 andw g, t, 0x03e0
684 andw r, t, 0x001f
685 shlw r, r, 5
686 mulhsw b, b, 0x0210
687 mulhsw g, g, 0x4200
688 mulhsw r, r, 0x4200
689 mergewl ag, 0xff, g
690 mergewl rb, r, b
691 shll rb, rb, 8
692 orl argb, ag, rb
693
694 .function video_orc_unpack_BGR15_be
695 .dest 4 argb guint32
696 .source 2 bgr15 guint16
697 .temp 2 t
698 .temp 2 r
699 .temp 2 g
700 .temp 2 b
701 .temp 4 ag
702 .temp 4 rb
703
704 loadw t, bgr15
705 andw b, t, 0x7c00
706 andw g, t, 0x03e0
707 andw r, t, 0x001f
708 shlw r, r, 5
709 mulhsw b, b, 0x0210
710 mulhsw g, g, 0x4200
711 mulhsw r, r, 0x4200
712 mergewl ag, 0xff, g
713 mergewl rb, r, b
714 shll ag, ag, 8
715 orl argb, ag, rb
716
717 .function video_orc_unpack_BGR15_le_trunc
718 .dest 4 argb guint32
719 .source 2 bgr15 guint16
720 .temp 2 t
721 .temp 2 r
722 .temp 2 g
723 .temp 2 b
724 .temp 4 ag
725 .temp 4 rb
726
727 loadw t, bgr15
728 andw b, t, 0x7c00
729 andw g, t, 0x03e0
730 andw r, t, 0x001f
731 shruw b, b, 7
732 shruw g, g, 2
733 shlw r, r, 3
734 mergewl ag, 0xff, g
735 mergewl rb, r, b
736 shll rb, rb, 8
737 orl argb, ag, rb
738
739 .function video_orc_unpack_BGR15_be_trunc
740 .dest 4 argb guint32
741 .source 2 bgr15 guint16
742 .temp 2 t
743 .temp 2 r
744 .temp 2 g
745 .temp 2 b
746 .temp 4 ag
747 .temp 4 rb
748
749 loadw t, bgr15
750 andw b, t, 0x7c00
751 andw g, t, 0x03e0
752 andw r, t, 0x001f
753 shruw b, b, 7
754 shruw g, g, 2
755 shlw r, r, 3
756 mergewl ag, 0xff, g
757 mergewl rb, r, b
758 shll ag, ag, 8
759 orl argb, ag, rb
760
761 .function video_orc_pack_BGR15_le
762 .dest 2 rgb15 guint16
763 .source 4 argb guint32
764 .temp 4 t
765 .temp 4 r
766 .temp 4 g
767 .temp 4 b
768 .temp 4 t2
769
770 loadl t, argb
771 andl r, t, 0xf800
772 andl g, t, 0xf80000
773 andl b, t, 0xf8000000
774 shrul b, b, 17
775 shrul g, g, 14
776 shrul r, r, 11
777 orl t2, r, g
778 orl t2, t2, b
779 select0lw rgb15, t2
780
781 .function video_orc_pack_BGR15_be
782 .dest 2 rgb15 guint16
783 .source 4 argb guint32
784 .temp 4 t
785 .temp 4 r
786 .temp 4 g
787 .temp 4 b
788 .temp 4 t2
789
790 loadl t, argb
791 andl r, t, 0xf80000
792 andl g, t, 0xf800
793 andl b, t, 0xf8
794 shll b, b, 7
795 shrul g, g, 6
796 shrul r, r, 19
797 orl t2, r, g
798 orl t2, t2, b
799 select1lw rgb15, t2
800
801 .function video_orc_unpack_RGB16
802 .dest 4 argb guint32
803 .source 2 rgb16 guint16
804 .temp 2 t
805 .temp 2 r
806 .temp 2 g
807 .temp 2 b
808 .temp 4 ar
809 .temp 4 gb
810 .temp 8 t2
811
812 loadw t, rgb16
813 andw r, t, 0xf800
814 andw g, t, 0x07e0
815 andw b, t, 0x001f
816 shruw r, r, 6
817 shlw b, b, 5
818 mulhsw r, r, 0x4200
819 mulhsw g, g, 0x2080
820 mulhsw b, b, 0x4200
821 mergewl ar, 0xff, r
822 mergewl gb, g, b
823 mergelq t2, ar, gb
824 x4 convsuswb argb, t2
825
826 .function video_orc_unpack_RGB16_trunc
827 .dest 4 argb guint32
828 .source 2 rgb16 guint16
829 .temp 2 t
830 .temp 2 r
831 .temp 2 g
832 .temp 2 b
833 .temp 4 ar
834 .temp 4 gb
835 .temp 8 t2
836
837 loadw t, rgb16
838 andw r, t, 0xf800
839 andw g, t, 0x07e0
840 andw b, t, 0x001f
841 shruw r, r, 8
842 shruw g, g, 3
843 shlw b, b, 3
844 mergewl ar, 0xff, r
845 mergewl gb, g, b
846 mergelq t2, ar, gb
847 x4 convsuswb argb, t2
848
849 .function video_orc_pack_RGB16_le
850 .dest 2 rgb15 guint16
851 .source 4 argb guint32
852 .temp 4 t
853 .temp 4 r
854 .temp 4 g
855 .temp 4 b
856 .temp 4 t2
857
858 loadl t, argb
859 andl r, t, 0xf800
860 andl g, t, 0xfc0000
861 andl b, t, 0xf8000000
862 shrul g, g, 13
863 shrul b, b, 27
864 orl t2, r, g
865 orl t2, t2, b
866 select0lw rgb15, t2
867
868 .function video_orc_pack_RGB16_be
869 .dest 2 rgb16 guint16
870 .source 4 argb guint32
871 .temp 4 t
872 .temp 4 r
873 .temp 4 g
874 .temp 4 b
875 .temp 4 t2
876
877 loadl t, argb
878 andl r, t, 0xf80000
879 andl g, t, 0xfc00
880 andl b, t, 0xf8
881 shrul r, r, 8
882 shrul g, g, 5
883 shrul b, b, 3
884 orl t2, r, g
885 orl t2, t2, b
886 select1lw rgb16, t2
887
888 .function video_orc_unpack_BGR16
889 .dest 4 argb guint32
890 .source 2 bgr16 guint16
891 .temp 2 t
892 .temp 2 r
893 .temp 2 g
894 .temp 2 b
895 .temp 4 ar
896 .temp 4 gb
897 .temp 8 t2
898
899 loadw t, bgr16
900 andw b, t, 0xf800
901 andw g, t, 0x07e0
902 andw r, t, 0x001f
903 shruw b, b, 6
904 shlw r, r, 5
905 mulhsw b, b, 0x4200
906 mulhsw g, g, 0x2080
907 mulhsw r, r, 0x4200
908 mergewl ar, 0xff, r
909 mergewl gb, g, b
910 mergelq t2, ar, gb
911 x4 convsuswb argb, t2
912
913 .function video_orc_unpack_BGR16_trunc
914 .dest 4 argb guint32
915 .source 2 bgr16 guint16
916 .temp 2 t
917 .temp 2 r
918 .temp 2 g
919 .temp 2 b
920 .temp 4 ar
921 .temp 4 gb
922 .temp 8 t2
923
924 loadw t, bgr16
925 andw b, t, 0xf800
926 andw g, t, 0x07e0
927 andw r, t, 0x001f
928 shruw b, b, 8
929 shruw g, g, 3
930 shlw r, r, 3
931 mergewl ar, 0xff, r
932 mergewl gb, g, b
933 mergelq t2, ar, gb
934 x4 convsuswb argb, t2
935
936 .function video_orc_pack_BGR16_le
937 .dest 2 rgb15 guint16
938 .source 4 argb guint32
939 .temp 4 t
940 .temp 4 r
941 .temp 4 g
942 .temp 4 b
943 .temp 4 t2
944
945 loadl t, argb
946 andl r, t, 0xf800
947 andl g, t, 0xfc0000
948 andl b, t, 0xf8000000
949 shrul r, r, 11
950 shrul g, g, 13
951 shrul b, b, 16
952 orl t2, r, g
953 orl t2, t2, b
954 select0lw rgb15, t2
955
956 .function video_orc_pack_BGR16_be
957 .dest 2 rgb15 guint16
958 .source 4 argb guint32
959 .temp 4 t
960 .temp 4 r
961 .temp 4 g
962 .temp 4 b
963 .temp 4 t2
964
965 loadl t, argb
966 andl r, t, 0xf80000
967 andl g, t, 0xfc00
968 andl b, t, 0xf8
969 shll b, b, 8
970 shrul g, g, 5
971 shrul r, r, 19
972 orl t2, r, g
973 orl t2, t2, b
974 select1lw rgb15, t2
975
976 .function video_orc_resample_bilinear_u32
977 .dest 4 d1 guint8
978 .source 4 s1 guint8
979 .param 4 p1
980 .param 4 p2
981
982 ldreslinl d1, s1, p1, p2
983
984 .function video_orc_merge_linear_u8
985 .dest 1 d1
986 .source 1 s1
987 .source 1 s2
988 .param 1 p1
989 .temp 2 t1
990 .temp 2 t2
991 .temp 1 a
992 .temp 1 t
993
994 loadb a, s1
995 convubw t1, s1
996 convubw t2, s2
997 subw t2, t2, t1
998 mullw t2, t2, p1
999 addw t2, t2, 128
1000 convhwb t, t2
1001 addb d1, t, a
1002
1003
1004 .function video_orc_memset_2d
1005 .flags 2d
1006 .dest 1 d1 guint8
1007 .param 1 p1
1008
1009 storeb d1, p1
1010
1011 .function video_orc_memcpy_2d
1012 .flags 2d
1013 .dest 1 d1 guint8
1014 .source 1 s1 guint8
1015
1016 copyb d1, s1
1017
1018 .function video_orc_convert_u16_to_u8
1019 .source 2 s guint16
1020 .dest 1 d guint8
1021
1022 convhwb d, s
1023
1024 .function video_orc_convert_u8_to_u16
1025 .source 1 s guint8
1026 .dest 2 d guint16
1027
1028 mergebw d, s, s
1029
1030 .function video_orc_splat_u16
1031 .dest 2 d1 guint8
1032 .param 2 p1
1033
1034 storew d1, p1
1035
1036 .function video_orc_splat_u32
1037 .dest 4 d1 guint8
1038 .param 4 p1
1039
1040 storel d1, p1
1041
1042 .function video_orc_splat_u64
1043 .dest 8 d1 guint8
1044 .longparam 8 p1
1045
1046 storeq d1, p1
1047
1048 .function video_orc_splat2_u64
1049 .dest 8 d1 guint8
1050 .param 4 p1
1051 .temp 4 p
1052
1053 loadpl p, p1
1054 x4 mergebw d1, p, p
1055
1056 .function video_orc_convert_I420_UYVY
1057 .dest 4 d1 guint8
1058 .dest 4 d2 guint8
1059 .source 2 y1 guint8
1060 .source 2 y2 guint8
1061 .source 1 u guint8
1062 .source 1 v guint8
1063 .temp 2 uv
1064
1065 mergebw uv, u, v
1066 x2 mergebw d1, uv, y1
1067 x2 mergebw d2, uv, y2
1068
1069
1070 .function video_orc_convert_I420_YUY2
1071 .dest 4 d1 guint8
1072 .dest 4 d2 guint8
1073 .source 2 y1 guint8
1074 .source 2 y2 guint8
1075 .source 1 u guint8
1076 .source 1 v guint8
1077 .temp 2 uv
1078
1079 mergebw uv, u, v
1080 x2 mergebw d1, y1, uv
1081 x2 mergebw d2, y2, uv
1082
1083
1084
1085 .function video_orc_convert_I420_AYUV
1086 .dest 4 d1 guint8
1087 .dest 4 d2 guint8
1088 .source 1 y1 guint8
1089 .source 1 y2 guint8
1090 .source 1 u guint8
1091 .source 1 v guint8
1092 .param 1 alpha
1093 .temp 2 uv
1094 .temp 2 ay
1095 .temp 1 tu
1096 .temp 1 tv
1097
1098 loadupdb tu, u
1099 loadupdb tv, v
1100 mergebw uv, tu, tv
1101 mergebw ay, alpha, y1
1102 mergewl d1, ay, uv
1103 mergebw ay, alpha, y2
1104 mergewl d2, ay, uv
1105
1106
1107 .function video_orc_convert_YUY2_I420
1108 .dest 2 y1 guint8
1109 .dest 2 y2 guint8
1110 .dest 1 u guint8
1111 .dest 1 v guint8
1112 .source 4 yuv1 guint8
1113 .source 4 yuv2 guint8
1114 .temp 2 t1
1115 .temp 2 t2
1116 .temp 2 ty
1117
1118 x2 splitwb t1, ty, yuv1
1119 storew y1, ty
1120 x2 splitwb t2, ty, yuv2
1121 storew y2, ty
1122 x2 avgub t1, t1, t2
1123 splitwb v, u, t1
1124
1125
1126 .function video_orc_convert_UYVY_YUY2
1127 .flags 2d
1128 .dest 4 yuy2 guint8
1129 .source 4 uyvy guint8
1130
1131 x2 swapw yuy2, uyvy
1132
1133
1134 .function video_orc_planar_chroma_420_422
1135 .flags 2d
1136 .dest 1 d1 guint8
1137 .dest 1 d2 guint8
1138 .source 1 s guint8
1139
1140 copyb d1, s
1141 copyb d2, s
1142
1143
1144 .function video_orc_planar_chroma_420_444
1145 .flags 2d
1146 .dest 2 d1 guint8
1147 .dest 2 d2 guint8
1148 .source 1 s guint8
1149 .temp 2 t
1150
1151 splatbw t, s
1152 storew d1, t
1153 storew d2, t
1154
1155
1156 .function video_orc_planar_chroma_422_444
1157 .flags 2d
1158 .dest 2 d1 guint8
1159 .source 1 s guint8
1160 .temp 2 t
1161
1162 splatbw t, s
1163 storew d1, t
1164
1165
1166 .function video_orc_planar_chroma_444_422
1167 .flags 2d
1168 .dest 1 d guint8
1169 .source 2 s guint8
1170 .temp 1 t1
1171 .temp 1 t2
1172
1173 splitwb t1, t2, s
1174 avgub d, t1, t2
1175
1176
1177 .function video_orc_planar_chroma_444_420
1178 .flags 2d
1179 .dest 1 d guint8
1180 .source 2 s1 guint8
1181 .source 2 s2 guint8
1182 .temp 2 t
1183 .temp 1 t1
1184 .temp 1 t2
1185
1186 x2 avgub t, s1, s2
1187 splitwb t1, t2, t
1188 avgub d, t1, t2
1189
1190
1191 .function video_orc_planar_chroma_422_420
1192 .flags 2d
1193 .dest 1 d guint8
1194 .source 1 s1 guint8
1195 .source 1 s2 guint8
1196
1197 avgub d, s1, s2
1198
1199
1200 .function video_orc_convert_YUY2_AYUV
1201 .flags 2d
1202 .dest 8 ayuv guint8
1203 .source 4 yuy2 guint8
1204 .param 1 alpha
1205 .temp 2 yy
1206 .temp 2 uv
1207 .temp 4 ayay
1208 .temp 4 uvuv
1209
1210 x2 splitwb uv, yy, yuy2
1211 x2 mergebw ayay, alpha, yy
1212 mergewl uvuv, uv, uv
1213 x2 mergewl ayuv, ayay, uvuv
1214
1215
1216 .function video_orc_convert_UYVY_AYUV
1217 .flags 2d
1218 .dest 8 ayuv guint8
1219 .source 4 uyvy guint8
1220 .param 1 alpha
1221 .temp 2 yy
1222 .temp 2 uv
1223 .temp 4 ayay
1224 .temp 4 uvuv
1225
1226 x2 splitwb yy, uv, uyvy
1227 x2 mergebw ayay, alpha, yy
1228 mergewl uvuv, uv, uv
1229 x2 mergewl ayuv, ayay, uvuv
1230
1231
1232 .function video_orc_convert_YUY2_Y42B
1233 .flags 2d
1234 .dest 2 y guint8
1235 .dest 1 u guint8
1236 .dest 1 v guint8
1237 .source 4 yuy2 guint8
1238 .temp 2 uv
1239
1240 x2 splitwb uv, y, yuy2
1241 splitwb v, u, uv
1242
1243
1244 .function video_orc_convert_UYVY_Y42B
1245 .flags 2d
1246 .dest 2 y guint8
1247 .dest 1 u guint8
1248 .dest 1 v guint8
1249 .source 4 uyvy guint8
1250 .temp 2 uv
1251
1252 x2 splitwb y, uv, uyvy
1253 splitwb v, u, uv
1254
1255
1256 .function video_orc_convert_YUY2_Y444
1257 .flags 2d
1258 .dest 2 y guint8
1259 .dest 2 uu guint8
1260 .dest 2 vv guint8
1261 .source 4 yuy2 guint8
1262 .temp 2 uv
1263 .temp 1 u
1264 .temp 1 v
1265
1266 x2 splitwb uv, y, yuy2
1267 splitwb v, u, uv
1268 splatbw uu, u
1269 splatbw vv, v
1270
1271
1272 .function video_orc_convert_UYVY_Y444
1273 .flags 2d
1274 .dest 2 y guint8
1275 .dest 2 uu guint8
1276 .dest 2 vv guint8
1277 .source 4 uyvy guint8
1278 .temp 2 uv
1279 .temp 1 u
1280 .temp 1 v
1281
1282 x2 splitwb y, uv, uyvy
1283 splitwb v, u, uv
1284 splatbw uu, u
1285 splatbw vv, v
1286
1287
1288 .function video_orc_convert_UYVY_I420
1289 .dest 2 y1 guint8
1290 .dest 2 y2 guint8
1291 .dest 1 u guint8
1292 .dest 1 v guint8
1293 .source 4 yuv1 guint8
1294 .source 4 yuv2 guint8
1295 .temp 2 t1
1296 .temp 2 t2
1297 .temp 2 ty
1298
1299 x2 splitwb ty, t1, yuv1
1300 storew y1, ty
1301 x2 splitwb ty, t2, yuv2
1302 storew y2, ty
1303 x2 avgub t1, t1, t2
1304 splitwb v, u, t1
1305
1306
1307
1308 .function video_orc_convert_AYUV_I420
1309 .flags 2d
1310 .dest 2 y1 guint8
1311 .dest 2 y2 guint8
1312 .dest 1 u guint8
1313 .dest 1 v guint8
1314 .source 8 ayuv1 guint8
1315 .source 8 ayuv2 guint8
1316 .temp 4 ay
1317 .temp 4 uv1
1318 .temp 4 uv2
1319 .temp 4 uv
1320 .temp 2 uu
1321 .temp 2 vv
1322 .temp 1 t1
1323 .temp 1 t2
1324
1325 x2 splitlw uv1, ay, ayuv1
1326 x2 select1wb y1, ay
1327 x2 splitlw uv2, ay, ayuv2
1328 x2 select1wb y2, ay
1329 x4 avgub uv, uv1, uv2
1330 x2 splitwb vv, uu, uv
1331 splitwb t1, t2, uu
1332 avgub u, t1, t2
1333 splitwb t1, t2, vv
1334 avgub v, t1, t2
1335
1336
1337
1338 .function video_orc_convert_AYUV_YUY2
1339 .flags 2d
1340 .dest 4 yuy2 guint8
1341 .source 8 ayuv guint8
1342 .temp 2 yy
1343 .temp 2 uv1
1344 .temp 2 uv2
1345 .temp 4 ayay
1346 .temp 4 uvuv
1347
1348 x2 splitlw uvuv, ayay, ayuv
1349 splitlw uv1, uv2, uvuv
1350 x2 avgub uv1, uv1, uv2
1351 x2 select1wb yy, ayay
1352 x2 mergebw yuy2, yy, uv1
1353
1354
1355 .function video_orc_convert_AYUV_UYVY
1356 .flags 2d
1357 .dest 4 yuy2 guint8
1358 .source 8 ayuv guint8
1359 .temp 2 yy
1360 .temp 2 uv1
1361 .temp 2 uv2
1362 .temp 4 ayay
1363 .temp 4 uvuv
1364
1365 x2 splitlw uvuv, ayay, ayuv
1366 splitlw uv1, uv2, uvuv
1367 x2 avgub uv1, uv1, uv2
1368 x2 select1wb yy, ayay
1369 x2 mergebw yuy2, uv1, yy
1370
1371
1372
1373 .function video_orc_convert_AYUV_Y42B
1374 .flags 2d
1375 .dest 2 y guint8
1376 .dest 1 u guint8
1377 .dest 1 v guint8
1378 .source 8 ayuv guint8
1379 .temp 4 ayay
1380 .temp 4 uvuv
1381 .temp 2 uv1
1382 .temp 2 uv2
1383
1384 x2 splitlw uvuv, ayay, ayuv
1385 splitlw uv1, uv2, uvuv
1386 x2 avgub uv1, uv1, uv2
1387 splitwb v, u, uv1
1388 x2 select1wb y, ayay
1389
1390
1391 .function video_orc_convert_AYUV_Y444
1392 .flags 2d
1393 .dest 1 y guint8
1394 .dest 1 u guint8
1395 .dest 1 v guint8
1396 .source 4 ayuv guint8
1397 .temp 2 ay
1398 .temp 2 uv
1399
1400 splitlw uv, ay, ayuv
1401 splitwb v, u, uv
1402 select1wb y, ay
1403
1404
1405 .function video_orc_convert_Y42B_YUY2
1406 .flags 2d
1407 .dest 4 yuy2 guint8
1408 .source 2 y guint8
1409 .source 1 u guint8
1410 .source 1 v guint8
1411 .temp 2 uv
1412
1413 mergebw uv, u, v
1414 x2 mergebw yuy2, y, uv
1415
1416
1417 .function video_orc_convert_Y42B_UYVY
1418 .flags 2d
1419 .dest 4 uyvy guint8
1420 .source 2 y guint8
1421 .source 1 u guint8
1422 .source 1 v guint8
1423 .temp 2 uv
1424
1425 mergebw uv, u, v
1426 x2 mergebw uyvy, uv, y
1427
1428
1429 .function video_orc_convert_Y42B_AYUV
1430 .flags 2d
1431 .dest 8 ayuv guint8
1432 .source 2 yy guint8
1433 .source 1 u guint8
1434 .source 1 v guint8
1435 .param 1 alpha
1436 .temp 2 uv
1437 .temp 2 ay
1438 .temp 4 uvuv
1439 .temp 4 ayay
1440
1441 mergebw uv, u, v
1442 x2 mergebw ayay, alpha, yy
1443 mergewl uvuv, uv, uv
1444 x2 mergewl ayuv, ayay, uvuv
1445
1446
1447 .function video_orc_convert_Y444_YUY2
1448 .flags 2d
1449 .dest 4 yuy2 guint8
1450 .source 2 y guint8
1451 .source 2 u guint8
1452 .source 2 v guint8
1453 .temp 2 uv
1454 .temp 4 uvuv
1455 .temp 2 uv1
1456 .temp 2 uv2
1457
1458 x2 mergebw uvuv, u, v
1459 splitlw uv1, uv2, uvuv
1460 x2 avgub uv, uv1, uv2
1461 x2 mergebw yuy2, y, uv
1462
1463
1464 .function video_orc_convert_Y444_UYVY
1465 .flags 2d
1466 .dest 4 uyvy guint8
1467 .source 2 y guint8
1468 .source 2 u guint8
1469 .source 2 v guint8
1470 .temp 2 uv
1471 .temp 4 uvuv
1472 .temp 2 uv1
1473 .temp 2 uv2
1474
1475 x2 mergebw uvuv, u, v
1476 splitlw uv1, uv2, uvuv
1477 x2 avgub uv, uv1, uv2
1478 x2 mergebw uyvy, uv, y
1479
1480
1481 .function video_orc_convert_Y444_AYUV
1482 .flags 2d
1483 .dest 4 ayuv guint8
1484 .source 1 yy guint8
1485 .source 1 u guint8
1486 .source 1 v guint8
1487 .param 1 alpha
1488 .temp 2 uv
1489 .temp 2 ay
1490
1491 mergebw uv, u, v
1492 mergebw ay, alpha, yy
1493 mergewl ayuv, ay, uv
1494
1495
1496
1497 .function video_orc_convert_AYUV_ARGB
1498 .flags 2d
1499 .dest 4 argb guint8
1500 .source 4 ayuv guint8
1501 .param 2 p1
1502 .param 2 p2
1503 .param 2 p3
1504 .param 2 p4
1505 .param 2 p5
1506 .temp 1 a
1507 .temp 1 y
1508 .temp 1 u
1509 .temp 1 v
1510 .temp 2 wy
1511 .temp 2 wu
1512 .temp 2 wv
1513 .temp 2 wr
1514 .temp 2 wg
1515 .temp 2 wb
1516 .temp 1 r
1517 .temp 1 g
1518 .temp 1 b
1519 .temp 4 x
1520 .const 1 c128 128
1521
1522 x4 subb x, ayuv, c128 
1523 splitlw wv, wy, x
1524 splitwb y, a, wy
1525 splitwb v, u, wv
1526
1527 splatbw wy, y
1528 splatbw wu, u
1529 splatbw wv, v
1530
1531 mulhsw wy, wy, p1
1532
1533 mulhsw wr, wv, p2
1534 addw wr, wy, wr
1535 convssswb r, wr
1536 mergebw wr, a, r
1537
1538 mulhsw wb, wu, p3
1539 addw wb, wy, wb
1540 convssswb b, wb
1541
1542 mulhsw wg, wu, p4
1543 addw wg, wy, wg
1544 mulhsw wy, wv, p5
1545 addw wg, wg, wy
1546
1547 convssswb g, wg
1548
1549 mergebw wb, g, b
1550 mergewl x, wr, wb
1551 x4 addb argb, x, c128
1552
1553 .function video_orc_convert_AYUV_BGRA
1554 .flags 2d
1555 .dest 4 bgra guint8
1556 .source 4 ayuv guint8
1557 .param 2 p1
1558 .param 2 p2
1559 .param 2 p3
1560 .param 2 p4
1561 .param 2 p5
1562 .temp 1 a
1563 .temp 1 y
1564 .temp 1 u
1565 .temp 1 v
1566 .temp 2 wy
1567 .temp 2 wu
1568 .temp 2 wv
1569 .temp 2 wr
1570 .temp 2 wg
1571 .temp 2 wb
1572 .temp 1 r
1573 .temp 1 g
1574 .temp 1 b
1575 .temp 4 x
1576 .const 1 c128 128
1577
1578 x4 subb x, ayuv, c128 
1579 splitlw wv, wy, x
1580 splitwb y, a, wy
1581 splitwb v, u, wv
1582
1583 splatbw wy, y
1584 splatbw wu, u
1585 splatbw wv, v
1586
1587 mulhsw wy, wy, p1
1588
1589 mulhsw wr, wv, p2
1590 addw wr, wy, wr
1591 convssswb r, wr
1592 mergebw wr, r, a
1593
1594 mulhsw wb, wu, p3
1595 addw wb, wy, wb
1596 convssswb b, wb
1597
1598 mulhsw wg, wu, p4
1599 addw wg, wy, wg
1600 mulhsw wy, wv, p5
1601 addw wg, wg, wy
1602
1603 convssswb g, wg
1604
1605 mergebw wb, b, g
1606 mergewl x, wb, wr
1607 x4 addb bgra, x, c128
1608
1609
1610 .function video_orc_convert_AYUV_ABGR
1611 .flags 2d
1612 .dest 4 argb guint8
1613 .source 4 ayuv guint8
1614 .param 2 p1
1615 .param 2 p2
1616 .param 2 p3
1617 .param 2 p4
1618 .param 2 p5
1619 .temp 1 a
1620 .temp 1 y
1621 .temp 1 u
1622 .temp 1 v
1623 .temp 2 wy
1624 .temp 2 wu
1625 .temp 2 wv
1626 .temp 2 wr
1627 .temp 2 wg
1628 .temp 2 wb
1629 .temp 1 r
1630 .temp 1 g
1631 .temp 1 b
1632 .temp 4 x
1633 .const 1 c128 128
1634
1635 x4 subb x, ayuv, c128 
1636 splitlw wv, wy, x
1637 splitwb y, a, wy
1638 splitwb v, u, wv
1639
1640 splatbw wy, y
1641 splatbw wu, u
1642 splatbw wv, v
1643
1644 mulhsw wy, wy, p1
1645
1646 mulhsw wr, wv, p2
1647 addw wr, wy, wr
1648 convssswb r, wr
1649
1650 mulhsw wb, wu, p3
1651 addw wb, wy, wb
1652 convssswb b, wb
1653 mergebw wb, a, b
1654
1655 mulhsw wg, wu, p4
1656 addw wg, wy, wg
1657 mulhsw wy, wv, p5
1658 addw wg, wg, wy
1659
1660 convssswb g, wg
1661
1662 mergebw wr, g, r
1663 mergewl x, wb, wr
1664 x4 addb argb, x, c128
1665
1666 .function video_orc_convert_AYUV_RGBA
1667 .flags 2d
1668 .dest 4 argb guint8
1669 .source 4 ayuv guint8
1670 .param 2 p1
1671 .param 2 p2
1672 .param 2 p3
1673 .param 2 p4
1674 .param 2 p5
1675 .temp 1 a
1676 .temp 1 y
1677 .temp 1 u
1678 .temp 1 v
1679 .temp 2 wy
1680 .temp 2 wu
1681 .temp 2 wv
1682 .temp 2 wr
1683 .temp 2 wg
1684 .temp 2 wb
1685 .temp 1 r
1686 .temp 1 g
1687 .temp 1 b
1688 .temp 4 x
1689 .const 1 c128 128
1690
1691 x4 subb x, ayuv, c128 
1692 splitlw wv, wy, x
1693 splitwb y, a, wy
1694 splitwb v, u, wv
1695
1696 splatbw wy, y
1697 splatbw wu, u
1698 splatbw wv, v
1699
1700 mulhsw wy, wy, p1
1701
1702 mulhsw wr, wv, p2
1703 addw wr, wy, wr
1704 convssswb r, wr
1705
1706 mulhsw wb, wu, p3
1707 addw wb, wy, wb
1708 convssswb b, wb
1709 mergebw wb, b, a
1710
1711 mulhsw wg, wu, p4
1712 addw wg, wy, wg
1713 mulhsw wy, wv, p5
1714 addw wg, wg, wy
1715
1716 convssswb g, wg
1717
1718 mergebw wr, r, g
1719 mergewl x, wr, wb
1720 x4 addb argb, x, c128
1721
1722 .function video_orc_convert_I420_BGRA
1723 .dest 4 argb guint8
1724 .source 1 y guint8
1725 .source 1 u guint8
1726 .source 1 v guint8
1727 .param 2 p1
1728 .param 2 p2
1729 .param 2 p3
1730 .param 2 p4
1731 .param 2 p5
1732 .temp 2 wy
1733 .temp 2 wu
1734 .temp 2 wv
1735 .temp 2 wr
1736 .temp 2 wg
1737 .temp 2 wb
1738 .temp 1 r
1739 .temp 1 g
1740 .temp 1 b
1741 .temp 4 x
1742 .const 1 c128 128
1743 .const 4 c4128 128
1744
1745 subb r, y, c128
1746 splatbw wy, r
1747 loadupdb r, u
1748 subb r, r, c128
1749 splatbw wu, r
1750 loadupdb r, v
1751 subb r, r, c128
1752 splatbw wv, r
1753
1754 mulhsw wy, wy, p1
1755
1756 mulhsw wr, wv, p2
1757 addw wr, wy, wr
1758 convssswb r, wr
1759 mergebw wr, r, 127
1760
1761 mulhsw wb, wu, p3
1762 addw wb, wy, wb
1763 convssswb b, wb
1764
1765 mulhsw wg, wu, p4
1766 addw wg, wy, wg
1767 mulhsw wy, wv, p5
1768 addw wg, wg, wy
1769
1770 convssswb g, wg
1771
1772 mergebw wb, b, g
1773 mergewl x, wb, wr
1774 x4 addb argb, x, c4128
1775
1776 .function video_orc_convert_I420_ARGB
1777 .dest 4 argb guint8
1778 .source 1 y guint8
1779 .source 1 u guint8
1780 .source 1 v guint8
1781 .param 2 p1
1782 .param 2 p2
1783 .param 2 p3
1784 .param 2 p4
1785 .param 2 p5
1786 .temp 2 wy
1787 .temp 2 wu
1788 .temp 2 wv
1789 .temp 2 wr
1790 .temp 2 wg
1791 .temp 2 wb
1792 .temp 1 r
1793 .temp 1 g
1794 .temp 1 b
1795 .temp 4 x
1796 .const 1 c128 128
1797 .const 4 c4128 128
1798
1799 subb r, y, c128
1800 splatbw wy, r
1801 loadupdb r, u
1802 subb r, r, c128
1803 splatbw wu, r
1804 loadupdb r, v
1805 subb r, r, c128
1806 splatbw wv, r
1807
1808 mulhsw wy, wy, p1
1809
1810 mulhsw wr, wv, p2
1811 addw wr, wy, wr
1812 convssswb r, wr
1813 mergebw wr, 127, r
1814
1815 mulhsw wb, wu, p3
1816 addw wb, wy, wb
1817 convssswb b, wb
1818
1819 mulhsw wg, wu, p4
1820 addw wg, wy, wg
1821 mulhsw wy, wv, p5
1822 addw wg, wg, wy
1823
1824 convssswb g, wg
1825
1826 mergebw wb, g, b
1827 mergewl x, wr, wb
1828 x4 addb argb, x, c4128
1829
1830 .function video_orc_matrix8
1831 .backup _custom_video_orc_matrix8
1832 .source 4 argb guint8
1833 .dest 4 ayuv guint8
1834 .longparam 8 p1
1835 .longparam 8 p2
1836 .longparam 8 p3
1837 .longparam 8 p4
1838 .const 1 c128 128
1839 .temp 2 w1
1840 .temp 2 w2
1841 .temp 1 b1
1842 .temp 1 b2
1843 .temp 4 l1
1844 .temp 4 ayuv2
1845 .temp 8 aq
1846 .temp 8 q1
1847 .temp 8 pr1
1848 .temp 8 pr2
1849 .temp 8 pr3
1850
1851 loadpq pr1, p1
1852 loadpq pr2, p2
1853 loadpq pr3, p3
1854
1855 x4 subb l1, argb, c128
1856
1857 select0lw w1, l1
1858 select1lw w2, l1
1859 select0wb b1, w1
1860 select1wb b2, w1
1861
1862 convubw w1, b1
1863 convuwl l1, w1
1864 x4 mergebw aq, l1, l1
1865
1866 splatbl l1, b2
1867 mergelq q1, l1, l1
1868 x4 mulhsw q1, q1, pr1
1869 x4 addw aq, aq, q1
1870
1871 select0wb b1, w2
1872 splatbl l1,b1
1873 mergelq q1, l1, l1
1874 x4 mulhsw q1, q1, pr2
1875 x4 addw aq, aq, q1
1876
1877 select1wb b2, w2
1878 splatbl l1, b2
1879 mergelq q1, l1, l1
1880 x4 mulhsw q1, q1, pr3
1881 x4 addw aq, aq, q1
1882
1883 x4 convssswb ayuv2, aq
1884 x4 addb ayuv, ayuv2, c128
1885
1886 #.function video_orc_resample_h_near_u32
1887 #.source 4 src guint32
1888 #.source 4 idx
1889 #.dest 4 dest guint32
1890 #.temp 4 t
1891 #
1892 #loadidxl t, src, idx
1893 #storel dest, t
1894
1895 .function video_orc_resample_h_near_u32_lq
1896 .dest 4 d1 guint32
1897 .source 4 s1 guint32
1898 .param 4 p1
1899 .param 4 p2
1900
1901 ldresnearl d1, s1, p1, p2
1902
1903 .function video_orc_resample_h_2tap_1u8_lq
1904 .dest 1 d1 guint8
1905 .source 1 s1 guint8
1906 .param 4 p1
1907 .param 4 p2
1908
1909 ldreslinb d1, s1, p1, p2
1910
1911 .function video_orc_resample_h_2tap_4u8_lq
1912 .dest 4 d1 guint32
1913 .source 4 s1 guint32
1914 .param 4 p1
1915 .param 4 p2
1916
1917 ldreslinl d1, s1, p1, p2
1918
1919 .function video_orc_resample_h_2tap_u8_lq
1920 .source 1 s1 guint8
1921 .source 1 s2 guint8
1922 .source 2 t1 gint16
1923 .source 2 t2 gint16
1924 .dest 1 d guint8
1925 .temp 2 w1
1926 .temp 2 w2
1927
1928 convubw w1, s1
1929 mullw w1, w1, t1
1930 convubw w2, s2
1931 mullw w2, w2, t2
1932 addw w1, w1, w2
1933 addw w1, w1, 32
1934 shrsw w1, w1, 6
1935 convsuswb d, w1
1936
1937 .function video_orc_resample_h_2tap_u16
1938 .source 2 s1 guint16
1939 .source 2 s2 guint16
1940 .source 2 t1 gint16
1941 .source 2 t2 gint16
1942 .dest 2 d guint16
1943 .temp 4 w1
1944 .temp 4 w2
1945 .temp 4 tl1
1946 .temp 4 tl2
1947
1948 convuwl w1, s1
1949 convswl tl1, t1
1950 mulll w1, w1, tl1
1951 convuwl w2, s2
1952 convswl tl2, t2
1953 mulll w2, w2, tl2
1954 addl w1, w1, w2
1955 addl w1, w1, 4096
1956 shrsl w1, w1, 12
1957 convsuslw d, w1
1958
1959 .function video_orc_resample_v_2tap_u8_lq
1960 .source 1 src1 guint8
1961 .source 1 src2 guint8
1962 .dest 1 dest guint8
1963 .param 2 p1 gint16
1964 .temp 1 t
1965 .temp 2 w1
1966 .temp 2 w2
1967
1968 convubw w1, src1
1969 convubw w2, src2
1970 subw w2, w2, w1
1971 mullw w2, w2, p1
1972 addw w2, w2, 128
1973 convhwb t, w2
1974 addb dest, t, src1
1975
1976 .function video_orc_resample_v_2tap_u16
1977 .source 2 src1 guint16
1978 .source 2 src2 guint16
1979 .dest 2 dest guint16
1980 .param 2 p1 gint16
1981 .temp 4 l1
1982 .temp 4 l2
1983 .temp 4 l3
1984
1985 convuwl l1, src1
1986 convuwl l2, src2
1987 subl l2, l2, l1
1988 convuwl l3, p1
1989 mulll l2, l2, l3
1990 addl l2, l2, 4096
1991 shrsl l2, l2, 12
1992 addl l1, l1, l2
1993 convsuslw dest, l1
1994
1995 .function video_orc_resample_v_2tap_u8
1996 .source 1 s1 guint8
1997 .source 1 s2 guint8
1998 .dest 1 d1 guint8
1999 .param 2 p1 gint16
2000 .temp 1 t
2001 .temp 2 w1
2002 .temp 2 w2
2003 .temp 4 t1
2004 .temp 4 t2
2005
2006 convubw w1, s1
2007 convubw w2, s2
2008 subw w2, w2, w1
2009 mulswl t2, w2, p1
2010 addl t2, t2, 4095
2011 shrsl t2, t2, 12
2012 convlw w2, t2
2013 addw w2, w2, w1
2014 convsuswb d1, w2
2015
2016 .function video_orc_resample_v_4tap_u8_lq
2017 .source 1 s1 guint8
2018 .source 1 s2 guint8
2019 .source 1 s3 guint8
2020 .source 1 s4 guint8
2021 .dest 1 d1 guint8
2022 .param 2 p1 gint16
2023 .param 2 p2 gint16
2024 .param 2 p3 gint16
2025 .param 2 p4 gint16
2026 .temp 2 w1
2027 .temp 2 w2
2028
2029 convubw w1, s1
2030 mullw w1, w1, p1
2031 convubw w2, s2
2032 mullw w2, w2, p2
2033 addw w1, w1, w2
2034 convubw w2, s3
2035 mullw w2, w2, p3
2036 addw w1, w1, w2
2037 convubw w2, s4
2038 mullw w2, w2, p4
2039 addw w1, w1, w2
2040 addw w1, w1, 32
2041 shrsw w1, w1, 6
2042 convsuswb d1, w1
2043
2044 .function video_orc_resample_v_4tap_u8
2045 .source 1 s1 guint8
2046 .source 1 s2 guint8
2047 .source 1 s3 guint8
2048 .source 1 s4 guint8
2049 .dest 1 d1 guint8
2050 .param 2 p1 gint16
2051 .param 2 p2 gint16
2052 .param 2 p3 gint16
2053 .param 2 p4 gint16
2054 .temp 2 w1
2055 .temp 2 w2
2056 .temp 4 t1
2057 .temp 4 t2
2058
2059 convubw w1, s1
2060 mulswl t1, w1, p1
2061 convubw w2, s2
2062 mulswl t2, w2, p2
2063 addl t1, t1, t2
2064 convubw w2, s3
2065 mulswl t2, w2, p3
2066 addl t1, t1, t2
2067 convubw w2, s4
2068 mulswl t2, w2, p4
2069 addl t1, t1, t2
2070 addl t1, t1, 4095
2071 shrsl t1, t1, 12
2072 convsuslw w1, t1
2073 convsuswb d1, w1
2074
2075 # crashes ORC for now but is potentially faster
2076 #.function video_orc_resample_h_4tap_u8
2077 #.source 1 s1 guint8
2078 #.source 1 s2 guint8
2079 #.source 1 s3 guint8
2080 #.source 1 s4 guint8
2081 #.source 2 t1 gint16
2082 #.source 2 t2 gint16
2083 #.source 2 t3 gint16
2084 #.source 2 t4 gint16
2085 #.dest 1 d1 guint8
2086 #.temp 2 w1
2087 #.temp 2 w2
2088 #.temp 4 l1
2089 #.temp 4 l2
2090 #
2091 #convubw w1, s1
2092 #mulswl l1, w1, t1
2093 #convubw w2, s2
2094 #mulswl l2, w2, t2
2095 #addl l1, l1, l2
2096 #convubw w2, s3
2097 #mulswl l2, w2, t3
2098 #addl l1, l1, l2
2099 #convubw w2, s4
2100 #mulswl l2, w2, t4
2101 #addl l1, l1, l2
2102 #addl l1, l1, 4095
2103 #shrsl l1, l1, 12
2104 #convsuslw w1, l1
2105 #convsuswb d1, w1
2106
2107 .function video_orc_resample_h_multaps_u8
2108 .source 1 s guint8
2109 .source 2 t gint16
2110 .dest 4 d gint32
2111 .temp 2 w1
2112
2113 convubw w1, s
2114 mulswl d, w1, t
2115
2116 .function video_orc_resample_h_muladdtaps_u8
2117 .flags 2d
2118 .source 1 s guint8
2119 .source 2 t gint16
2120 .dest 4 d gint32
2121 .temp 2 w1
2122 .temp 4 t1
2123
2124 convubw w1, s
2125 mulswl t1, w1, t
2126 addl d, d, t1
2127
2128 .function video_orc_resample_scaletaps_u8
2129 .source 4 s gint32
2130 .dest 1 d guint8
2131 .temp 2 w1
2132 .temp 4 t1
2133
2134 addl t1, s, 4095
2135 shrsl t1, t1, 12
2136 convsuslw w1, t1
2137 convsuswb d, w1
2138
2139 .function video_orc_resample_h_multaps_u8_lq
2140 .source 1 s guint8
2141 .source 2 t gint16
2142 .dest 2 d gint16
2143 .temp 2 w1
2144
2145 convubw w1, s
2146 mullw d, w1, t
2147
2148 .function video_orc_resample_h_muladdtaps_u8_lq
2149 .flags 2d
2150 .source 1 s guint8
2151 .source 2 t gint16
2152 .dest 2 d gint16
2153 .temp 2 w1
2154
2155 convubw w1, s
2156 mullw w1, w1, t
2157 addw d, d, w1
2158
2159 .function video_orc_resample_h_multaps3_u8_lq
2160 .source 1 s1 guint8
2161 .source 1 s2 guint8
2162 .source 1 s3 guint8
2163 .source 2 t1 gint16
2164 .source 2 t2 gint16
2165 .source 2 t3 gint16
2166 .dest 2 d gint16
2167 .temp 2 w1
2168 .temp 2 w2
2169
2170 convubw w1, s1
2171 mullw w1, w1, t1
2172 convubw w2, s2
2173 mullw w2, w2, t2
2174 addw w1, w1, w2
2175 convubw w2, s3
2176 mullw w2, w2, t3
2177 addw d, w1, w2
2178
2179 .function video_orc_resample_h_muladdtaps3_u8_lq
2180 .source 1 s1 guint8
2181 .source 1 s2 guint8
2182 .source 1 s3 guint8
2183 .source 2 t1 gint16
2184 .source 2 t2 gint16
2185 .source 2 t3 gint16
2186 .dest 2 d gint16
2187 .temp 2 w1
2188 .temp 2 w2
2189
2190 convubw w1, s1
2191 mullw w1, w1, t1
2192 convubw w2, s2
2193 mullw w2, w2, t2
2194 addw w1, w1, w2
2195 convubw w2, s3
2196 mullw w2, w2, t3
2197 addw w1, w1, w2
2198 addw d, d, w1
2199
2200 .function video_orc_resample_h_muladdscaletaps3_u8_lq
2201 .source 1 s1 guint8
2202 .source 1 s2 guint8
2203 .source 1 s3 guint8
2204 .source 2 t1 gint16
2205 .source 2 t2 gint16
2206 .source 2 t3 gint16
2207 .source 2 temp gint16
2208 .dest 1 d guint8
2209 .temp 2 w1
2210 .temp 2 w2
2211
2212 convubw w1, s1
2213 mullw w1, w1, t1
2214 convubw w2, s2
2215 mullw w2, w2, t2
2216 addw w1, w1, w2
2217 convubw w2, s3
2218 mullw w2, w2, t3
2219 addw w1, w1, w2
2220 addw w1, w1, temp
2221 addw w1, w1, 32
2222 shrsw w1, w1, 6
2223 convsuswb d, w1
2224
2225 .function video_orc_resample_scaletaps_u8_lq
2226 .source 2 s gint16
2227 .dest 1 d guint8
2228 .temp 2 w1
2229
2230 addw w1, s, 32
2231 shrsw w1, w1, 6
2232 convsuswb d, w1
2233
2234 .function video_orc_resample_h_multaps_u16
2235 .source 2 s guint16
2236 .source 2 t gint16
2237 .dest 4 d gint32
2238 .temp 4 l1
2239 .temp 4 l2
2240
2241 convuwl l1, s
2242 convswl l2, t
2243 mulll d, l1, l2
2244
2245 .function video_orc_resample_h_muladdtaps_u16
2246 .flags 2d
2247 .source 2 s guint16
2248 .source 2 t gint16
2249 .dest 4 d gint32
2250 .temp 4 l1
2251 .temp 4 l2
2252
2253 convuwl l1, s
2254 convswl l2, t
2255 mulll l1, l1, l2
2256 addl d, d, l1
2257
2258 .function video_orc_resample_scaletaps_u16
2259 .source 4 s gint32
2260 .dest 2 d guint16
2261 .temp 4 t1
2262
2263 addl t1, s, 4095
2264 shrsl t1, t1, 12
2265 convsuslw d, t1
2266
2267 .function video_orc_resample_v_multaps_u8
2268 .source 1 s guint8
2269 .param 2 t gint16
2270 .dest 4 d gint32
2271 .temp 2 w1
2272
2273 convubw w1, s
2274 mulswl d, w1, t
2275
2276 .function video_orc_resample_v_muladdtaps_u8
2277 .source 1 s guint8
2278 .param 2 t gint16
2279 .dest 4 d gint32
2280 .temp 2 w1
2281 .temp 4 t1
2282
2283 convubw w1, s
2284 mulswl t1, w1, t
2285 addl d, d, t1
2286
2287 .function video_orc_resample_v_multaps_u16
2288 .source 2 s guint16
2289 .param 2 t gint16
2290 .dest 4 d gint32
2291 .temp 4 l1
2292
2293 convuwl l1, s
2294 mulll d, l1, t
2295
2296 .function video_orc_resample_v_muladdtaps_u16
2297 .source 2 s guint16
2298 .param 2 t gint16
2299 .dest 4 d gint32
2300 .temp 4 t1
2301 .temp 4 t2
2302
2303 convuwl t1, s
2304 convswl t2, t
2305 mulll t1, t1, t2
2306 addl d, d, t1
2307
2308 .function video_orc_resample_v_multaps_u8_lq
2309 .source 1 s guint8
2310 .param 2 t gint16
2311 .dest 2 d gint16
2312 .temp 2 w1
2313
2314 convubw w1, s
2315 mullw d, w1, t
2316
2317 .function video_orc_resample_v_multaps4_u8_lq
2318 .source 1 s1 guint8
2319 .source 1 s2 guint8
2320 .source 1 s3 guint8
2321 .source 1 s4 guint8
2322 .param 2 t1 gint16
2323 .param 2 t2 gint16
2324 .param 2 t3 gint16
2325 .param 2 t4 gint16
2326 .dest 2 d gint16
2327 .temp 2 w1
2328 .temp 2 w2
2329
2330 convubw w1, s1
2331 mullw w1, w1, t1
2332 convubw w2, s2
2333 mullw w2, w2, t2
2334 addw w1, w1, w2
2335 convubw w2, s3
2336 mullw w2, w2, t3
2337 addw w1, w1, w2
2338 convubw w2, s4
2339 mullw w2, w2, t4
2340 addw d, w1, w2
2341
2342 .function video_orc_resample_v_muladdtaps_u8_lq
2343 .source 1 s guint8
2344 .param 2 t gint16
2345 .dest 2 d gint16
2346 .temp 2 w1
2347
2348 convubw w1, s
2349 mullw w1, w1, t
2350 addw d, d, w1
2351
2352 .function video_orc_resample_v_muladdtaps4_u8_lq
2353 .source 1 s1 guint8
2354 .source 1 s2 guint8
2355 .source 1 s3 guint8
2356 .source 1 s4 guint8
2357 .param 2 t1 gint16
2358 .param 2 t2 gint16
2359 .param 2 t3 gint16
2360 .param 2 t4 gint16
2361 .dest 2 d gint16
2362 .temp 2 w1
2363 .temp 2 w2
2364
2365 convubw w1, s1
2366 mullw w1, w1, t1
2367 convubw w2, s2
2368 mullw w2, w2, t2
2369 addw w1, w1, w2
2370 convubw w2, s3
2371 mullw w2, w2, t3
2372 addw w1, w1, w2
2373 convubw w2, s4
2374 mullw w2, w2, t4
2375 addw w1, w1, w2
2376 addw d, d, w1
2377
2378 .function video_orc_resample_v_muladdscaletaps4_u8_lq
2379 .source 1 s1 guint8
2380 .source 1 s2 guint8
2381 .source 1 s3 guint8
2382 .source 1 s4 guint8
2383 .source 2 temp gint16
2384 .param 2 t1 gint16
2385 .param 2 t2 gint16
2386 .param 2 t3 gint16
2387 .param 2 t4 gint16
2388 .dest 1 d guint8
2389 .temp 2 w1
2390 .temp 2 w2
2391
2392 convubw w1, s1
2393 mullw w1, w1, t1
2394 convubw w2, s2
2395 mullw w2, w2, t2
2396 addw w1, w1, w2
2397 convubw w2, s3
2398 mullw w2, w2, t3
2399 addw w1, w1, w2
2400 convubw w2, s4
2401 mullw w2, w2, t4
2402 addw w1, w1, w2
2403 addw w1, w1, temp
2404 addw w1, w1, 32
2405 shrsw w1, w1, 6
2406 convsuswb d, w1
2407
2408 .function video_orc_chroma_down_h2_u8
2409 .source 8 s guint8
2410 .dest 8 d guint8
2411 .temp 4 ayuv1
2412 .temp 4 ayuv2
2413 .temp 2 ay1
2414 .temp 2 uv1
2415 .temp 2 uv2
2416
2417 splitql ayuv2, ayuv1, s
2418 splitlw uv1, ay1, ayuv1
2419 select1lw uv2, ayuv2
2420 x2 avgub uv1, uv1, uv2
2421 mergewl ayuv1, ay1, uv1
2422 mergelq d, ayuv1, ayuv2
2423
2424 #.function video_orc_chroma_up_h2_cs_u8
2425 #.source 8 s guint8
2426 #.source 4 s1 guint8
2427 #.dest 8 d guint8
2428 #.temp 4 ayuv1
2429 #.temp 4 ayuv2
2430 #.temp 4 ayuv3
2431 #.temp 2 ay2
2432 #.temp 2 uv2
2433 #.temp 2 uv3
2434 #
2435 #splitql ayuv2, ayuv1, s
2436 #ldresnearl ayuv3, s1, 0x20000, 0x20000
2437 #splitlw uv2, ay2, ayuv2
2438 #select1lw uv3, ayuv3
2439 #x2 avgub uv2, uv2, uv3
2440 #mergewl ayuv2, ay2, uv2
2441 #mergelq d, ayuv1, ayuv2
2442
2443 .function video_orc_chroma_down_v2_u8
2444 .source 4 s1 guint8
2445 .source 4 s2 guint8
2446 .dest 4 d guint8
2447 .temp 2 ay1
2448 .temp 2 uv1
2449 .temp 2 uv2
2450
2451 splitlw uv1, ay1, s1
2452 select1lw uv2, s2
2453 x2 avgub uv1, uv1, uv2
2454 mergewl d, ay1, uv1
2455
2456 .function video_orc_chroma_up_v2_u8
2457 .source 4 s1 guint8
2458 .source 4 s2 guint8
2459 .dest 4 d1 guint8
2460 .dest 4 d2 guint8
2461 .temp 2 ay1
2462 .temp 2 ay2
2463 .temp 2 uv1
2464 .temp 2 uv2
2465 .temp 4 uuvv1
2466 .temp 4 uuvv2
2467 .temp 4 uuvv3
2468
2469 splitlw uv1, ay1, s1
2470 splitlw uv2, ay2, s2
2471 x2 convubw uuvv1, uv1
2472 x2 convubw uuvv2, uv2
2473
2474 x2 mullw uuvv3, uuvv1, 3
2475 x2 addw uuvv3, uuvv3, uuvv2
2476 x2 addw uuvv3, uuvv3, 2
2477 x2 shruw uuvv3, uuvv3, 2
2478 x2 convsuswb uv1, uuvv3
2479 mergewl d1, ay1, uv1
2480
2481 x2 mullw uuvv3, uuvv2, 3
2482 x2 addw uuvv3, uuvv3, uuvv1
2483 x2 addw uuvv3, uuvv3, 2
2484 x2 shruw uuvv3, uuvv3, 2
2485 x2 convsuswb uv2, uuvv3
2486 mergewl d2, ay2, uv2
2487
2488 .function video_orc_chroma_up_v2_u16
2489 .source 8 s1 guint16
2490 .source 8 s2 guint16
2491 .dest 8 d1 guint16
2492 .dest 8 d2 guint16
2493 .temp 4 ay1
2494 .temp 4 ay2
2495 .temp 4 uv1
2496 .temp 4 uv2
2497 .temp 8 uuvv1
2498 .temp 8 uuvv2
2499 .temp 8 uuvv3
2500
2501 splitql uv1, ay1, s1
2502 splitql uv2, ay2, s2
2503 x2 convuwl uuvv1, uv1
2504 x2 convuwl uuvv2, uv2
2505
2506 x2 mulll uuvv3, uuvv1, 3
2507 x2 addl uuvv3, uuvv3, uuvv2
2508 x2 addl uuvv3, uuvv3, 2
2509 x2 shrul uuvv3, uuvv3, 2
2510 x2 convsuslw uv1, uuvv3
2511 mergelq d1, ay1, uv1
2512
2513 x2 mulll uuvv3, uuvv2, 3
2514 x2 addl uuvv3, uuvv3, uuvv1
2515 x2 addl uuvv3, uuvv3, 2
2516 x2 shrul uuvv3, uuvv3, 2
2517 x2 convsuslw uv2, uuvv3
2518 mergelq d2, ay2, uv2
2519
2520 .function video_orc_chroma_down_v2_u16
2521 .source 8 s1 guint16
2522 .source 8 s2 guint16
2523 .dest 8 d guint16
2524 .temp 4 ay1
2525 .temp 4 uv1
2526 .temp 4 uv2
2527
2528 splitql uv1, ay1, s1
2529 select1ql uv2, s2
2530 x2 avguw uv1, uv1, uv2
2531 mergelq d, ay1, uv1
2532
2533
2534 .function video_orc_chroma_down_v4_u8
2535 .source 4 s1 guint8
2536 .source 4 s2 guint8
2537 .source 4 s3 guint8
2538 .source 4 s4 guint8
2539 .dest 4 d guint8
2540 .temp 2 ay1
2541 .temp 2 uv1
2542 .temp 4 uuvv1
2543 .temp 4 uuvv2
2544 .temp 4 uuvv3
2545
2546 splitlw uv1, ay1, s1
2547 x2 convubw uuvv1, uv1
2548 select1lw uv1, s4
2549 x2 convubw uuvv2, uv1
2550 x2 addw uuvv3, uuvv1, uuvv2
2551 select1lw uv1, s2
2552 x2 convubw uuvv1, uv1
2553 select1lw uv1, s3
2554 x2 convubw uuvv2, uv1
2555 x2 addw uuvv1, uuvv1, uuvv2
2556 x2 shlw uuvv2, uuvv1, 1
2557 x2 addw uuvv1, uuvv1, uuvv2
2558 x2 addw uuvv3, uuvv3, uuvv1
2559 x2 addw uuvv3, uuvv3, 4
2560 x2 shruw uuvv3, uuvv3, 3
2561 x2 convsuswb uv1, uuvv3
2562 mergewl d, ay1, uv1
2563
2564 .function video_orc_chroma_down_v4_u16
2565 .source 8 s1 guint16
2566 .source 8 s2 guint16
2567 .source 8 s3 guint16
2568 .source 8 s4 guint16
2569 .dest 8 d guint16
2570 .temp 4 ay1
2571 .temp 4 uv1
2572 .temp 8 uuvv1
2573 .temp 8 uuvv2
2574 .temp 8 uuvv3
2575
2576 splitql uv1, ay1, s1
2577 x2 convuwl uuvv1, uv1
2578 select1ql uv1, s4
2579 x2 convuwl uuvv2, uv1
2580 x2 addl uuvv3, uuvv1, uuvv2
2581 select1ql uv1, s2
2582 x2 convuwl uuvv1, uv1
2583 select1ql uv1, s3
2584 x2 convuwl uuvv2, uv1
2585 x2 addl uuvv1, uuvv1, uuvv2
2586 x2 shll uuvv2, uuvv1, 1
2587 x2 addl uuvv1, uuvv1, uuvv2
2588 x2 addl uuvv3, uuvv3, uuvv1
2589 x2 addl uuvv3, uuvv3, 4
2590 x2 shrul uuvv3, uuvv3, 3
2591 x2 convsuslw uv1, uuvv3
2592 mergelq d, ay1, uv1
2593
2594 .function video_orc_dither_none_4u8_mask
2595 .dest 4 p guint8
2596 .param 4 masks
2597 .temp 4 m
2598
2599 loadpl m, masks
2600 x4 andnb p, m, p
2601
2602 .function video_orc_dither_none_4u16_mask
2603 .dest 8 p guint16
2604 .longparam 8 masks
2605 .temp 8 m
2606
2607 loadpq m, masks
2608 x4 andnw p, m, p
2609
2610 .function video_orc_dither_verterr_4u8_mask
2611 .dest 4 p guint8
2612 .dest 8 e guint16
2613 .longparam 8 masks
2614 .temp 8 m
2615 .temp 8 t1
2616
2617 loadpq m, masks
2618 x4 convubw t1, p
2619 x4 addw t1, e, t1
2620 x4 andw e, m, t1
2621 x4 andnw t1, m, t1
2622 x4 convsuswb p, t1
2623
2624 .function video_orc_dither_fs_muladd_u8
2625 .dest 2 e guint16
2626 .temp 2 t1
2627 .temp 2 t2
2628
2629 loadoffw t2, e, 4
2630 mullw t2, t2, 5
2631 addw t1, t2, e
2632 loadoffw t2, e, 8
2633 mullw t2, t2, 3
2634 addw e, t1, t2
2635
2636 # due to error propagation we should disable
2637 # loop_shift for this function and only work on
2638 # 4 pixels at a time.
2639 #.function video_orc_dither_fs_add_4u8_mask
2640 #.flags no-unroll
2641 #.dest 4 d guint8
2642 #.dest 8 e1 guint16
2643 #.dest 8 e2 guint16
2644 #.longparam 8 masks
2645 #.temp 8 p
2646 #.temp 8 t1
2647 #.temp 8 t2
2648 #
2649 #x4 mullw t1, e1, 7
2650 #x4 addw t1, t1, e2
2651 #x4 shruw t1, t1, 4
2652 #x4 convubw p, d
2653 #x4 addw t1, t1, p
2654 #x4 andnw p, masks, t1
2655 #x4 convsuswb d, p
2656 #x4 andw e2, t1, masks
2657
2658 .function video_orc_dither_ordered_u8
2659 .source 1 e guint8
2660 .dest 1 d guint8
2661
2662 addusb d, d, e
2663
2664 .function video_orc_dither_ordered_4u8_mask
2665 .source 8 e1 guint16
2666 .dest 4 d guint8
2667 .longparam 8 masks
2668 .temp 8 p
2669 .temp 8 m
2670
2671 loadpq m, masks
2672 x4 convubw p, d
2673 x4 addw p, p, e1
2674 x4 andnw p, m, p
2675 x4 convsuswb d, p
2676
2677 .function video_orc_dither_ordered_4u16_mask
2678 .source 8 e1 guint16
2679 .dest 8 d guint16
2680 .longparam 8 masks
2681 .temp 8 p
2682 .temp 8 m
2683
2684 loadpq m, masks
2685 x4 addusw p, d, e1
2686 x4 andnw d, m, p
2687
2688 .function video_orc_convert_UYVY_GRAY8
2689 .flags 2d
2690 .dest 1 d guint8
2691 .source 2 s
2692 .temp 1 t1
2693 .temp 2 t2
2694
2695 loadw t2, s
2696 convhwb t1, t2
2697 storeb d, t1