"Fossies" - the Fresh Open Source Software Archive

Member "quicktime4linux-2.3/cmodel_yuv420p.c" (9 Jan 2007, 37647 Bytes) of package /linux/privat/old/quicktime4linux-2.3-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    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.
    6  * 
    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.
   11  * 
   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 
   15  * USA
   16  */
   17 
   18 
   19 
   20 #include "cmodel_permutation.h"
   21 
   22 
   23 
   24 
   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)
   29 {
   30     int y, u, v, r, g, b;
   31     
   32     y = (*input_y << 16) | (*input_y << 8) | *input_y;
   33     u = *input_u;
   34     v = *input_v;
   35     YUV_TO_RGB(y, u, v, r, g, b)
   36 
   37     *(*output) = (unsigned char)((r & 0xc0) +
   38                              ((g & 0xe0) >> 2) +
   39                              ((b & 0xe0) >> 5));
   40     (*output)++;
   41 }
   42 
   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)
   47 {
   48     int y, u, v;
   49     int r, g, b;
   50     
   51     y = (*input_y << 16) | (*input_y << 8) | *input_y;
   52     u = *input_u;
   53     v = *input_v;
   54     YUV_TO_RGB(y, u, v, r, g, b)
   55 
   56     *(uint16_t*)(*output) = ((b & 0xf8) << 8)
   57              + ((g & 0xfc) << 3)
   58              + ((r & 0xf8) >> 3);
   59     (*output) += 2;
   60 }
   61 
   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)
   66 {
   67     int y, u, v;
   68     int r, g, b;
   69     
   70     y = (*input_y << 16) | (*input_y << 8) | *input_y;
   71     u = *input_u;
   72     v = *input_v;
   73     YUV_TO_RGB(y, u, v, r, g, b)
   74 
   75     *(uint16_t*)(*output) = ((r & 0xf8) << 8)
   76              + ((g & 0xfc) << 3)
   77              + ((b & 0xf8) >> 3);
   78     (*output) += 2;
   79 }
   80 
   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)
   85 {
   86     int y, u, v;
   87     int r, g, b;
   88     
   89     y = (*input_y << 16) | (*input_y << 8) | *input_y;
   90     u = *input_u;
   91     v = *input_v;
   92     YUV_TO_RGB(y, u, v, r, g, b)
   93 
   94     (*output)[0] = b;
   95     (*output)[1] = g;
   96     (*output)[2] = r;
   97     (*output) += 3;
   98 }
   99 
  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)
  104 {
  105     int y, u, v;
  106     int r, g, b;
  107 
  108     y = (*input_y << 16) | (*input_y << 8) | *input_y;
  109     u = *input_u;
  110     v = *input_v;
  111     YUV_TO_RGB(y, u, v, r, g, b)
  112 
  113     (*output)[0] = b;
  114     (*output)[1] = g;
  115     (*output)[2] = r;
  116     (*output) += 4;
  117 }
  118 
  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)
  123 {
  124 // Signedness is important
  125     int y, u, v, r, g, b;
  126 
  127     y = (*input_y << 16) | (*input_y << 8) | *input_y;
  128     u = *input_u;
  129     v = *input_v;
  130     YUV_TO_RGB(y, u, v, r, g, b)
  131 
  132     (*output)[0] = r;
  133     (*output)[1] = g;
  134     (*output)[2] = b;
  135     (*output) += 3;
  136 }
  137 
  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)
  142 {
  143 // Signedness is important
  144     int y, u, v, r, g, b;
  145 
  146     y = (*input_y << 16) | (*input_y << 8) | *input_y;
  147     u = *input_u;
  148     v = *input_v;
  149     YUV_TO_RGB(y, u, v, r, g, b)
  150 
  151     (*output)[0] = 0xff;
  152     (*output)[1] = r;
  153     (*output)[2] = g;
  154     (*output)[3] = b;
  155     (*output) += 4;
  156 }
  157 
  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)
  162 {
  163 // Signedness is important
  164     int y, u, v, r, g, b;
  165 
  166     y = (*input_y << 16) | (*input_y << 8) | *input_y;
  167     u = *input_u;
  168     v = *input_v;
  169     YUV_TO_RGB(y, u, v, r, g, b)
  170 
  171     (*output)[0] = 0xff;
  172     (*output)[3] = r;
  173     (*output)[2] = g;
  174     (*output)[1] = b;
  175     (*output) += 4;
  176 }
  177 
  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)
  182 {
  183 // Signedness is important
  184     int y, u, v;
  185     int r, g, b;
  186 
  187     y = (*input_y << 16) | (*input_y << 8) | *input_y;
  188     u = *input_u;
  189     v = *input_v;
  190     YUV_TO_RGB(y, u, v, r, g, b)
  191 
  192     (*output)[0] = r;
  193     (*output)[1] = g;
  194     (*output)[2] = b;
  195     (*output)[3] = 0xff;
  196     (*output) += 4;
  197 }
  198 
  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)
  203 {
  204 // Signedness is important
  205     int y, u, v;
  206     int r, g, b;
  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)
  211     (*output)[0] = r;
  212     (*output)[1] = g;
  213     (*output)[2] = b;
  214 
  215     (*output) += 3;
  216 }
  217 
  218 
  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)
  223 {
  224 // Signedness is important
  225     int y, u, v;
  226     int r, g, b;
  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)
  231 
  232     (*output)[0] = r;
  233     (*output)[1] = g;
  234     (*output)[2] = b;
  235     (*output)[3] = 0xffff;
  236 
  237     (*output) += 4;
  238 }
  239 
  240 
  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)
  245 {
  246 // Signedness is important
  247     float y = (float)*input_y / 0xff;
  248     int u, v;
  249     float r, g, b;
  250     u = *input_u;
  251     v = *input_v;
  252     YUV_TO_FLOAT(y, u, v, r, g, b)
  253 
  254     *(*output)++ = r;
  255     *(*output)++ = g;
  256     *(*output)++ = b;
  257 }
  258 
  259 
  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)
  264 {
  265 // Signedness is important
  266     float y = (float)*input_y / 0xff;
  267     int u, v;
  268     float r, g, b;
  269     u = *input_u;
  270     v = *input_v;
  271     YUV_TO_FLOAT(y, u, v, r, g, b)
  272 
  273     *(*output)++ = r;
  274     *(*output)++ = g;
  275     *(*output)++ = b;
  276     *(*output)++ = 1.0;
  277 }
  278 
  279 
  280 
  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)
  285 {
  286     (*output)[0] = *input_y;
  287     (*output)[1] = *input_u;
  288     (*output)[2] = *input_v;
  289     (*output) += 3;
  290 }
  291 
  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)
  296 {
  297     (*output)[0] = (*input_y << 8) | *input_y;
  298     (*output)[1] = (*input_u << 8) | *input_u;
  299     (*output)[2] = (*input_v << 8) | *input_v;
  300     (*output) += 3;
  301 }
  302 
  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)
  307 {
  308     (*output)[0] = *input_y;
  309     (*output)[1] = *input_u;
  310     (*output)[2] = *input_v;
  311     (*output)[3] = 0xff;
  312     (*output) += 4;
  313 }
  314 
  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)
  319 {
  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;
  323 
  324     (*output)[3] = 0xffff;
  325     (*output) += 4;
  326 }
  327 
  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,
  334     int j)
  335 {
  336     output_y[j] = *input_y;
  337     output_u[j / 2] = *input_u;
  338     output_v[j / 2] = *input_v;
  339 }
  340 
  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,
  347     int j)
  348 {
  349     output_y[j] = *input_y;
  350     output_u[j] = *input_u;
  351     output_v[j] = *input_v;
  352 }
  353 
  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,
  358     int j)
  359 {
  360 // Store U and V for even pixels only
  361     if(!(j & 1))
  362     {
  363         (*output)[1] = *input_u;
  364         (*output)[3] = *input_v;
  365         (*output)[0] = *input_y;
  366     }
  367     else
  368 // Store Y and advance output for odd pixels only
  369     {
  370         (*output)[2] = *input_y;
  371         (*output) += 4;
  372     }
  373 }
  374 
  375 
  376 
  377 
  378 
  379 
  380 
  381 
  382 
  383 
  384 
  385 
  386 
  387 
  388 
  389 // ******************************** YUV444P -> ********************************
  390 
  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,
  397     int j)
  398 {
  399     output_y[j] = *input_y;
  400     output_u[j] = *input_u;
  401     output_v[j] = *input_v;
  402 }
  403 
  404 
  405 
  406 
  407 #define TRANSFER_FRAME_DEFAULT(output, \
  408     input, \
  409     y_in_offset, \
  410     u_in_offset, \
  411     v_in_offset, \
  412     input_column) \
  413 { \
  414     register int i, j; \
  415  \
  416     switch(in_colormodel) \
  417     { \
  418         case BC_YUV420P: \
  419             switch(out_colormodel) \
  420             { \
  421                 case BC_RGB8: \
  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 \
  428                     break; \
  429                 case BC_BGR565: \
  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 \
  436                     break; \
  437                 case BC_RGB565: \
  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 \
  444                     break; \
  445                 case BC_BGR888:      \
  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 \
  452                     break; \
  453                 case BC_BGR8888: \
  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 \
  460                     break; \
  461                 case BC_YUV420P: \
  462                     for(i = 0; i < out_h; i++) \
  463                     { \
  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++) \
  471                         { \
  472                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
  473                                 input_u + (u_in_offset), \
  474                                 input_v + (v_in_offset), \
  475                                 output_y, \
  476                                 output_u, \
  477                                 output_v, \
  478                                 j); \
  479                         } \
  480                     } \
  481                     break; \
  482                 case BC_YUV422: \
  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), \
  488                         j); \
  489                     TRANSFER_FRAME_TAIL \
  490                     break; \
  491                 case BC_YUV422P: \
  492                     for(i = 0; i < out_h; i++) \
  493                     { \
  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++) \
  501                         { \
  502                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
  503                                 input_u + (u_in_offset), \
  504                                 input_v + (v_in_offset), \
  505                                 output_y, \
  506                                 output_u, \
  507                                 output_v, \
  508                                 j); \
  509                         } \
  510                     } \
  511                     break; \
  512                 case BC_YUV444P: \
  513                     for(i = 0; i < out_h; i++) \
  514                     { \
  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++) \
  522                         { \
  523                             transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
  524                                 input_u + (u_in_offset), \
  525                                 input_v + (v_in_offset), \
  526                                 output_y, \
  527                                 output_u, \
  528                                 output_v, \
  529                                 j); \
  530                         } \
  531                     } \
  532                     break; \
  533                 case BC_RGB888:      \
  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 \
  540                     break; \
  541                 case BC_ARGB8888:      \
  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 \
  548                     break; \
  549                 case BC_ABGR8888:      \
  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 \
  556                     break; \
  557                 case BC_RGBA8888:      \
  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 \
  564                     break; \
  565                 case BC_RGB161616:      \
  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 \
  572                     break; \
  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 \
  580                     break; \
  581                 case BC_RGB_FLOAT:      \
  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 \
  588                     break; \
  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 \
  596                     break; \
  597                 case BC_YUV888: \
  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 \
  604                     break; \
  605                 case BC_YUVA8888: \
  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 \
  612                     break; \
  613                 case BC_YUV161616: \
  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 \
  620                     break; \
  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 \
  628                     break; \
  629             } \
  630             break; \
  631  \
  632         case BC_YUV9P: \
  633             switch(out_colormodel) \
  634             { \
  635                 case BC_RGB8: \
  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 \
  642                     break; \
  643                 case BC_BGR565: \
  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 \
  650                     break; \
  651                 case BC_RGB565: \
  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 \
  658                     break; \
  659                 case BC_BGR888:      \
  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 \
  666                     break; \
  667                 case BC_BGR8888: \
  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 \
  674                     break; \
  675                 case BC_YUV420P: \
  676                     for(i = 0; i < out_h; i++) \
  677                     { \
  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++) \
  685                         { \
  686                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
  687                                 input_u + (u_in_offset), \
  688                                 input_v + (v_in_offset), \
  689                                 output_y, \
  690                                 output_u, \
  691                                 output_v, \
  692                                 j); \
  693                         } \
  694                     } \
  695                     break; \
  696                 case BC_YUV422: \
  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), \
  702                         j); \
  703                     TRANSFER_FRAME_TAIL \
  704                     break; \
  705                 case BC_YUV422P: \
  706                     for(i = 0; i < out_h; i++) \
  707                     { \
  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++) \
  715                         { \
  716                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
  717                                 input_u + (u_in_offset), \
  718                                 input_v + (v_in_offset), \
  719                                 output_y, \
  720                                 output_u, \
  721                                 output_v, \
  722                                 j); \
  723                         } \
  724                     } \
  725                     break; \
  726                 case BC_YUV444P: \
  727                     for(i = 0; i < out_h; i++) \
  728                     { \
  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++) \
  736                         { \
  737                             transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
  738                                 input_u + (u_in_offset), \
  739                                 input_v + (v_in_offset), \
  740                                 output_y, \
  741                                 output_u, \
  742                                 output_v, \
  743                                 j); \
  744                         } \
  745                     } \
  746                     break; \
  747                 case BC_RGB888:      \
  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 \
  754                     break; \
  755                 case BC_ARGB8888:      \
  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 \
  762                     break; \
  763                 case BC_ABGR8888:      \
  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 \
  770                     break; \
  771                 case BC_RGBA8888:      \
  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 \
  778                     break; \
  779                 case BC_RGB161616:      \
  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 \
  786                     break; \
  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 \
  794                     break; \
  795                 case BC_RGB_FLOAT:      \
  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 \
  802                     break; \
  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 \
  810                     break; \
  811                 case BC_YUV888: \
  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 \
  818                     break; \
  819                 case BC_YUVA8888: \
  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 \
  826                     break; \
  827                 case BC_YUV161616: \
  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 \
  834                     break; \
  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 \
  842                     break; \
  843             } \
  844             break; \
  845  \
  846         case BC_YUV422P: \
  847             switch(out_colormodel) \
  848             { \
  849                 case BC_RGB8: \
  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 \
  856                     break; \
  857                 case BC_BGR565: \
  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 \
  864                     break; \
  865                 case BC_RGB565: \
  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 \
  872                     break; \
  873                 case BC_BGR888:      \
  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 \
  880                     break; \
  881                 case BC_BGR8888: \
  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 \
  888                     break; \
  889                 case BC_RGB888:      \
  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 \
  896                     break; \
  897                 case BC_ARGB8888:      \
  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 \
  904                     break; \
  905                 case BC_ABGR8888:      \
  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 \
  912                     break; \
  913                 case BC_RGBA8888:      \
  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 \
  920                     break; \
  921                 case BC_RGB161616:      \
  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 \
  928                     break; \
  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 \
  936                     break; \
  937                 case BC_RGB_FLOAT:      \
  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 \
  944                     break; \
  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 \
  952                     break; \
  953                 case BC_YUV888: \
  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 \
  960                     break; \
  961                 case BC_YUVA8888: \
  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 \
  968                     break; \
  969                 case BC_YUV161616: \
  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 \
  976                     break; \
  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 \
  984                     break; \
  985                 case BC_YUV420P: \
  986                     for(i = 0; i < out_h; i++) \
  987                     { \
  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++) \
  995                         { \
  996                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
  997                                 input_u + (u_in_offset), \
  998                                 input_v + (v_in_offset), \
  999                                 output_y, \
 1000                                 output_u, \
 1001                                 output_v, \
 1002                                 j); \
 1003                         } \
 1004                     } \
 1005                     break; \
 1006                 case BC_YUV422: \
 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), \
 1012                         j); \
 1013                     TRANSFER_FRAME_TAIL \
 1014                     break; \
 1015                 case BC_YUV422P: \
 1016                     for(i = 0; i < out_h; i++) \
 1017                     { \
 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++) \
 1025                         { \
 1026                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
 1027                                 input_u + (u_in_offset), \
 1028                                 input_v + (v_in_offset), \
 1029                                 output_y, \
 1030                                 output_u, \
 1031                                 output_v, \
 1032                                 j); \
 1033                         } \
 1034                     } \
 1035                     break; \
 1036                 case BC_YUV444P: \
 1037                     for(i = 0; i < out_h; i++) \
 1038                     { \
 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++) \
 1046                         { \
 1047                             transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \
 1048                                 input_u + (u_in_offset), \
 1049                                 input_v + (v_in_offset), \
 1050                                 output_y, \
 1051                                 output_u, \
 1052                                 output_v, \
 1053                                 j); \
 1054                         } \
 1055                     } \
 1056                     break; \
 1057             } \
 1058             break; \
 1059  \
 1060  \
 1061         case BC_YUV444P: \
 1062             switch(out_colormodel) \
 1063             { \
 1064                 case BC_RGB8: \
 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 \
 1071                     break; \
 1072                 case BC_BGR565: \
 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 \
 1079                     break; \
 1080                 case BC_RGB565: \
 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 \
 1087                     break; \
 1088                 case BC_BGR888:      \
 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 \
 1095                     break; \
 1096                 case BC_BGR8888: \
 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 \
 1103                     break; \
 1104                 case BC_RGB888:      \
 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 \
 1111                     break; \
 1112                 case BC_ARGB8888:      \
 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 \
 1119                     break; \
 1120                 case BC_ABGR8888:      \
 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 \
 1127                     break; \
 1128                 case BC_RGBA8888:      \
 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 \
 1135                     break; \
 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 \
 1143                     break; \
 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 \
 1151                     break; \
 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 \
 1159                     break; \
 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 \
 1167                     break; \
 1168                 case BC_YUV888: \
 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 \
 1175                     break; \
 1176                 case BC_YUVA8888: \
 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 \
 1183                     break; \
 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 \
 1191                     break; \
 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 \
 1199                     break; \
 1200                 case BC_YUV420P: \
 1201                     for(i = 0; i < out_h; i++) \
 1202                     { \
 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++) \
 1210                         { \
 1211                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
 1212                                 input_u + (u_in_offset), \
 1213                                 input_v + (v_in_offset), \
 1214                                 output_y, \
 1215                                 output_u, \
 1216                                 output_v, \
 1217                                 j); \
 1218                         } \
 1219                     } \
 1220                     break; \
 1221                 case BC_YUV422: \
 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), \
 1227                         j); \
 1228                     TRANSFER_FRAME_TAIL \
 1229                     break; \
 1230                 case BC_YUV422P: \
 1231                     for(i = 0; i < out_h; i++) \
 1232                     { \
 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++) \
 1240                         { \
 1241                             transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \
 1242                                 input_u + (u_in_offset), \
 1243                                 input_v + (v_in_offset), \
 1244                                 output_y, \
 1245                                 output_u, \
 1246                                 output_v, \
 1247                                 j); \
 1248                         } \
 1249                     } \
 1250                     break; \
 1251                 case BC_YUV444P: \
 1252                     for(i = 0; i < out_h; i++) \
 1253                     { \
 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++) \
 1261                         { \
 1262                             transfer_YUV444P_to_YUV444P(input_y + (y_in_offset), \
 1263                                 input_u + (u_in_offset), \
 1264                                 input_v + (v_in_offset), \
 1265                                 output_y, \
 1266                                 output_u, \
 1267                                 output_v, \
 1268                                 j); \
 1269                         } \
 1270                     } \
 1271                     break; \
 1272             } \
 1273             break; \
 1274     } \
 1275 }
 1276 
 1277 void cmodel_yuv420p(PERMUTATION_ARGS)
 1278 {
 1279     if(scale)
 1280     {
 1281         TRANSFER_FRAME_DEFAULT(&output_row, 
 1282             input_row + column_table[j] * in_pixelsize,
 1283             column_table[j],
 1284             column_table[j] / 2,
 1285             column_table[j] / 2,
 1286             0);
 1287     }
 1288     else
 1289     {
 1290         TRANSFER_FRAME_DEFAULT(&output_row, 
 1291             input_row + j * in_pixelsize,
 1292             j,
 1293             j / 2,
 1294             j / 2,
 1295             0);
 1296     }
 1297 }
 1298 
 1299 void cmodel_yuv9p(PERMUTATION_ARGS)
 1300 {
 1301     if(scale)
 1302     {
 1303         TRANSFER_FRAME_DEFAULT(&output_row, 
 1304             input_row + column_table[j] * in_pixelsize,
 1305             column_table[j],
 1306             column_table[j] / 4,
 1307             column_table[j] / 4,
 1308             0);
 1309     }
 1310     else
 1311     {
 1312         TRANSFER_FRAME_DEFAULT(&output_row, 
 1313             input_row + j * in_pixelsize,
 1314             j,
 1315             j / 4,
 1316             j / 4,
 1317             0);
 1318     }
 1319 }
 1320 
 1321 void cmodel_yuv444p(PERMUTATION_ARGS)
 1322 {
 1323     if(scale)
 1324     {
 1325         TRANSFER_FRAME_DEFAULT(&output_row, 
 1326             input_row + column_table[j] * in_pixelsize,
 1327             column_table[j],
 1328             column_table[j],
 1329             column_table[j],
 1330             0);
 1331     }
 1332     else
 1333     {
 1334         TRANSFER_FRAME_DEFAULT(&output_row, 
 1335             input_row + j * in_pixelsize,
 1336             j,
 1337             j,
 1338             j,
 1339             0);
 1340     }
 1341 }