1 YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) 2 LOADCHROMA(0); 3 PUTRGB24(dst_1, py_1, 0); 4 PUTRGB24(dst_2, py_2, 0); 5 6 LOADCHROMA(1); 7 PUTRGB24(dst_2, py_2, 1); 8 PUTRGB24(dst_1, py_1, 1); 9 10 LOADCHROMA(2); 11 PUTRGB24(dst_1, py_1, 2); 12 PUTRGB24(dst_2, py_2, 2); 13 14 LOADCHROMA(3); 15 PUTRGB24(dst_2, py_2, 3); 16 PUTRGB24(dst_1, py_1, 3); 17 ENDYUV2RGBLINE(24, 0) 18 LOADCHROMA(0); 19 PUTRGB24(dst_1, py_1, 0); 20 PUTRGB24(dst_2, py_2, 0); 21 22 LOADCHROMA(1); 23 PUTRGB24(dst_2, py_2, 1); 24 PUTRGB24(dst_1, py_1, 1); 25 ENDYUV2RGBLINE(24, 1) 26 LOADCHROMA(0); 27 PUTRGB24(dst_1, py_1, 0); 28 PUTRGB24(dst_2, py_2, 0); 29 ENDYUV2RGBFUNC()
1 #define PUTRGB24(dst, src, i) 2 Y = src[2 * i]; 3 dst[6 * i + 0] = r[Y]; 4 dst[6 * i + 1] = g[Y]; 5 dst[6 * i + 2] = b[Y]; 6 Y = src[2 * i + 1]; 7 dst[6 * i + 3] = r[Y]; 8 dst[6 * i + 4] = g[Y]; 9 dst[6 * i + 5] = b[Y];
1 #define LOADCHROMA(i) 2 U = pu[i]; 3 V = pv[i]; 4 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 5 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 6 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM];
1 #define ENDYUV2RGBLINE(dst_delta, ss) 2 pu += 4 >> ss; 3 pv += 4 >> ss; 4 py_1 += 8 >> ss; 5 py_2 += 8 >> ss; 6 dst_1 += dst_delta >> ss; 7 dst_2 += dst_delta >> ss; 8 } 9 if (c->dstW & (4 >> ss)) { 10 int av_unused Y, U, V;
1 #define ENDYUV2RGBFUNC() 2 } 3 } 4 return srcSliceH; 5 }
1 #define YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0) 2 static int yuv2rgb_c_24_rgb(SwsContext *c, const uint8_t *src[], 3 int srcStride[], int srcSliceY, int srcSliceH, 4 uint8_t *dst[], int dstStride[]) 5 { 6 int y; 7 8 if (!0 && c->srcFormat == AV_PIX_FMT_YUV422P) 9 { 10 srcStride[1] *= 2; 11 srcStride[2] *= 2; 12 } 13 for (y = 0; y < srcSliceH; y += 2) 14 { 15 uint8_t *dst_1 = 16 (uint8_t *)(dst[0] + (y + srcSliceY) * dstStride[0]); 17 uint8_t *dst_2 = 18 (uint8_t *)(dst[0] + (y + srcSliceY + 1) * dstStride[0]); 19 uint8_t av_unused *r, *g, *b; 20 const uint8_t *py_1 = src[0] + y * srcStride[0]; 21 const uint8_t *py_2 = py_1 + srcStride[0]; 22 const uint8_t *pu = src[1] + (y >> 1) * srcStride[1]; 23 const uint8_t *pv = src[2] + (y >> 1) * srcStride[2]; 24 const uint8_t av_unused *pa_1, *pa_2; 25 unsigned int h_size = c->dstW >> 3; 26 if (0) 27 { 28 pa_1 = src[3] + y * srcStride[3]; 29 pa_2 = pa_1 + srcStride[3]; 30 } 31 while (h_size--) 32 { 33 int av_unused U, V, Y; 34 U = pu[0]; 35 V = pv[0]; 36 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 37 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 38 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 39 40 Y = py_1[2 * 0]; 41 dst_1[6 * 0 + 0] = r[Y]; 42 dst_1[6 * 0 + 1] = g[Y]; 43 dst_1[6 * 0 + 2] = b[Y]; 44 Y = py_1[2 * 0 + 1]; 45 dst_1[6 * 0 + 3] = r[Y]; 46 dst_1[6 * 0 + 4] = g[Y]; 47 dst_1[6 * 0 + 5] = b[Y]; 48 49 Y = py_2[2 * 0]; 50 dst_2[6 * 0 + 0] = r[Y]; 51 dst_2[6 * 0 + 1] = g[Y]; 52 dst_2[6 * 0 + 2] = b[Y]; 53 Y = py_2[2 * 0 + 1]; 54 dst_2[6 * 0 + 3] = r[Y]; 55 dst_2[6 * 0 + 4] = g[Y]; 56 dst_2[6 * 0 + 5] = b[Y]; 57 58 U = pu[1]; 59 V = pv[1]; 60 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 61 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 62 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 63 64 Y = py_2[2 * 1]; 65 dst_2[6 * 1 + 0] = r[Y]; 66 dst_2[6 * 1 + 1] = g[Y]; 67 dst_2[6 * 1 + 2] = b[Y]; 68 Y = py_2[2 * 1 + 1]; 69 dst_2[6 * 1 + 3] = r[Y]; 70 dst_2[6 * 1 + 4] = g[Y]; 71 dst_2[6 * 1 + 5] = b[Y]; 72 73 Y = py_1[2 * 1]; 74 dst_1[6 * 1 + 0] = r[Y]; 75 dst_1[6 * 1 + 1] = g[Y]; 76 dst_1[6 * 1 + 2] = b[Y]; 77 Y = py_1[2 * 1 + 1]; 78 dst_1[6 * 1 + 3] = r[Y]; 79 dst_1[6 * 1 + 4] = g[Y]; 80 dst_1[6 * 1 + 5] = b[Y]; 81 82 U = pu[2]; 83 V = pv[2]; 84 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 85 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 86 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 87 88 Y = py_1[2 * 2]; 89 dst_1[6 * 2 + 0] = r[Y]; 90 dst_1[6 * 2 + 1] = g[Y]; 91 dst_1[6 * 2 + 2] = b[Y]; 92 Y = py_1[2 * 2 + 1]; 93 dst_1[6 * 2 + 3] = r[Y]; 94 dst_1[6 * 2 + 4] = g[Y]; 95 dst_1[6 * 2 + 5] = b[Y]; 96 97 Y = py_2[2 * 2]; 98 dst_2[6 * 2 + 0] = r[Y]; 99 dst_2[6 * 2 + 1] = g[Y]; 100 dst_2[6 * 2 + 2] = b[Y]; 101 Y = py_2[2 * 2 + 1]; 102 dst_2[6 * 2 + 3] = r[Y]; 103 dst_2[6 * 2 + 4] = g[Y]; 104 dst_2[6 * 2 + 5] = b[Y]; 105 106 U = pu[3]; 107 V = pv[3]; 108 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 109 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 110 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 111 112 Y = py_2[2 * 3]; 113 dst_2[6 * 3 + 0] = r[Y]; 114 dst_2[6 * 3 + 1] = g[Y]; 115 dst_2[6 * 3 + 2] = b[Y]; 116 Y = py_2[2 * 3 + 1]; 117 dst_2[6 * 3 + 3] = r[Y]; 118 dst_2[6 * 3 + 4] = g[Y]; 119 dst_2[6 * 3 + 5] = b[Y]; 120 121 Y = py_1[2 * 3]; 122 dst_1[6 * 3 + 0] = r[Y]; 123 dst_1[6 * 3 + 1] = g[Y]; 124 dst_1[6 * 3 + 2] = b[Y]; 125 Y = py_1[2 * 3 + 1]; 126 dst_1[6 * 3 + 3] = r[Y]; 127 dst_1[6 * 3 + 4] = g[Y]; 128 dst_1[6 * 3 + 5] = b[Y]; 129 130 pu += 4 >> 0; 131 pv += 4 >> 0; 132 py_1 += 8 >> 0; 133 py_2 += 8 >> 0; 134 dst_1 += 24 >> 0; 135 dst_2 += 24 >> 0; 136 } 137 if (c->dstW & (4 >> 0)) 138 { 139 int av_unused Y, U, V; 140 141 U = pu[0]; 142 V = pv[0]; 143 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 144 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 145 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 146 147 Y = py_1[2 * 0]; 148 dst_1[6 * 0 + 0] = r[Y]; 149 dst_1[6 * 0 + 1] = g[Y]; 150 dst_1[6 * 0 + 2] = b[Y]; 151 Y = py_1[2 * 0 + 1]; 152 dst_1[6 * 0 + 3] = r[Y]; 153 dst_1[6 * 0 + 4] = g[Y]; 154 dst_1[6 * 0 + 5] = b[Y]; 155 156 Y = py_2[2 * 0]; 157 dst_2[6 * 0 + 0] = r[Y]; 158 dst_2[6 * 0 + 1] = g[Y]; 159 dst_2[6 * 0 + 2] = b[Y]; 160 Y = py_2[2 * 0 + 1]; 161 dst_2[6 * 0 + 3] = r[Y]; 162 dst_2[6 * 0 + 4] = g[Y]; 163 dst_2[6 * 0 + 5] = b[Y]; 164 165 U = pu[1]; 166 V = pv[1]; 167 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 168 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 169 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 170 171 Y = py_2[2 * 1]; 172 dst_2[6 * 1 + 0] = r[Y]; 173 dst_2[6 * 1 + 1] = g[Y]; 174 dst_2[6 * 1 + 2] = b[Y]; 175 Y = py_2[2 * 1 + 1]; 176 dst_2[6 * 1 + 3] = r[Y]; 177 dst_2[6 * 1 + 4] = g[Y]; 178 dst_2[6 * 1 + 5] = b[Y]; 179 180 Y = py_1[2 * 1]; 181 dst_1[6 * 1 + 0] = r[Y]; 182 dst_1[6 * 1 + 1] = g[Y]; 183 dst_1[6 * 1 + 2] = b[Y]; 184 Y = py_1[2 * 1 + 1]; 185 dst_1[6 * 1 + 3] = r[Y]; 186 dst_1[6 * 1 + 4] = g[Y]; 187 dst_1[6 * 1 + 5] = b[Y]; 188 189 pu += 4 >> 1; 190 pv += 4 >> 1; 191 py_1 += 8 >> 1; 192 py_2 += 8 >> 1; 193 dst_1 += 24 >> 1; 194 dst_2 += 24 >> 1; 195 } 196 if (c->dstW & (4 >> ss)) 197 { 198 int av_unused Y, U, V; 199 200 U = pu[0]; 201 V = pv[0]; 202 r = (void *)c->table_rV[V+YUVRGB_TABLE_HEADROOM]; 203 g = (void *)(c->table_gU[U+YUVRGB_TABLE_HEADROOM] + c->table_gV[V+YUVRGB_TABLE_HEADROOM]); 204 b = (void *)c->table_bU[U+YUVRGB_TABLE_HEADROOM]; 205 206 Y = py_1[2 * 0]; 207 dst_1[6 * 0 + 0] = r[Y]; 208 dst_1[6 * 0 + 1] = g[Y]; 209 dst_1[6 * 0 + 2] = b[Y]; 210 Y = py_1[2 * 0 + 1]; 211 dst_1[6 * 0 + 3] = r[Y]; 212 dst_1[6 * 0 + 4] = g[Y]; 213 dst_1[6 * 0 + 5] = b[Y]; 214 215 Y = py_2[2 * 0]; 216 dst_2[6 * 0 + 0] = r[Y]; 217 dst_2[6 * 0 + 1] = g[Y]; 218 dst_2[6 * 0 + 2] = b[Y]; 219 Y = py_2[2 * 0 + 1]; 220 dst_2[6 * 0 + 3] = r[Y]; 221 dst_2[6 * 0 + 4] = g[Y]; 222 dst_2[6 * 0 + 5] = b[Y]; 223 } 224 } 225 return srcSliceH; 226 }