48 size_t width = s3d->
x;
49 size_t height = s3d->
y;
50 const size_t channels = s3d->
channels;
52 const int stride_from = width;
53 const int stride_to = width;
55 const int anaglyph_encoding[3][3] = {
63 r = anaglyph_encoding[mode][0];
64 g = anaglyph_encoding[mode][1];
65 b = anaglyph_encoding[mode][2];
73 for (y = 0; y < height; y++) {
74 float *to = rect_to + stride_to * y * 3;
76 rect_left + stride_from * y * 3,
77 rect_right + stride_from * y * 3,
80 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
87 else if (channels == 4) {
88 for (y = 0; y < height; y++) {
89 float *to = rect_to + stride_to * y * 4;
91 rect_left + stride_from * y * 4,
92 rect_right + stride_from * y * 4,
95 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
99 to[3] = std::max(from[0][3], from[1][3]);
110 for (y = 0; y < height; y++) {
111 uchar *to = rect_to + stride_to * y * 3;
113 rect_left + stride_from * y * 3,
114 rect_right + stride_from * y * 3,
117 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
124 else if (channels == 4) {
125 for (y = 0; y < height; y++) {
126 uchar *to = rect_to + stride_to * y * 4;
128 rect_left + stride_from * y * 4,
129 rect_right + stride_from * y * 4,
132 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
136 to[3] = std::max(from[0][3], from[1][3]);
148 size_t width = s3d->
x;
149 size_t height = s3d->
y;
150 const size_t channels = s3d->
channels;
152 const int stride_from = width;
153 const int stride_to = width;
156 const float *rect_left = s3d->
rectf.
left;
163 for (y = 0; y < height; y++) {
164 float *to = rect_to + stride_to * y *
channels;
165 const float *from[2] = {
166 rect_left + stride_from * y *
channels,
167 rect_right + stride_from * y *
channels,
169 memcpy(to, from[i],
sizeof(
float) * channels * stride_from);
176 for (y = 0; y < height; y++) {
177 float *to = rect_to + stride_to *
y;
178 const float *from[2] = {
179 rect_left + stride_from *
y,
180 rect_right + stride_from *
y,
184 for (x = 0; x < width; x++, from[0] += 1, from[1] += 1, to += 1) {
190 else if (channels == 3) {
191 for (y = 0; y < height; y++) {
192 float *to = rect_to + stride_to * y * 3;
193 const float *from[2] = {
194 rect_left + stride_from * y * 3,
195 rect_right + stride_from * y * 3,
199 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
205 else if (channels == 4) {
206 for (y = 0; y < height; y++) {
207 float *to = rect_to + stride_to * y *
channels;
208 const float *from[2] = {
209 rect_left + stride_from * y *
channels,
210 rect_right + stride_from * y *
channels,
214 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
225 for (y = 0; y < height; y++) {
226 float *to = rect_to + stride_to *
y;
227 const float *from[2] = {
228 rect_left + stride_from *
y,
229 rect_right + stride_from *
y,
232 for (x = 0; x < width; x++, from[0] += 1, from[1] += 1, to += 1) {
239 else if (channels == 3) {
241 for (y = 0; y < height; y++) {
242 float *to = rect_to + stride_to * y * 3;
243 const float *from[2] = {
244 rect_left + stride_from * y * 3,
245 rect_right + stride_from * y * 3,
248 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
255 else if (channels == 4) {
257 for (y = 0; y < height; y++) {
258 float *to = rect_to + stride_to * y * 4;
259 const float *from[2] = {
260 rect_left + stride_from * y * 4,
261 rect_right + stride_from * y * 4,
264 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
286 for (y = 0; y < height; y++) {
288 const uchar *from[2] = {
289 rect_left + stride_from * y *
channels,
290 rect_right + stride_from * y *
channels,
292 memcpy(to, from[i],
sizeof(
uchar) * channels * stride_from);
299 for (y = 0; y < height; y++) {
300 uchar *to = rect_to + stride_to *
y;
301 const uchar *from[2] = {
302 rect_left + stride_from *
y,
303 rect_right + stride_from *
y,
306 for (x = 0; x < width; x++, from[0] += 1, from[1] += 1, to += 1) {
312 else if (channels == 3) {
313 for (y = 0; y < height; y++) {
314 uchar *to = rect_to + stride_to * y * 3;
315 const uchar *from[2] = {
316 rect_left + stride_from * y * 3,
317 rect_right + stride_from * y * 3,
320 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
326 else if (channels == 4) {
327 for (y = 0; y < height; y++) {
328 uchar *to = rect_to + stride_to * y * 4;
329 const uchar *from[2] = {
330 rect_left + stride_from * y * 4,
331 rect_right + stride_from * y * 4,
334 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
345 for (y = 0; y < height; y++) {
346 uchar *to = rect_to + stride_to *
y;
347 const uchar *from[2] = {
348 rect_left + stride_from *
y,
349 rect_right + stride_from *
y,
352 for (x = 0; x < width; x++, from[0] += 1, from[1] += 1, to += 1) {
359 else if (channels == 3) {
361 for (y = 0; y < height; y++) {
362 uchar *to = rect_to + stride_to * y * 3;
363 const uchar *from[2] = {
364 rect_left + stride_from * y * 3,
365 rect_right + stride_from * y * 3,
368 for (x = 0; x < width; x++, from[0] += 3, from[1] += 3, to += 3) {
375 else if (channels == 4) {
377 for (y = 0; y < height; y++) {
378 uchar *to = rect_to + stride_to * y * 4;
379 const uchar *from[2] = {
380 rect_left + stride_from * y * 4,
381 rect_right + stride_from * y * 4,
384 for (x = 0; x < width; x++, from[0] += 4, from[1] += 4, to += 4) {
830 size_t width = s3d->
x;
831 size_t height = s3d->
y;
832 const size_t channels = s3d->
channels;
834 const int stride_from = width;
835 const int stride_to = width;
837 const int anaglyph_encoding[3][3] = {
845 r = anaglyph_encoding[mode][0];
846 g = anaglyph_encoding[mode][1];
847 b = anaglyph_encoding[mode][2];
855 for (y = 0; y < height; y++) {
856 float *from = rect_from + stride_from * y * 3;
858 rect_left + stride_to * y * 3,
859 rect_right + stride_to * y * 3,
862 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
869 else if (channels == 4) {
870 for (y = 0; y < height; y++) {
871 float *from = rect_from + stride_from * y * 4;
873 rect_left + stride_to * y * 4,
874 rect_right + stride_to * y * 4,
877 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {
881 to[0][3] = to[1][3] = from[3];
892 for (y = 0; y < height; y++) {
893 uchar *from = rect_from + stride_from * y * 3;
895 rect_left + stride_to * y * 3,
896 rect_right + stride_to * y * 3,
899 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
906 else if (channels == 4) {
907 for (y = 0; y < height; y++) {
908 uchar *from = rect_from + stride_from * y * 4;
910 rect_left + stride_to * y * 4,
911 rect_right + stride_to * y * 4,
914 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {
918 to[0][3] = to[1][3] = from[3];
930 size_t width = s3d->
x;
931 size_t height = s3d->
y;
932 const size_t channels = s3d->
channels;
934 const int stride_from = width;
935 const int stride_to = width;
945 for (y = 0; y < height; y++) {
946 const float *from = rect_from + stride_from * y *
channels;
948 rect_left + stride_to * y *
channels,
949 rect_right + stride_to * y *
channels,
951 memcpy(to[i], from,
sizeof(
float) * channels * stride_to);
958 for (y = 0; y < height; y++) {
959 const float *from = rect_from + stride_from *
y;
961 rect_left + stride_to *
y,
962 rect_right + stride_to *
y,
966 for (x = 0; x < width; x++, from += 1, to[0] += 1, to[1] += 1) {
972 else if (channels == 3) {
973 for (y = 0; y < height; y++) {
974 const float *from = rect_from + stride_from * y * 3;
976 rect_left + stride_to * y * 3,
977 rect_right + stride_to * y * 3,
981 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
987 else if (channels == 4) {
988 for (y = 0; y < height; y++) {
989 const float *from = rect_from + stride_from * y *
channels;
991 rect_left + stride_to * y *
channels,
992 rect_right + stride_to * y *
channels,
996 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {
1005 if (channels == 1) {
1006 char i = char(swap);
1007 for (y = 0; y < height; y++) {
1008 const float *from = rect_from + stride_from *
y;
1010 rect_left + stride_to *
y,
1011 rect_right + stride_to *
y,
1014 for (x = 0; x < width; x++, from += 1, to[0] += 1, to[1] += 1) {
1021 else if (channels == 3) {
1022 char i = char(swap);
1023 for (y = 0; y < height; y++) {
1024 const float *from = rect_from + stride_from * y * 3;
1026 rect_left + stride_to * y * 3,
1027 rect_right + stride_to * y * 3,
1030 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
1037 else if (channels == 4) {
1038 char i = char(swap);
1039 for (y = 0; y < height; y++) {
1040 const float *from = rect_from + stride_from * y * 4;
1042 rect_left + stride_to * y * 4,
1043 rect_right + stride_to * y * 4,
1046 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {
1067 char i = char(swap);
1068 for (y = 0; y < height; y++) {
1071 rect_left + stride_to * y *
channels,
1072 rect_right + stride_to * y *
channels,
1074 memcpy(to[i], from,
sizeof(
uchar) * channels * stride_to);
1080 if (channels == 1) {
1081 for (y = 0; y < height; y++) {
1082 const uchar *from = rect_from + stride_from *
y;
1084 rect_left + stride_to *
y,
1085 rect_right + stride_to *
y,
1087 char i = char(swap);
1088 for (x = 0; x < width; x++, from += 1, to[0] += 1, to[1] += 1) {
1094 else if (channels == 3) {
1095 for (y = 0; y < height; y++) {
1096 const uchar *from = rect_from + stride_from * y * 3;
1098 rect_left + stride_to * y * 3,
1099 rect_right + stride_to * y * 3,
1101 char i = char(swap);
1102 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
1108 else if (channels == 4) {
1109 for (y = 0; y < height; y++) {
1110 const uchar *from = rect_from + stride_from * y * 4;
1112 rect_left + stride_to * y * 4,
1113 rect_right + stride_to * y * 4,
1115 char i = char(swap);
1116 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {
1125 if (channels == 1) {
1126 char i = char(swap);
1127 for (y = 0; y < height; y++) {
1128 const uchar *from = rect_from + stride_from *
y;
1130 rect_left + stride_to *
y,
1131 rect_right + stride_to *
y,
1134 for (x = 0; x < width; x++, from += 1, to[0] += 1, to[1] += 1) {
1141 else if (channels == 3) {
1142 char i = char(swap);
1143 for (y = 0; y < height; y++) {
1144 const uchar *from = rect_from + stride_from * y * 3;
1146 rect_left + stride_to * y * 3,
1147 rect_right + stride_to * y * 3,
1150 for (x = 0; x < width; x++, from += 3, to[0] += 3, to[1] += 3) {
1157 else if (channels == 4) {
1158 char i = char(swap);
1159 for (y = 0; y < height; y++) {
1160 const uchar *from = rect_from + stride_from * y * 4;
1162 rect_left + stride_to * y * 4,
1163 rect_right + stride_to * y * 4,
1166 for (x = 0; x < width; x++, from += 4, to[0] += 4, to[1] += 4) {