annotate libswscale/yuv2rgb.c @ 29285:1230bcd21ac6

synced with r2769
author ptt
date Thu, 28 May 2009 15:39:02 +0000
parents 5094e70fc72a
children 321437b5bde2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
1 /*
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
2 * software YUV to RGB converter
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
3 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
4 * Copyright (C) 2009 Konstantin Shishkov
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
5 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
6 * 1,4,8bpp support and context / deglobalize stuff
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
7 * by Michael Niedermayer (michaelni@gmx.at)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
8 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
9 * This file is part of FFmpeg.
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
10 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
11 * FFmpeg is free software; you can redistribute it and/or
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
12 * modify it under the terms of the GNU Lesser General Public
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
13 * License as published by the Free Software Foundation; either
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
14 * version 2.1 of the License, or (at your option) any later version.
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
15 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
16 * FFmpeg is distributed in the hope that it will be useful,
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
19 * Lesser General Public License for more details.
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
20 *
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
21 * You should have received a copy of the GNU Lesser General Public
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
22 * License along with FFmpeg; if not, write to the Free Software
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
24 */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
25
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
26 #include <stdio.h>
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
27 #include <stdlib.h>
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
28 #include <inttypes.h>
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
29 #include <assert.h>
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
30
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
31 #include "config.h"
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
32 #include "rgb2rgb.h"
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
33 #include "swscale.h"
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
34 #include "swscale_internal.h"
28957
e538af2c69c1 Do not assume long is same width as x86 register.
ramiro
parents: 28953
diff changeset
35 #include "libavutil/x86_cpu.h"
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
36
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
37 extern const uint8_t dither_8x8_32[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
38 extern const uint8_t dither_8x8_73[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
39 extern const uint8_t dither_8x8_220[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
40
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
41 const int32_t ff_yuv2rgb_coeffs[8][4] = {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
42 {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
43 {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
44 {104597, 132201, 25675, 53279}, /* unspecified */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
45 {104597, 132201, 25675, 53279}, /* reserved */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
46 {104448, 132798, 24759, 53109}, /* FCC */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
47 {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
48 {104597, 132201, 25675, 53279}, /* SMPTE 170M */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
49 {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
50 };
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
51
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
52 #define LOADCHROMA(i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
53 U = pu[i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
54 V = pv[i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
55 r = (void *)c->table_rV[V]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
56 g = (void *)(c->table_gU[U] + c->table_gV[V]); \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
57 b = (void *)c->table_bU[U];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
58
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
59 #define PUTRGB(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
60 Y = src[2*i+o]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
61 dst[2*i ] = r[Y] + g[Y] + b[Y]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
62 Y = src[2*i+1-o]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
63 dst[2*i+1] = r[Y] + g[Y] + b[Y];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
64
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
65 #define PUTRGB24(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
66 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
67 dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
68 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
69 dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
70
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
71 #define PUTBGR24(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
72 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
73 dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
74 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
75 dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
76
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
77 #define PUTRGBA(dst,ysrc,asrc,i,o,s) \
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
78 Y = ysrc[2*i+o]; \
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
79 dst[2*i ] = r[Y] + g[Y] + b[Y] + (asrc[2*i ]<<s); \
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
80 Y = ysrc[2*i+1-o]; \
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
81 dst[2*i+1] = r[Y] + g[Y] + b[Y] + (asrc[2*i+1]<<s);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
82
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
83 #define YUV2RGBFUNC(func_name, dst_type, alpha) \
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
84 static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
85 int srcSliceH, uint8_t* dst[], int dstStride[]){\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
86 int y;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
87 \
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
88 if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
89 srcStride[1] *= 2;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
90 srcStride[2] *= 2;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
91 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
92 for (y=0; y<srcSliceH; y+=2) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
93 dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
94 dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
95 dst_type av_unused *r, *b;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
96 dst_type *g;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
97 uint8_t *py_1 = src[0] + y*srcStride[0];\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
98 uint8_t *py_2 = py_1 + srcStride[0];\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
99 uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
100 uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
101 uint8_t av_unused *pa_1, *pa_2;\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
102 unsigned int h_size = c->dstW>>3;\
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
103 if (alpha){\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
104 pa_1 = src[3] + y*srcStride[3];\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
105 pa_2 = pa_1 + srcStride[3];\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
106 }\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
107 while (h_size--) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
108 int av_unused U, V;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
109 int Y;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
110
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
111 #define ENDYUV2RGBLINE(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
112 pu += 4;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
113 pv += 4;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
114 py_1 += 8;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
115 py_2 += 8;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
116 dst_1 += dst_delta;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
117 dst_2 += dst_delta;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
118 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
119 if (c->dstW & 4) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
120 int av_unused Y, U, V;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
121
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
122 #define ENDYUV2RGBFUNC()\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
123 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
124 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
125 return srcSliceH;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
126 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
127
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
128 #define CLOSEYUV2RGBFUNC(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
129 ENDYUV2RGBLINE(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
130 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
131
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
132 YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
133 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
134 PUTRGB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
135 PUTRGB(dst_2,py_2,0,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
136
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
137 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
138 PUTRGB(dst_2,py_2,1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
139 PUTRGB(dst_1,py_1,1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
140
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
141 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
142 PUTRGB(dst_1,py_1,2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
143 PUTRGB(dst_2,py_2,2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
144
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
145 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
146 PUTRGB(dst_2,py_2,3,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
147 PUTRGB(dst_1,py_1,3,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
148 ENDYUV2RGBLINE(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
149 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
150 PUTRGB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
151 PUTRGB(dst_2,py_2,0,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
152
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
153 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
154 PUTRGB(dst_2,py_2,1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
155 PUTRGB(dst_1,py_1,1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
156 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
157
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
158 YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
159 LOADCHROMA(0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
160 PUTRGBA(dst_1,py_1,pa_1,0,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
161 PUTRGBA(dst_2,py_2,pa_2,0,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
162
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
163 LOADCHROMA(1);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
164 PUTRGBA(dst_2,py_2,pa_1,1,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
165 PUTRGBA(dst_1,py_1,pa_2,1,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
166
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
167 LOADCHROMA(2);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
168 PUTRGBA(dst_1,py_1,pa_1,2,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
169 PUTRGBA(dst_2,py_2,pa_2,2,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
170
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
171 LOADCHROMA(3);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
172 PUTRGBA(dst_2,py_2,pa_1,3,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
173 PUTRGBA(dst_1,py_1,pa_2,3,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
174 pa_1 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
175 pa_2 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
176 ENDYUV2RGBLINE(8)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
177 LOADCHROMA(0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
178 PUTRGBA(dst_1,py_1,pa_1,0,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
179 PUTRGBA(dst_2,py_2,pa_2,0,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
180
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
181 LOADCHROMA(1);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
182 PUTRGBA(dst_2,py_2,pa_1,1,1,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
183 PUTRGBA(dst_1,py_1,pa_2,1,0,24);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
184 ENDYUV2RGBFUNC()
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
185
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
186 YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
187 LOADCHROMA(0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
188 PUTRGBA(dst_1,py_1,pa_1,0,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
189 PUTRGBA(dst_2,py_2,pa_2,0,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
190
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
191 LOADCHROMA(1);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
192 PUTRGBA(dst_2,py_2,pa_2,1,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
193 PUTRGBA(dst_1,py_1,pa_1,1,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
194
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
195 LOADCHROMA(2);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
196 PUTRGBA(dst_1,py_1,pa_1,2,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
197 PUTRGBA(dst_2,py_2,pa_2,2,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
198
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
199 LOADCHROMA(3);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
200 PUTRGBA(dst_2,py_2,pa_2,3,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
201 PUTRGBA(dst_1,py_1,pa_1,3,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
202 pa_1 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
203 pa_2 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
204 ENDYUV2RGBLINE(8)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
205 LOADCHROMA(0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
206 PUTRGBA(dst_1,py_1,pa_1,0,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
207 PUTRGBA(dst_2,py_2,pa_2,0,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
208
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
209 LOADCHROMA(1);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
210 PUTRGBA(dst_2,py_2,pa_2,1,1,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
211 PUTRGBA(dst_1,py_1,pa_1,1,0,0);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
212 ENDYUV2RGBFUNC()
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
213
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
214 YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
215 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
216 PUTRGB24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
217 PUTRGB24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
218
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
219 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
220 PUTRGB24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
221 PUTRGB24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
222
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
223 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
224 PUTRGB24(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
225 PUTRGB24(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
226
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
227 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
228 PUTRGB24(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
229 PUTRGB24(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
230 ENDYUV2RGBLINE(24)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
231 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
232 PUTRGB24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
233 PUTRGB24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
234
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
235 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
236 PUTRGB24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
237 PUTRGB24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
238 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
239
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
240 // only trivial mods from yuv2rgb_c_24_rgb
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
241 YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
242 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
243 PUTBGR24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
244 PUTBGR24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
245
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
246 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
247 PUTBGR24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
248 PUTBGR24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
249
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
250 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
251 PUTBGR24(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
252 PUTBGR24(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
253
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
254 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
255 PUTBGR24(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
256 PUTBGR24(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
257 ENDYUV2RGBLINE(24)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
258 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
259 PUTBGR24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
260 PUTBGR24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
261
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
262 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
263 PUTBGR24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
264 PUTBGR24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
265 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
266
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
267 // This is exactly the same code as yuv2rgb_c_32 except for the types of
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
268 // r, g, b, dst_1, dst_2
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
269 YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
270 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
271 PUTRGB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
272 PUTRGB(dst_2,py_2,0,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
273
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
274 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
275 PUTRGB(dst_2,py_2,1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
276 PUTRGB(dst_1,py_1,1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
277
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
278 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
279 PUTRGB(dst_1,py_1,2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
280 PUTRGB(dst_2,py_2,2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
281
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
282 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
283 PUTRGB(dst_2,py_2,3,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
284 PUTRGB(dst_1,py_1,3,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
285 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
286
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
287 // This is exactly the same code as yuv2rgb_c_32 except for the types of
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
288 // r, g, b, dst_1, dst_2
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
289 YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
290 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
291 PUTRGB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
292 PUTRGB(dst_2,py_2,0,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
293
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
294 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
295 PUTRGB(dst_2,py_2,1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
296 PUTRGB(dst_1,py_1,1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
297
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
298 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
299 PUTRGB(dst_1,py_1,2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
300 PUTRGB(dst_2,py_2,2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
301
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
302 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
303 PUTRGB(dst_2,py_2,3,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
304 PUTRGB(dst_1,py_1,3,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
305 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
306
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
307 // r, g, b, dst_1, dst_2
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
308 YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
309 const uint8_t *d32 = dither_8x8_32[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
310 const uint8_t *d64 = dither_8x8_73[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
311 #define PUTRGB8(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
312 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
313 dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
314 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
315 dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
316
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
317 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
318 PUTRGB8(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
319 PUTRGB8(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
320
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
321 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
322 PUTRGB8(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
323 PUTRGB8(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
324
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
325 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
326 PUTRGB8(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
327 PUTRGB8(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
328
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
329 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
330 PUTRGB8(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
331 PUTRGB8(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
332 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
333
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
334
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
335 // This is exactly the same code as yuv2rgb_c_32 except for the types of
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
336 // r, g, b, dst_1, dst_2
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
337 YUV2RGBFUNC(yuv2rgb_c_4, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
338 int acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
339 #define PUTRGB4(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
340 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
341 acc = r[Y] + g[Y] + b[Y]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
342 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
343 acc |= (r[Y] + g[Y] + b[Y])<<4; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
344 dst[i] = acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
345
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
346 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
347 PUTRGB4(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
348 PUTRGB4(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
349
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
350 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
351 PUTRGB4(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
352 PUTRGB4(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
353
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
354 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
355 PUTRGB4(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
356 PUTRGB4(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
357
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
358 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
359 PUTRGB4(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
360 PUTRGB4(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
361 CLOSEYUV2RGBFUNC(4)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
362
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
363 YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
364 const uint8_t *d64 = dither_8x8_73[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
365 const uint8_t *d128 = dither_8x8_220[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
366 int acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
367
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
368 #define PUTRGB4D(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
369 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
370 acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
371 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
372 acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
373 dst[i]= acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
374
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
375 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
376 PUTRGB4D(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
377 PUTRGB4D(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
378
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
379 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
380 PUTRGB4D(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
381 PUTRGB4D(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
382
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
383 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
384 PUTRGB4D(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
385 PUTRGB4D(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
386
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
387 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
388 PUTRGB4D(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
389 PUTRGB4D(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
390 CLOSEYUV2RGBFUNC(4)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
391
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
392 // This is exactly the same code as yuv2rgb_c_32 except for the types of
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
393 // r, g, b, dst_1, dst_2
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
394 YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
395 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
396 PUTRGB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
397 PUTRGB(dst_2,py_2,0,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
398
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
399 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
400 PUTRGB(dst_2,py_2,1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
401 PUTRGB(dst_1,py_1,1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
402
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
403 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
404 PUTRGB(dst_1,py_1,2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
405 PUTRGB(dst_2,py_2,2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
406
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
407 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
408 PUTRGB(dst_2,py_2,3,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
409 PUTRGB(dst_1,py_1,3,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
410 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
411
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
412 YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
413 const uint8_t *d64 = dither_8x8_73[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
414 const uint8_t *d128 = dither_8x8_220[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
415
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
416 #define PUTRGB4DB(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
417 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
418 dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
419 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
420 dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
421
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
422 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
423 PUTRGB4DB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
424 PUTRGB4DB(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
425
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
426 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
427 PUTRGB4DB(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
428 PUTRGB4DB(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
429
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
430 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
431 PUTRGB4DB(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
432 PUTRGB4DB(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
433
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
434 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
435 PUTRGB4DB(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
436 PUTRGB4DB(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
437 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
438
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
439 YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
440 const uint8_t *d128 = dither_8x8_220[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
441 char out_1 = 0, out_2 = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
442 g= c->table_gU[128] + c->table_gV[128];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
443
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
444 #define PUTRGB1(out,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
445 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
446 out+= out + g[Y+d128[0+o]]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
447 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
448 out+= out + g[Y+d128[1+o]];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
449
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
450 PUTRGB1(out_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
451 PUTRGB1(out_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
452
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
453 PUTRGB1(out_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
454 PUTRGB1(out_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
455
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
456 PUTRGB1(out_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
457 PUTRGB1(out_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
458
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
459 PUTRGB1(out_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
460 PUTRGB1(out_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
461
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
462 dst_1[0]= out_1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
463 dst_2[0]= out_2;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
464 CLOSEYUV2RGBFUNC(1)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
465
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
466 SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
467 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
468 SwsFunc t = NULL;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
469 #if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL
29028
f8db50af4035 Move yuv2rgb code to subdirs.
ramiro
parents: 29011
diff changeset
470 t = ff_yuv2rgb_init_mmx(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
471 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
472 #if HAVE_VIS
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
473 t = ff_yuv2rgb_init_vis(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
474 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
475 #if CONFIG_MLIB
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
476 t = ff_yuv2rgb_init_mlib(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
477 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
478 #if HAVE_ALTIVEC && CONFIG_GPL
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
479 if (c->flags & SWS_CPU_CAPS_ALTIVEC)
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
480 t = ff_yuv2rgb_init_altivec(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
481 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
482
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
483 #if ARCH_BFIN
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
484 if (c->flags & SWS_CPU_CAPS_BFIN)
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
485 t = ff_yuv2rgb_get_func_ptr_bfin(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
486 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
487
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
488 if (t)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
489 return t;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
490
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
491 av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found.\n");
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
492
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
493 switch (c->dstFormat) {
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
494 case PIX_FMT_ARGB:
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
495 case PIX_FMT_ABGR: if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) return yuva2argb_c;
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
496 case PIX_FMT_RGBA:
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
497 case PIX_FMT_BGRA: return (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) ? yuva2rgba_c : yuv2rgb_c_32;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
498 case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
499 case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
500 case PIX_FMT_RGB565:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
501 case PIX_FMT_BGR565:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
502 case PIX_FMT_RGB555:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
503 case PIX_FMT_BGR555: return yuv2rgb_c_16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
504 case PIX_FMT_RGB8:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
505 case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
506 case PIX_FMT_RGB4:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
507 case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
508 case PIX_FMT_RGB4_BYTE:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
509 case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
510 case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
511 default:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
512 assert(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
513 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
514 return NULL;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
515 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
516
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
517 static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
518 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
519 int i;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
520 int64_t cb = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
521
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
522 y_table -= elemsize * (inc >> 9);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
523
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
524 for (i = 0; i < 256; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
525 table[i] = y_table + elemsize * (cb >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
526 cb += inc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
527 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
528 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
529
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
530 static void fill_gv_table(int table[256], const int elemsize, const int inc)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
531 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
532 int i;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
533 int64_t cb = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
534 int off = -(inc >> 9);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
535
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
536 for (i = 0; i < 256; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
537 table[i] = elemsize * (off + (cb >> 16));
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
538 cb += inc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
539 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
540 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
541
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
542 av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange,
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
543 int brightness, int contrast, int saturation)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
544 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
545 const int isRgb = c->dstFormat==PIX_FMT_RGB32
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
546 || c->dstFormat==PIX_FMT_RGB32_1
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
547 || c->dstFormat==PIX_FMT_BGR24
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
548 || c->dstFormat==PIX_FMT_RGB565
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
549 || c->dstFormat==PIX_FMT_RGB555
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
550 || c->dstFormat==PIX_FMT_RGB8
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
551 || c->dstFormat==PIX_FMT_RGB4
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
552 || c->dstFormat==PIX_FMT_RGB4_BYTE
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
553 || c->dstFormat==PIX_FMT_MONOBLACK;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
554 const int bpp = fmt_depth(c->dstFormat);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
555 uint8_t *y_table;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
556 uint16_t *y_table16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
557 uint32_t *y_table32;
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
558 int i, base, rbase, gbase, bbase, abase, needAlpha;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
559 const int yoffs = fullRange ? 384 : 326;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
560
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
561 int64_t crv = inv_table[0];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
562 int64_t cbu = inv_table[1];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
563 int64_t cgu = -inv_table[2];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
564 int64_t cgv = -inv_table[3];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
565 int64_t cy = 1<<16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
566 int64_t oy = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
567
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
568 int64_t yb = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
569
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
570 if (!fullRange) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
571 cy = (cy*255) / 219;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
572 oy = 16<<16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
573 } else {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
574 crv = (crv*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
575 cbu = (cbu*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
576 cgu = (cgu*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
577 cgv = (cgv*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
578 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
579
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
580 cy = (cy *contrast ) >> 16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
581 crv = (crv*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
582 cbu = (cbu*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
583 cgu = (cgu*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
584 cgv = (cgv*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
585 oy -= 256*brightness;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
586
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
587 //scale coefficients by cy
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
588 crv = ((crv << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
589 cbu = ((cbu << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
590 cgu = ((cgu << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
591 cgv = ((cgv << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
592
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
593 av_free(c->yuvTable);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
594
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
595 switch (bpp) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
596 case 1:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
597 c->yuvTable = av_malloc(1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
598 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
599 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
600 for (i = 0; i < 1024-110; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
601 y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
602 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
603 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
604 fill_table(c->table_gU, 1, cgu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
605 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
606 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
607 case 4:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
608 case 4|128:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
609 rbase = isRgb ? 3 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
610 gbase = 1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
611 bbase = isRgb ? 0 : 3;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
612 c->yuvTable = av_malloc(1024*3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
613 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
614 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
615 for (i = 0; i < 1024-110; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
616 int yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
617 y_table[i+110 ] = (yval >> 7) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
618 y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
619 y_table[i+110+2048] = (yval >> 7) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
620 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
621 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
622 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
623 fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
624 fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
625 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
626 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
627 case 8:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
628 rbase = isRgb ? 5 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
629 gbase = isRgb ? 2 : 3;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
630 bbase = isRgb ? 0 : 6;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
631 c->yuvTable = av_malloc(1024*3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
632 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
633 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
634 for (i = 0; i < 1024-38; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
635 int yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
636 y_table[i+16 ] = ((yval + 18) / 36) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
637 y_table[i+16+1024] = ((yval + 18) / 36) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
638 y_table[i+37+2048] = ((yval + 43) / 85) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
639 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
640 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
641 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
642 fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
643 fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
644 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
645 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
646 case 15:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
647 case 16:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
648 rbase = isRgb ? bpp - 5 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
649 gbase = 5;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
650 bbase = isRgb ? 0 : (bpp - 5);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
651 c->yuvTable = av_malloc(1024*3*2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
652 y_table16 = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
653 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
654 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
655 uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
656 y_table16[i ] = (yval >> 3) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
657 y_table16[i+1024] = (yval >> (18 - bpp)) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
658 y_table16[i+2048] = (yval >> 3) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
659 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
660 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
661 fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
662 fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
663 fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
664 fill_gv_table(c->table_gV, 2, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
665 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
666 case 24:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
667 c->yuvTable = av_malloc(1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
668 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
669 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
670 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
671 y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
672 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
673 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
674 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
675 fill_table(c->table_gU, 1, cgu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
676 fill_table(c->table_bU, 1, cbu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
677 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
678 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
679 case 32:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
680 base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
681 rbase = base + (isRgb ? 16 : 0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
682 gbase = base + 8;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
683 bbase = base + (isRgb ? 0 : 16);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
684 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
685 if (!needAlpha)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
686 abase = (base + 24) & 31;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
687 c->yuvTable = av_malloc(1024*3*4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
688 y_table32 = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
689 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
690 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
691 uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
692 y_table32[i ] = (yval << rbase) + (needAlpha ? 0 : (255 << abase));
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
693 y_table32[i+1024] = yval << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
694 y_table32[i+2048] = yval << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
695 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
696 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
697 fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
698 fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
699 fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
700 fill_gv_table(c->table_gV, 4, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
701 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
702 default:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
703 c->yuvTable = NULL;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
704 av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
705 return -1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
706 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
707 return 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
708 }