annotate libswscale/yuv2rgb.c @ 32657:cccc340868f4

Simplify vector declarations and fast inttypes check with statement_check().
author diego
date Sun, 02 Jan 2011 11:49:48 +0000
parents 9fb969676b7c
children
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"
30798
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
36 #include "libavutil/bswap.h"
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
37
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
38 extern const uint8_t dither_4x4_16[4][8];
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
39 extern const uint8_t dither_8x8_32[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
40 extern const uint8_t dither_8x8_73[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
41 extern const uint8_t dither_8x8_220[8][8];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
42
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
43 const int32_t ff_yuv2rgb_coeffs[8][4] = {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
44 {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
45 {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
46 {104597, 132201, 25675, 53279}, /* unspecified */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
47 {104597, 132201, 25675, 53279}, /* reserved */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
48 {104448, 132798, 24759, 53109}, /* FCC */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
49 {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
50 {104597, 132201, 25675, 53279}, /* SMPTE 170M */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
51 {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
52 };
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
53
30687
6cef34c73074 Apply consistency nit.
stefano
parents: 30471
diff changeset
54 const int *sws_getCoefficients(int colorspace)
30471
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
55 {
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
56 if (colorspace > 7 || colorspace < 0)
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
57 colorspace = SWS_CS_DEFAULT;
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
58 return ff_yuv2rgb_coeffs[colorspace];
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
59 }
ef00ce26e9b5 Add function to translate SWS_CS_* to coefficient array
conrad
parents: 30377
diff changeset
60
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
61 #define LOADCHROMA(i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
62 U = pu[i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
63 V = pv[i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
64 r = (void *)c->table_rV[V]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
65 g = (void *)(c->table_gU[U] + c->table_gV[V]); \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
66 b = (void *)c->table_bU[U];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
67
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
68 #define PUTRGB(dst,src,i) \
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
69 Y = src[2*i]; \
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
70 dst[2*i ] = r[Y] + g[Y] + b[Y]; \
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
71 Y = src[2*i+1]; \
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
72 dst[2*i+1] = r[Y] + g[Y] + b[Y];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
73
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
74 #define PUTRGB24(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
75 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
76 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
77 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
78 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
79
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
80 #define PUTBGR24(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
81 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
82 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
83 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
84 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
85
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
86 #define PUTRGBA(dst,ysrc,asrc,i,s) \
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
87 Y = ysrc[2*i]; \
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
88 dst[2*i ] = r[Y] + g[Y] + b[Y] + (asrc[2*i ]<<s); \
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
89 Y = ysrc[2*i+1]; \
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
90 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
91
29300
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
92 #define PUTRGB48(dst,src,i) \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
93 Y = src[2*i]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
94 dst[12*i+ 0] = dst[12*i+ 1] = r[Y]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
95 dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
96 dst[12*i+ 4] = dst[12*i+ 5] = b[Y]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
97 Y = src[2*i+1]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
98 dst[12*i+ 6] = dst[12*i+ 7] = r[Y]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
99 dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
100 dst[12*i+10] = dst[12*i+11] = b[Y];
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
101
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
102 #define YUV2RGBFUNC(func_name, dst_type, alpha) \
30264
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
103 static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
29481
c080f1f5c07e Cosmetics:
ramiro
parents: 29441
diff changeset
104 int srcSliceH, uint8_t* dst[], int dstStride[]) \
c080f1f5c07e Cosmetics:
ramiro
parents: 29441
diff changeset
105 {\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
106 int y;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
107 \
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
108 if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
109 srcStride[1] *= 2;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
110 srcStride[2] *= 2;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
111 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
112 for (y=0; y<srcSliceH; y+=2) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
113 dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
114 dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
115 dst_type av_unused *r, *b;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
116 dst_type *g;\
30264
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
117 const uint8_t *py_1 = src[0] + y*srcStride[0];\
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
118 const uint8_t *py_2 = py_1 + srcStride[0];\
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
119 const uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
120 const uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
1032ff2e83f1 Const correctness for src pointer. Remove all constness related warnings in
zuxy
parents: 29481
diff changeset
121 const uint8_t av_unused *pa_1, *pa_2;\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
122 unsigned int h_size = c->dstW>>3;\
29481
c080f1f5c07e Cosmetics:
ramiro
parents: 29441
diff changeset
123 if (alpha) {\
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
124 pa_1 = src[3] + y*srcStride[3];\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
125 pa_2 = pa_1 + srcStride[3];\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
126 }\
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
127 while (h_size--) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
128 int av_unused U, V;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
129 int Y;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
130
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
131 #define ENDYUV2RGBLINE(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
132 pu += 4;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
133 pv += 4;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
134 py_1 += 8;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
135 py_2 += 8;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
136 dst_1 += dst_delta;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
137 dst_2 += dst_delta;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
138 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
139 if (c->dstW & 4) {\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
140 int av_unused Y, U, V;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
141
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
142 #define ENDYUV2RGBFUNC()\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
143 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
144 }\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
145 return srcSliceH;\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
146 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
147
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
148 #define CLOSEYUV2RGBFUNC(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
149 ENDYUV2RGBLINE(dst_delta)\
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
150 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
151
29300
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
152 YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
153 LOADCHROMA(0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
154 PUTRGB48(dst_1,py_1,0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
155 PUTRGB48(dst_2,py_2,0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
156
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
157 LOADCHROMA(1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
158 PUTRGB48(dst_2,py_2,1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
159 PUTRGB48(dst_1,py_1,1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
160
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
161 LOADCHROMA(2);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
162 PUTRGB48(dst_1,py_1,2);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
163 PUTRGB48(dst_2,py_2,2);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
164
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
165 LOADCHROMA(3);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
166 PUTRGB48(dst_2,py_2,3);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
167 PUTRGB48(dst_1,py_1,3);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
168 ENDYUV2RGBLINE(48)
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
169 LOADCHROMA(0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
170 PUTRGB48(dst_1,py_1,0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
171 PUTRGB48(dst_2,py_2,0);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
172
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
173 LOADCHROMA(1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
174 PUTRGB48(dst_2,py_2,1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
175 PUTRGB48(dst_1,py_1,1);
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
176 ENDYUV2RGBFUNC()
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
177
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
178 YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
179 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
180 PUTRGB(dst_1,py_1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
181 PUTRGB(dst_2,py_2,0);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
182
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
183 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
184 PUTRGB(dst_2,py_2,1);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
185 PUTRGB(dst_1,py_1,1);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
186
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
187 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
188 PUTRGB(dst_1,py_1,2);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
189 PUTRGB(dst_2,py_2,2);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
190
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
191 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
192 PUTRGB(dst_2,py_2,3);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
193 PUTRGB(dst_1,py_1,3);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
194 ENDYUV2RGBLINE(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
195 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
196 PUTRGB(dst_1,py_1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
197 PUTRGB(dst_2,py_2,0);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
198
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
199 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
200 PUTRGB(dst_2,py_2,1);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
201 PUTRGB(dst_1,py_1,1);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
202 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
203
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
204 YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
205 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
206 PUTRGBA(dst_1,py_1,pa_1,0,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
207 PUTRGBA(dst_2,py_2,pa_2,0,24);
28975
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);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
210 PUTRGBA(dst_2,py_2,pa_1,1,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
211 PUTRGBA(dst_1,py_1,pa_2,1,24);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
212
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
213 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
214 PUTRGBA(dst_1,py_1,pa_1,2,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
215 PUTRGBA(dst_2,py_2,pa_2,2,24);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
216
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
217 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
218 PUTRGBA(dst_2,py_2,pa_1,3,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
219 PUTRGBA(dst_1,py_1,pa_2,3,24);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
220 pa_1 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
221 pa_2 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
222 ENDYUV2RGBLINE(8)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
223 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
224 PUTRGBA(dst_1,py_1,pa_1,0,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
225 PUTRGBA(dst_2,py_2,pa_2,0,24);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
226
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
227 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
228 PUTRGBA(dst_2,py_2,pa_1,1,24);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
229 PUTRGBA(dst_1,py_1,pa_2,1,24);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
230 ENDYUV2RGBFUNC()
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
231
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
232 YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
233 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
234 PUTRGBA(dst_1,py_1,pa_1,0,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
235 PUTRGBA(dst_2,py_2,pa_2,0,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
236
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
237 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
238 PUTRGBA(dst_2,py_2,pa_2,1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
239 PUTRGBA(dst_1,py_1,pa_1,1,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
240
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
241 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
242 PUTRGBA(dst_1,py_1,pa_1,2,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
243 PUTRGBA(dst_2,py_2,pa_2,2,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
244
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
245 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
246 PUTRGBA(dst_2,py_2,pa_2,3,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
247 PUTRGBA(dst_1,py_1,pa_1,3,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
248 pa_1 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
249 pa_2 += 8;\
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
250 ENDYUV2RGBLINE(8)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
251 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
252 PUTRGBA(dst_1,py_1,pa_1,0,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
253 PUTRGBA(dst_2,py_2,pa_2,0,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
254
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
255 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
256 PUTRGBA(dst_2,py_2,pa_2,1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
257 PUTRGBA(dst_1,py_1,pa_1,1,0);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
258 ENDYUV2RGBFUNC()
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
259
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
260 YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
261 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
262 PUTRGB24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
263 PUTRGB24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
264
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
265 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
266 PUTRGB24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
267 PUTRGB24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
268
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
269 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
270 PUTRGB24(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
271 PUTRGB24(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
272
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
273 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
274 PUTRGB24(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
275 PUTRGB24(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
276 ENDYUV2RGBLINE(24)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
277 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
278 PUTRGB24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
279 PUTRGB24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
280
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
281 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
282 PUTRGB24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
283 PUTRGB24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
284 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
285
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
286 // 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
287 YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
288 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
289 PUTBGR24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
290 PUTBGR24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
291
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
292 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
293 PUTBGR24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
294 PUTBGR24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
295
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
296 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
297 PUTBGR24(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
298 PUTBGR24(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
299
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
300 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
301 PUTBGR24(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
302 PUTBGR24(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
303 ENDYUV2RGBLINE(24)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
304 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
305 PUTBGR24(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
306 PUTBGR24(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
307
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
308 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
309 PUTBGR24(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
310 PUTBGR24(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
311 ENDYUV2RGBFUNC()
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
312
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
313 // 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
314 // 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
315 YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
316 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
317 PUTRGB(dst_1,py_1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
318 PUTRGB(dst_2,py_2,0);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
319
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
320 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
321 PUTRGB(dst_2,py_2,1);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
322 PUTRGB(dst_1,py_1,1);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
323
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
324 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
325 PUTRGB(dst_1,py_1,2);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
326 PUTRGB(dst_2,py_2,2);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
327
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
328 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
329 PUTRGB(dst_2,py_2,3);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
330 PUTRGB(dst_1,py_1,3);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
331 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
332
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
333 #if 0 // Currently unused
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
334 // 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
335 // 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
336 YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
337 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
338 PUTRGB(dst_1,py_1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
339 PUTRGB(dst_2,py_2,0);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
340
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
341 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
342 PUTRGB(dst_2,py_2,1);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
343 PUTRGB(dst_1,py_1,1);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
344
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
345 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
346 PUTRGB(dst_1,py_1,2);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
347 PUTRGB(dst_2,py_2,2);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
348
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
349 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
350 PUTRGB(dst_2,py_2,3);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
351 PUTRGB(dst_1,py_1,3);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
352 CLOSEYUV2RGBFUNC(8)
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
353 #endif
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
354
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
355 // r, g, b, dst_1, dst_2
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
356 YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0)
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
357 const uint8_t *d16 = dither_4x4_16[y&3];
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
358 #define PUTRGB12(dst,src,i,o) \
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
359 Y = src[2*i]; \
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
360 dst[2*i] = r[Y+d16[0+o]] + g[Y+d16[0+o]] + b[Y+d16[0+o]]; \
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
361 Y = src[2*i+1]; \
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
362 dst[2*i+1] = r[Y+d16[1+o]] + g[Y+d16[1+o]] + b[Y+d16[1+o]];
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
363
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
364 LOADCHROMA(0);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
365 PUTRGB12(dst_1,py_1,0,0);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
366 PUTRGB12(dst_2,py_2,0,0+8);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
367
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
368 LOADCHROMA(1);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
369 PUTRGB12(dst_2,py_2,1,2+8);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
370 PUTRGB12(dst_1,py_1,1,2);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
371
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
372 LOADCHROMA(2);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
373 PUTRGB12(dst_1,py_1,2,4);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
374 PUTRGB12(dst_2,py_2,2,4+8);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
375
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
376 LOADCHROMA(3);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
377 PUTRGB12(dst_2,py_2,3,6+8);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
378 PUTRGB12(dst_1,py_1,3,6);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
379 CLOSEYUV2RGBFUNC(8)
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
380
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
381 // 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
382 YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
383 const uint8_t *d32 = dither_8x8_32[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
384 const uint8_t *d64 = dither_8x8_73[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
385 #define PUTRGB8(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
386 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
387 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
388 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
389 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
390
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
391 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
392 PUTRGB8(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
393 PUTRGB8(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
394
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
395 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
396 PUTRGB8(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
397 PUTRGB8(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
398
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
399 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
400 PUTRGB8(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
401 PUTRGB8(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
402
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
403 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
404 PUTRGB8(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
405 PUTRGB8(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
406 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
407
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
408 #if 0 // Currently unused
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
409 // 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
410 // 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
411 YUV2RGBFUNC(yuv2rgb_c_4, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
412 int acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
413 #define PUTRGB4(dst,src,i) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
414 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
415 acc = r[Y] + g[Y] + b[Y]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
416 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
417 acc |= (r[Y] + g[Y] + b[Y])<<4; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
418 dst[i] = acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
419
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
420 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
421 PUTRGB4(dst_1,py_1,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
422 PUTRGB4(dst_2,py_2,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
423
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
424 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
425 PUTRGB4(dst_2,py_2,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
426 PUTRGB4(dst_1,py_1,1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
427
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
428 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
429 PUTRGB4(dst_1,py_1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
430 PUTRGB4(dst_2,py_2,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
431
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
432 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
433 PUTRGB4(dst_2,py_2,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
434 PUTRGB4(dst_1,py_1,3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
435 CLOSEYUV2RGBFUNC(4)
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
436 #endif
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
437
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
438 YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
439 const uint8_t *d64 = dither_8x8_73[y&7];
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 int acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
442
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
443 #define PUTRGB4D(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
444 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
445 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
446 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
447 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
448 dst[i]= acc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
449
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
450 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
451 PUTRGB4D(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
452 PUTRGB4D(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
453
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
454 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
455 PUTRGB4D(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
456 PUTRGB4D(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
457
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
458 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
459 PUTRGB4D(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
460 PUTRGB4D(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
461
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
462 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
463 PUTRGB4D(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
464 PUTRGB4D(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
465 CLOSEYUV2RGBFUNC(4)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
466
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
467 #if 0 // Currently unused
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
468 // 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
469 // 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
470 YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
471 LOADCHROMA(0);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
472 PUTRGB(dst_1,py_1,0);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
473 PUTRGB(dst_2,py_2,0);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
474
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
475 LOADCHROMA(1);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
476 PUTRGB(dst_2,py_2,1);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
477 PUTRGB(dst_1,py_1,1);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
478
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
479 LOADCHROMA(2);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
480 PUTRGB(dst_1,py_1,2);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
481 PUTRGB(dst_2,py_2,2);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
482
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
483 LOADCHROMA(3);
29441
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
484 PUTRGB(dst_2,py_2,3);
3b88f0acdc0b Remove 'offset' argument from PUTRGB* macros since it's unneeded and caused
kostya
parents: 29370
diff changeset
485 PUTRGB(dst_1,py_1,3);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
486 CLOSEYUV2RGBFUNC(8)
30323
27bd71e5ef2f Define out currently unused static functions.
zuxy
parents: 30264
diff changeset
487 #endif
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
488
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
489 YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
490 const uint8_t *d64 = dither_8x8_73[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
491 const uint8_t *d128 = dither_8x8_220[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
492
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
493 #define PUTRGB4DB(dst,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
494 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
495 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
496 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
497 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
498
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
499 LOADCHROMA(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
500 PUTRGB4DB(dst_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
501 PUTRGB4DB(dst_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
502
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
503 LOADCHROMA(1);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
504 PUTRGB4DB(dst_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
505 PUTRGB4DB(dst_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
506
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
507 LOADCHROMA(2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
508 PUTRGB4DB(dst_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
509 PUTRGB4DB(dst_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
510
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
511 LOADCHROMA(3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
512 PUTRGB4DB(dst_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
513 PUTRGB4DB(dst_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
514 CLOSEYUV2RGBFUNC(8)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
515
28943
cf087cb82252 Add an alpha parameter to the YUV2RGBFUNC macro to ease the upcoming yuva2rgb patch
sdrik
parents: 28738
diff changeset
516 YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
517 const uint8_t *d128 = dither_8x8_220[y&7];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
518 char out_1 = 0, out_2 = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
519 g= c->table_gU[128] + c->table_gV[128];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
520
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
521 #define PUTRGB1(out,src,i,o) \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
522 Y = src[2*i]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
523 out+= out + g[Y+d128[0+o]]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
524 Y = src[2*i+1]; \
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
525 out+= out + g[Y+d128[1+o]];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
526
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
527 PUTRGB1(out_1,py_1,0,0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
528 PUTRGB1(out_2,py_2,0,0+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
529
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
530 PUTRGB1(out_2,py_2,1,2+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
531 PUTRGB1(out_1,py_1,1,2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
532
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
533 PUTRGB1(out_1,py_1,2,4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
534 PUTRGB1(out_2,py_2,2,4+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
535
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
536 PUTRGB1(out_2,py_2,3,6+8);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
537 PUTRGB1(out_1,py_1,3,6);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
538
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
539 dst_1[0]= out_1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
540 dst_2[0]= out_2;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
541 CLOSEYUV2RGBFUNC(1)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
542
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
543 SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
544 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
545 SwsFunc t = NULL;
31078
6502a6b24f9b alternative LGPL-licensed, MMX-optimized YUV to RGB conversion routines
diego
parents: 30919
diff changeset
546 #if HAVE_MMX
29028
f8db50af4035 Move yuv2rgb code to subdirs.
ramiro
parents: 29011
diff changeset
547 t = ff_yuv2rgb_init_mmx(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
548 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
549 #if HAVE_VIS
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
550 t = ff_yuv2rgb_init_vis(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
551 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
552 #if CONFIG_MLIB
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
553 t = ff_yuv2rgb_init_mlib(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
554 #endif
29370
059ff1f4e280 The AltiVec code in libswscale no longer is under GPL.
diego
parents: 29300
diff changeset
555 #if HAVE_ALTIVEC
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
556 if (c->flags & SWS_CPU_CAPS_ALTIVEC)
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
557 t = ff_yuv2rgb_init_altivec(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
558 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
559
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
560 #if ARCH_BFIN
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
561 if (c->flags & SWS_CPU_CAPS_BFIN)
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
562 t = ff_yuv2rgb_get_func_ptr_bfin(c);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
563 #endif
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
564
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
565 if (t)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
566 return t;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
567
30328
0e52b96c6199 User friendly warning message that gives out names of source and target formats
zuxy
parents: 30323
diff changeset
568 av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found from %s to %s.\n", sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
569
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
570 switch (c->dstFormat) {
29300
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
571 case PIX_FMT_RGB48BE:
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
572 case PIX_FMT_RGB48LE: return yuv2rgb_c_48;
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
573 case PIX_FMT_ARGB:
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
574 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
575 case PIX_FMT_RGBA:
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
576 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
577 case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
578 case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
579 case PIX_FMT_RGB565:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
580 case PIX_FMT_BGR565:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
581 case PIX_FMT_RGB555:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
582 case PIX_FMT_BGR555: return yuv2rgb_c_16;
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
583 case PIX_FMT_RGB444:
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
584 case PIX_FMT_BGR444: return yuv2rgb_c_12_ordered_dither;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
585 case PIX_FMT_RGB8:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
586 case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
587 case PIX_FMT_RGB4:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
588 case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
589 case PIX_FMT_RGB4_BYTE:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
590 case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
591 case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
592 default:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
593 assert(0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
594 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
595 return NULL;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
596 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
597
31656
9fb969676b7c Change the type of Y table to pointer to void in fill_table().
benoit
parents: 31613
diff changeset
598 static void fill_table(uint8_t* table[256], const int elemsize, const int inc, void *y_tab)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
599 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
600 int i;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
601 int64_t cb = 0;
31656
9fb969676b7c Change the type of Y table to pointer to void in fill_table().
benoit
parents: 31613
diff changeset
602 uint8_t *y_table = y_tab;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
603
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
604 y_table -= elemsize * (inc >> 9);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
605
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
606 for (i = 0; i < 256; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
607 table[i] = y_table + elemsize * (cb >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
608 cb += inc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
609 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
610 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
611
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
612 static void fill_gv_table(int table[256], const int elemsize, const int inc)
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
613 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
614 int i;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
615 int64_t cb = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
616 int off = -(inc >> 9);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
617
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
618 for (i = 0; i < 256; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
619 table[i] = elemsize * (off + (cb >> 16));
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
620 cb += inc;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
621 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
622 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
623
31234
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
624 static uint16_t roundToInt16(int64_t f)
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
625 {
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
626 int r= (f + (1<<15))>>16;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
627 if (r<-0x7FFF) return 0x8000;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
628 else if (r> 0x7FFF) return 0x7FFF;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
629 else return r;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
630 }
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
631
28953
1e56ea9937ce Consistently use ff_ prefixes for internal symbols.
diego
parents: 28947
diff changeset
632 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
633 int brightness, int contrast, int saturation)
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
634 {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
635 const int isRgb = c->dstFormat==PIX_FMT_RGB32
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
636 || c->dstFormat==PIX_FMT_RGB32_1
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
637 || c->dstFormat==PIX_FMT_BGR24
30798
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
638 || c->dstFormat==PIX_FMT_RGB565BE
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
639 || c->dstFormat==PIX_FMT_RGB565LE
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
640 || c->dstFormat==PIX_FMT_RGB555BE
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
641 || c->dstFormat==PIX_FMT_RGB555LE
30813
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
642 || c->dstFormat==PIX_FMT_RGB444BE
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
643 || c->dstFormat==PIX_FMT_RGB444LE
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
644 || c->dstFormat==PIX_FMT_RGB8
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
645 || c->dstFormat==PIX_FMT_RGB4
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
646 || c->dstFormat==PIX_FMT_RGB4_BYTE
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
647 || c->dstFormat==PIX_FMT_MONOBLACK;
30798
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
648 const int isNotNe = c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE)
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
649 || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE)
30813
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
650 || c->dstFormat==PIX_FMT_NE(RGB444LE,RGB444BE)
30798
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
651 || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE)
30813
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
652 || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE)
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
653 || c->dstFormat==PIX_FMT_NE(BGR444LE,BGR444BE);
30377
2eea1f09e2c5 Use av_get_bits_per_pixel() for computing the bits per pixel of the
stefano
parents: 30328
diff changeset
654 const int bpp = c->dstFormatBpp;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
655 uint8_t *y_table;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
656 uint16_t *y_table16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
657 uint32_t *y_table32;
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
658 int i, base, rbase, gbase, bbase, abase, needAlpha;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
659 const int yoffs = fullRange ? 384 : 326;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
660
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
661 int64_t crv = inv_table[0];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
662 int64_t cbu = inv_table[1];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
663 int64_t cgu = -inv_table[2];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
664 int64_t cgv = -inv_table[3];
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
665 int64_t cy = 1<<16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
666 int64_t oy = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
667
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
668 int64_t yb = 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
669
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
670 if (!fullRange) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
671 cy = (cy*255) / 219;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
672 oy = 16<<16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
673 } else {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
674 crv = (crv*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
675 cbu = (cbu*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
676 cgu = (cgu*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
677 cgv = (cgv*224) / 255;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
678 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
679
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
680 cy = (cy *contrast ) >> 16;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
681 crv = (crv*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
682 cbu = (cbu*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
683 cgu = (cgu*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
684 cgv = (cgv*contrast * saturation) >> 32;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
685 oy -= 256*brightness;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
686
31234
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
687 c->uOffset= 0x0400040004000400LL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
688 c->vOffset= 0x0400040004000400LL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
689 c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
690 c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
691 c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
692 c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
693 c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
694 c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
695
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
696 c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
697 c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
698 c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
699 c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
700 c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
701 c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
ef9fdc663e72 Move internal scale context fields initialization from
stefano
parents: 31078
diff changeset
702
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
703 //scale coefficients by cy
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
704 crv = ((crv << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
705 cbu = ((cbu << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
706 cgu = ((cgu << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
707 cgv = ((cgv << 16) + 0x8000) / cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
708
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
709 av_free(c->yuvTable);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
710
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
711 switch (bpp) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
712 case 1:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
713 c->yuvTable = av_malloc(1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
714 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
715 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
716 for (i = 0; i < 1024-110; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
717 y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
718 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
719 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
720 fill_table(c->table_gU, 1, cgu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
721 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
722 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
723 case 4:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
724 case 4|128:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
725 rbase = isRgb ? 3 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
726 gbase = 1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
727 bbase = isRgb ? 0 : 3;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
728 c->yuvTable = av_malloc(1024*3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
729 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
730 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
731 for (i = 0; i < 1024-110; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
732 int yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
733 y_table[i+110 ] = (yval >> 7) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
734 y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
735 y_table[i+110+2048] = (yval >> 7) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
736 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
737 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
738 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
739 fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
740 fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
741 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
742 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
743 case 8:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
744 rbase = isRgb ? 5 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
745 gbase = isRgb ? 2 : 3;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
746 bbase = isRgb ? 0 : 6;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
747 c->yuvTable = av_malloc(1024*3);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
748 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
749 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
750 for (i = 0; i < 1024-38; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
751 int yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
752 y_table[i+16 ] = ((yval + 18) / 36) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
753 y_table[i+16+1024] = ((yval + 18) / 36) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
754 y_table[i+37+2048] = ((yval + 43) / 85) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
755 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
756 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
757 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
758 fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
759 fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
760 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
761 break;
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
762 case 12:
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
763 rbase = isRgb ? 8 : 0;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
764 gbase = 4;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
765 bbase = isRgb ? 0 : 8;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
766 c->yuvTable = av_malloc(1024*3*2);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
767 y_table16 = c->yuvTable;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
768 yb = -(384<<16) - oy;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
769 for (i = 0; i < 1024; i++) {
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
770 uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
30800
d600373a8935 Cosmetics: fix vertical alignment.
benoit
parents: 30799
diff changeset
771 y_table16[i ] = (yval >> 4) << rbase;
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
772 y_table16[i+1024] = (yval >> 4) << gbase;
30800
d600373a8935 Cosmetics: fix vertical alignment.
benoit
parents: 30799
diff changeset
773 y_table16[i+2048] = (yval >> 4) << bbase;
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
774 yb += cy;
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
775 }
30813
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
776 if (isNotNe)
87acb5d9e4aa Add support to BGR444/RGB444 foreign endian output in libswscale.
stefano
parents: 30800
diff changeset
777 for (i = 0; i < 1024*3; i++)
31613
55abf5e08172 Add av_ prefix to bswap macros
mru
parents: 31234
diff changeset
778 y_table16[i] = av_bswap16(y_table16[i]);
30799
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
779 fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
780 fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
781 fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
782 fill_gv_table(c->table_gV, 2, cgv);
76f3878f34fd libswscale: Extend the unaccelerated path of the unscaled yuv2rgb special
benoit
parents: 30798
diff changeset
783 break;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
784 case 15:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
785 case 16:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
786 rbase = isRgb ? bpp - 5 : 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
787 gbase = 5;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
788 bbase = isRgb ? 0 : (bpp - 5);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
789 c->yuvTable = av_malloc(1024*3*2);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
790 y_table16 = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
791 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
792 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
793 uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
794 y_table16[i ] = (yval >> 3) << rbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
795 y_table16[i+1024] = (yval >> (18 - bpp)) << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
796 y_table16[i+2048] = (yval >> 3) << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
797 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
798 }
30798
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
799 if(isNotNe)
91f90077acf6 Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
cehoyos
parents: 30687
diff changeset
800 for (i = 0; i < 1024*3; i++)
31613
55abf5e08172 Add av_ prefix to bswap macros
mru
parents: 31234
diff changeset
801 y_table16[i] = av_bswap16(y_table16[i]);
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
802 fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
803 fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
804 fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
805 fill_gv_table(c->table_gV, 2, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
806 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
807 case 24:
29300
321437b5bde2 YUV into RGB48 BE/LE conversion support
kostya
parents: 29198
diff changeset
808 case 48:
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
809 c->yuvTable = av_malloc(1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
810 y_table = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
811 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
812 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
813 y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
814 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
815 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
816 fill_table(c->table_rV, 1, crv, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
817 fill_table(c->table_gU, 1, cgu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
818 fill_table(c->table_bU, 1, cbu, y_table + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
819 fill_gv_table(c->table_gV, 1, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
820 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
821 case 32:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
822 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
823 rbase = base + (isRgb ? 16 : 0);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
824 gbase = base + 8;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
825 bbase = base + (isRgb ? 0 : 16);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
826 needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
827 if (!needAlpha)
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
828 abase = (base + 24) & 31;
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
829 c->yuvTable = av_malloc(1024*3*4);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
830 y_table32 = c->yuvTable;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
831 yb = -(384<<16) - oy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
832 for (i = 0; i < 1024; i++) {
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
833 uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
28975
bab0430f2e59 Add YUVA420P -> RGBA/BGRA/ARGB/ABGR unscaled converters
sdrik
parents: 28957
diff changeset
834 y_table32[i ] = (yval << rbase) + (needAlpha ? 0 : (255 << abase));
28688
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
835 y_table32[i+1024] = yval << gbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
836 y_table32[i+2048] = yval << bbase;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
837 yb += cy;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
838 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
839 fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
840 fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
841 fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
842 fill_gv_table(c->table_gV, 4, cgv);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
843 break;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
844 default:
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
845 c->yuvTable = NULL;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
846 av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
847 return -1;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
848 }
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
849 return 0;
0386e8c28782 Rename yuv2rgb2.c --> yuv2rgb.c.
diego
parents:
diff changeset
850 }