Mercurial > libavcodec.hg
annotate imgconvert.c @ 52:1d796bdb2c2a libavcodec
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
| author | glantau |
|---|---|
| date | Sat, 11 Aug 2001 19:03:02 +0000 |
| parents | 1d2077091e88 |
| children | 5aa6292a1660 |
| rev | line source |
|---|---|
| 0 | 1 /* |
| 2 * Misc image convertion routines | |
| 3 * Copyright (c) 2001 Gerard Lantau. | |
| 4 * | |
| 5 * This program is free software; you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License as published by | |
| 7 * the Free Software Foundation; either version 2 of the License, or | |
| 8 * (at your option) any later version. | |
| 9 * | |
| 10 * This program is distributed in the hope that it will be useful, | |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 * GNU General Public License for more details. | |
| 14 * | |
| 15 * You should have received a copy of the GNU General Public License | |
| 16 * along with this program; if not, write to the Free Software | |
| 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 18 */ | |
| 19 #include <stdlib.h> | |
| 20 #include <stdio.h> | |
| 21 #include <string.h> | |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
22 |
| 0 | 23 #include "avcodec.h" |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
24 #include "dsputil.h" |
| 0 | 25 |
| 17 | 26 #ifdef USE_FASTMEMCPY |
| 27 #include "fastmemcpy.h" | |
| 28 #endif | |
| 0 | 29 /* XXX: totally non optimized */ |
| 30 | |
| 31 static void yuv422_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr, | |
| 32 UINT8 *src, int width, int height) | |
| 33 { | |
| 34 int x, y; | |
| 35 UINT8 *p = src; | |
| 36 | |
| 37 for(y=0;y<height;y+=2) { | |
| 38 for(x=0;x<width;x+=2) { | |
| 39 lum[0] = p[0]; | |
| 40 cb[0] = p[1]; | |
| 41 lum[1] = p[2]; | |
| 42 cr[0] = p[3]; | |
| 43 p += 4; | |
| 44 lum += 2; | |
| 45 cb++; | |
| 46 cr++; | |
| 47 } | |
| 48 for(x=0;x<width;x+=2) { | |
| 49 lum[0] = p[0]; | |
| 50 lum[1] = p[2]; | |
| 51 p += 4; | |
| 52 lum += 2; | |
| 53 } | |
| 54 } | |
| 55 } | |
| 56 | |
| 57 #define SCALEBITS 8 | |
| 58 #define ONE_HALF (1 << (SCALEBITS - 1)) | |
| 59 #define FIX(x) ((int) ((x) * (1L<<SCALEBITS) + 0.5)) | |
| 60 | |
| 61 static void rgb24_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr, | |
| 62 UINT8 *src, int width, int height) | |
| 63 { | |
| 64 int wrap, wrap3, x, y; | |
| 65 int r, g, b, r1, g1, b1; | |
| 66 UINT8 *p; | |
| 67 | |
| 68 wrap = width; | |
| 69 wrap3 = width * 3; | |
| 70 p = src; | |
| 71 for(y=0;y<height;y+=2) { | |
| 72 for(x=0;x<width;x+=2) { | |
| 73 r = p[0]; | |
| 74 g = p[1]; | |
| 75 b = p[2]; | |
| 76 r1 = r; | |
| 77 g1 = g; | |
| 78 b1 = b; | |
| 79 lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 80 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 81 r = p[3]; | |
| 82 g = p[4]; | |
| 83 b = p[5]; | |
| 84 r1 += r; | |
| 85 g1 += g; | |
| 86 b1 += b; | |
| 87 lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 88 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 89 p += wrap3; | |
| 90 lum += wrap; | |
| 91 | |
| 92 r = p[0]; | |
| 93 g = p[1]; | |
| 94 b = p[2]; | |
| 95 r1 += r; | |
| 96 g1 += g; | |
| 97 b1 += b; | |
| 98 lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 99 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 100 r = p[3]; | |
| 101 g = p[4]; | |
| 102 b = p[5]; | |
| 103 r1 += r; | |
| 104 g1 += g; | |
| 105 b1 += b; | |
| 106 lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 107 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 108 | |
| 109 cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + | |
| 110 FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; | |
| 111 cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - | |
| 112 FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; | |
| 113 | |
| 114 cb++; | |
| 115 cr++; | |
| 116 p += -wrap3 + 2 * 3; | |
| 117 lum += -wrap + 2; | |
| 118 } | |
| 119 p += wrap3; | |
| 120 lum += wrap; | |
| 121 } | |
| 122 } | |
| 123 | |
| 124 static void bgr24_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr, | |
| 125 UINT8 *src, int width, int height) | |
| 126 { | |
| 127 int wrap, wrap3, x, y; | |
| 128 int r, g, b, r1, g1, b1; | |
| 129 UINT8 *p; | |
| 130 | |
| 131 wrap = width; | |
| 132 wrap3 = width * 3; | |
| 133 p = src; | |
| 134 for(y=0;y<height;y+=2) { | |
| 135 for(x=0;x<width;x+=2) { | |
| 136 b = p[0]; | |
| 137 g = p[1]; | |
| 138 r = p[2]; | |
| 139 r1 = r; | |
| 140 g1 = g; | |
| 141 b1 = b; | |
| 142 lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 143 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 144 b = p[3]; | |
| 145 g = p[4]; | |
| 146 r = p[5]; | |
| 147 r1 += r; | |
| 148 g1 += g; | |
| 149 b1 += b; | |
| 150 lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 151 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 152 p += wrap3; | |
| 153 lum += wrap; | |
| 154 | |
| 155 b = p[0]; | |
| 156 g = p[1]; | |
| 157 r = p[2]; | |
| 158 r1 += r; | |
| 159 g1 += g; | |
| 160 b1 += b; | |
| 161 lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 162 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 163 b = p[3]; | |
| 164 g = p[4]; | |
| 165 r = p[5]; | |
| 166 r1 += r; | |
| 167 g1 += g; | |
| 168 b1 += b; | |
| 169 lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g + | |
| 170 FIX(0.11400) * b + ONE_HALF) >> SCALEBITS; | |
| 171 | |
| 172 cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + | |
| 173 FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; | |
| 174 cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 - | |
| 175 FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128; | |
| 176 | |
| 177 cb++; | |
| 178 cr++; | |
| 179 p += -wrap3 + 2 * 3; | |
| 180 lum += -wrap + 2; | |
| 181 } | |
| 182 p += wrap3; | |
| 183 lum += wrap; | |
| 184 } | |
| 185 } | |
| 186 | |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
187 /* XXX: use generic filter ? */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
188 /* 1x2 -> 1x1 */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
189 static void shrink2(UINT8 *dst, int dst_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
190 UINT8 *src, int src_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
191 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
192 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
193 int w; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
194 UINT8 *s1, *s2, *d; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
195 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
196 for(;height > 0; height--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
197 s1 = src; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
198 s2 = s1 + src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
199 d = dst; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
200 for(w = width;w >= 4; w-=4) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
201 d[0] = (s1[0] + s2[0]) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
202 d[1] = (s1[1] + s2[1]) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
203 d[2] = (s1[2] + s2[2]) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
204 d[3] = (s1[3] + s2[3]) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
205 s1 += 4; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
206 s2 += 4; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
207 d += 4; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
208 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
209 for(;w > 0; w--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
210 d[0] = (s1[0] + s2[0]) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
211 s1++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
212 s2++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
213 d++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
214 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
215 src += 2 * src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
216 dst += dst_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
217 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
218 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
219 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
220 /* 2x2 -> 1x1 */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
221 static void shrink22(UINT8 *dst, int dst_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
222 UINT8 *src, int src_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
223 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
224 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
225 int w; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
226 UINT8 *s1, *s2, *d; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
227 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
228 for(;height > 0; height--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
229 s1 = src; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
230 s2 = s1 + src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
231 d = dst; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
232 for(w = width;w >= 4; w-=4) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
233 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
234 d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
235 d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
236 d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
237 s1 += 8; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
238 s2 += 8; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
239 d += 4; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
240 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
241 for(;w > 0; w--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
242 d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
243 s1 += 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
244 s2 += 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
245 d++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
246 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
247 src += 2 * src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
248 dst += dst_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
249 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
250 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
251 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
252 static void img_copy(UINT8 *dst, int dst_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
253 UINT8 *src, int src_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
254 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
255 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
256 for(;height > 0; height--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
257 memcpy(dst, src, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
258 dst += dst_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
259 src += src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
260 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
261 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
262 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
263 #define SCALE_BITS 10 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
264 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
265 #define C_Y (76309 >> (16 - SCALE_BITS)) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
266 #define C_RV (117504 >> (16 - SCALE_BITS)) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
267 #define C_BU (138453 >> (16 - SCALE_BITS)) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
268 #define C_GU (13954 >> (16 - SCALE_BITS)) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
269 #define C_GV (34903 >> (16 - SCALE_BITS)) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
270 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
271 #define RGBOUT(r, g, b, y1)\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
272 {\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
273 y = (y1 - 16) * C_Y;\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
274 r = cm[(y + r_add) >> SCALE_BITS];\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
275 g = cm[(y + g_add) >> SCALE_BITS];\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
276 b = cm[(y + b_add) >> SCALE_BITS];\ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
277 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
278 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
279 /* XXX: no chroma interpolating is done */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
280 static void yuv420p_to_rgb24(AVPicture *dst, AVPicture *src, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
281 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
282 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
283 UINT8 *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr, *d, *d1, *d2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
284 int w, y, cb, cr, r_add, g_add, b_add, width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
285 UINT8 *cm = cropTbl + MAX_NEG_CROP; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
286 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
287 d = dst->data[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
288 y1_ptr = src->data[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
289 cb_ptr = src->data[1]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
290 cr_ptr = src->data[2]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
291 width2 = width >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
292 for(;height > 0; height -= 2) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
293 d1 = d; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
294 d2 = d + dst->linesize[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
295 y2_ptr = y1_ptr + src->linesize[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
296 for(w = width2; w > 0; w --) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
297 cb = cb_ptr[0] - 128; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
298 cr = cr_ptr[0] - 128; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
299 r_add = C_RV * cr + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
300 g_add = - C_GU * cb - C_GV * cr + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
301 b_add = C_BU * cb + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
302 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
303 /* output 4 pixels */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
304 RGBOUT(d1[0], d1[1], d1[2], y1_ptr[0]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
305 RGBOUT(d1[3], d1[4], d1[5], y1_ptr[1]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
306 RGBOUT(d2[0], d2[1], d2[2], y2_ptr[0]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
307 RGBOUT(d2[3], d2[4], d2[5], y2_ptr[1]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
308 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
309 d1 += 6; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
310 d2 += 6; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
311 y1_ptr += 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
312 y2_ptr += 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
313 cb_ptr++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
314 cr_ptr++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
315 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
316 d += 2 * dst->linesize[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
317 y1_ptr += 2 * src->linesize[0] - width; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
318 cb_ptr += src->linesize[1] - width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
319 cr_ptr += src->linesize[2] - width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
320 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
321 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
322 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
323 /* XXX: no chroma interpolating is done */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
324 static void yuv422p_to_rgb24(AVPicture *dst, AVPicture *src, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
325 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
326 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
327 UINT8 *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
328 int w, y, cb, cr, r_add, g_add, b_add, width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
329 UINT8 *cm = cropTbl + MAX_NEG_CROP; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
330 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
331 d = dst->data[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
332 y1_ptr = src->data[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
333 cb_ptr = src->data[1]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
334 cr_ptr = src->data[2]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
335 width2 = width >> 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
336 for(;height > 0; height --) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
337 d1 = d; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
338 for(w = width2; w > 0; w --) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
339 cb = cb_ptr[0] - 128; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
340 cr = cr_ptr[0] - 128; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
341 r_add = C_RV * cr + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
342 g_add = - C_GU * cb - C_GV * cr + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
343 b_add = C_BU * cb + (1 << (SCALE_BITS - 1)); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
344 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
345 /* output 2 pixels */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
346 RGBOUT(d1[0], d1[1], d1[2], y1_ptr[0]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
347 RGBOUT(d1[3], d1[4], d1[5], y1_ptr[1]); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
348 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
349 d1 += 6; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
350 y1_ptr += 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
351 cb_ptr++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
352 cr_ptr++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
353 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
354 d += dst->linesize[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
355 y1_ptr += src->linesize[0] - width; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
356 cb_ptr += src->linesize[1] - width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
357 cr_ptr += src->linesize[2] - width2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
358 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
359 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
360 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
361 /* XXX: always use linesize. Return -1 if not supported */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
362 int img_convert(AVPicture *dst, int dst_pix_fmt, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
363 AVPicture *src, int pix_fmt, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
364 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
365 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
366 int i; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
367 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
368 if (dst_pix_fmt == pix_fmt) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
369 switch(pix_fmt) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
370 case PIX_FMT_YUV420P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
371 for(i=0;i<3;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
372 if (i == 1) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
373 width >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
374 height >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
375 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
376 img_copy(dst->data[i], dst->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
377 src->data[i], src->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
378 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
379 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
380 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
381 default: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
382 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
383 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
384 } else if (dst_pix_fmt == PIX_FMT_YUV420P) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
385 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
386 switch(pix_fmt) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
387 case PIX_FMT_YUV420P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
388 for(i=0;i<3;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
389 img_copy(dst->data[i], dst->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
390 src->data[i], src->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
391 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
392 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
393 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
394 case PIX_FMT_YUV422P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
395 img_copy(dst->data[0], dst->linesize[0], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
396 src->data[0], src->linesize[0], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
397 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
398 width >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
399 height >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
400 for(i=1;i<3;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
401 shrink2(dst->data[i], dst->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
402 src->data[i], src->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
403 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
404 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
405 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
406 case PIX_FMT_YUV444P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
407 img_copy(dst->data[0], dst->linesize[0], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
408 src->data[0], src->linesize[0], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
409 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
410 width >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
411 height >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
412 for(i=1;i<3;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
413 shrink22(dst->data[i], dst->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
414 src->data[i], src->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
415 width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
416 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
417 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
418 case PIX_FMT_YUV422: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
419 yuv422_to_yuv420p(dst->data[0], dst->data[1], dst->data[2], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
420 src->data[0], width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
421 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
422 case PIX_FMT_RGB24: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
423 rgb24_to_yuv420p(dst->data[0], dst->data[1], dst->data[2], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
424 src->data[0], width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
425 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
426 case PIX_FMT_BGR24: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
427 bgr24_to_yuv420p(dst->data[0], dst->data[1], dst->data[2], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
428 src->data[0], width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
429 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
430 default: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
431 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
432 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
433 } else if (dst_pix_fmt == PIX_FMT_RGB24) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
434 switch(pix_fmt) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
435 case PIX_FMT_YUV420P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
436 yuv420p_to_rgb24(dst, src, width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
437 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
438 case PIX_FMT_YUV422P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
439 yuv422p_to_rgb24(dst, src, width, height); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
440 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
441 default: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
442 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
443 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
444 } else { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
445 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
446 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
447 return 0; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
448 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
449 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
450 /* filter parameters: [-1 4 2 4 -1] // 8 */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
451 static void deinterlace_line(UINT8 *dst, UINT8 *src, int src_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
452 int size) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
453 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
454 UINT8 *cm = cropTbl + MAX_NEG_CROP; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
455 int sum; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
456 UINT8 *s; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
457 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
458 for(;size > 0;size--) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
459 s = src; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
460 sum = -s[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
461 s += src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
462 sum += s[0] << 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
463 s += src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
464 sum += s[0] << 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
465 s += src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
466 sum += s[0] << 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
467 s += src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
468 sum += -s[0]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
469 dst[0] = cm[(sum + 4) >> 3]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
470 dst++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
471 src++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
472 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
473 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
474 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
475 /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
476 top field is copied as is, but the bottom field is deinterlaced |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
477 against the top field. */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
478 static void deinterlace_bottom_field(UINT8 *dst, int dst_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
479 UINT8 *src1, int src_wrap, |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
480 int width, int height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
481 { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
482 UINT8 *src, *ptr; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
483 int y, y1, i; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
484 UINT8 buf[5 * width]; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
485 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
486 src = src1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
487 for(y=0;y<height;y+=2) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
488 /* copy top field line */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
489 memcpy(dst, src, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
490 dst += dst_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
491 src += (1 - 2) * src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
492 y1 = y - 2; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
493 if (y1 >= 0 && (y1 + 4) < height) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
494 /* fast case : no edges */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
495 deinterlace_line(dst, src, src_wrap, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
496 } else { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
497 /* in order to use the same function, we use an intermediate buffer */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
498 ptr = buf; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
499 for(i=0;i<5;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
500 if (y1 < 0) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
501 memcpy(ptr, src1, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
502 else if (y1 >= height) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
503 memcpy(ptr, src1 + (height - 1) * src_wrap, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
504 else |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
505 memcpy(ptr, src1 + y1 * src_wrap, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
506 y1++; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
507 ptr += width; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
508 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
509 deinterlace_line(dst, buf, width, width); |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
510 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
511 dst += dst_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
512 src += (2 + 1) * src_wrap; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
513 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
514 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
515 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
516 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
517 /* deinterlace, return -1 if format not handled */ |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
518 int avpicture_deinterlace(AVPicture *dst, AVPicture *src, |
| 0 | 519 int pix_fmt, int width, int height) |
| 520 { | |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
521 int i; |
| 0 | 522 |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
523 if (pix_fmt != PIX_FMT_YUV420P && |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
524 pix_fmt != PIX_FMT_YUV422P && |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
525 pix_fmt != PIX_FMT_YUV444P) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
526 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
527 if ((width & 1) != 0 || (height & 3) != 0) |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
528 return -1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
529 |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
530 for(i=0;i<3;i++) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
531 if (i == 1) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
532 switch(pix_fmt) { |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
533 case PIX_FMT_YUV420P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
534 width >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
535 height >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
536 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
537 case PIX_FMT_YUV422P: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
538 width >>= 1; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
539 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
540 default: |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
541 break; |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
542 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
543 } |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
544 deinterlace_bottom_field(dst->data[i], dst->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
545 src->data[i], src->linesize[i], |
|
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
546 width, height); |
| 0 | 547 } |
|
52
1d796bdb2c2a
added 422P, 444P support - added deinterlace support - added xxx to RGB24 convertion
glantau
parents:
18
diff
changeset
|
548 return 0; |
| 0 | 549 } |
