[svn] / branches / dev-api-4 / xvidcore / src / image / colorspace.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/image/colorspace.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/xvidcore/src/image/colorspace.c revision 651, Sun Nov 17 00:20:30 2002 UTC branches/dev-api-4/xvidcore/src/image/colorspace.c revision 1161, Wed Oct 1 23:23:01 2003 UTC
# Line 1  Line 1 
1  /*****************************************************************************  /*****************************************************************************
2   *   *
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - colorspace conversion module -   *  - Colorspace conversion functions -
5   *   *
6   *  Copyright(C) 2002 Peter Ross <pross@xvid.org>   *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
  *               2002 Michael Militzer <isibaar@xvid.org>  
7   *   *
8   *  This file is part of XviD, a free MPEG-4 video encoder/decoder   *  This program is free software ; you can redistribute it and/or modify
9   *   *  it under the terms of the GNU General Public License as published by
  *  XviD is free software; you can redistribute it and/or modify it  
  *  under the terms of the GNU General Public License as published by  
10   *  the Free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
11   *  (at your option) any later version.   *  (at your option) any later version.
12   *   *
# Line 22  Line 19 
19   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   *  Under section 8 of the GNU General Public License, the copyright   * $Id: colorspace.c,v 1.8.2.4 2003-10-01 23:23:01 edgomez Exp $
  *  holders of XVID explicitly forbid distribution in the following  
  *  countries:  
  *  
  *    - Japan  
  *    - United States of America  
  *  
  *  Linking XviD statically or dynamically with other modules is making a  
  *  combined work based on XviD.  Thus, the terms and conditions of the  
  *  GNU General Public License cover the whole combination.  
  *  
  *  As a special exception, the copyright holders of XviD give you  
  *  permission to link XviD with independent modules that communicate with  
  *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
  *  license terms of these independent modules, and to copy and distribute  
  *  the resulting combined work under terms of your choice, provided that  
  *  every copy of the combined work is accompanied by a complete copy of  
  *  the source code of XviD (the version of XviD used to produce the  
  *  combined work), being distributed under the terms of the GNU General  
  *  Public License plus this exception.  An independent module is a module  
  *  which is not derived from or based on XviD.  
  *  
  *  Note that people who make modified versions of XviD are not obligated  
  *  to grant this special exception for their modified versions; it is  
  *  their choice whether to do so.  The GNU General Public License gives  
  *  permission to release a modified version without this exception; this  
  *  exception also makes it possible to release a modified version which  
  *  carries forward this exception.  
  *  
  * $Id: colorspace.c,v 1.6 2002-11-17 00:20:30 edgomez Exp $  
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
26  #include <string.h>                             // memcpy  #include <string.h>                             /* memcpy */
27    
28    #include "../global.h"
29  #include "colorspace.h"  #include "colorspace.h"
 #include "../divx4.h"                   // DEC_PICTURE  
30    
31  // function pointers  /* function pointers */
32    
33  /* input */  /* input */
34  color_inputFuncPtr rgb555_to_yv12;  packedFuncPtr rgb555_to_yv12;
35  color_inputFuncPtr rgb565_to_yv12;  packedFuncPtr rgb565_to_yv12;
36  color_inputFuncPtr rgb24_to_yv12;  packedFuncPtr bgr_to_yv12;
37  color_inputFuncPtr rgb32_to_yv12;  packedFuncPtr bgra_to_yv12;
38  color_inputFuncPtr yuv_to_yv12;  packedFuncPtr abgr_to_yv12;
39  color_inputFuncPtr yuyv_to_yv12;  packedFuncPtr rgba_to_yv12;
40  color_inputFuncPtr uyvy_to_yv12;  packedFuncPtr yuv_to_yv12;
41    packedFuncPtr yuyv_to_yv12;
42    packedFuncPtr uyvy_to_yv12;
43    
44    packedFuncPtr rgb555i_to_yv12;
45    packedFuncPtr rgb565i_to_yv12;
46    packedFuncPtr bgri_to_yv12;
47    packedFuncPtr bgrai_to_yv12;
48    packedFuncPtr abgri_to_yv12;
49    packedFuncPtr rgbai_to_yv12;
50    packedFuncPtr yuyvi_to_yv12;
51    packedFuncPtr uyvyi_to_yv12;
52    
53  /* output */  /* output */
54  color_outputFuncPtr yv12_to_rgb555;  packedFuncPtr yv12_to_rgb555;
55  color_outputFuncPtr yv12_to_rgb565;  packedFuncPtr yv12_to_rgb565;
56  color_outputFuncPtr yv12_to_rgb24;  packedFuncPtr yv12_to_bgr;
57  color_outputFuncPtr yv12_to_rgb32;  packedFuncPtr yv12_to_bgra;
58  color_outputFuncPtr yv12_to_yuv;  packedFuncPtr yv12_to_abgr;
59  color_outputFuncPtr yv12_to_yuyv;  packedFuncPtr yv12_to_rgba;
60  color_outputFuncPtr yv12_to_uyvy;  packedFuncPtr yv12_to_yuv;
61    packedFuncPtr yv12_to_yuyv;
62    packedFuncPtr yv12_to_uyvy;
63    
64    packedFuncPtr yv12_to_rgb555i;
65    packedFuncPtr yv12_to_rgb565i;
66    packedFuncPtr yv12_to_bgri;
67    packedFuncPtr yv12_to_bgrai;
68    packedFuncPtr yv12_to_abgri;
69    packedFuncPtr yv12_to_rgbai;
70    packedFuncPtr yv12_to_yuyvi;
71    packedFuncPtr yv12_to_uyvyi;
72    
73    planarFuncPtr yv12_to_yv12;
74    
75    
76    int32_t RGB_Y_tab[256];
77    int32_t B_U_tab[256];
78    int32_t G_U_tab[256];
79    int32_t G_V_tab[256];
80    int32_t R_V_tab[256];
81    
82    
83    
84    /********** generic colorspace macro **********/
85    
86    
87    #define MAKE_COLORSPACE(NAME,SIZE,PIXELS,VPIXELS,FUNC,C1,C2,C3,C4) \
88    void    \
89    NAME(uint8_t * x_ptr, int x_stride,     \
90                                     uint8_t * y_ptr, uint8_t * u_ptr, uint8_t * v_ptr,     \
91                                     int y_stride, int uv_stride,   \
92                                     int width, int height, int vflip)      \
93    {       \
94            int fixed_width = (width + 1) & ~1;                             \
95            int x_dif = x_stride - (SIZE)*fixed_width;              \
96            int y_dif = y_stride - fixed_width;                             \
97            int uv_dif = uv_stride - (fixed_width / 2);             \
98            int x, y;                                                                               \
99            if (vflip) {                                                            \
100                    x_ptr += (height - 1) * x_stride;                       \
101                    x_dif = -(SIZE)*fixed_width - x_stride;         \
102                    x_stride = -x_stride;                                           \
103            }                                                                                               \
104            for (y = 0; y < height; y+=(VPIXELS)) {                 \
105                    FUNC##_ROW(SIZE,C1,C2,C3,C4);                           \
106                    for (x = 0; x < fixed_width; x+=(PIXELS)) {     \
107                            FUNC(SIZE,C1,C2,C3,C4);                         \
108                            x_ptr += (PIXELS)*(SIZE);                               \
109                            y_ptr += (PIXELS);                                              \
110                            u_ptr += (PIXELS)/2;                                    \
111                            v_ptr += (PIXELS)/2;                                    \
112                    }                                                                                       \
113                    x_ptr += x_dif + (VPIXELS-1)*x_stride;          \
114                    y_ptr += y_dif + (VPIXELS-1)*y_stride;          \
115                    u_ptr += uv_dif + ((VPIXELS/2)-1)*uv_stride;    \
116                    v_ptr += uv_dif + ((VPIXELS/2)-1)*uv_stride;    \
117            }                                                                                               \
118    }
119    
120    
121  #define MIN(A,B)        ((A)<(B)?(A):(B))  
122  #define MAX(A,B)        ((A)>(B)?(A):(B))  /********** colorspace input (xxx_to_yv12) functions **********/
123    
124  /*      rgb -> yuv def's  /*      rgb -> yuv def's
125    
# Line 112  Line 150 
150  #define FIX_IN(x)               ((uint16_t) ((x) * (1L<<SCALEBITS_IN) + 0.5))  #define FIX_IN(x)               ((uint16_t) ((x) * (1L<<SCALEBITS_IN) + 0.5))
151    
152    
153  int32_t RGB_Y_tab[256];  /* rgb16/rgb16i input */
 int32_t B_U_tab[256];  
 int32_t G_U_tab[256];  
 int32_t G_V_tab[256];  
 int32_t R_V_tab[256];  
   
   
 /* rgb555 -> yuv 4:2:0 planar */  
 void  
 rgb555_to_yv12_c(uint8_t * y_out,  
                                  uint8_t * u_out,  
                                  uint8_t * v_out,  
                                  uint8_t * src,  
                                  int width,  
                                  int height,  
                                  int y_stride)  
 {  
         int32_t src_stride = width * 2;  
         uint32_t y_dif = y_stride - width;  
         uint32_t uv_dif = (y_stride - width) / 2;  
         uint32_t x, y;  
   
         if (height < 0) {  
                 height = -height;  
                 src += (height - 1) * src_stride;  
                 src_stride = -src_stride;  
         }  
   
   
         for (y = height / 2; y; y--) {  
                 // process one 2x2 block per iteration  
                 for (x = 0; x < (uint32_t) width; x += 2) {  
                         int rgb, r, g, b, r4, g4, b4;  
   
                         rgb = *(uint16_t *) (src + x * 2);  
                         b4 = b = (rgb << 3) & 0xf8;  
                         g4 = g = (rgb >> 2) & 0xf8;  
                         r4 = r = (rgb >> 7) & 0xf8;  
                         y_out[0] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + src_stride);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 2) & 0xf8;  
                         r4 += r = (rgb >> 7) & 0xf8;  
                         y_out[y_stride] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + 2);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 2) & 0xf8;  
                         r4 += r = (rgb >> 7) & 0xf8;  
                         y_out[1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + src_stride + 2);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 2) & 0xf8;  
                         r4 += r = (rgb >> 7) & 0xf8;  
                         y_out[y_stride + 1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         *u_out++ =  
                                 (uint8_t) ((-FIX_IN(U_R_IN) * r4 - FIX_IN(U_G_IN) * g4 +  
                                                         FIX_IN(U_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 U_ADD_IN;  
   
   
                         *v_out++ =  
                                 (uint8_t) ((FIX_IN(V_R_IN) * r4 - FIX_IN(V_G_IN) * g4 -  
                                                         FIX_IN(V_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 V_ADD_IN;  
   
                         y_out += 2;  
                 }  
                 src += src_stride * 2;  
                 y_out += y_dif + y_stride;  
                 u_out += uv_dif;  
                 v_out += uv_dif;  
         }  
 }  
   
   
   
 /* rgb565_to_yuv_c  
         NOTE:   identical to rgb555 except for shift/mask  
                         not tested */  
   
 void  
 rgb565_to_yv12_c(uint8_t * y_out,  
                                  uint8_t * u_out,  
                                  uint8_t * v_out,  
                                  uint8_t * src,  
                                  int width,  
                                  int height,  
                                  int y_stride)  
 {  
         int32_t src_stride = width * 2;  
   
         uint32_t y_dif = y_stride - width;  
         uint32_t uv_dif = (y_stride - width) / 2;  
         uint32_t x, y;  
   
         if (height < 0) {  
                 height = -height;  
                 src += (height - 1) * src_stride;  
                 src_stride = -src_stride;  
         }  
   
   
         for (y = height / 2; y; y--) {  
                 // process one 2x2 block per iteration  
                 for (x = 0; x < (uint32_t) width; x += 2) {  
                         int rgb, r, g, b, r4, g4, b4;  
   
                         rgb = *(uint16_t *) (src + x * 2);  
                         b4 = b = (rgb << 3) & 0xf8;  
                         g4 = g = (rgb >> 3) & 0xfc;  
                         r4 = r = (rgb >> 8) & 0xf8;  
                         y_out[0] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + src_stride);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 3) & 0xfc;  
                         r4 += r = (rgb >> 8) & 0xf8;  
                         y_out[y_stride] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + 2);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 3) & 0xfc;  
                         r4 += r = (rgb >> 8) & 0xf8;  
                         y_out[1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         rgb = *(uint16_t *) (src + x * 2 + src_stride + 2);  
                         b4 += b = (rgb << 3) & 0xf8;  
                         g4 += g = (rgb >> 3) & 0xfc;  
                         r4 += r = (rgb >> 8) & 0xf8;  
                         y_out[y_stride + 1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         *u_out++ =  
                                 (uint8_t) ((-FIX_IN(U_R_IN) * r4 - FIX_IN(U_G_IN) * g4 +  
                                                         FIX_IN(U_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 U_ADD_IN;  
   
   
                         *v_out++ =  
                                 (uint8_t) ((FIX_IN(V_R_IN) * r4 - FIX_IN(V_G_IN) * g4 -  
                                                         FIX_IN(V_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 V_ADD_IN;  
   
                         y_out += 2;  
                 }  
                 src += src_stride * 2;  
                 y_out += y_dif + y_stride;  
                 u_out += uv_dif;  
                 v_out += uv_dif;  
         }  
 }  
   
   
   
   
 /*      rgb24 -> yuv 4:2:0 planar  
   
         NOTE: always flips.  
 */  
   
 void  
 rgb24_to_yv12_c(uint8_t * y_out,  
                                 uint8_t * u_out,  
                                 uint8_t * v_out,  
                                 uint8_t * src,  
                                 int width,  
                                 int height,  
                                 int stride)  
 {  
         uint32_t width3 = (width << 1) + width; /* width * 3 */  
         uint32_t src_dif = (width << 3) + width;        /* width3 * 3 */  
         uint32_t y_dif = (stride << 1) - width;  
         uint32_t uv_dif = (stride - width) >> 1;  
         uint32_t x, y;  
   
         src += (height - 2) * width3;  
   
   
         for (y = height >> 1; y; y--) {  
                 for (x = width >> 1; x; x--) {  
                         uint32_t r, g, b, r4, g4, b4;  
   
                         b4 = b = src[0];  
                         g4 = g = src[1];  
                         r4 = r = src[2];  
                         y_out[stride + 0] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         b4 += (b = src[3]);  
                         g4 += (g = src[4]);  
                         r4 += (r = src[5]);  
                         y_out[stride + 1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         b4 += (b = src[width3 + 0]);  
                         g4 += (g = src[width3 + 1]);  
                         r4 += (r = src[width3 + 2]);  
                         y_out[0] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         b4 += (b = src[width3 + 3]);  
                         g4 += (g = src[width3 + 4]);  
                         r4 += (r = src[width3 + 5]);  
                         y_out[1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         *u_out++ =  
                                 (uint8_t) ((-FIX_IN(U_R_IN) * r4 - FIX_IN(U_G_IN) * g4 +  
                                                         FIX_IN(U_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 U_ADD_IN;  
   
   
                         *v_out++ =  
                                 (uint8_t) ((FIX_IN(V_R_IN) * r4 - FIX_IN(V_G_IN) * g4 -  
                                                         FIX_IN(V_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 V_ADD_IN;  
   
   
                         src += 6;  
                         y_out += 2;  
                 }  
                 src -= src_dif;  
                 y_out += y_dif;  
                 u_out += uv_dif;  
                 v_out += uv_dif;  
         }  
 }  
   
   
 /*      rgb32 -> yuv 4:2:0 planar  
154    
155          NOTE: always flips  #define MK_RGB555_B(RGB)  ((RGB) << 3) & 0xf8
156  */  #define MK_RGB555_G(RGB)  ((RGB) >> 2) & 0xf8
157    #define MK_RGB555_R(RGB)  ((RGB) >> 7) & 0xf8
158  void  
159  rgb32_to_yv12_c(uint8_t * y_out,  #define MK_RGB565_B(RGB)  ((RGB) << 3) & 0xf8
160                                  uint8_t * u_out,  #define MK_RGB565_G(RGB)  ((RGB) >> 3) & 0xfc
161                                  uint8_t * v_out,  #define MK_RGB565_R(RGB)  ((RGB) >> 8) & 0xf8
162                                  uint8_t * src,  
163                                  int width,  
164                                  int height,  #define READ_RGB16_Y(ROW, UVID, C1,C2,C3,C4)    \
165                                  int stride)          rgb = *(uint16_t *) (x_ptr + ((ROW)*x_stride) + 0);     \
166  {          b##UVID += b = C1##_B(rgb);                             \
167          uint32_t width4 = (width << 2); /* width * 4 */          g##UVID += g = C1##_G(rgb);                             \
168          uint32_t src_dif = 3 * width4;          r##UVID += r = C1##_R(rgb);                             \
169          uint32_t y_dif = (stride << 1) - width;          y_ptr[(ROW)*y_stride+0] =                               \
170          uint32_t uv_dif = (stride - width) >> 1;                  (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +   \
171          uint32_t x, y;                                          FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;        \
172            rgb = *(uint16_t *) (x_ptr + ((ROW)*x_stride) + 2);     \
173          src += (height - 2) * width4;          b##UVID += b = C1##_B(rgb);                             \
174            g##UVID += g = C1##_G(rgb);                             \
175          for (y = height >> 1; y; y--) {          r##UVID += r = C1##_R(rgb);                             \
176                  for (x = width >> 1; x; x--) {          y_ptr[(ROW)*y_stride+1] =                               \
177                          uint32_t r, g, b, r4, g4, b4;                  (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +                   \
178                                            FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;
179                          b4 = b = src[0];  
180                          g4 = g = src[1];  #define READ_RGB16_UV(UV_ROW,UVID)      \
181                          r4 = r = src[2];          u_ptr[(UV_ROW)*uv_stride] =                                                                                                             \
182                          y_out[stride + 0] =                  (uint8_t) ((-FIX_IN(U_R_IN) * r##UVID - FIX_IN(U_G_IN) * g##UVID +                      \
183                                  (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +                                          FIX_IN(U_B_IN) * b##UVID) >> (SCALEBITS_IN + 2)) + U_ADD_IN;    \
184                                                          FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;          v_ptr[(UV_ROW)*uv_stride] =                                                                                                             \
185                    (uint8_t) ((FIX_IN(V_R_IN) * r##UVID - FIX_IN(V_G_IN) * g##UVID -                       \
186                                            FIX_IN(V_B_IN) * b##UVID) >> (SCALEBITS_IN + 2)) + V_ADD_IN;
187    
188    #define RGB16_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
189            /* nothing */
190    #define RGB16_TO_YV12(SIZE,C1,C2,C3,C4) \
191            uint32_t rgb, r, g, b, r0, g0, b0;      \
192            r0 = g0 = b0 = 0;                                       \
193            READ_RGB16_Y (0, 0, C1,C2,C3,C4)        \
194            READ_RGB16_Y (1, 0, C1,C2,C3,C4)        \
195            READ_RGB16_UV(0, 0)
196    
197    
198    #define RGB16I_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
199            /* nothing */
200    #define RGB16I_TO_YV12(SIZE,C1,C2,C3,C4)        \
201            uint32_t rgb, r, g, b, r0, g0, b0, r1, g1, b1;  \
202            r0 = g0 = b0 = r1 = g1 = b1 = 0;        \
203            READ_RGB16_Y (0, 0, C1,C2,C3,C4)        \
204            READ_RGB16_Y (1, 1, C1,C2,C3,C4)        \
205            READ_RGB16_Y (2, 0, C1,C2,C3,C4)        \
206            READ_RGB16_Y (3, 1, C1,C2,C3,C4)        \
207            READ_RGB16_UV(0, 0)                                     \
208            READ_RGB16_UV(1, 1)
209    
210    
211    /* rgb/rgbi input */
212    
213    #define READ_RGB_Y(SIZE, ROW, UVID, C1,C2,C3,C4)        \
214            r##UVID += r = x_ptr[(ROW)*x_stride+(C1)];                                              \
215            g##UVID += g = x_ptr[(ROW)*x_stride+(C2)];                                              \
216            b##UVID += b = x_ptr[(ROW)*x_stride+(C3)];                                              \
217            y_ptr[(ROW)*y_stride+0] =                                                                       \
218                    (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +   \
219                                            FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;        \
220            r##UVID += r = x_ptr[(ROW)*x_stride+(SIZE)+(C1)];                               \
221            g##UVID += g = x_ptr[(ROW)*x_stride+(SIZE)+(C2)];                               \
222            b##UVID += b = x_ptr[(ROW)*x_stride+(SIZE)+(C3)];                               \
223            y_ptr[(ROW)*y_stride+1] =                                                                       \
224                    (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +   \
225                                            FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;
226    
227    #define READ_RGB_UV(UV_ROW,UVID)        \
228            u_ptr[(UV_ROW)*uv_stride] =                                                                                                             \
229                    (uint8_t) ((-FIX_IN(U_R_IN) * r##UVID - FIX_IN(U_G_IN) * g##UVID +                      \
230                                            FIX_IN(U_B_IN) * b##UVID) >> (SCALEBITS_IN + 2)) + U_ADD_IN;    \
231            v_ptr[(UV_ROW)*uv_stride] =                                                                                                             \
232                    (uint8_t) ((FIX_IN(V_R_IN) * r##UVID - FIX_IN(V_G_IN) * g##UVID -                       \
233                                            FIX_IN(V_B_IN) * b##UVID) >> (SCALEBITS_IN + 2)) + V_ADD_IN;
234    
235    
236    #define RGB_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
237            /* nothing */
238    #define RGB_TO_YV12(SIZE,C1,C2,C3,C4)   \
239            uint32_t r, g, b, r0, g0, b0;           \
240            r0 = g0 = b0 = 0;                                       \
241            READ_RGB_Y(SIZE, 0, 0, C1,C2,C3,C4)     \
242            READ_RGB_Y(SIZE, 1, 0, C1,C2,C3,C4)     \
243            READ_RGB_UV(     0, 0)
244    
245    #define RGBI_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
246            /* nothing */
247    #define RGBI_TO_YV12(SIZE,C1,C2,C3,C4)  \
248            uint32_t r, g, b, r0, g0, b0, r1, g1, b1;       \
249            r0 = g0 = b0 = r1 = g1 = b1 = 0;        \
250            READ_RGB_Y(SIZE, 0, 0, C1,C2,C3,C4)     \
251            READ_RGB_Y(SIZE, 1, 1, C1,C2,C3,C4)     \
252            READ_RGB_Y(SIZE, 2, 0, C1,C2,C3,C4)     \
253            READ_RGB_Y(SIZE, 3, 1, C1,C2,C3,C4)     \
254            READ_RGB_UV(     0, 0)                          \
255            READ_RGB_UV(     1, 1)
256    
257    
258    /* yuyv/yuyvi input */
259    
260    #define READ_YUYV_Y(ROW,C1,C2,C3,C4)    \
261            y_ptr[(ROW)*y_stride+0] = x_ptr[(ROW)*x_stride+(C1)];   \
262            y_ptr[(ROW)*y_stride+1] = x_ptr[(ROW)*x_stride+(C3)];
263    #define READ_YUYV_UV(UV_ROW,ROW1,ROW2,C1,C2,C3,C4) \
264            u_ptr[(UV_ROW)*uv_stride] = (x_ptr[(ROW1)*x_stride+(C2)] + x_ptr[(ROW2)*x_stride+(C2)] + 1) / 2;        \
265            v_ptr[(UV_ROW)*uv_stride] = (x_ptr[(ROW1)*x_stride+(C4)] + x_ptr[(ROW2)*x_stride+(C4)] + 1) / 2;
266    
267    #define YUYV_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
268            /* nothing */
269    #define YUYV_TO_YV12(SIZE,C1,C2,C3,C4)  \
270            READ_YUYV_Y (0,      C1,C2,C3,C4)       \
271            READ_YUYV_Y (1,      C1,C2,C3,C4)       \
272            READ_YUYV_UV(0, 0,1, C1,C2,C3,C4)
273    
274    #define YUYVI_TO_YV12_ROW(SIZE,C1,C2,C3,C4) \
275            /* nothing */
276    #define YUYVI_TO_YV12(SIZE,C1,C2,C3,C4) \
277            READ_YUYV_Y (0, C1,C2,C3,C4)    \
278            READ_YUYV_Y (1, C1,C2,C3,C4)    \
279            READ_YUYV_Y (2, C1,C2,C3,C4)    \
280            READ_YUYV_Y (3, C1,C2,C3,C4)    \
281            READ_YUYV_UV(0, 0,2, C1,C2,C3,C4)       \
282            READ_YUYV_UV(1, 1,3, C1,C2,C3,C4)
283    
284    
285    MAKE_COLORSPACE(rgb555_to_yv12_c,  2,2,2, RGB16_TO_YV12,  MK_RGB555, 0,0,0)
286    MAKE_COLORSPACE(rgb565_to_yv12_c,  2,2,2, RGB16_TO_YV12,  MK_RGB565, 0,0,0)
287    MAKE_COLORSPACE(bgr_to_yv12_c,     3,2,2, RGB_TO_YV12,    2,1,0, 0)
288    MAKE_COLORSPACE(bgra_to_yv12_c,    4,2,2, RGB_TO_YV12,    2,1,0, 0)
289    MAKE_COLORSPACE(abgr_to_yv12_c,    4,2,2, RGB_TO_YV12,    3,2,1, 0)
290    MAKE_COLORSPACE(rgba_to_yv12_c,    4,2,2, RGB_TO_YV12,    0,1,2, 0)
291    MAKE_COLORSPACE(yuyv_to_yv12_c,    2,2,2, YUYV_TO_YV12,   0,1,2,3)
292    MAKE_COLORSPACE(uyvy_to_yv12_c,    2,2,2, YUYV_TO_YV12,   1,0,3,2)
293    
294    MAKE_COLORSPACE(rgb555i_to_yv12_c, 2,2,4, RGB16I_TO_YV12, MK_RGB555, 0,0,0)
295    MAKE_COLORSPACE(rgb565i_to_yv12_c, 2,2,4, RGB16I_TO_YV12, MK_RGB565, 0,0,0)
296    MAKE_COLORSPACE(bgri_to_yv12_c,    3,2,4, RGBI_TO_YV12,   2,1,0, 0)
297    MAKE_COLORSPACE(bgrai_to_yv12_c,   4,2,4, RGBI_TO_YV12,   2,1,0, 0)
298    MAKE_COLORSPACE(abgri_to_yv12_c,   4,2,4, RGBI_TO_YV12,   3,2,1, 0)
299    MAKE_COLORSPACE(rgbai_to_yv12_c,   4,2,4, RGBI_TO_YV12,   0,1,2, 0)
300    MAKE_COLORSPACE(yuyvi_to_yv12_c,   2,2,4, YUYVI_TO_YV12,  0,1,2,3)
301    MAKE_COLORSPACE(uyvyi_to_yv12_c,   2,2,4, YUYVI_TO_YV12,  1,0,3,2)
302    
                         b4 += (b = src[4]);  
                         g4 += (g = src[5]);  
                         r4 += (r = src[6]);  
                         y_out[stride + 1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         b4 += (b = src[width4 + 0]);  
                         g4 += (g = src[width4 + 1]);  
                         r4 += (r = src[width4 + 2]);  
   
                         y_out[0] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         b4 += (b = src[width4 + 4]);  
                         g4 += (g = src[width4 + 5]);  
                         r4 += (r = src[width4 + 6]);  
                         y_out[1] =  
                                 (uint8_t) ((FIX_IN(Y_R_IN) * r + FIX_IN(Y_G_IN) * g +  
                                                         FIX_IN(Y_B_IN) * b) >> SCALEBITS_IN) + Y_ADD_IN;  
   
                         *u_out++ =  
                                 (uint8_t) ((-FIX_IN(U_R_IN) * r4 - FIX_IN(U_G_IN) * g4 +  
                                                         FIX_IN(U_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 U_ADD_IN;  
   
                         *v_out++ =  
                                 (uint8_t) ((FIX_IN(V_R_IN) * r4 - FIX_IN(V_G_IN) * g4 -  
                                                         FIX_IN(V_B_IN) * b4) >> (SCALEBITS_IN + 2)) +  
                                 V_ADD_IN;  
   
                         src += 8;  
                         y_out += 2;  
                 }  
                 src -= src_dif;  
                 y_out += y_dif;  
                 u_out += uv_dif;  
                 v_out += uv_dif;  
         }  
 }  
   
 /*      yuv planar -> yuv 4:2:0 planar  
   
         NOTE: does not flip */  
   
 void  
 yuv_to_yv12_c(uint8_t * y_out,  
                           uint8_t * u_out,  
                           uint8_t * v_out,  
                           uint8_t * src,  
                           int width,  
                           int height,  
                           int stride)  
 {  
         uint32_t stride2 = stride >> 1;  
         uint32_t width2 = width >> 1;  
         uint32_t y;  
   
         for (y = height; y; y--) {  
                 memcpy(y_out, src, width);  
                 src += width;  
                 y_out += stride;  
         }  
   
         for (y = height >> 1; y; y--) {  
                 memcpy(u_out, src, width2);  
                 src += width2;  
                 u_out += stride2;  
         }  
   
         for (y = height >> 1; y; y--) {  
                 memcpy(v_out, src, width2);  
                 src += width2;  
                 v_out += stride2;  
         }  
 }  
   
   
   
 /* yuyv (yuv2) packed -> yuv 4:2:0 planar  
   
    NOTE: does not flip */  
   
 void  
 yuyv_to_yv12_c(uint8_t * y_out,  
                            uint8_t * u_out,  
                            uint8_t * v_out,  
                            uint8_t * src,  
                            int width,  
                            int height,  
                            int stride)  
 {  
         uint32_t width2 = width + width;  
         uint32_t y_dif = stride - width;  
         uint32_t uv_dif = y_dif >> 1;  
         uint32_t x, y;  
   
         for (y = height >> 1; y; y--) {  
   
                 for (x = width >> 1; x; x--) {  
                         *y_out++ = *src++;  
                         //*u_out++ = *src++;  
                         *u_out++ = (*(src + width2) + *src) >> 1;  
                         src++;  
                         *y_out++ = *src++;  
                         //*v_out++ = *src++;  
                         *v_out++ = (*(src + width2) + *src) >> 1;  
                         src++;  
   
                 }  
   
                 y_out += y_dif;  
                 u_out += uv_dif;  
                 v_out += uv_dif;  
   
                 for (x = width >> 1; x; x--) {  
                         *y_out++ = *src++;  
                         src++;  
                         *y_out++ = *src++;  
                         src++;  
                 }  
   
                 y_out += y_dif;  
   
         }  
   
 }  
   
   
   
 /* uyvy packed -> yuv 4:2:0 planar  
   
    NOTE: does not flip */  
   
   
 void  
 uyvy_to_yv12_c(uint8_t * y_out,  
                            uint8_t * u_out,  
                            uint8_t * v_out,  
                            uint8_t * src,  
                            int width,  
                            int height,  
                            int stride)  
 {  
         uint32_t width2 = width + width;  
         uint32_t y_dif = stride - width;  
         uint32_t uv_dif = y_dif >> 1;  
         uint32_t x, y;  
   
         for (y = height >> 1; y; y--) {  
   
                 for (x = width >> 1; x; x--) {  
                         *u_out++ = *src++;  
                         // *u_out++ = (*(src+width2) + *src++) >> 1;  
                         *y_out++ = *src++;  
                         //*v_out++ = *src++;  
                         *v_out++ = (*(src + width2) + *src) >> 1;  
                         src++;  
                         *y_out++ = *src++;  
                 }  
   
                 y_out += y_dif;  
                 u_out += uv_dif;;  
                 v_out += uv_dif;;  
   
                 for (x = width >> 1; x; x--) {  
                         src++;  
                         *y_out++ = *src++;  
                         src++;  
                         *y_out++ = *src++;  
                 }  
   
                 y_out += y_dif;  
         }  
 }  
303    
304    /********** colorspace output (yv12_to_xxx) functions **********/
305    
306  /*      yuv -> rgb def's */  /*      yuv -> rgb def's */
307    
# Line 588  Line 316 
316  #define R_V_OUT                 1.596  #define R_V_OUT                 1.596
317  #define V_ADD_OUT               128  #define V_ADD_OUT               128
318    
   
319  #define SCALEBITS_OUT   13  #define SCALEBITS_OUT   13
320  #define FIX_OUT(x)              ((uint16_t) ((x) * (1L<<SCALEBITS_OUT) + 0.5))  #define FIX_OUT(x)              ((uint16_t) ((x) * (1L<<SCALEBITS_OUT) + 0.5))
321    
322    
323  /* initialize rgb lookup tables */  /* rgb16/rgb16i output */
   
 void  
 colorspace_init(void)  
 {  
         int32_t i;  
   
         for (i = 0; i < 256; i++) {  
                 RGB_Y_tab[i] = FIX_OUT(RGB_Y_OUT) * (i - Y_ADD_OUT);  
                 B_U_tab[i] = FIX_OUT(B_U_OUT) * (i - U_ADD_OUT);  
                 G_U_tab[i] = FIX_OUT(G_U_OUT) * (i - U_ADD_OUT);  
                 G_V_tab[i] = FIX_OUT(G_V_OUT) * (i - V_ADD_OUT);  
                 R_V_tab[i] = FIX_OUT(R_V_OUT) * (i - V_ADD_OUT);  
         }  
 }  
   
 /* yuv 4:2:0 planar -> rgb555 + very simple error diffusion  
 */  
324    
325  #define MK_RGB555(R,G,B)        ((MAX(0,MIN(255, R)) << 7) & 0x7c00) | \  #define MK_RGB555(R,G,B)        \
326            ((MAX(0,MIN(255, R)) << 7) & 0x7c00) | \
327                                                          ((MAX(0,MIN(255, G)) << 2) & 0x03e0) | \                                                          ((MAX(0,MIN(255, G)) << 2) & 0x03e0) | \
328                                                          ((MAX(0,MIN(255, B)) >> 3) & 0x001f)                                                          ((MAX(0,MIN(255, B)) >> 3) & 0x001f)
329    
330    #define MK_RGB565(R,G,B)        \
331  void          ((MAX(0,MIN(255, R)) << 8) & 0xf800) | \
 yv12_to_rgb555_c(uint8_t * dst,  
                                  int dst_stride,  
                                  uint8_t * y_src,  
                                  uint8_t * u_src,  
                                  uint8_t * v_src,  
                                  int y_stride,  
                                  int uv_stride,  
                                  int width,  
                                  int height)  
 {  
         const uint32_t dst_dif = 4 * dst_stride - 2 * width;  
         int32_t y_dif = 2 * y_stride - width;  
   
         uint8_t *dst2 = dst + 2 * dst_stride;  
         uint8_t *y_src2 = y_src + y_stride;  
         uint32_t x, y;  
   
         if (height < 0) {  
                 height = -height;  
                 y_src += (height - 1) * y_stride;  
                 y_src2 = y_src - y_stride;  
                 u_src += (height / 2 - 1) * uv_stride;  
                 v_src += (height / 2 - 1) * uv_stride;  
                 y_dif = -width - 2 * y_stride;  
                 uv_stride = -uv_stride;  
         }  
   
         for (y = height / 2; y; y--) {  
                 int r, g, b;  
                 int r2, g2, b2;  
   
                 r = g = b = 0;  
                 r2 = g2 = b2 = 0;  
   
                 // process one 2x2 block per iteration  
                 for (x = 0; x < (uint32_t) width / 2; x++) {  
                         int u, v;  
                         int b_u, g_uv, r_v, rgb_y;  
   
                         u = u_src[x];  
                         v = v_src[x];  
   
                         b_u = B_U_tab[u];  
                         g_uv = G_U_tab[u] + G_V_tab[v];  
                         r_v = R_V_tab[v];  
   
                         rgb_y = RGB_Y_tab[*y_src];  
                         b = (b & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);  
                         g = (g & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);  
                         r = (r & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);  
                         *(uint16_t *) dst = MK_RGB555(r, g, b);  
   
                         y_src++;  
                         rgb_y = RGB_Y_tab[*y_src];  
                         b = (b & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);  
                         g = (g & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);  
                         r = (r & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);  
                         *(uint16_t *) (dst + 2) = MK_RGB555(r, g, b);  
                         y_src++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b2 = (b2 & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);  
                         g2 = (g2 & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);  
                         r2 = (r2 & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);  
                         *(uint16_t *) (dst2) = MK_RGB555(r2, g2, b2);  
                         y_src2++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b2 = (b2 & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);  
                         g2 = (g2 & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);  
                         r2 = (r2 & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);  
                         *(uint16_t *) (dst2 + 2) = MK_RGB555(r2, g2, b2);  
                         y_src2++;  
   
                         dst += 4;  
                         dst2 += 4;  
                 }  
   
                 dst += dst_dif;  
                 dst2 += dst_dif;  
   
                 y_src += y_dif;  
                 y_src2 += y_dif;  
   
                 u_src += uv_stride;  
                 v_src += uv_stride;  
         }  
 }  
   
   
 /* yuv 4:2:0 planar -> rgb565 + very simple error diffusion  
         NOTE:   identical to rgb555 except for shift/mask  */  
   
   
 #define MK_RGB565(R,G,B)        ((MAX(0,MIN(255, R)) << 8) & 0xf800) | \  
332                                                          ((MAX(0,MIN(255, G)) << 3) & 0x07e0) | \                                                          ((MAX(0,MIN(255, G)) << 3) & 0x07e0) | \
333                                                          ((MAX(0,MIN(255, B)) >> 3) & 0x001f)                                                          ((MAX(0,MIN(255, B)) >> 3) & 0x001f)
334    
335  void  #define WRITE_RGB16(ROW,UV_ROW,C1)      \
336  yv12_to_rgb565_c(uint8_t * dst,          rgb_y = RGB_Y_tab[ y_ptr[y_stride + 0] ];                       \
337                                   int dst_stride,          b[ROW] = (b[ROW] & 0x7) + ((rgb_y + b_u##UV_ROW) >> SCALEBITS_OUT);     \
338                                   uint8_t * y_src,          g[ROW] = (g[ROW] & 0x7) + ((rgb_y - g_uv##UV_ROW) >> SCALEBITS_OUT);    \
339                                   uint8_t * u_src,          r[ROW] = (r[ROW] & 0x7) + ((rgb_y + r_v##UV_ROW) >> SCALEBITS_OUT);             \
340                                   uint8_t * v_src,          *(uint16_t *) (x_ptr+((ROW)*x_stride)+0) = C1(r[ROW], g[ROW], b[ROW]);  \
341                                   int y_stride,          rgb_y = RGB_Y_tab[ y_ptr[y_stride + 1] ];                               \
342                                   int uv_stride,          b[ROW] = (b[ROW] & 0x7) + ((rgb_y + b_u##UV_ROW) >> SCALEBITS_OUT);             \
343                                   int width,          g[ROW] = (g[ROW] & 0x7) + ((rgb_y - g_uv##UV_ROW) >> SCALEBITS_OUT);    \
344                                   int height)          r[ROW] = (r[ROW] & 0x7) + ((rgb_y + r_v##UV_ROW) >> SCALEBITS_OUT);             \
345  {          *(uint16_t *) (x_ptr+((ROW)*x_stride)+2) = C1(r[ROW], g[ROW], b[ROW]);
346          const uint32_t dst_dif = 4 * dst_stride - 2 * width;  
347          int32_t y_dif = 2 * y_stride - width;  #define YV12_TO_RGB16_ROW(SIZE,C1,C2,C3,C4) \
348            int r[2], g[2], b[2];                                   \
349          uint8_t *dst2 = dst + 2 * dst_stride;          r[0] = r[1] = g[0] = g[1] = b[0] = b[1] = 0;
350          uint8_t *y_src2 = y_src + y_stride;  #define YV12_TO_RGB16(SIZE,C1,C2,C3,C4)         \
351          uint32_t x, y;          int rgb_y;                                                                                              \
352            int b_u0 = B_U_tab[ u_ptr[0] ];                                                         \
353          if (height < 0) {                       // flip image?          int g_uv0 = G_U_tab[ u_ptr[0] ] + G_V_tab[ v_ptr[0] ];          \
354                  height = -height;          int r_v0 = R_V_tab[ v_ptr[0] ];                                                         \
355                  y_src += (height - 1) * y_stride;          WRITE_RGB16(0, 0, C1)                                                                           \
356                  y_src2 = y_src - y_stride;          WRITE_RGB16(1, 0, C1)
357                  u_src += (height / 2 - 1) * uv_stride;  
358                  v_src += (height / 2 - 1) * uv_stride;  #define YV12_TO_RGB16I_ROW(SIZE,C1,C2,C3,C4) \
359                  y_dif = -width - 2 * y_stride;          int r[4], g[4], b[4];                                   \
360                  uv_stride = -uv_stride;          r[0] = r[1] = r[2] = r[3] = 0;                  \
361          }          g[0] = g[1] = g[2] = g[3] = 0;                  \
362            b[0] = b[1] = b[2] = b[3] = 0;
363          for (y = height / 2; y; y--) {  #define YV12_TO_RGB16I(SIZE,C1,C2,C3,C4)                \
364                  int r, g, b;          int rgb_y;                                                                                                      \
365                  int r2, g2, b2;          int b_u0 = B_U_tab[ u_ptr[0] ];                                                         \
366            int g_uv0 = G_U_tab[ u_ptr[0] ] + G_V_tab[ v_ptr[0] ];          \
367                  r = g = b = 0;          int r_v0 = R_V_tab[ v_ptr[0] ];                                                         \
368                  r2 = g2 = b2 = 0;      int b_u1 = B_U_tab[ u_ptr[uv_stride] ];                                             \
369            int g_uv1 = G_U_tab[ u_ptr[uv_stride] ] + G_V_tab[ v_ptr[uv_stride] ];  \
370                  // process one 2x2 block per iteration          int r_v1 = R_V_tab[ v_ptr[uv_stride] ];                                         \
371                  for (x = 0; x < (uint32_t) width / 2; x++) {      WRITE_RGB16(0, 0, C1)                                                                               \
372                          int u, v;          WRITE_RGB16(1, 1, C1)                                                                           \
373                          int b_u, g_uv, r_v, rgb_y;      WRITE_RGB16(2, 0, C1)                                                                               \
374            WRITE_RGB16(3, 1, C1)                                                                           \
375                          u = u_src[x];  
376                          v = v_src[x];  
377    /* rgb/rgbi output */
378                          b_u = B_U_tab[u];  
379                          g_uv = G_U_tab[u] + G_V_tab[v];  #define WRITE_RGB(SIZE,ROW,UV_ROW,C1,C2,C3,C4)  \
380                          r_v = R_V_tab[v];          rgb_y = RGB_Y_tab[ y_ptr[(ROW)*y_stride + 0] ];                                         \
381            x_ptr[(ROW)*x_stride+(C3)] = MAX(0, MIN(255, (rgb_y + b_u##UV_ROW) >> SCALEBITS_OUT));  \
382                          rgb_y = RGB_Y_tab[*y_src];          x_ptr[(ROW)*x_stride+(C2)] = MAX(0, MIN(255, (rgb_y - g_uv##UV_ROW) >> SCALEBITS_OUT)); \
383                          b = (b & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);          x_ptr[(ROW)*x_stride+(C1)] = MAX(0, MIN(255, (rgb_y + r_v##UV_ROW) >> SCALEBITS_OUT));  \
384                          g = (g & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);          if ((SIZE)>3) x_ptr[(ROW)*x_stride+(C4)] = 0;                                                                   \
385                          r = (r & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);          rgb_y = RGB_Y_tab[ y_ptr[(ROW)*y_stride + 1] ];                                                                 \
386                          *(uint16_t *) dst = MK_RGB565(r, g, b);          x_ptr[(ROW)*x_stride+(SIZE)+(C3)] = MAX(0, MIN(255, (rgb_y + b_u##UV_ROW) >> SCALEBITS_OUT));   \
387            x_ptr[(ROW)*x_stride+(SIZE)+(C2)] = MAX(0, MIN(255, (rgb_y - g_uv##UV_ROW) >> SCALEBITS_OUT));  \
388                          y_src++;          x_ptr[(ROW)*x_stride+(SIZE)+(C1)] = MAX(0, MIN(255, (rgb_y + r_v##UV_ROW) >> SCALEBITS_OUT));   \
389                          rgb_y = RGB_Y_tab[*y_src];          if ((SIZE)>3) x_ptr[(ROW)*x_stride+(SIZE)+(C4)] = 0;
390                          b = (b & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);  
391                          g = (g & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);  
392                          r = (r & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);  #define YV12_TO_RGB_ROW(SIZE,C1,C2,C3,C4)       /* nothing */
393                          *(uint16_t *) (dst + 2) = MK_RGB565(r, g, b);  #define YV12_TO_RGB(SIZE,C1,C2,C3,C4)                           \
394                          y_src++;          int rgb_y;                                                                                              \
395            int b_u0 = B_U_tab[ u_ptr[0] ];                                                 \
396                          rgb_y = RGB_Y_tab[*y_src2];          int g_uv0 = G_U_tab[ u_ptr[0] ] + G_V_tab[ v_ptr[0] ];  \
397                          b2 = (b2 & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);          int r_v0 = R_V_tab[ v_ptr[0] ];                                                 \
398                          g2 = (g2 & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);          WRITE_RGB(SIZE, 0, 0, C1,C2,C3,C4)                                              \
399                          r2 = (r2 & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);          WRITE_RGB(SIZE, 1, 0, C1,C2,C3,C4)
400                          *(uint16_t *) (dst2) = MK_RGB565(r2, g2, b2);  
401                          y_src2++;  #define YV12_TO_RGBI_ROW(SIZE,C1,C2,C3,C4)      /* nothing */
402    #define YV12_TO_RGBI(SIZE,C1,C2,C3,C4)                          \
403                          rgb_y = RGB_Y_tab[*y_src2];          int rgb_y;                                                                                              \
404                          b2 = (b2 & 0x7) + ((rgb_y + b_u) >> SCALEBITS_OUT);          int b_u0 = B_U_tab[ u_ptr[0] ];                                                 \
405                          g2 = (g2 & 0x7) + ((rgb_y - g_uv) >> SCALEBITS_OUT);          int g_uv0 = G_U_tab[ u_ptr[0] ] + G_V_tab[ v_ptr[0] ];  \
406                          r2 = (r2 & 0x7) + ((rgb_y + r_v) >> SCALEBITS_OUT);          int r_v0 = R_V_tab[ v_ptr[0] ];                                                 \
407                          *(uint16_t *) (dst2 + 2) = MK_RGB565(r2, g2, b2);      int b_u1 = B_U_tab[ u_ptr[uv_stride] ];                                     \
408                          y_src2++;          int g_uv1 = G_U_tab[ u_ptr[uv_stride] ] + G_V_tab[ v_ptr[uv_stride] ];  \
409            int r_v1 = R_V_tab[ v_ptr[uv_stride] ];                                 \
410                          dst += 4;          WRITE_RGB(SIZE, 0, 0, C1,C2,C3,C4)              \
411                          dst2 += 4;          WRITE_RGB(SIZE, 1, 1, C1,C2,C3,C4)              \
412                  }          WRITE_RGB(SIZE, 2, 0, C1,C2,C3,C4)              \
413            WRITE_RGB(SIZE, 3, 1, C1,C2,C3,C4)
414                  dst += dst_dif;  
415                  dst2 += dst_dif;  
416    /* yuyv/yuyvi output */
417                  y_src += y_dif;  
418                  y_src2 += y_dif;  #define WRITE_YUYV(ROW,UV_ROW,C1,C2,C3,C4)      \
419            x_ptr[(ROW)*x_stride+(C1)] = y_ptr[   (ROW)*y_stride +0];       \
420                  u_src += uv_stride;          x_ptr[(ROW)*x_stride+(C2)] = u_ptr[(UV_ROW)*uv_stride+0];       \
421                  v_src += uv_stride;          x_ptr[(ROW)*x_stride+(C3)] = y_ptr[   (ROW)*y_stride +1];       \
422          }          x_ptr[(ROW)*x_stride+(C4)] = v_ptr[(UV_ROW)*uv_stride+0];       \
423  }  
424    #define YV12_TO_YUYV_ROW(SIZE,C1,C2,C3,C4)      /* nothing */
425    #define YV12_TO_YUYV(SIZE,C1,C2,C3,C4)  \
426            WRITE_YUYV(0, 0, C1,C2,C3,C4)           \
427  /* yuv 4:2:0 planar -> rgb24 */          WRITE_YUYV(1, 0, C1,C2,C3,C4)
428    
429  void  #define YV12_TO_YUYVI_ROW(SIZE,C1,C2,C3,C4) /* nothing */
430  yv12_to_rgb24_c(uint8_t * dst,  #define YV12_TO_YUYVI(SIZE,C1,C2,C3,C4) \
431                                  int dst_stride,          WRITE_YUYV(0, 0, C1,C2,C3,C4)           \
432                                  uint8_t * y_src,          WRITE_YUYV(1, 1, C1,C2,C3,C4)           \
433                                  uint8_t * u_src,          WRITE_YUYV(2, 0, C1,C2,C3,C4)           \
434                                  uint8_t * v_src,          WRITE_YUYV(3, 1, C1,C2,C3,C4)
435                                  int y_stride,  
436                                  int uv_stride,  
437                                  int width,  MAKE_COLORSPACE(yv12_to_rgb555_c,  2,2,2, YV12_TO_RGB16,  MK_RGB555, 0,0,0)
438                                  int height)  MAKE_COLORSPACE(yv12_to_rgb565_c,  2,2,2, YV12_TO_RGB16,  MK_RGB565, 0,0,0)
439  {  MAKE_COLORSPACE(yv12_to_bgr_c,     3,2,2, YV12_TO_RGB,    2,1,0, 0)
440          const uint32_t dst_dif = 6 * dst_stride - 3 * width;  MAKE_COLORSPACE(yv12_to_bgra_c,    4,2,2, YV12_TO_RGB,    2,1,0,3)
441          int32_t y_dif = 2 * y_stride - width;  MAKE_COLORSPACE(yv12_to_abgr_c,    4,2,2, YV12_TO_RGB,    3,2,1,0)
442    MAKE_COLORSPACE(yv12_to_rgba_c,    4,2,2, YV12_TO_RGB,    0,1,2,3)
443          uint8_t *dst2 = dst + 3 * dst_stride;  MAKE_COLORSPACE(yv12_to_yuyv_c,    2,2,2, YV12_TO_YUYV,   0,1,2,3)
444          uint8_t *y_src2 = y_src + y_stride;  MAKE_COLORSPACE(yv12_to_uyvy_c,    2,2,2, YV12_TO_YUYV,   1,0,3,2)
445          uint32_t x, y;  
446    MAKE_COLORSPACE(yv12_to_rgb555i_c, 2,2,4, YV12_TO_RGB16I, MK_RGB555, 0,0,0)
447          if (height < 0) {                       // flip image?  MAKE_COLORSPACE(yv12_to_rgb565i_c, 2,2,4, YV12_TO_RGB16I, MK_RGB565, 0,0,0)
448                  height = -height;  MAKE_COLORSPACE(yv12_to_bgri_c,    3,2,4, YV12_TO_RGBI,   2,1,0, 0)
449                  y_src += (height - 1) * y_stride;  MAKE_COLORSPACE(yv12_to_bgrai_c,   4,2,4, YV12_TO_RGBI,   2,1,0,3)
450                  y_src2 = y_src - y_stride;  MAKE_COLORSPACE(yv12_to_abgri_c,   4,2,4, YV12_TO_RGBI,   3,2,1,0)
451                  u_src += (height / 2 - 1) * uv_stride;  MAKE_COLORSPACE(yv12_to_rgbai_c,   4,2,4, YV12_TO_RGBI,   0,1,2,3)
452                  v_src += (height / 2 - 1) * uv_stride;  MAKE_COLORSPACE(yv12_to_yuyvi_c,   2,2,4, YV12_TO_YUYVI,  0,1,2,3)
453                  y_dif = -width - 2 * y_stride;  MAKE_COLORSPACE(yv12_to_uyvyi_c,   2,2,4, YV12_TO_YUYVI,  1,0,3,2)
454                  uv_stride = -uv_stride;  
455          }  
456    
457          for (y = height / 2; y; y--) {  /* yv12 to yv12 copy function */
458                  // process one 2x2 block per iteration  
459                  for (x = 0; x < (uint32_t) width / 2; x++) {  void
460                          int u, v;  yv12_to_yv12_c(uint8_t * y_dst, uint8_t * u_dst, uint8_t * v_dst,
461                          int b_u, g_uv, r_v, rgb_y;                                  int y_dst_stride, int uv_dst_stride,
462                          int r, g, b;                                  uint8_t * y_src, uint8_t * u_src, uint8_t * v_src,
463                                    int y_src_stride, int uv_src_stride,
464                          u = u_src[x];                                  int width, int height, int vflip)
465                          v = v_src[x];  {
466            int width2 = width / 2;
467                          b_u = B_U_tab[u];          int height2 = height / 2;
468                          g_uv = G_U_tab[u] + G_V_tab[v];          int y;
469                          r_v = R_V_tab[v];  
470            if (vflip) {
471                          rgb_y = RGB_Y_tab[*y_src];                  y_src += (height - 1) * y_src_stride;
472                          b = (rgb_y + b_u) >> SCALEBITS_OUT;                  u_src += (height2 - 1) * uv_src_stride;
473                          g = (rgb_y - g_uv) >> SCALEBITS_OUT;                  v_src += (height2 - 1) * uv_src_stride;
474                          r = (rgb_y + r_v) >> SCALEBITS_OUT;                  y_src_stride = -y_src_stride;
475                          dst[0] = MAX(0, MIN(255, b));                  uv_src_stride = -uv_src_stride;
                         dst[1] = MAX(0, MIN(255, g));  
                         dst[2] = MAX(0, MIN(255, r));  
   
                         y_src++;  
                         rgb_y = RGB_Y_tab[*y_src];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst[3] = MAX(0, MIN(255, b));  
                         dst[4] = MAX(0, MIN(255, g));  
                         dst[5] = MAX(0, MIN(255, r));  
                         y_src++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst2[0] = MAX(0, MIN(255, b));  
                         dst2[1] = MAX(0, MIN(255, g));  
                         dst2[2] = MAX(0, MIN(255, r));  
                         y_src2++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst2[3] = MAX(0, MIN(255, b));  
                         dst2[4] = MAX(0, MIN(255, g));  
                         dst2[5] = MAX(0, MIN(255, r));  
                         y_src2++;  
   
                         dst += 6;  
                         dst2 += 6;  
                 }  
   
                 dst += dst_dif;  
                 dst2 += dst_dif;  
   
                 y_src += y_dif;  
                 y_src2 += y_dif;  
   
                 u_src += uv_stride;  
                 v_src += uv_stride;  
         }  
 }  
   
   
   
 /* yuv 4:2:0 planar -> rgb32 */  
   
 void  
 yv12_to_rgb32_c(uint8_t * dst,  
                                 int dst_stride,  
                                 uint8_t * y_src,  
                                 uint8_t * v_src,  
                                 uint8_t * u_src,  
                                 int y_stride,  
                                 int uv_stride,  
                                 int width,  
                                 int height)  
 {  
         const uint32_t dst_dif = 8 * dst_stride - 4 * width;  
         int32_t y_dif = 2 * y_stride - width;  
   
         uint8_t *dst2 = dst + 4 * dst_stride;  
         uint8_t *y_src2 = y_src + y_stride;  
         uint32_t x, y;  
   
         if (height < 0) {                       // flip image?  
                 height = -height;  
                 y_src += (height - 1) * y_stride;  
                 y_src2 = y_src - y_stride;  
                 u_src += (height / 2 - 1) * uv_stride;  
                 v_src += (height / 2 - 1) * uv_stride;  
                 y_dif = -width - 2 * y_stride;  
                 uv_stride = -uv_stride;  
         }  
   
         for (y = height / 2; y; y--) {  
                 // process one 2x2 block per iteration  
                 for (x = 0; x < (uint32_t) width / 2; x++) {  
                         int u, v;  
                         int b_u, g_uv, r_v, rgb_y;  
                         int r, g, b;  
   
                         u = u_src[x];  
                         v = v_src[x];  
   
                         b_u = B_U_tab[u];  
                         g_uv = G_U_tab[u] + G_V_tab[v];  
                         r_v = R_V_tab[v];  
   
                         rgb_y = RGB_Y_tab[*y_src];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst[0] = MAX(0, MIN(255, r));  
                         dst[1] = MAX(0, MIN(255, g));  
                         dst[2] = MAX(0, MIN(255, b));  
                         dst[3] = 0;  
   
                         y_src++;  
                         rgb_y = RGB_Y_tab[*y_src];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst[4] = MAX(0, MIN(255, r));  
                         dst[5] = MAX(0, MIN(255, g));  
                         dst[6] = MAX(0, MIN(255, b));  
                         dst[7] = 0;  
                         y_src++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst2[0] = MAX(0, MIN(255, r));  
                         dst2[1] = MAX(0, MIN(255, g));  
                         dst2[2] = MAX(0, MIN(255, b));  
                         dst2[3] = 0;  
                         y_src2++;  
   
                         rgb_y = RGB_Y_tab[*y_src2];  
                         b = (rgb_y + b_u) >> SCALEBITS_OUT;  
                         g = (rgb_y - g_uv) >> SCALEBITS_OUT;  
                         r = (rgb_y + r_v) >> SCALEBITS_OUT;  
                         dst2[4] = MAX(0, MIN(255, r));  
                         dst2[5] = MAX(0, MIN(255, g));  
                         dst2[6] = MAX(0, MIN(255, b));  
                         dst2[7] = 0;  
                         y_src2++;  
   
                         dst += 8;  
                         dst2 += 8;  
                 }  
   
                 dst += dst_dif;  
                 dst2 += dst_dif;  
   
                 y_src += y_dif;  
                 y_src2 += y_dif;  
   
                 u_src += uv_stride;  
                 v_src += uv_stride;  
         }  
 }  
   
   
   
 /*      yuv 4:2:0 planar -> yuv planar */  
   
 void  
 yv12_to_yuv_c(uint8_t * dst,  
                           int dst_stride,  
                           uint8_t * y_src,  
                           uint8_t * u_src,  
                           uint8_t * v_src,  
                           int y_stride,  
                           int uv_stride,  
                           int width,  
                           int height)  
 {  
         uint32_t dst_stride2 = dst_stride >> 1;  
         uint32_t width2 = width >> 1;  
         uint32_t y;  
   
         if (height < 0) {  
                 height = -height;  
                 y_src += (height - 1) * y_stride;  
                 u_src += (height / 2 - 1) * uv_stride;  
                 v_src += (height / 2 - 1) * uv_stride;  
                 y_stride = -y_stride;  
                 uv_stride = -uv_stride;  
476          }          }
477    
478          for (y = height; y; y--) {          for (y = height; y; y--) {
479                  memcpy(dst, y_src, width);                  memcpy(y_dst, y_src, width);
480                  dst += dst_stride;                  y_src += y_src_stride;
481                  y_src += y_stride;                  y_dst += y_dst_stride;
         }  
   
         for (y = height >> 1; y; y--) {  
                 memcpy(dst, u_src, width2);  
                 dst += dst_stride2;  
                 u_src += uv_stride;  
         }  
   
         for (y = height >> 1; y; y--) {  
                 memcpy(dst, v_src, width2);  
                 dst += dst_stride2;  
                 v_src += uv_stride;  
         }  
 }  
   
   
   
   
 /* yuv 4:2:0 planar -> yuyv (yuv2) packed */  
   
 void  
 yv12_to_yuyv_c(uint8_t * dst,  
                            int dst_stride,  
                            uint8_t * y_src,  
                            uint8_t * u_src,  
                            uint8_t * v_src,  
                            int y_stride,  
                            int uv_stride,  
                            int width,  
                            int height)  
 {  
         const uint32_t dst_dif = 2 * (dst_stride - width);  
         uint32_t x, y;  
   
         if (height < 0) {  
                 height = -height;  
                 y_src += (height - 1) * y_stride;  
                 u_src += (height / 2 - 1) * uv_stride;  
                 v_src += (height / 2 - 1) * uv_stride;  
                 y_stride = -y_stride;  
                 uv_stride = -uv_stride;  
482          }          }
483    
484          for (y = 0; y < (uint32_t) height; y++) {          for (y = height2; y; y--) {
485                  for (x = 0; x < (uint32_t) width / 2; x++) {                  memcpy(u_dst, u_src, width2);
486                          dst[0] = y_src[2 * x];                  u_src += uv_src_stride;
487                          dst[1] = u_src[x];                  u_dst += uv_dst_stride;
                         dst[2] = y_src[2 * x + 1];  
                         dst[3] = v_src[x];  
                         dst += 4;  
                 }  
                 dst += dst_dif;  
                 y_src += y_stride;  
                 if (y & 1) {  
                         u_src += uv_stride;  
                         v_src += uv_stride;  
488                  }                  }
         }  
 }  
   
   
   
 /* yuv 4:2:0 planar -> uyvy packed */  
489    
490  void          for (y = height2; y; y--) {
491  yv12_to_uyvy_c(uint8_t * dst,                  memcpy(v_dst, v_src, width2);
492                             int dst_stride,                  v_src += uv_src_stride;
493                             uint8_t * y_src,                  v_dst += uv_dst_stride;
                            uint8_t * u_src,  
                            uint8_t * v_src,  
                            int y_stride,  
                            int uv_stride,  
                            int width,  
                            int height)  
 {  
         const uint32_t dst_dif = 2 * (dst_stride - width);  
         uint32_t x, y;  
   
         if (height < 0) {  
                 height = -height;  
                 y_src += (height - 1) * y_stride;  
                 u_src += (height / 2 - 1) * uv_stride;  
                 v_src += (height / 2 - 1) * uv_stride;  
                 y_stride = -y_stride;  
                 uv_stride = -uv_stride;  
         }  
   
         for (y = 0; y < (uint32_t) height; y++) {  
                 for (x = 0; x < (uint32_t) width / 2; x++) {  
                         dst[0] = u_src[x];  
                         dst[1] = y_src[2 * x];  
                         dst[2] = v_src[x];  
                         dst[3] = y_src[2 * x + 1];  
                         dst += 4;  
                 }  
                 dst += dst_dif;  
                 y_src += y_stride;  
                 if (y & 1) {  
                         u_src += uv_stride;  
                         v_src += uv_stride;  
                 }  
494          }          }
495  }  }
496    
497    
 /*      user yuv planar -> yuv 4:2:0 planar  
498    
499          NOTE: does not flip */  /* initialize rgb lookup tables */
500    
501  void  void
502  user_to_yuv_c(uint8_t * y_out,  colorspace_init(void)
                           uint8_t * u_out,  
                           uint8_t * v_out,  
                           int stride,  
                           DEC_PICTURE * picture,  
                           int width,  
                           int height)  
503  {  {
504          uint32_t stride2 = stride >> 1;          int32_t i;
         uint32_t width2 = width >> 1;  
         uint32_t y;  
         uint8_t *src;  
   
         src = picture->y;  
         for (y = height; y; y--) {  
                 memcpy(y_out, src, width);  
                 src += picture->stride_y;  
                 y_out += stride;  
         }  
   
         src = picture->u;  
         for (y = height >> 1; y; y--) {  
                 memcpy(u_out, src, width2);  
                 src += picture->stride_uv;  
                 u_out += stride2;  
         }  
505    
506          src = picture->v;          for (i = 0; i < 256; i++) {
507          for (y = height >> 1; y; y--) {                  RGB_Y_tab[i] = FIX_OUT(RGB_Y_OUT) * (i - Y_ADD_OUT);
508                  memcpy(v_out, src, width2);                  B_U_tab[i] = FIX_OUT(B_U_OUT) * (i - U_ADD_OUT);
509                  src += picture->stride_uv;                  G_U_tab[i] = FIX_OUT(G_U_OUT) * (i - U_ADD_OUT);
510                  v_out += stride2;                  G_V_tab[i] = FIX_OUT(G_V_OUT) * (i - V_ADD_OUT);
511                    R_V_tab[i] = FIX_OUT(R_V_OUT) * (i - V_ADD_OUT);
512          }          }
513  }  }

Legend:
Removed from v.651  
changed lines
  Added in v.1161

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4