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)
253 // optimization error here
262 static inline void transfer_YUV_PLANAR_to_RGBA_FLOAT(float* *output,
263 unsigned char *input_y,
264 unsigned char *input_u,
265 unsigned char *input_v)
267 // Signedness is important
268 float y = (float)*input_y / 0xff;
273 YUV_TO_FLOAT(y, u, v, r, g, b)
275 // optimization error here
285 static inline void transfer_YUV_PLANAR_to_YUV888(unsigned char *(*output),
286 unsigned char *input_y,
287 unsigned char *input_u,
288 unsigned char *input_v)
290 (*output)[0] = *input_y;
291 (*output)[1] = *input_u;
292 (*output)[2] = *input_v;
296 static inline void transfer_YUV_PLANAR_to_YUV161616(uint16_t *(*output),
297 unsigned char *input_y,
298 unsigned char *input_u,
299 unsigned char *input_v)
301 (*output)[0] = (*input_y << 8) | *input_y;
302 (*output)[1] = (*input_u << 8) | *input_u;
303 (*output)[2] = (*input_v << 8) | *input_v;
307 static inline void transfer_YUV_PLANAR_to_YUVA8888(unsigned char *(*output),
308 unsigned char *input_y,
309 unsigned char *input_u,
310 unsigned char *input_v)
312 (*output)[0] = *input_y;
313 (*output)[1] = *input_u;
314 (*output)[2] = *input_v;
319 static inline void transfer_YUV_PLANAR_to_YUVA16161616(uint16_t *(*output),
320 unsigned char *input_y,
321 unsigned char *input_u,
322 unsigned char *input_v)
324 (*output)[0] = (((uint16_t)*input_y) << 8) | *input_y;
325 (*output)[1] = (((uint16_t)*input_u) << 8) | *input_u;
326 (*output)[2] = (((uint16_t)*input_v) << 8) | *input_v;
328 (*output)[3] = 0xffff;
332 static inline void transfer_YUV_PLANAR_to_YUV420P(unsigned char *input_y,
333 unsigned char *input_u,
334 unsigned char *input_v,
335 unsigned char *output_y,
336 unsigned char *output_u,
337 unsigned char *output_v,
340 output_y[j] = *input_y;
341 output_u[j / 2] = *input_u;
342 output_v[j / 2] = *input_v;
345 static inline void transfer_YUV_PLANAR_to_YUV444P(unsigned char *input_y,
346 unsigned char *input_u,
347 unsigned char *input_v,
348 unsigned char *output_y,
349 unsigned char *output_u,
350 unsigned char *output_v,
353 output_y[j] = *input_y;
354 output_u[j] = *input_u;
355 output_v[j] = *input_v;
358 static inline void transfer_YUV_PLANAR_to_YUV422(unsigned char *(*output),
359 unsigned char *input_y,
360 unsigned char *input_u,
361 unsigned char *input_v,
364 // Store U and V for even pixels only
367 (*output)[1] = *input_u;
368 (*output)[3] = *input_v;
369 (*output)[0] = *input_y;
372 // Store Y and advance output for odd pixels only
374 (*output)[2] = *input_y;
393 // ******************************** YUV444P -> ********************************
395 static inline void transfer_YUV444P_to_YUV444P(unsigned char *input_y,
396 unsigned char *input_u,
397 unsigned char *input_v,
398 unsigned char *output_y,
399 unsigned char *output_u,
400 unsigned char *output_v,
403 output_y[j] = *input_y;
404 output_u[j] = *input_u;
405 output_v[j] = *input_v;
411 #define TRANSFER_FRAME_DEFAULT(output, \
420 switch(in_colormodel) \
423 switch(out_colormodel) \
426 TRANSFER_YUV420P_IN_HEAD \
427 transfer_YUV_PLANAR_to_RGB8((output), \
428 input_y + (y_in_offset), \
429 input_u + (u_in_offset), \
430 input_v + (v_in_offset)); \
431 TRANSFER_FRAME_TAIL \
434 TRANSFER_YUV420P_IN_HEAD \
435 transfer_YUV_PLANAR_to_BGR565((output), \
436 input_y + (y_in_offset), \
437 input_u + (u_in_offset), \
438 input_v + (v_in_offset)); \
439 TRANSFER_FRAME_TAIL \
442 TRANSFER_YUV420P_IN_HEAD \
443 transfer_YUV_PLANAR_to_RGB565((output), \
444 input_y + (y_in_offset), \
445 input_u + (u_in_offset), \
446 input_v + (v_in_offset)); \
447 TRANSFER_FRAME_TAIL \
450 TRANSFER_YUV420P_IN_HEAD \
451 transfer_YUV_PLANAR_to_BGR888((output), \
452 input_y + (y_in_offset), \
453 input_u + (u_in_offset), \
454 input_v + (v_in_offset)); \
455 TRANSFER_FRAME_TAIL \
458 TRANSFER_YUV420P_IN_HEAD \
459 transfer_YUV_PLANAR_to_BGR8888((output), \
460 input_y + (y_in_offset), \
461 input_u + (u_in_offset), \
462 input_v + (v_in_offset)); \
463 TRANSFER_FRAME_TAIL \
466 for(i = 0; i < out_h; i++) \
468 unsigned char *output_y = out_y_plane + i * total_out_w; \
469 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
470 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
471 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
472 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
473 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
474 for(j = 0; j < out_w; j++) \
476 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
477 input_u + (u_in_offset), \
478 input_v + (v_in_offset), \
487 TRANSFER_YUV420P_IN_HEAD \
488 transfer_YUV_PLANAR_to_YUV422((output), \
489 input_y + (y_in_offset), \
490 input_u + (u_in_offset), \
491 input_v + (v_in_offset), \
493 TRANSFER_FRAME_TAIL \
496 for(i = 0; i < out_h; i++) \
498 unsigned char *output_y = out_y_plane + i * total_out_w; \
499 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
500 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
501 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
502 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
503 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
504 for(j = 0; j < out_w; j++) \
506 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
507 input_u + (u_in_offset), \
508 input_v + (v_in_offset), \
517 for(i = 0; i < out_h; i++) \
519 unsigned char *output_y = out_y_plane + i * total_out_w; \
520 unsigned char *output_u = out_u_plane + i * total_out_w; \
521 unsigned char *output_v = out_v_plane + i * total_out_w; \
522 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
523 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
524 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
525 for(j = 0; j < out_w; j++) \
527 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
528 input_u + (u_in_offset), \
529 input_v + (v_in_offset), \
538 TRANSFER_YUV420P_IN_HEAD \
539 transfer_YUV_PLANAR_to_RGB888((output), \
540 input_y + (y_in_offset), \
541 input_u + (u_in_offset), \
542 input_v + (v_in_offset)); \
543 TRANSFER_FRAME_TAIL \
546 TRANSFER_YUV420P_IN_HEAD \
547 transfer_YUV_PLANAR_to_ARGB8888((output), \
548 input_y + (y_in_offset), \
549 input_u + (u_in_offset), \
550 input_v + (v_in_offset)); \
551 TRANSFER_FRAME_TAIL \
554 TRANSFER_YUV420P_IN_HEAD \
555 transfer_YUV_PLANAR_to_ABGR8888((output), \
556 input_y + (y_in_offset), \
557 input_u + (u_in_offset), \
558 input_v + (v_in_offset)); \
559 TRANSFER_FRAME_TAIL \
562 TRANSFER_YUV420P_IN_HEAD \
563 transfer_YUV_PLANAR_to_RGBA8888((output), \
564 input_y + (y_in_offset), \
565 input_u + (u_in_offset), \
566 input_v + (v_in_offset)); \
567 TRANSFER_FRAME_TAIL \
570 TRANSFER_YUV420P_IN_HEAD \
571 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
572 input_y + (y_in_offset), \
573 input_u + (u_in_offset), \
574 input_v + (v_in_offset)); \
575 TRANSFER_FRAME_TAIL \
577 case BC_RGBA16161616: \
578 TRANSFER_YUV420P_IN_HEAD \
579 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
580 input_y + (y_in_offset), \
581 input_u + (u_in_offset), \
582 input_v + (v_in_offset)); \
583 TRANSFER_FRAME_TAIL \
586 TRANSFER_YUV420P_IN_HEAD \
587 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
588 input_y + (y_in_offset), \
589 input_u + (u_in_offset), \
590 input_v + (v_in_offset)); \
591 TRANSFER_FRAME_TAIL \
593 case BC_RGBA_FLOAT: \
594 TRANSFER_YUV420P_IN_HEAD \
595 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
596 input_y + (y_in_offset), \
597 input_u + (u_in_offset), \
598 input_v + (v_in_offset)); \
599 TRANSFER_FRAME_TAIL \
602 TRANSFER_YUV420P_IN_HEAD \
603 transfer_YUV_PLANAR_to_YUV888((output), \
604 input_y + (y_in_offset), \
605 input_u + (u_in_offset), \
606 input_v + (v_in_offset)); \
607 TRANSFER_FRAME_TAIL \
610 TRANSFER_YUV420P_IN_HEAD \
611 transfer_YUV_PLANAR_to_YUVA8888((output), \
612 input_y + (y_in_offset), \
613 input_u + (u_in_offset), \
614 input_v + (v_in_offset)); \
615 TRANSFER_FRAME_TAIL \
618 TRANSFER_YUV420P_IN_HEAD \
619 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
620 input_y + (y_in_offset), \
621 input_u + (u_in_offset), \
622 input_v + (v_in_offset)); \
623 TRANSFER_FRAME_TAIL \
625 case BC_YUVA16161616: \
626 TRANSFER_YUV420P_IN_HEAD \
627 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
628 input_y + (y_in_offset), \
629 input_u + (u_in_offset), \
630 input_v + (v_in_offset)); \
631 TRANSFER_FRAME_TAIL \
637 switch(out_colormodel) \
640 TRANSFER_YUV9P_IN_HEAD \
641 transfer_YUV_PLANAR_to_RGB8((output), \
642 input_y + (y_in_offset), \
643 input_u + (u_in_offset), \
644 input_v + (v_in_offset)); \
645 TRANSFER_FRAME_TAIL \
648 TRANSFER_YUV9P_IN_HEAD \
649 transfer_YUV_PLANAR_to_BGR565((output), \
650 input_y + (y_in_offset), \
651 input_u + (u_in_offset), \
652 input_v + (v_in_offset)); \
653 TRANSFER_FRAME_TAIL \
656 TRANSFER_YUV9P_IN_HEAD \
657 transfer_YUV_PLANAR_to_RGB565((output), \
658 input_y + (y_in_offset), \
659 input_u + (u_in_offset), \
660 input_v + (v_in_offset)); \
661 TRANSFER_FRAME_TAIL \
664 TRANSFER_YUV9P_IN_HEAD \
665 transfer_YUV_PLANAR_to_BGR888((output), \
666 input_y + (y_in_offset), \
667 input_u + (u_in_offset), \
668 input_v + (v_in_offset)); \
669 TRANSFER_FRAME_TAIL \
672 TRANSFER_YUV9P_IN_HEAD \
673 transfer_YUV_PLANAR_to_BGR8888((output), \
674 input_y + (y_in_offset), \
675 input_u + (u_in_offset), \
676 input_v + (v_in_offset)); \
677 TRANSFER_FRAME_TAIL \
680 for(i = 0; i < out_h; i++) \
682 unsigned char *output_y = out_y_plane + i * total_out_w; \
683 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
684 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
685 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
686 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
687 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
688 for(j = 0; j < out_w; j++) \
690 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
691 input_u + (u_in_offset), \
692 input_v + (v_in_offset), \
701 TRANSFER_YUV9P_IN_HEAD \
702 transfer_YUV_PLANAR_to_YUV422((output), \
703 input_y + (y_in_offset), \
704 input_u + (u_in_offset), \
705 input_v + (v_in_offset), \
707 TRANSFER_FRAME_TAIL \
710 for(i = 0; i < out_h; i++) \
712 unsigned char *output_y = out_y_plane + i * total_out_w; \
713 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
714 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
715 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
716 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
717 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
718 for(j = 0; j < out_w; j++) \
720 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
721 input_u + (u_in_offset), \
722 input_v + (v_in_offset), \
731 for(i = 0; i < out_h; i++) \
733 unsigned char *output_y = out_y_plane + i * total_out_w; \
734 unsigned char *output_u = out_u_plane + i * total_out_w; \
735 unsigned char *output_v = out_v_plane + i * total_out_w; \
736 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
737 unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \
738 unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \
739 for(j = 0; j < out_w; j++) \
741 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
742 input_u + (u_in_offset), \
743 input_v + (v_in_offset), \
752 TRANSFER_YUV9P_IN_HEAD \
753 transfer_YUV_PLANAR_to_RGB888((output), \
754 input_y + (y_in_offset), \
755 input_u + (u_in_offset), \
756 input_v + (v_in_offset)); \
757 TRANSFER_FRAME_TAIL \
760 TRANSFER_YUV9P_IN_HEAD \
761 transfer_YUV_PLANAR_to_ARGB8888((output), \
762 input_y + (y_in_offset), \
763 input_u + (u_in_offset), \
764 input_v + (v_in_offset)); \
765 TRANSFER_FRAME_TAIL \
768 TRANSFER_YUV9P_IN_HEAD \
769 transfer_YUV_PLANAR_to_ABGR8888((output), \
770 input_y + (y_in_offset), \
771 input_u + (u_in_offset), \
772 input_v + (v_in_offset)); \
773 TRANSFER_FRAME_TAIL \
776 TRANSFER_YUV9P_IN_HEAD \
777 transfer_YUV_PLANAR_to_RGBA8888((output), \
778 input_y + (y_in_offset), \
779 input_u + (u_in_offset), \
780 input_v + (v_in_offset)); \
781 TRANSFER_FRAME_TAIL \
784 TRANSFER_YUV9P_IN_HEAD \
785 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
786 input_y + (y_in_offset), \
787 input_u + (u_in_offset), \
788 input_v + (v_in_offset)); \
789 TRANSFER_FRAME_TAIL \
791 case BC_RGBA16161616: \
792 TRANSFER_YUV9P_IN_HEAD \
793 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
794 input_y + (y_in_offset), \
795 input_u + (u_in_offset), \
796 input_v + (v_in_offset)); \
797 TRANSFER_FRAME_TAIL \
800 TRANSFER_YUV9P_IN_HEAD \
801 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
802 input_y + (y_in_offset), \
803 input_u + (u_in_offset), \
804 input_v + (v_in_offset)); \
805 TRANSFER_FRAME_TAIL \
807 case BC_RGBA_FLOAT: \
808 TRANSFER_YUV9P_IN_HEAD \
809 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
810 input_y + (y_in_offset), \
811 input_u + (u_in_offset), \
812 input_v + (v_in_offset)); \
813 TRANSFER_FRAME_TAIL \
816 TRANSFER_YUV9P_IN_HEAD \
817 transfer_YUV_PLANAR_to_YUV888((output), \
818 input_y + (y_in_offset), \
819 input_u + (u_in_offset), \
820 input_v + (v_in_offset)); \
821 TRANSFER_FRAME_TAIL \
824 TRANSFER_YUV9P_IN_HEAD \
825 transfer_YUV_PLANAR_to_YUVA8888((output), \
826 input_y + (y_in_offset), \
827 input_u + (u_in_offset), \
828 input_v + (v_in_offset)); \
829 TRANSFER_FRAME_TAIL \
832 TRANSFER_YUV9P_IN_HEAD \
833 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
834 input_y + (y_in_offset), \
835 input_u + (u_in_offset), \
836 input_v + (v_in_offset)); \
837 TRANSFER_FRAME_TAIL \
839 case BC_YUVA16161616: \
840 TRANSFER_YUV9P_IN_HEAD \
841 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
842 input_y + (y_in_offset), \
843 input_u + (u_in_offset), \
844 input_v + (v_in_offset)); \
845 TRANSFER_FRAME_TAIL \
851 switch(out_colormodel) \
854 TRANSFER_YUV422P_IN_HEAD \
855 transfer_YUV_PLANAR_to_RGB8((output), \
856 input_y + (y_in_offset), \
857 input_u + (u_in_offset), \
858 input_v + (v_in_offset)); \
859 TRANSFER_FRAME_TAIL \
862 TRANSFER_YUV422P_IN_HEAD \
863 transfer_YUV_PLANAR_to_BGR565((output), \
864 input_y + (y_in_offset), \
865 input_u + (u_in_offset), \
866 input_v + (v_in_offset)); \
867 TRANSFER_FRAME_TAIL \
870 TRANSFER_YUV422P_IN_HEAD \
871 transfer_YUV_PLANAR_to_RGB565((output), \
872 input_y + (y_in_offset), \
873 input_u + (u_in_offset), \
874 input_v + (v_in_offset)); \
875 TRANSFER_FRAME_TAIL \
878 TRANSFER_YUV422P_IN_HEAD \
879 transfer_YUV_PLANAR_to_BGR888((output), \
880 input_y + (y_in_offset), \
881 input_u + (u_in_offset), \
882 input_v + (v_in_offset)); \
883 TRANSFER_FRAME_TAIL \
886 TRANSFER_YUV422P_IN_HEAD \
887 transfer_YUV_PLANAR_to_BGR8888((output), \
888 input_y + (y_in_offset), \
889 input_u + (u_in_offset), \
890 input_v + (v_in_offset)); \
891 TRANSFER_FRAME_TAIL \
894 TRANSFER_YUV422P_IN_HEAD \
895 transfer_YUV_PLANAR_to_RGB888((output), \
896 input_y + (y_in_offset), \
897 input_u + (u_in_offset), \
898 input_v + (v_in_offset)); \
899 TRANSFER_FRAME_TAIL \
902 TRANSFER_YUV422P_IN_HEAD \
903 transfer_YUV_PLANAR_to_ARGB8888((output), \
904 input_y + (y_in_offset), \
905 input_u + (u_in_offset), \
906 input_v + (v_in_offset)); \
907 TRANSFER_FRAME_TAIL \
910 TRANSFER_YUV422P_IN_HEAD \
911 transfer_YUV_PLANAR_to_ABGR8888((output), \
912 input_y + (y_in_offset), \
913 input_u + (u_in_offset), \
914 input_v + (v_in_offset)); \
915 TRANSFER_FRAME_TAIL \
918 TRANSFER_YUV422P_IN_HEAD \
919 transfer_YUV_PLANAR_to_RGBA8888((output), \
920 input_y + (y_in_offset), \
921 input_u + (u_in_offset), \
922 input_v + (v_in_offset)); \
923 TRANSFER_FRAME_TAIL \
926 TRANSFER_YUV422P_IN_HEAD \
927 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
928 input_y + (y_in_offset), \
929 input_u + (u_in_offset), \
930 input_v + (v_in_offset)); \
931 TRANSFER_FRAME_TAIL \
933 case BC_RGBA16161616: \
934 TRANSFER_YUV422P_IN_HEAD \
935 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
936 input_y + (y_in_offset), \
937 input_u + (u_in_offset), \
938 input_v + (v_in_offset)); \
939 TRANSFER_FRAME_TAIL \
942 TRANSFER_YUV422P_IN_HEAD \
943 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
944 input_y + (y_in_offset), \
945 input_u + (u_in_offset), \
946 input_v + (v_in_offset)); \
947 TRANSFER_FRAME_TAIL \
949 case BC_RGBA_FLOAT: \
950 TRANSFER_YUV422P_IN_HEAD \
951 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
952 input_y + (y_in_offset), \
953 input_u + (u_in_offset), \
954 input_v + (v_in_offset)); \
955 TRANSFER_FRAME_TAIL \
958 TRANSFER_YUV422P_IN_HEAD \
959 transfer_YUV_PLANAR_to_YUV888((output), \
960 input_y + (y_in_offset), \
961 input_u + (u_in_offset), \
962 input_v + (v_in_offset)); \
963 TRANSFER_FRAME_TAIL \
966 TRANSFER_YUV422P_IN_HEAD \
967 transfer_YUV_PLANAR_to_YUVA8888((output), \
968 input_y + (y_in_offset), \
969 input_u + (u_in_offset), \
970 input_v + (v_in_offset)); \
971 TRANSFER_FRAME_TAIL \
974 TRANSFER_YUV422P_IN_HEAD \
975 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
976 input_y + (y_in_offset), \
977 input_u + (u_in_offset), \
978 input_v + (v_in_offset)); \
979 TRANSFER_FRAME_TAIL \
981 case BC_YUVA16161616: \
982 TRANSFER_YUV422P_IN_HEAD \
983 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
984 input_y + (y_in_offset), \
985 input_u + (u_in_offset), \
986 input_v + (v_in_offset)); \
987 TRANSFER_FRAME_TAIL \
990 for(i = 0; i < out_h; i++) \
992 unsigned char *output_y = out_y_plane + i * total_out_w; \
993 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
994 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
995 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
996 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
997 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
998 for(j = 0; j < out_w; j++) \
1000 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1001 input_u + (u_in_offset), \
1002 input_v + (v_in_offset), \
1011 TRANSFER_YUV422_IN_HEAD \
1012 transfer_YUV_PLANAR_to_YUV422((output), \
1013 input_y + (y_in_offset), \
1014 input_u + (u_in_offset), \
1015 input_v + (v_in_offset), \
1017 TRANSFER_FRAME_TAIL \
1020 for(i = 0; i < out_h; i++) \
1022 unsigned char *output_y = out_y_plane + i * total_out_w; \
1023 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
1024 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
1025 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1026 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
1027 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
1028 for(j = 0; j < out_w; j++) \
1030 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1031 input_u + (u_in_offset), \
1032 input_v + (v_in_offset), \
1041 for(i = 0; i < out_h; i++) \
1043 unsigned char *output_y = out_y_plane + i * total_out_w; \
1044 unsigned char *output_u = out_u_plane + i * total_out_w; \
1045 unsigned char *output_v = out_v_plane + i * total_out_w; \
1046 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1047 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \
1048 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \
1049 for(j = 0; j < out_w; j++) \
1051 transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
1052 input_u + (u_in_offset), \
1053 input_v + (v_in_offset), \
1066 switch(out_colormodel) \
1069 TRANSFER_YUV444P_IN_HEAD \
1070 transfer_YUV_PLANAR_to_RGB8((output), \
1071 input_y + (y_in_offset), \
1072 input_u + (u_in_offset), \
1073 input_v + (v_in_offset)); \
1074 TRANSFER_FRAME_TAIL \
1077 TRANSFER_YUV444P_IN_HEAD \
1078 transfer_YUV_PLANAR_to_BGR565((output), \
1079 input_y + (y_in_offset), \
1080 input_u + (u_in_offset), \
1081 input_v + (v_in_offset)); \
1082 TRANSFER_FRAME_TAIL \
1085 TRANSFER_YUV444P_IN_HEAD \
1086 transfer_YUV_PLANAR_to_RGB565((output), \
1087 input_y + (y_in_offset), \
1088 input_u + (u_in_offset), \
1089 input_v + (v_in_offset)); \
1090 TRANSFER_FRAME_TAIL \
1093 TRANSFER_YUV444P_IN_HEAD \
1094 transfer_YUV_PLANAR_to_BGR888((output), \
1095 input_y + (y_in_offset), \
1096 input_u + (u_in_offset), \
1097 input_v + (v_in_offset)); \
1098 TRANSFER_FRAME_TAIL \
1101 TRANSFER_YUV444P_IN_HEAD \
1102 transfer_YUV_PLANAR_to_BGR8888((output), \
1103 input_y + (y_in_offset), \
1104 input_u + (u_in_offset), \
1105 input_v + (v_in_offset)); \
1106 TRANSFER_FRAME_TAIL \
1109 TRANSFER_YUV444P_IN_HEAD \
1110 transfer_YUV_PLANAR_to_RGB888((output), \
1111 input_y + (y_in_offset), \
1112 input_u + (u_in_offset), \
1113 input_v + (v_in_offset)); \
1114 TRANSFER_FRAME_TAIL \
1117 TRANSFER_YUV444P_IN_HEAD \
1118 transfer_YUV_PLANAR_to_ARGB8888((output), \
1119 input_y + (y_in_offset), \
1120 input_u + (u_in_offset), \
1121 input_v + (v_in_offset)); \
1122 TRANSFER_FRAME_TAIL \
1125 TRANSFER_YUV444P_IN_HEAD \
1126 transfer_YUV_PLANAR_to_ABGR8888((output), \
1127 input_y + (y_in_offset), \
1128 input_u + (u_in_offset), \
1129 input_v + (v_in_offset)); \
1130 TRANSFER_FRAME_TAIL \
1133 TRANSFER_YUV444P_IN_HEAD \
1134 transfer_YUV_PLANAR_to_RGBA8888((output), \
1135 input_y + (y_in_offset), \
1136 input_u + (u_in_offset), \
1137 input_v + (v_in_offset)); \
1138 TRANSFER_FRAME_TAIL \
1140 case BC_RGB161616: \
1141 TRANSFER_YUV444P_IN_HEAD \
1142 transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \
1143 input_y + (y_in_offset), \
1144 input_u + (u_in_offset), \
1145 input_v + (v_in_offset)); \
1146 TRANSFER_FRAME_TAIL \
1148 case BC_RGBA16161616: \
1149 TRANSFER_YUV444P_IN_HEAD \
1150 transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \
1151 input_y + (y_in_offset), \
1152 input_u + (u_in_offset), \
1153 input_v + (v_in_offset)); \
1154 TRANSFER_FRAME_TAIL \
1156 case BC_RGB_FLOAT: \
1157 TRANSFER_YUV444P_IN_HEAD \
1158 transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \
1159 input_y + (y_in_offset), \
1160 input_u + (u_in_offset), \
1161 input_v + (v_in_offset)); \
1162 TRANSFER_FRAME_TAIL \
1164 case BC_RGBA_FLOAT: \
1165 TRANSFER_YUV444P_IN_HEAD \
1166 transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \
1167 input_y + (y_in_offset), \
1168 input_u + (u_in_offset), \
1169 input_v + (v_in_offset)); \
1170 TRANSFER_FRAME_TAIL \
1173 TRANSFER_YUV444P_IN_HEAD \
1174 transfer_YUV_PLANAR_to_YUV888((output), \
1175 input_y + (y_in_offset), \
1176 input_u + (u_in_offset), \
1177 input_v + (v_in_offset)); \
1178 TRANSFER_FRAME_TAIL \
1181 TRANSFER_YUV444P_IN_HEAD \
1182 transfer_YUV_PLANAR_to_YUVA8888((output), \
1183 input_y + (y_in_offset), \
1184 input_u + (u_in_offset), \
1185 input_v + (v_in_offset)); \
1186 TRANSFER_FRAME_TAIL \
1188 case BC_YUV161616: \
1189 TRANSFER_YUV444P_IN_HEAD \
1190 transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \
1191 input_y + (y_in_offset), \
1192 input_u + (u_in_offset), \
1193 input_v + (v_in_offset)); \
1194 TRANSFER_FRAME_TAIL \
1196 case BC_YUVA16161616: \
1197 TRANSFER_YUV444P_IN_HEAD \
1198 transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \
1199 input_y + (y_in_offset), \
1200 input_u + (u_in_offset), \
1201 input_v + (v_in_offset)); \
1202 TRANSFER_FRAME_TAIL \
1205 for(i = 0; i < out_h; i++) \
1207 unsigned char *output_y = out_y_plane + i * total_out_w; \
1208 unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \
1209 unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \
1210 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1211 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1212 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1213 for(j = 0; j < out_w; j++) \
1215 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1216 input_u + (u_in_offset), \
1217 input_v + (v_in_offset), \
1226 TRANSFER_YUV444P_IN_HEAD \
1227 transfer_YUV_PLANAR_to_YUV422((output), \
1228 input_y + (y_in_offset), \
1229 input_u + (u_in_offset), \
1230 input_v + (v_in_offset), \
1232 TRANSFER_FRAME_TAIL \
1235 for(i = 0; i < out_h; i++) \
1237 unsigned char *output_y = out_y_plane + i * total_out_w; \
1238 unsigned char *output_u = out_u_plane + i * total_out_w / 2; \
1239 unsigned char *output_v = out_v_plane + i * total_out_w / 2; \
1240 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1241 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1242 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1243 for(j = 0; j < out_w; j++) \
1245 transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
1246 input_u + (u_in_offset), \
1247 input_v + (v_in_offset), \
1256 for(i = 0; i < out_h; i++) \
1258 unsigned char *output_y = out_y_plane + i * total_out_w; \
1259 unsigned char *output_u = out_u_plane + i * total_out_w; \
1260 unsigned char *output_v = out_v_plane + i * total_out_w; \
1261 unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \
1262 unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \
1263 unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \
1264 for(j = 0; j < out_w; j++) \
1266 transfer_YUV444P_to_YUV444P(input_y + (y_in_offset), \
1267 input_u + (u_in_offset), \
1268 input_v + (v_in_offset), \
1281 void cmodel_yuv420p(PERMUTATION_ARGS)
1285 TRANSFER_FRAME_DEFAULT(&output_row,
1286 input_row + column_table[j] * in_pixelsize,
1288 column_table[j] / 2,
1289 column_table[j] / 2,
1294 TRANSFER_FRAME_DEFAULT(&output_row,
1295 input_row + j * in_pixelsize,
1303 void cmodel_yuv9p(PERMUTATION_ARGS)
1307 TRANSFER_FRAME_DEFAULT(&output_row,
1308 input_row + column_table[j] * in_pixelsize,
1310 column_table[j] / 4,
1311 column_table[j] / 4,
1316 TRANSFER_FRAME_DEFAULT(&output_row,
1317 input_row + j * in_pixelsize,
1325 void cmodel_yuv444p(PERMUTATION_ARGS)
1329 TRANSFER_FRAME_DEFAULT(&output_row,
1330 input_row + column_table[j] * in_pixelsize,
1338 TRANSFER_FRAME_DEFAULT(&output_row,
1339 input_row + j * in_pixelsize,