2 * This library is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU Lesser General Public License as published
4 * by the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This library is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 #include "cmodel_permutation.h"
25 static inline void transfer_YUV_PLANAR_to_RGB8(unsigned char *(*output
),
26 unsigned char *input_y
,
27 unsigned char *input_u
,
28 unsigned char *input_v
)
32 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
35 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
37 *(*output
) = (unsigned char)((r
& 0xc0) +
43 static inline void transfer_YUV_PLANAR_to_BGR565(unsigned char *(*output
),
44 unsigned char *input_y
,
45 unsigned char *input_u
,
46 unsigned char *input_v
)
51 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
54 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
56 *(uint16_t*)(*output
) = ((b
& 0xf8) << 8)
62 static inline void transfer_YUV_PLANAR_to_RGB565(unsigned char *(*output
),
63 unsigned char *input_y
,
64 unsigned char *input_u
,
65 unsigned char *input_v
)
70 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
73 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
75 *(uint16_t*)(*output
) = ((r
& 0xf8) << 8)
81 static inline void transfer_YUV_PLANAR_to_BGR888(unsigned char *(*output
),
82 unsigned char *input_y
,
83 unsigned char *input_u
,
84 unsigned char *input_v
)
89 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
92 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
100 static inline void transfer_YUV_PLANAR_to_BGR8888(unsigned char *(*output
),
101 unsigned char *input_y
,
102 unsigned char *input_u
,
103 unsigned char *input_v
)
108 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
111 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
119 static inline void transfer_YUV_PLANAR_to_RGB888(unsigned char *(*output
),
120 unsigned char *input_y
,
121 unsigned char *input_u
,
122 unsigned char *input_v
)
124 // Signedness is important
125 int y
, u
, v
, r
, g
, b
;
127 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
130 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
138 static inline void transfer_YUV_PLANAR_to_ARGB8888(unsigned char *(*output
),
139 unsigned char *input_y
,
140 unsigned char *input_u
,
141 unsigned char *input_v
)
143 // Signedness is important
144 int y
, u
, v
, r
, g
, b
;
146 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
149 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
158 static inline void transfer_YUV_PLANAR_to_ABGR8888(unsigned char *(*output
),
159 unsigned char *input_y
,
160 unsigned char *input_u
,
161 unsigned char *input_v
)
163 // Signedness is important
164 int y
, u
, v
, r
, g
, b
;
166 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
169 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
178 static inline void transfer_YUV_PLANAR_to_RGBA8888(unsigned char *(*output
),
179 unsigned char *input_y
,
180 unsigned char *input_u
,
181 unsigned char *input_v
)
183 // Signedness is important
187 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
190 YUV_TO_RGB(y
, u
, v
, r
, g
, b
)
199 static inline void transfer_YUV_PLANAR_to_RGB161616(uint16_t *(*output
),
200 unsigned char *input_y
,
201 unsigned char *input_u
,
202 unsigned char *input_v
)
204 // Signedness is important
207 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
208 u
= (*input_u
<< 8) | *input_u
;
209 v
= (*input_v
<< 8) | *input_v
;
210 YUV_TO_RGB16(y
, u
, v
, r
, g
, b
)
219 static inline void transfer_YUV_PLANAR_to_RGBA16161616(uint16_t *(*output
),
220 unsigned char *input_y
,
221 unsigned char *input_u
,
222 unsigned char *input_v
)
224 // Signedness is important
227 y
= (*input_y
<< 16) | (*input_y
<< 8) | *input_y
;
228 u
= (*input_u
<< 8) | *input_u
;
229 v
= (*input_v
<< 8) | *input_v
;
230 YUV_TO_RGB16(y
, u
, v
, r
, g
, b
)
235 (*output
)[3] = 0xffff;
241 static inline void transfer_YUV_PLANAR_to_RGB_FLOAT(float* *output
,
242 unsigned char *input_y
,
243 unsigned char *input_u
,
244 unsigned char *input_v
)
246 // Signedness is important
247 float y
= (float)*input_y
/ 0xff;
252 YUV_TO_FLOAT(y
, u
, v
, r
, g
, b
)
260 static inline void transfer_YUV_PLANAR_to_RGBA_FLOAT(float* *output
,
261 unsigned char *input_y
,
262 unsigned char *input_u
,
263 unsigned char *input_v
)
265 // Signedness is important
266 float y
= (float)*input_y
/ 0xff;
271 YUV_TO_FLOAT(y
, u
, v
, r
, g
, b
)
281 static inline void transfer_YUV_PLANAR_to_YUV888(unsigned char *(*output
),
282 unsigned char *input_y
,
283 unsigned char *input_u
,
284 unsigned char *input_v
)
286 (*output
)[0] = *input_y
;
287 (*output
)[1] = *input_u
;
288 (*output
)[2] = *input_v
;
292 static inline void transfer_YUV_PLANAR_to_YUV161616(uint16_t *(*output
),
293 unsigned char *input_y
,
294 unsigned char *input_u
,
295 unsigned char *input_v
)
297 (*output
)[0] = (*input_y
<< 8) | *input_y
;
298 (*output
)[1] = (*input_u
<< 8) | *input_u
;
299 (*output
)[2] = (*input_v
<< 8) | *input_v
;
303 static inline void transfer_YUV_PLANAR_to_YUVA8888(unsigned char *(*output
),
304 unsigned char *input_y
,
305 unsigned char *input_u
,
306 unsigned char *input_v
)
308 (*output
)[0] = *input_y
;
309 (*output
)[1] = *input_u
;
310 (*output
)[2] = *input_v
;
315 static inline void transfer_YUV_PLANAR_to_YUVA16161616(uint16_t *(*output
),
316 unsigned char *input_y
,
317 unsigned char *input_u
,
318 unsigned char *input_v
)
320 (*output
)[0] = (((uint16_t)*input_y
) << 8) | *input_y
;
321 (*output
)[1] = (((uint16_t)*input_u
) << 8) | *input_u
;
322 (*output
)[2] = (((uint16_t)*input_v
) << 8) | *input_v
;
324 (*output
)[3] = 0xffff;
328 static inline void transfer_YUV_PLANAR_to_YUV420P(unsigned char *input_y
,
329 unsigned char *input_u
,
330 unsigned char *input_v
,
331 unsigned char *output_y
,
332 unsigned char *output_u
,
333 unsigned char *output_v
,
336 output_y
[j
] = *input_y
;
337 output_u
[j
/ 2] = *input_u
;
338 output_v
[j
/ 2] = *input_v
;
341 static inline void transfer_YUV_PLANAR_to_YUV444P(unsigned char *input_y
,
342 unsigned char *input_u
,
343 unsigned char *input_v
,
344 unsigned char *output_y
,
345 unsigned char *output_u
,
346 unsigned char *output_v
,
349 output_y
[j
] = *input_y
;
350 output_u
[j
] = *input_u
;
351 output_v
[j
] = *input_v
;
354 static inline void transfer_YUV_PLANAR_to_YUV422(unsigned char *(*output
),
355 unsigned char *input_y
,
356 unsigned char *input_u
,
357 unsigned char *input_v
,
360 // Store U and V for even pixels only
363 (*output
)[1] = *input_u
;
364 (*output
)[3] = *input_v
;
365 (*output
)[0] = *input_y
;
368 // Store Y and advance output for odd pixels only
370 (*output
)[2] = *input_y
;
389 // ******************************** YUV444P -> ********************************
391 static inline void transfer_YUV444P_to_YUV444P(unsigned char *input_y
,
392 unsigned char *input_u
,
393 unsigned char *input_v
,
394 unsigned char *output_y
,
395 unsigned char *output_u
,
396 unsigned char *output_v
,
399 output_y
[j
] = *input_y
;
400 output_u
[j
] = *input_u
;
401 output_v
[j
] = *input_v
;
407 #define TRANSFER_FRAME_DEFAULT(output, \
416 switch(in_colormodel) \
419 switch(out_colormodel) \
422 TRANSFER_YUV420P_IN_HEAD \
423 transfer_YUV_PLANAR_to_RGB8((output), \
424 input_y + (y_in_offset), \
425 input_u + (u_in_offset), \
426 input_v + (v_in_offset)); \
427 TRANSFER_FRAME_TAIL \
430 TRANSFER_YUV420P_IN_HEAD \
431 transfer_YUV_PLANAR_to_BGR565((output), \
432 input_y + (y_in_offset), \
433 input_u + (u_in_offset), \
434 input_v + (v_in_offset)); \
435 TRANSFER_FRAME_TAIL \
438 TRANSFER_YUV420P_IN_HEAD \
439 transfer_YUV_PLANAR_to_RGB565((output), \
440 input_y + (y_in_offset), \
441 input_u + (u_in_offset), \
442 input_v + (v_in_offset)); \
443 TRANSFER_FRAME_TAIL \
446 TRANSFER_YUV420P_IN_HEAD \
447 transfer_YUV_PLANAR_to_BGR888((output), \
448 input_y + (y_in_offset), \
449 input_u + (u_in_offset), \
450 input_v + (v_in_offset)); \
451 TRANSFER_FRAME_TAIL \
454 TRANSFER_YUV420P_IN_HEAD \
455 transfer_YUV_PLANAR_to_BGR8888((output), \
456 input_y + (y_in_offset), \
457 input_u + (u_in_offset), \
458 input_v + (v_in_offset)); \
459 TRANSFER_FRAME_TAIL \
462 for(i = 0; i < out_h; i++) \
464 unsigned char *output_y = out_y_plane + i * total_out_w; \
465 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
466 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
467 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
468 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
469 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
470 for(j = 0; j < out_w; j++) \
472 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
473 input_u + (u_in_offset), \
474 input_v + (v_in_offset), \
483 TRANSFER_YUV420P_IN_HEAD \
484 transfer_YUV_PLANAR_to_YUV422((output), \
485 input_y + (y_in_offset), \
486 input_u + (u_in_offset), \
487 input_v + (v_in_offset), \
489 TRANSFER_FRAME_TAIL \
492 for(i = 0; i < out_h; i++) \
494 unsigned char *output_y = out_y_plane + i * total_out_w; \
495 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
496 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
497 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
498 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
499 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
500 for(j = 0; j < out_w; j++) \
502 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
503 input_u + (u_in_offset), \
504 input_v + (v_in_offset), \
513 for(i = 0; i < out_h; i++) \
515 unsigned char *output_y = out_y_plane + i * total_out_w; \
516 unsigned char *output_u = out_u_plane + i * total_out_w; \
517 unsigned char *output_v = out_v_plane + i * total_out_w; \
518 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
519 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
520 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
521 for(j = 0; j < out_w; j++) \
523 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
524 input_u + (u_in_offset), \
525 input_v + (v_in_offset), \
534 TRANSFER_YUV420P_IN_HEAD \
535 transfer_YUV_PLANAR_to_RGB888((output), \
536 input_y + (y_in_offset), \
537 input_u + (u_in_offset), \
538 input_v + (v_in_offset)); \
539 TRANSFER_FRAME_TAIL \
542 TRANSFER_YUV420P_IN_HEAD \
543 transfer_YUV_PLANAR_to_ARGB8888((output), \
544 input_y + (y_in_offset), \
545 input_u + (u_in_offset), \
546 input_v + (v_in_offset)); \
547 TRANSFER_FRAME_TAIL \
550 TRANSFER_YUV420P_IN_HEAD \
551 transfer_YUV_PLANAR_to_ABGR8888((output), \
552 input_y + (y_in_offset), \
553 input_u + (u_in_offset), \
554 input_v + (v_in_offset)); \
555 TRANSFER_FRAME_TAIL \
558 TRANSFER_YUV420P_IN_HEAD \
559 transfer_YUV_PLANAR_to_RGBA8888((output), \
560 input_y + (y_in_offset), \
561 input_u + (u_in_offset), \
562 input_v + (v_in_offset)); \
563 TRANSFER_FRAME_TAIL \
566 TRANSFER_YUV420P_IN_HEAD \
567 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
568 input_y + (y_in_offset), \
569 input_u + (u_in_offset), \
570 input_v + (v_in_offset)); \
571 TRANSFER_FRAME_TAIL \
573 case BC_RGBA16161616: \
574 TRANSFER_YUV420P_IN_HEAD \
575 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
576 input_y + (y_in_offset), \
577 input_u + (u_in_offset), \
578 input_v + (v_in_offset)); \
579 TRANSFER_FRAME_TAIL \
582 TRANSFER_YUV420P_IN_HEAD \
583 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
584 input_y + (y_in_offset), \
585 input_u + (u_in_offset), \
586 input_v + (v_in_offset)); \
587 TRANSFER_FRAME_TAIL \
589 case BC_RGBA_FLOAT: \
590 TRANSFER_YUV420P_IN_HEAD \
591 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
592 input_y + (y_in_offset), \
593 input_u + (u_in_offset), \
594 input_v + (v_in_offset)); \
595 TRANSFER_FRAME_TAIL \
598 TRANSFER_YUV420P_IN_HEAD \
599 transfer_YUV_PLANAR_to_YUV888((output), \
600 input_y + (y_in_offset), \
601 input_u + (u_in_offset), \
602 input_v + (v_in_offset)); \
603 TRANSFER_FRAME_TAIL \
606 TRANSFER_YUV420P_IN_HEAD \
607 transfer_YUV_PLANAR_to_YUVA8888((output), \
608 input_y + (y_in_offset), \
609 input_u + (u_in_offset), \
610 input_v + (v_in_offset)); \
611 TRANSFER_FRAME_TAIL \
614 TRANSFER_YUV420P_IN_HEAD \
615 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
616 input_y + (y_in_offset), \
617 input_u + (u_in_offset), \
618 input_v + (v_in_offset)); \
619 TRANSFER_FRAME_TAIL \
621 case BC_YUVA16161616: \
622 TRANSFER_YUV420P_IN_HEAD \
623 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
624 input_y + (y_in_offset), \
625 input_u + (u_in_offset), \
626 input_v + (v_in_offset)); \
627 TRANSFER_FRAME_TAIL \
633 switch(out_colormodel) \
636 TRANSFER_YUV9P_IN_HEAD \
637 transfer_YUV_PLANAR_to_RGB8((output), \
638 input_y + (y_in_offset), \
639 input_u + (u_in_offset), \
640 input_v + (v_in_offset)); \
641 TRANSFER_FRAME_TAIL \
644 TRANSFER_YUV9P_IN_HEAD \
645 transfer_YUV_PLANAR_to_BGR565((output), \
646 input_y + (y_in_offset), \
647 input_u + (u_in_offset), \
648 input_v + (v_in_offset)); \
649 TRANSFER_FRAME_TAIL \
652 TRANSFER_YUV9P_IN_HEAD \
653 transfer_YUV_PLANAR_to_RGB565((output), \
654 input_y + (y_in_offset), \
655 input_u + (u_in_offset), \
656 input_v + (v_in_offset)); \
657 TRANSFER_FRAME_TAIL \
660 TRANSFER_YUV9P_IN_HEAD \
661 transfer_YUV_PLANAR_to_BGR888((output), \
662 input_y + (y_in_offset), \
663 input_u + (u_in_offset), \
664 input_v + (v_in_offset)); \
665 TRANSFER_FRAME_TAIL \
668 TRANSFER_YUV9P_IN_HEAD \
669 transfer_YUV_PLANAR_to_BGR8888((output), \
670 input_y + (y_in_offset), \
671 input_u + (u_in_offset), \
672 input_v + (v_in_offset)); \
673 TRANSFER_FRAME_TAIL \
676 for(i = 0; i < out_h; i++) \
678 unsigned char *output_y = out_y_plane + i * total_out_w; \
679 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
680 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
681 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
682 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
683 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
684 for(j = 0; j < out_w; j++) \
686 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
687 input_u + (u_in_offset), \
688 input_v + (v_in_offset), \
697 TRANSFER_YUV9P_IN_HEAD \
698 transfer_YUV_PLANAR_to_YUV422((output), \
699 input_y + (y_in_offset), \
700 input_u + (u_in_offset), \
701 input_v + (v_in_offset), \
703 TRANSFER_FRAME_TAIL \
706 for(i = 0; i < out_h; i++) \
708 unsigned char *output_y = out_y_plane + i * total_out_w; \
709 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
710 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
711 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
712 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
713 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
714 for(j = 0; j < out_w; j++) \
716 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
717 input_u + (u_in_offset), \
718 input_v + (v_in_offset), \
727 for(i = 0; i < out_h; i++) \
729 unsigned char *output_y = out_y_plane + i * total_out_w; \
730 unsigned char *output_u = out_u_plane + i * total_out_w; \
731 unsigned char *output_v = out_v_plane + i * total_out_w; \
732 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
733 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
734 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
735 for(j = 0; j < out_w; j++) \
737 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
738 input_u + (u_in_offset), \
739 input_v + (v_in_offset), \
748 TRANSFER_YUV9P_IN_HEAD \
749 transfer_YUV_PLANAR_to_RGB888((output), \
750 input_y + (y_in_offset), \
751 input_u + (u_in_offset), \
752 input_v + (v_in_offset)); \
753 TRANSFER_FRAME_TAIL \
756 TRANSFER_YUV9P_IN_HEAD \
757 transfer_YUV_PLANAR_to_ARGB8888((output), \
758 input_y + (y_in_offset), \
759 input_u + (u_in_offset), \
760 input_v + (v_in_offset)); \
761 TRANSFER_FRAME_TAIL \
764 TRANSFER_YUV9P_IN_HEAD \
765 transfer_YUV_PLANAR_to_ABGR8888((output), \
766 input_y + (y_in_offset), \
767 input_u + (u_in_offset), \
768 input_v + (v_in_offset)); \
769 TRANSFER_FRAME_TAIL \
772 TRANSFER_YUV9P_IN_HEAD \
773 transfer_YUV_PLANAR_to_RGBA8888((output), \
774 input_y + (y_in_offset), \
775 input_u + (u_in_offset), \
776 input_v + (v_in_offset)); \
777 TRANSFER_FRAME_TAIL \
780 TRANSFER_YUV9P_IN_HEAD \
781 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
782 input_y + (y_in_offset), \
783 input_u + (u_in_offset), \
784 input_v + (v_in_offset)); \
785 TRANSFER_FRAME_TAIL \
787 case BC_RGBA16161616: \
788 TRANSFER_YUV9P_IN_HEAD \
789 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
790 input_y + (y_in_offset), \
791 input_u + (u_in_offset), \
792 input_v + (v_in_offset)); \
793 TRANSFER_FRAME_TAIL \
796 TRANSFER_YUV9P_IN_HEAD \
797 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
798 input_y + (y_in_offset), \
799 input_u + (u_in_offset), \
800 input_v + (v_in_offset)); \
801 TRANSFER_FRAME_TAIL \
803 case BC_RGBA_FLOAT: \
804 TRANSFER_YUV9P_IN_HEAD \
805 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
806 input_y + (y_in_offset), \
807 input_u + (u_in_offset), \
808 input_v + (v_in_offset)); \
809 TRANSFER_FRAME_TAIL \
812 TRANSFER_YUV9P_IN_HEAD \
813 transfer_YUV_PLANAR_to_YUV888((output), \
814 input_y + (y_in_offset), \
815 input_u + (u_in_offset), \
816 input_v + (v_in_offset)); \
817 TRANSFER_FRAME_TAIL \
820 TRANSFER_YUV9P_IN_HEAD \
821 transfer_YUV_PLANAR_to_YUVA8888((output), \
822 input_y + (y_in_offset), \
823 input_u + (u_in_offset), \
824 input_v + (v_in_offset)); \
825 TRANSFER_FRAME_TAIL \
828 TRANSFER_YUV9P_IN_HEAD \
829 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
830 input_y + (y_in_offset), \
831 input_u + (u_in_offset), \
832 input_v + (v_in_offset)); \
833 TRANSFER_FRAME_TAIL \
835 case BC_YUVA16161616: \
836 TRANSFER_YUV9P_IN_HEAD \
837 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
838 input_y + (y_in_offset), \
839 input_u + (u_in_offset), \
840 input_v + (v_in_offset)); \
841 TRANSFER_FRAME_TAIL \
847 switch(out_colormodel) \
850 TRANSFER_YUV422P_IN_HEAD \
851 transfer_YUV_PLANAR_to_RGB8((output), \
852 input_y + (y_in_offset), \
853 input_u + (u_in_offset), \
854 input_v + (v_in_offset)); \
855 TRANSFER_FRAME_TAIL \
858 TRANSFER_YUV422P_IN_HEAD \
859 transfer_YUV_PLANAR_to_BGR565((output), \
860 input_y + (y_in_offset), \
861 input_u + (u_in_offset), \
862 input_v + (v_in_offset)); \
863 TRANSFER_FRAME_TAIL \
866 TRANSFER_YUV422P_IN_HEAD \
867 transfer_YUV_PLANAR_to_RGB565((output), \
868 input_y + (y_in_offset), \
869 input_u + (u_in_offset), \
870 input_v + (v_in_offset)); \
871 TRANSFER_FRAME_TAIL \
874 TRANSFER_YUV422P_IN_HEAD \
875 transfer_YUV_PLANAR_to_BGR888((output), \
876 input_y + (y_in_offset), \
877 input_u + (u_in_offset), \
878 input_v + (v_in_offset)); \
879 TRANSFER_FRAME_TAIL \
882 TRANSFER_YUV422P_IN_HEAD \
883 transfer_YUV_PLANAR_to_BGR8888((output), \
884 input_y + (y_in_offset), \
885 input_u + (u_in_offset), \
886 input_v + (v_in_offset)); \
887 TRANSFER_FRAME_TAIL \
890 TRANSFER_YUV422P_IN_HEAD \
891 transfer_YUV_PLANAR_to_RGB888((output), \
892 input_y + (y_in_offset), \
893 input_u + (u_in_offset), \
894 input_v + (v_in_offset)); \
895 TRANSFER_FRAME_TAIL \
898 TRANSFER_YUV422P_IN_HEAD \
899 transfer_YUV_PLANAR_to_ARGB8888((output), \
900 input_y + (y_in_offset), \
901 input_u + (u_in_offset), \
902 input_v + (v_in_offset)); \
903 TRANSFER_FRAME_TAIL \
906 TRANSFER_YUV422P_IN_HEAD \
907 transfer_YUV_PLANAR_to_ABGR8888((output), \
908 input_y + (y_in_offset), \
909 input_u + (u_in_offset), \
910 input_v + (v_in_offset)); \
911 TRANSFER_FRAME_TAIL \
914 TRANSFER_YUV422P_IN_HEAD \
915 transfer_YUV_PLANAR_to_RGBA8888((output), \
916 input_y + (y_in_offset), \
917 input_u + (u_in_offset), \
918 input_v + (v_in_offset)); \
919 TRANSFER_FRAME_TAIL \
922 TRANSFER_YUV422P_IN_HEAD \
923 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
924 input_y + (y_in_offset), \
925 input_u + (u_in_offset), \
926 input_v + (v_in_offset)); \
927 TRANSFER_FRAME_TAIL \
929 case BC_RGBA16161616: \
930 TRANSFER_YUV422P_IN_HEAD \
931 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
932 input_y + (y_in_offset), \
933 input_u + (u_in_offset), \
934 input_v + (v_in_offset)); \
935 TRANSFER_FRAME_TAIL \
938 TRANSFER_YUV422P_IN_HEAD \
939 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
940 input_y + (y_in_offset), \
941 input_u + (u_in_offset), \
942 input_v + (v_in_offset)); \
943 TRANSFER_FRAME_TAIL \
945 case BC_RGBA_FLOAT: \
946 TRANSFER_YUV422P_IN_HEAD \
947 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
948 input_y + (y_in_offset), \
949 input_u + (u_in_offset), \
950 input_v + (v_in_offset)); \
951 TRANSFER_FRAME_TAIL \
954 TRANSFER_YUV422P_IN_HEAD \
955 transfer_YUV_PLANAR_to_YUV888((output), \
956 input_y + (y_in_offset), \
957 input_u + (u_in_offset), \
958 input_v + (v_in_offset)); \
959 TRANSFER_FRAME_TAIL \
962 TRANSFER_YUV422P_IN_HEAD \
963 transfer_YUV_PLANAR_to_YUVA8888((output), \
964 input_y + (y_in_offset), \
965 input_u + (u_in_offset), \
966 input_v + (v_in_offset)); \
967 TRANSFER_FRAME_TAIL \
970 TRANSFER_YUV422P_IN_HEAD \
971 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
972 input_y + (y_in_offset), \
973 input_u + (u_in_offset), \
974 input_v + (v_in_offset)); \
975 TRANSFER_FRAME_TAIL \
977 case BC_YUVA16161616: \
978 TRANSFER_YUV422P_IN_HEAD \
979 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
980 input_y + (y_in_offset), \
981 input_u + (u_in_offset), \
982 input_v + (v_in_offset)); \
983 TRANSFER_FRAME_TAIL \
986 for(i = 0; i < out_h; i++) \
988 unsigned char *output_y = out_y_plane + i * total_in_w; \
989 unsigned char *output_u = out_u_plane + i / 2 * total_in_w / 2; \
990 unsigned char *output_v = out_v_plane + i / 2 * total_in_w / 2; \
991 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
992 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
993 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
994 for(j = 0; j < out_w; j++) \
996 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
997 input_u + (u_in_offset), \
998 input_v + (v_in_offset), \
1007 TRANSFER_YUV422_IN_HEAD \
1008 transfer_YUV_PLANAR_to_YUV422((output), \
1009 input_y + (y_in_offset), \
1010 input_u + (u_in_offset), \
1011 input_v + (v_in_offset), \
1013 TRANSFER_FRAME_TAIL \
1016 for(i = 0; i < out_h; i++) \
1018 unsigned char *output_y = out_y_plane + i * total_in_w; \
1019 unsigned char *output_u = out_u_plane + i * total_in_w / 2; \
1020 unsigned char *output_v = out_v_plane + i * total_in_w / 2; \
1021 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1022 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
1023 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
1024 for(j = 0; j < out_w; j++) \
1026 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1027 input_u + (u_in_offset), \
1028 input_v + (v_in_offset), \
1037 for(i = 0; i < out_h; i++) \
1039 unsigned char *output_y = out_y_plane + i * total_in_w; \
1040 unsigned char *output_u = out_u_plane + i * total_in_w; \
1041 unsigned char *output_v = out_v_plane + i * total_in_w; \
1042 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1043 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
1044 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
1045 for(j = 0; j < out_w; j++) \
1047 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
1048 input_u + (u_in_offset), \
1049 input_v + (v_in_offset), \
1062 switch(out_colormodel) \
1065 TRANSFER_YUV444P_IN_HEAD \
1066 transfer_YUV_PLANAR_to_RGB8((output), \
1067 input_y + (y_in_offset), \
1068 input_u + (u_in_offset), \
1069 input_v + (v_in_offset)); \
1070 TRANSFER_FRAME_TAIL \
1073 TRANSFER_YUV444P_IN_HEAD \
1074 transfer_YUV_PLANAR_to_BGR565((output), \
1075 input_y + (y_in_offset), \
1076 input_u + (u_in_offset), \
1077 input_v + (v_in_offset)); \
1078 TRANSFER_FRAME_TAIL \
1081 TRANSFER_YUV444P_IN_HEAD \
1082 transfer_YUV_PLANAR_to_RGB565((output), \
1083 input_y + (y_in_offset), \
1084 input_u + (u_in_offset), \
1085 input_v + (v_in_offset)); \
1086 TRANSFER_FRAME_TAIL \
1089 TRANSFER_YUV444P_IN_HEAD \
1090 transfer_YUV_PLANAR_to_BGR888((output), \
1091 input_y + (y_in_offset), \
1092 input_u + (u_in_offset), \
1093 input_v + (v_in_offset)); \
1094 TRANSFER_FRAME_TAIL \
1097 TRANSFER_YUV444P_IN_HEAD \
1098 transfer_YUV_PLANAR_to_BGR8888((output), \
1099 input_y + (y_in_offset), \
1100 input_u + (u_in_offset), \
1101 input_v + (v_in_offset)); \
1102 TRANSFER_FRAME_TAIL \
1105 TRANSFER_YUV444P_IN_HEAD \
1106 transfer_YUV_PLANAR_to_RGB888((output), \
1107 input_y + (y_in_offset), \
1108 input_u + (u_in_offset), \
1109 input_v + (v_in_offset)); \
1110 TRANSFER_FRAME_TAIL \
1113 TRANSFER_YUV444P_IN_HEAD \
1114 transfer_YUV_PLANAR_to_ARGB8888((output), \
1115 input_y + (y_in_offset), \
1116 input_u + (u_in_offset), \
1117 input_v + (v_in_offset)); \
1118 TRANSFER_FRAME_TAIL \
1121 TRANSFER_YUV444P_IN_HEAD \
1122 transfer_YUV_PLANAR_to_ABGR8888((output), \
1123 input_y + (y_in_offset), \
1124 input_u + (u_in_offset), \
1125 input_v + (v_in_offset)); \
1126 TRANSFER_FRAME_TAIL \
1129 TRANSFER_YUV444P_IN_HEAD \
1130 transfer_YUV_PLANAR_to_RGBA8888((output), \
1131 input_y + (y_in_offset), \
1132 input_u + (u_in_offset), \
1133 input_v + (v_in_offset)); \
1134 TRANSFER_FRAME_TAIL \
1136 case BC_RGB161616: \
1137 TRANSFER_YUV444P_IN_HEAD \
1138 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
1139 input_y + (y_in_offset), \
1140 input_u + (u_in_offset), \
1141 input_v + (v_in_offset)); \
1142 TRANSFER_FRAME_TAIL \
1144 case BC_RGBA16161616: \
1145 TRANSFER_YUV444P_IN_HEAD \
1146 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
1147 input_y + (y_in_offset), \
1148 input_u + (u_in_offset), \
1149 input_v + (v_in_offset)); \
1150 TRANSFER_FRAME_TAIL \
1152 case BC_RGB_FLOAT: \
1153 TRANSFER_YUV444P_IN_HEAD \
1154 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
1155 input_y + (y_in_offset), \
1156 input_u + (u_in_offset), \
1157 input_v + (v_in_offset)); \
1158 TRANSFER_FRAME_TAIL \
1160 case BC_RGBA_FLOAT: \
1161 TRANSFER_YUV444P_IN_HEAD \
1162 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
1163 input_y + (y_in_offset), \
1164 input_u + (u_in_offset), \
1165 input_v + (v_in_offset)); \
1166 TRANSFER_FRAME_TAIL \
1169 TRANSFER_YUV444P_IN_HEAD \
1170 transfer_YUV_PLANAR_to_YUV888((output), \
1171 input_y + (y_in_offset), \
1172 input_u + (u_in_offset), \
1173 input_v + (v_in_offset)); \
1174 TRANSFER_FRAME_TAIL \
1177 TRANSFER_YUV444P_IN_HEAD \
1178 transfer_YUV_PLANAR_to_YUVA8888((output), \
1179 input_y + (y_in_offset), \
1180 input_u + (u_in_offset), \
1181 input_v + (v_in_offset)); \
1182 TRANSFER_FRAME_TAIL \
1184 case BC_YUV161616: \
1185 TRANSFER_YUV444P_IN_HEAD \
1186 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
1187 input_y + (y_in_offset), \
1188 input_u + (u_in_offset), \
1189 input_v + (v_in_offset)); \
1190 TRANSFER_FRAME_TAIL \
1192 case BC_YUVA16161616: \
1193 TRANSFER_YUV444P_IN_HEAD \
1194 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
1195 input_y + (y_in_offset), \
1196 input_u + (u_in_offset), \
1197 input_v + (v_in_offset)); \
1198 TRANSFER_FRAME_TAIL \
1201 for(i = 0; i < out_h; i++) \
1203 unsigned char *output_y = out_y_plane + i * total_in_w; \
1204 unsigned char *output_u = out_u_plane + i / 2 * total_in_w / 2; \
1205 unsigned char *output_v = out_v_plane + i / 2 * total_in_w / 2; \
1206 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1207 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1208 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1209 for(j = 0; j < out_w; j++) \
1211 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1212 input_u + (u_in_offset), \
1213 input_v + (v_in_offset), \
1222 TRANSFER_YUV444P_IN_HEAD \
1223 transfer_YUV_PLANAR_to_YUV422((output), \
1224 input_y + (y_in_offset), \
1225 input_u + (u_in_offset), \
1226 input_v + (v_in_offset), \
1228 TRANSFER_FRAME_TAIL \
1231 for(i = 0; i < out_h; i++) \
1233 unsigned char *output_y = out_y_plane + i * total_in_w; \
1234 unsigned char *output_u = out_u_plane + i * total_in_w / 2; \
1235 unsigned char *output_v = out_v_plane + i * total_in_w / 2; \
1236 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1237 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1238 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1239 for(j = 0; j < out_w; j++) \
1241 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1242 input_u + (u_in_offset), \
1243 input_v + (v_in_offset), \
1252 for(i = 0; i < out_h; i++) \
1254 unsigned char *output_y = out_y_plane + i * total_in_w; \
1255 unsigned char *output_u = out_u_plane + i * total_in_w; \
1256 unsigned char *output_v = out_v_plane + i * total_in_w; \
1257 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1258 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1259 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1260 for(j = 0; j < out_w; j++) \
1262 transfer_YUV444P_to_YUV444P(input_y + (y_in_offset), \
1263 input_u + (u_in_offset), \
1264 input_v + (v_in_offset), \
1277 void cmodel_yuv420p(PERMUTATION_ARGS
)
1281 TRANSFER_FRAME_DEFAULT(&output_row
,
1282 input_row
+ column_table
[j
] * in_pixelsize
,
1284 column_table
[j
] / 2,
1285 column_table
[j
] / 2,
1290 TRANSFER_FRAME_DEFAULT(&output_row
,
1291 input_row
+ j
* in_pixelsize
,
1299 void cmodel_yuv9p(PERMUTATION_ARGS
)
1303 TRANSFER_FRAME_DEFAULT(&output_row
,
1304 input_row
+ column_table
[j
] * in_pixelsize
,
1306 column_table
[j
] / 4,
1307 column_table
[j
] / 4,
1312 TRANSFER_FRAME_DEFAULT(&output_row
,
1313 input_row
+ j
* in_pixelsize
,
1321 void cmodel_yuv444p(PERMUTATION_ARGS
)
1325 TRANSFER_FRAME_DEFAULT(&output_row
,
1326 input_row
+ column_table
[j
] * in_pixelsize
,
1334 TRANSFER_FRAME_DEFAULT(&output_row
,
1335 input_row
+ j
* in_pixelsize
,