2 * This library is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU Lesser General Public License as published
4 * by the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This library is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Must match colormodels.h in quicktime
24 #ifndef BC_TRANSPARENCY
34 // Working bitmaps are packed to simplify processing
65 // only used in intermediate ffmpeg xfers
71 // Colormodels purely used by Quicktime are done in Quicktime.
73 // For communication with the X Server
74 #define FOURCC_YV12 0x32315659 /* YV12 YUV420P */
75 #define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */
76 #define FOURCC_UYVY 0x59565955 /* UYVY UVY422 */
77 #define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */
80 #endif // !BC_TRANSPARENCY
83 // Access with BC_WindowBase::cmodels
89 static int calculate_pixelsize(int colormodel);
90 static int calculate_datasize(int w, int h, int bytes_per_line, int color_model);
91 static int calculate_max(int colormodel);
92 static int components(int colormodel);
93 static int is_yuv(int colormodel);
94 static int has_alpha(int colormodel);
95 static int is_float(int colormodel);
97 // Tell when to use plane arguments or row pointer arguments to functions
98 static int is_planar(int color_model);
99 static void to_text(char *string, int cmodel);
100 static int from_text(const char *text);
102 static void transfer(unsigned char **output_rows, /* Leave NULL if non existent */
103 unsigned char **input_rows,
104 unsigned char *out_y_plane, /* Leave NULL if non existent */
105 unsigned char *out_u_plane,
106 unsigned char *out_v_plane,
107 unsigned char *in_y_plane, /* Leave NULL if non existent */
108 unsigned char *in_u_plane,
109 unsigned char *in_v_plane,
110 int in_x, /* Dimensions to capture from input frame */
114 int out_x, /* Dimensions to project on output frame */
120 int bg_color, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */
121 int in_rowspan, /* For planar use the luma rowspan */
122 int out_rowspan); /* For planar use the luma rowspan */
124 // ptrs are either row pointers (colormodel flat) or plane pointers (colormodel planar)
125 static void transfer(
126 unsigned char **output_ptrs, int out_colormodel,
127 int out_x, int out_y, int out_w, int out_h, int out_rowspan,
128 unsigned char **input_ptrs, int in_colormodel,
129 int in_x, int in_y, int in_w, int in_h, int in_rowspan,
132 static int bc_to_x(int color_model);
133 static void bcxfer_stop_slicers();