annotate imgconvert_template.h @ 1305:abca3b39231d libavcodec

* removed redundant includes (they were even wrongly used)
author kabi
date Fri, 13 Jun 2003 09:36:13 +0000
parents 0f37976aa436
children 766a2f4edbea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1204
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
1 /*
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
2 * Templates for image convertion routines
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
3 * Copyright (c) 2001, 2002, 2003 Fabrice Bellard.
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
4 *
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
9 *
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
14 *
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
18 */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
19
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
20 #ifndef RGB_OUT
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
21 #define RGB_OUT(d, r, g, b) RGBA_OUT(d, r, g, b, 0xff)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
22 #endif
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
23
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
24 static void glue(yuv420p_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
25 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
26 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
27 uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *d, *d1, *d2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
28 int w, y, cb, cr, r_add, g_add, b_add, width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
29 uint8_t *cm = cropTbl + MAX_NEG_CROP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
30 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
31
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
32 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
33 y1_ptr = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
34 cb_ptr = src->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
35 cr_ptr = src->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
36 width2 = (width + 1) >> 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
37 for(;height >= 2; height -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
38 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
39 d2 = d + dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
40 y2_ptr = y1_ptr + src->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
41 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
42 YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
43 /* output 4 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
44 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
45 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
46
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
47 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
48 RGB_OUT(d1 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
49
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
50 YUV_TO_RGB2_CCIR(r, g, b, y2_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
51 RGB_OUT(d2, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
52
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
53 YUV_TO_RGB2_CCIR(r, g, b, y2_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
54 RGB_OUT(d2 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
55
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
56 d1 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
57 d2 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
58
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
59 y1_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
60 y2_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
61 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
62 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
63 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
64 /* handle odd width */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
65 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
66 YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
67 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
68 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
69
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
70 YUV_TO_RGB2_CCIR(r, g, b, y2_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
71 RGB_OUT(d2, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
72 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
73 d2 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
74 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
75 y2_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
76 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
77 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
78 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
79 d += 2 * dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
80 y1_ptr += 2 * src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
81 cb_ptr += src->linesize[1] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
82 cr_ptr += src->linesize[2] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
83 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
84 /* handle odd height */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
85 if (height) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
86 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
87 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
88 YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
89 /* output 2 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
90 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
91 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
92
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
93 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
94 RGB_OUT(d1 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
95
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
96 d1 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
97
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
98 y1_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
99 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
100 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
101 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
102 /* handle width */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
103 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
104 YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
105 /* output 2 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
106 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
107 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
108 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
109
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
110 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
111 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
112 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
113 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
114 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
115 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
116
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
117 static void glue(yuvj420p_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
118 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
119 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
120 uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *d, *d1, *d2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
121 int w, y, cb, cr, r_add, g_add, b_add, width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
122 uint8_t *cm = cropTbl + MAX_NEG_CROP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
123 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
124
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
125 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
126 y1_ptr = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
127 cb_ptr = src->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
128 cr_ptr = src->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
129 width2 = (width + 1) >> 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
130 for(;height >= 2; height -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
131 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
132 d2 = d + dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
133 y2_ptr = y1_ptr + src->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
134 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
135 YUV_TO_RGB1(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
136 /* output 4 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
137 YUV_TO_RGB2(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
138 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
139
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
140 YUV_TO_RGB2(r, g, b, y1_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
141 RGB_OUT(d1 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
142
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
143 YUV_TO_RGB2(r, g, b, y2_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
144 RGB_OUT(d2, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
145
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
146 YUV_TO_RGB2(r, g, b, y2_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
147 RGB_OUT(d2 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
148
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
149 d1 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
150 d2 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
151
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
152 y1_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
153 y2_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
154 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
155 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
156 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
157 /* handle odd width */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
158 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
159 YUV_TO_RGB1(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
160 YUV_TO_RGB2(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
161 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
162
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
163 YUV_TO_RGB2(r, g, b, y2_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
164 RGB_OUT(d2, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
165 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
166 d2 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
167 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
168 y2_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
169 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
170 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
171 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
172 d += 2 * dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
173 y1_ptr += 2 * src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
174 cb_ptr += src->linesize[1] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
175 cr_ptr += src->linesize[2] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
176 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
177 /* handle odd height */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
178 if (height) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
179 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
180 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
181 YUV_TO_RGB1(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
182 /* output 2 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
183 YUV_TO_RGB2(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
184 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
185
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
186 YUV_TO_RGB2(r, g, b, y1_ptr[1]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
187 RGB_OUT(d1 + BPP, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
188
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
189 d1 += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
190
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
191 y1_ptr += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
192 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
193 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
194 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
195 /* handle width */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
196 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
197 YUV_TO_RGB1(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
198 /* output 2 pixels */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
199 YUV_TO_RGB2(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
200 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
201 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
202
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
203 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
204 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
205 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
206 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
207 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
208 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
209
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
210 static void glue(RGB_NAME, _to_yuv420p)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
211 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
212 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
213 int wrap, wrap3, width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
214 int r, g, b, r1, g1, b1, w;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
215 uint8_t *lum, *cb, *cr;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
216 const uint8_t *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
217
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
218 lum = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
219 cb = dst->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
220 cr = dst->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
221
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
222 width2 = (width + 1) >> 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
223 wrap = dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
224 wrap3 = src->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
225 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
226 for(;height>=2;height -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
227 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
228 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
229 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
230 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
231 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
232 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
233
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
234 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
235 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
236 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
237 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
238 lum[1] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
239 p += wrap3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
240 lum += wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
241
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
242 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
243 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
244 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
245 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
246 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
247
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
248 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
249 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
250 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
251 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
252 lum[1] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
253
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
254 cb[0] = RGB_TO_U_CCIR(r1, g1, b1, 2);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
255 cr[0] = RGB_TO_V_CCIR(r1, g1, b1, 2);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
256
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
257 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
258 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
259 p += -wrap3 + 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
260 lum += -wrap + 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
261 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
262 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
263 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
264 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
265 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
266 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
267 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
268 p += wrap3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
269 lum += wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
270 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
271 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
272 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
273 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
274 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
275 cb[0] = RGB_TO_U_CCIR(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
276 cr[0] = RGB_TO_V_CCIR(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
277 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
278 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
279 p += -wrap3 + BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
280 lum += -wrap + 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
281 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
282 p += wrap3 + (wrap3 - width * BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
283 lum += wrap + (wrap - width);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
284 cb += dst->linesize[1] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
285 cr += dst->linesize[2] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
286 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
287 /* handle odd height */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
288 if (height) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
289 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
290 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
291 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
292 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
293 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
294 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
295
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
296 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
297 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
298 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
299 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
300 lum[1] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
301 cb[0] = RGB_TO_U_CCIR(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
302 cr[0] = RGB_TO_V_CCIR(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
303 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
304 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
305 p += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
306 lum += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
307 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
308 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
309 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
310 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
311 cb[0] = RGB_TO_U_CCIR(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
312 cr[0] = RGB_TO_V_CCIR(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
313 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
314 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
315 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
316
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
317 static void glue(RGB_NAME, _to_gray)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
318 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
319 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
320 const unsigned char *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
321 unsigned char *q;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
322 int r, g, b, dst_wrap, src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
323 int x, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
324
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
325 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
326 src_wrap = src->linesize[0] - BPP * width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
327
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
328 q = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
329 dst_wrap = dst->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
330
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
331 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
332 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
333 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
334 q[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
335 q++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
336 p += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
337 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
338 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
339 q += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
340 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
341 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
342
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
343 static void glue(gray_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
344 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
345 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
346 const unsigned char *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
347 unsigned char *q;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
348 int r, dst_wrap, src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
349 int x, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
350
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
351 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
352 src_wrap = src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
353
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
354 q = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
355 dst_wrap = dst->linesize[0] - BPP * width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
356
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
357 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
358 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
359 r = p[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
360 RGB_OUT(q, r, r, r);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
361 q += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
362 p ++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
363 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
364 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
365 q += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
366 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
367 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
368
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
369 static void glue(pal8_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
370 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
371 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
372 const unsigned char *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
373 unsigned char *q;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
374 int r, g, b, dst_wrap, src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
375 int x, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
376 uint32_t v;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
377 const uint32_t *palette;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
378
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
379 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
380 src_wrap = src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
381 palette = (uint32_t *)src->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
382
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
383 q = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
384 dst_wrap = dst->linesize[0] - BPP * width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
385
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
386 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
387 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
388 v = palette[p[0]];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
389 r = (v >> 16) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
390 g = (v >> 8) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
391 b = (v) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
392 #ifdef RGBA_OUT
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
393 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
394 int a;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
395 a = (v >> 24) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
396 RGBA_OUT(q, r, g, b, a);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
397 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
398 #else
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
399 RGB_OUT(q, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
400 #endif
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
401 q += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
402 p ++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
403 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
404 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
405 q += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
406 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
407 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
408
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
409 #if !defined(FMT_RGBA32) && defined(RGBA_OUT)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
410 /* alpha support */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
411
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
412 static void glue(rgba32_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
413 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
414 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
415 const uint8_t *s;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
416 uint8_t *d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
417 int src_wrap, dst_wrap, j, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
418 unsigned int v, r, g, b, a;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
419
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
420 s = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
421 src_wrap = src->linesize[0] - width * 4;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
422
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
423 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
424 dst_wrap = dst->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
425
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
426 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
427 for(j = 0;j < width; j++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
428 v = ((const uint32_t *)(s))[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
429 a = (v >> 24) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
430 r = (v >> 16) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
431 g = (v >> 8) & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
432 b = v & 0xff;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
433 RGBA_OUT(d, r, g, b, a);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
434 s += 4;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
435 d += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
436 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
437 s += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
438 d += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
439 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
440 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
441
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
442 static void glue(RGB_NAME, _to_rgba32)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
443 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
444 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
445 const uint8_t *s;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
446 uint8_t *d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
447 int src_wrap, dst_wrap, j, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
448 unsigned int r, g, b, a;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
449
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
450 s = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
451 src_wrap = src->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
452
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
453 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
454 dst_wrap = dst->linesize[0] - width * 4;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
455
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
456 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
457 for(j = 0;j < width; j++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
458 RGBA_IN(r, g, b, a, s);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
459 ((uint32_t *)(d))[0] = (a << 24) | (r << 16) | (g << 8) | b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
460 d += 4;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
461 s += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
462 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
463 s += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
464 d += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
465 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
466 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
467
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
468 #endif /* !defined(FMT_RGBA32) && defined(RGBA_IN) */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
469
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
470 #ifndef FMT_RGB24
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
471
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
472 static void glue(rgb24_to_, RGB_NAME)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
473 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
474 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
475 const uint8_t *s;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
476 uint8_t *d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
477 int src_wrap, dst_wrap, j, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
478 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
479
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
480 s = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
481 src_wrap = src->linesize[0] - width * 3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
482
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
483 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
484 dst_wrap = dst->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
485
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
486 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
487 for(j = 0;j < width; j++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
488 r = s[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
489 g = s[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
490 b = s[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
491 RGB_OUT(d, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
492 s += 3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
493 d += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
494 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
495 s += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
496 d += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
497 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
498 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
499
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
500 static void glue(RGB_NAME, _to_rgb24)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
501 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
502 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
503 const uint8_t *s;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
504 uint8_t *d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
505 int src_wrap, dst_wrap, j, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
506 unsigned int r, g , b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
507
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
508 s = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
509 src_wrap = src->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
510
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
511 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
512 dst_wrap = dst->linesize[0] - width * 3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
513
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
514 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
515 for(j = 0;j < width; j++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
516 RGB_IN(r, g, b, s)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
517 d[0] = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
518 d[1] = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
519 d[2] = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
520 d += 3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
521 s += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
522 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
523 s += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
524 d += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
525 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
526 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
527
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
528 #endif /* !FMT_RGB24 */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
529
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
530 #ifdef FMT_RGB24
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
531
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
532 static void yuv444p_to_rgb24(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
533 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
534 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
535 uint8_t *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
536 int w, y, cb, cr, r_add, g_add, b_add;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
537 uint8_t *cm = cropTbl + MAX_NEG_CROP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
538 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
539
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
540 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
541 y1_ptr = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
542 cb_ptr = src->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
543 cr_ptr = src->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
544 for(;height > 0; height --) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
545 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
546 for(w = width; w > 0; w--) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
547 YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
548
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
549 YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
550 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
551 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
552
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
553 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
554 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
555 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
556 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
557 d += dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
558 y1_ptr += src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
559 cb_ptr += src->linesize[1] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
560 cr_ptr += src->linesize[2] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
561 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
562 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
563
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
564 static void yuvj444p_to_rgb24(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
565 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
566 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
567 uint8_t *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
568 int w, y, cb, cr, r_add, g_add, b_add;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
569 uint8_t *cm = cropTbl + MAX_NEG_CROP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
570 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
571
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
572 d = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
573 y1_ptr = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
574 cb_ptr = src->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
575 cr_ptr = src->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
576 for(;height > 0; height --) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
577 d1 = d;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
578 for(w = width; w > 0; w--) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
579 YUV_TO_RGB1(cb_ptr[0], cr_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
580
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
581 YUV_TO_RGB2(r, g, b, y1_ptr[0]);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
582 RGB_OUT(d1, r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
583 d1 += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
584
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
585 y1_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
586 cb_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
587 cr_ptr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
588 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
589 d += dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
590 y1_ptr += src->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
591 cb_ptr += src->linesize[1] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
592 cr_ptr += src->linesize[2] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
593 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
594 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
595
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
596 static void rgb24_to_yuv444p(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
597 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
598 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
599 int src_wrap, x, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
600 int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
601 uint8_t *lum, *cb, *cr;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
602 const uint8_t *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
603
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
604 lum = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
605 cb = dst->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
606 cr = dst->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
607
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
608 src_wrap = src->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
609 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
610 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
611 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
612 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
613 lum[0] = RGB_TO_Y_CCIR(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
614 cb[0] = RGB_TO_U_CCIR(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
615 cr[0] = RGB_TO_V_CCIR(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
616 p += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
617 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
618 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
619 lum++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
620 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
621 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
622 lum += dst->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
623 cb += dst->linesize[1] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
624 cr += dst->linesize[2] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
625 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
626 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
627
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
628 static void rgb24_to_yuvj420p(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
629 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
630 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
631 int wrap, wrap3, width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
632 int r, g, b, r1, g1, b1, w;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
633 uint8_t *lum, *cb, *cr;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
634 const uint8_t *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
635
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
636 lum = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
637 cb = dst->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
638 cr = dst->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
639
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
640 width2 = (width + 1) >> 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
641 wrap = dst->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
642 wrap3 = src->linesize[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
643 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
644 for(;height>=2;height -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
645 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
646 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
647 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
648 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
649 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
650 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
651
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
652 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
653 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
654 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
655 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
656 lum[1] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
657 p += wrap3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
658 lum += wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
659
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
660 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
661 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
662 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
663 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
664 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
665
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
666 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
667 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
668 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
669 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
670 lum[1] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
671
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
672 cb[0] = RGB_TO_U(r1, g1, b1, 2);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
673 cr[0] = RGB_TO_V(r1, g1, b1, 2);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
674
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
675 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
676 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
677 p += -wrap3 + 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
678 lum += -wrap + 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
679 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
680 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
681 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
682 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
683 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
684 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
685 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
686 p += wrap3;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
687 lum += wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
688 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
689 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
690 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
691 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
692 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
693 cb[0] = RGB_TO_U(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
694 cr[0] = RGB_TO_V(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
695 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
696 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
697 p += -wrap3 + BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
698 lum += -wrap + 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
699 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
700 p += wrap3 + (wrap3 - width * BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
701 lum += wrap + (wrap - width);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
702 cb += dst->linesize[1] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
703 cr += dst->linesize[2] - width2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
704 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
705 /* handle odd height */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
706 if (height) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
707 for(w = width; w >= 2; w -= 2) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
708 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
709 r1 = r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
710 g1 = g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
711 b1 = b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
712 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
713
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
714 RGB_IN(r, g, b, p + BPP);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
715 r1 += r;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
716 g1 += g;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
717 b1 += b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
718 lum[1] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
719 cb[0] = RGB_TO_U(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
720 cr[0] = RGB_TO_V(r1, g1, b1, 1);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
721 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
722 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
723 p += 2 * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
724 lum += 2;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
725 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
726 if (w) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
727 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
728 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
729 cb[0] = RGB_TO_U(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
730 cr[0] = RGB_TO_V(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
731 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
732 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
733 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
734
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
735 static void rgb24_to_yuvj444p(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
736 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
737 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
738 int src_wrap, x, y;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
739 int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
740 uint8_t *lum, *cb, *cr;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
741 const uint8_t *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
742
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
743 lum = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
744 cb = dst->data[1];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
745 cr = dst->data[2];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
746
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
747 src_wrap = src->linesize[0] - width * BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
748 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
749 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
750 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
751 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
752 lum[0] = RGB_TO_Y(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
753 cb[0] = RGB_TO_U(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
754 cr[0] = RGB_TO_V(r, g, b, 0);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
755 p += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
756 cb++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
757 cr++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
758 lum++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
759 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
760 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
761 lum += dst->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
762 cb += dst->linesize[1] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
763 cr += dst->linesize[2] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
764 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
765 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
766
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
767 #endif /* FMT_RGB24 */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
768
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
769 #if defined(FMT_RGB24) || defined(FMT_RGBA32)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
770
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
771 static void glue(RGB_NAME, _to_pal8)(AVPicture *dst, AVPicture *src,
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
772 int width, int height)
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
773 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
774 const unsigned char *p;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
775 unsigned char *q;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
776 int dst_wrap, src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
777 int x, y, has_alpha;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
778 unsigned int r, g, b;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
779
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
780 p = src->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
781 src_wrap = src->linesize[0] - BPP * width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
782
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
783 q = dst->data[0];
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
784 dst_wrap = dst->linesize[0] - width;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
785 has_alpha = 0;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
786
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
787 for(y=0;y<height;y++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
788 for(x=0;x<width;x++) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
789 #ifdef RGBA_IN
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
790 {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
791 unsigned int a;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
792 RGBA_IN(r, g, b, a, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
793 /* crude approximation for alpha ! */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
794 if (a < 0x80) {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
795 has_alpha = 1;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
796 q[0] = TRANSP_INDEX;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
797 } else {
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
798 q[0] = gif_clut_index(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
799 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
800 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
801 #else
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
802 RGB_IN(r, g, b, p);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
803 q[0] = gif_clut_index(r, g, b);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
804 #endif
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
805 q++;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
806 p += BPP;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
807 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
808 p += src_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
809 q += dst_wrap;
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
810 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
811
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
812 build_rgb_palette(dst->data[1], has_alpha);
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
813 }
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
814
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
815 #endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
816
1208
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
817 #ifdef RGBA_IN
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
818
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
819 static int glue(get_alpha_info_, RGB_NAME)(AVPicture *src, int width, int height)
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
820 {
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
821 const unsigned char *p;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
822 int src_wrap, ret, x, y;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
823 unsigned int r, g, b, a;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
824
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
825 p = src->data[0];
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
826 src_wrap = src->linesize[0] - BPP * width;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
827 ret = 0;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
828 for(y=0;y<height;y++) {
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
829 for(x=0;x<width;x++) {
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
830 RGBA_IN(r, g, b, a, p);
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
831 if (a == 0x00) {
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
832 ret |= FF_ALPHA_TRANSP;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
833 } else if (a != 0xff) {
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
834 ret |= FF_ALPHA_SEMI_TRANSP;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
835 }
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
836 p += BPP;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
837 }
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
838 p += src_wrap;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
839 }
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
840 return ret;
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
841 }
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
842
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
843 #endif /* RGBA_IN */
0f37976aa436 added img_get_alpha_info()
bellard
parents: 1204
diff changeset
844
1204
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
845 #undef RGB_IN
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
846 #undef RGBA_IN
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
847 #undef RGB_OUT
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
848 #undef RGBA_OUT
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
849 #undef BPP
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
850 #undef RGB_NAME
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
851 #undef FMT_RGB24
e55580ae9969 almost exhaustive image conversion support
bellard
parents:
diff changeset
852 #undef FMT_RGBA32