43 size_t width = s3d->
x;
44 size_t height = s3d->
y;
45 const size_t channels = s3d->
channels;
47 const int stride_from = width;
48 const int stride_to = width;
50 const int anaglyph_encoding[3][3] = {
58 r = anaglyph_encoding[mode][0];
59 g = anaglyph_encoding[mode][1];
60 b = anaglyph_encoding[mode][2];
68 for (
y = 0;
y < height;
y++) {
69 float *to = rect_to + stride_to *
y * 3;
71 rect_left + stride_from *
y * 3,
72 rect_right + stride_from *
y * 3,
75 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
82 else if (channels == 4) {
83 for (
y = 0;
y < height;
y++) {
84 float *to = rect_to + stride_to *
y * 4;
86 rect_left + stride_from *
y * 4,
87 rect_right + stride_from *
y * 4,
90 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
94 to[3] = std::max(from[0][3], from[1][3]);
105 for (
y = 0;
y < height;
y++) {
106 uchar *to = rect_to + stride_to *
y * 3;
108 rect_left + stride_from *
y * 3,
109 rect_right + stride_from *
y * 3,
112 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
119 else if (channels == 4) {
120 for (
y = 0;
y < height;
y++) {
121 uchar *to = rect_to + stride_to *
y * 4;
123 rect_left + stride_from *
y * 4,
124 rect_right + stride_from *
y * 4,
127 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
131 to[3] = std::max(from[0][3], from[1][3]);
143 size_t width = s3d->
x;
144 size_t height = s3d->
y;
145 const size_t channels = s3d->
channels;
147 const int stride_from = width;
148 const int stride_to = width;
151 const float *rect_left = s3d->
rectf.
left;
158 for (
y = 0;
y < height;
y++) {
159 float *to = rect_to + stride_to *
y * channels;
160 const float *from[2] = {
161 rect_left + stride_from *
y * channels,
162 rect_right + stride_from *
y * channels,
164 memcpy(to, from[
i],
sizeof(
float) * channels * stride_from);
171 for (
y = 0;
y < height;
y++) {
172 float *to = rect_to + stride_to *
y;
173 const float *from[2] = {
174 rect_left + stride_from *
y,
175 rect_right + stride_from *
y,
179 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
185 else if (channels == 3) {
186 for (
y = 0;
y < height;
y++) {
187 float *to = rect_to + stride_to *
y * 3;
188 const float *from[2] = {
189 rect_left + stride_from *
y * 3,
190 rect_right + stride_from *
y * 3,
194 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
200 else if (channels == 4) {
201 for (
y = 0;
y < height;
y++) {
202 float *to = rect_to + stride_to *
y * channels;
203 const float *from[2] = {
204 rect_left + stride_from *
y * channels,
205 rect_right + stride_from *
y * channels,
209 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
220 for (
y = 0;
y < height;
y++) {
221 float *to = rect_to + stride_to *
y;
222 const float *from[2] = {
223 rect_left + stride_from *
y,
224 rect_right + stride_from *
y,
227 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
234 else if (channels == 3) {
236 for (
y = 0;
y < height;
y++) {
237 float *to = rect_to + stride_to *
y * 3;
238 const float *from[2] = {
239 rect_left + stride_from *
y * 3,
240 rect_right + stride_from *
y * 3,
243 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
250 else if (channels == 4) {
252 for (
y = 0;
y < height;
y++) {
253 float *to = rect_to + stride_to *
y * 4;
254 const float *from[2] = {
255 rect_left + stride_from *
y * 4,
256 rect_right + stride_from *
y * 4,
259 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
281 for (
y = 0;
y < height;
y++) {
282 uchar *to = rect_to + stride_to *
y * channels;
283 const uchar *from[2] = {
284 rect_left + stride_from *
y * channels,
285 rect_right + stride_from *
y * channels,
287 memcpy(to, from[
i],
sizeof(
uchar) * channels * stride_from);
294 for (
y = 0;
y < height;
y++) {
295 uchar *to = rect_to + stride_to *
y;
296 const uchar *from[2] = {
297 rect_left + stride_from *
y,
298 rect_right + stride_from *
y,
301 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
307 else if (channels == 3) {
308 for (
y = 0;
y < height;
y++) {
309 uchar *to = rect_to + stride_to *
y * 3;
310 const uchar *from[2] = {
311 rect_left + stride_from *
y * 3,
312 rect_right + stride_from *
y * 3,
315 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
321 else if (channels == 4) {
322 for (
y = 0;
y < height;
y++) {
323 uchar *to = rect_to + stride_to *
y * 4;
324 const uchar *from[2] = {
325 rect_left + stride_from *
y * 4,
326 rect_right + stride_from *
y * 4,
329 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
340 for (
y = 0;
y < height;
y++) {
341 uchar *to = rect_to + stride_to *
y;
342 const uchar *from[2] = {
343 rect_left + stride_from *
y,
344 rect_right + stride_from *
y,
347 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
354 else if (channels == 3) {
356 for (
y = 0;
y < height;
y++) {
357 uchar *to = rect_to + stride_to *
y * 3;
358 const uchar *from[2] = {
359 rect_left + stride_from *
y * 3,
360 rect_right + stride_from *
y * 3,
363 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
370 else if (channels == 4) {
372 for (
y = 0;
y < height;
y++) {
373 uchar *to = rect_to + stride_to *
y * 4;
374 const uchar *from[2] = {
375 rect_left + stride_from *
y * 4,
376 rect_right + stride_from *
y * 4,
379 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
399 size_t width = s3d->
x;
400 size_t height = s3d->
y;
401 const size_t channels = s3d->
channels;
403 const int stride_from = width;
404 const int stride_to = width * 2;
406 const int l = int(crosseyed);
410 const float *rect_left = s3d->
rectf.
left;
414 for (
y = 0;
y < height;
y++) {
415 float *to = rect_to + stride_to *
y * channels;
416 const float *from[2] = {
417 rect_left + stride_from *
y * channels,
418 rect_right + stride_from *
y * channels,
421 memcpy(to, from[
l],
sizeof(
float) * channels * stride_from);
422 memcpy(to + channels * stride_from, from[r],
sizeof(
float) * channels * stride_from);
430 for (
y = 0;
y < height;
y++) {
431 uchar *to = rect_to + stride_to *
y * channels;
432 const uchar *from[2] = {
433 rect_left + stride_from *
y * channels,
434 rect_right + stride_from *
y * channels,
437 memcpy(to, from[
l],
sizeof(
uchar) * channels * stride_from);
438 memcpy(to + channels * stride_from, from[r],
sizeof(
uchar) * channels * stride_from);
447 size_t width = s3d->
x;
448 size_t height = s3d->
y;
449 const size_t channels = s3d->
channels;
451 const int stride_from = width;
452 const int stride_to = width;
455 const float *rect_left = s3d->
rectf.
left;
459 for (
y = 0;
y < height;
y++) {
460 float *to = rect_to + stride_to *
y * channels;
461 const float *from[2] = {
462 rect_left + stride_from *
y * channels,
463 rect_right + stride_from *
y * channels,
466 memcpy(to, from[1],
sizeof(
float) * channels * stride_from);
468 to + channels * height * stride_from, from[0],
sizeof(
float) * channels * stride_from);
476 for (
y = 0;
y < height;
y++) {
477 uchar *to = rect_to + stride_to *
y * channels;
478 const uchar *from[2] = {
479 rect_left + stride_from *
y * channels,
480 rect_right + stride_from *
y * channels,
483 memcpy(to, from[1],
sizeof(
uchar) * channels * stride_from);
485 to + channels * height * stride_from, from[0],
sizeof(
uchar) * channels * stride_from);
697 size_t width = s3d->
x;
698 size_t height = s3d->
y;
699 const size_t channels = s3d->
channels;
701 const int stride_from = width;
702 const int stride_to = width;
704 const int anaglyph_encoding[3][3] = {
712 r = anaglyph_encoding[mode][0];
713 g = anaglyph_encoding[mode][1];
714 b = anaglyph_encoding[mode][2];
722 for (
y = 0;
y < height;
y++) {
723 float *from = rect_from + stride_from *
y * 3;
725 rect_left + stride_to *
y * 3,
726 rect_right + stride_to *
y * 3,
729 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
736 else if (channels == 4) {
737 for (
y = 0;
y < height;
y++) {
738 float *from = rect_from + stride_from *
y * 4;
740 rect_left + stride_to *
y * 4,
741 rect_right + stride_to *
y * 4,
744 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
748 to[0][3] = to[1][3] = from[3];
759 for (
y = 0;
y < height;
y++) {
760 uchar *from = rect_from + stride_from *
y * 3;
762 rect_left + stride_to *
y * 3,
763 rect_right + stride_to *
y * 3,
766 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
773 else if (channels == 4) {
774 for (
y = 0;
y < height;
y++) {
775 uchar *from = rect_from + stride_from *
y * 4;
777 rect_left + stride_to *
y * 4,
778 rect_right + stride_to *
y * 4,
781 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
785 to[0][3] = to[1][3] = from[3];
797 size_t width = s3d->
x;
798 size_t height = s3d->
y;
799 const size_t channels = s3d->
channels;
801 const int stride_from = width;
802 const int stride_to = width;
812 for (
y = 0;
y < height;
y++) {
813 const float *from = rect_from + stride_from *
y * channels;
815 rect_left + stride_to *
y * channels,
816 rect_right + stride_to *
y * channels,
818 memcpy(to[
i], from,
sizeof(
float) * channels * stride_to);
825 for (
y = 0;
y < height;
y++) {
826 const float *from = rect_from + stride_from *
y;
828 rect_left + stride_to *
y,
829 rect_right + stride_to *
y,
833 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
839 else if (channels == 3) {
840 for (
y = 0;
y < height;
y++) {
841 const float *from = rect_from + stride_from *
y * 3;
843 rect_left + stride_to *
y * 3,
844 rect_right + stride_to *
y * 3,
848 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
854 else if (channels == 4) {
855 for (
y = 0;
y < height;
y++) {
856 const float *from = rect_from + stride_from *
y * channels;
858 rect_left + stride_to *
y * channels,
859 rect_right + stride_to *
y * channels,
863 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
874 for (
y = 0;
y < height;
y++) {
875 const float *from = rect_from + stride_from *
y;
877 rect_left + stride_to *
y,
878 rect_right + stride_to *
y,
881 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
888 else if (channels == 3) {
890 for (
y = 0;
y < height;
y++) {
891 const float *from = rect_from + stride_from *
y * 3;
893 rect_left + stride_to *
y * 3,
894 rect_right + stride_to *
y * 3,
897 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
904 else if (channels == 4) {
906 for (
y = 0;
y < height;
y++) {
907 const float *from = rect_from + stride_from *
y * 4;
909 rect_left + stride_to *
y * 4,
910 rect_right + stride_to *
y * 4,
913 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
935 for (
y = 0;
y < height;
y++) {
936 const uchar *from = rect_from + stride_from *
y * channels;
938 rect_left + stride_to *
y * channels,
939 rect_right + stride_to *
y * channels,
941 memcpy(to[
i], from,
sizeof(
uchar) * channels * stride_to);
948 for (
y = 0;
y < height;
y++) {
949 const uchar *from = rect_from + stride_from *
y;
951 rect_left + stride_to *
y,
952 rect_right + stride_to *
y,
955 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
961 else if (channels == 3) {
962 for (
y = 0;
y < height;
y++) {
963 const uchar *from = rect_from + stride_from *
y * 3;
965 rect_left + stride_to *
y * 3,
966 rect_right + stride_to *
y * 3,
969 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
975 else if (channels == 4) {
976 for (
y = 0;
y < height;
y++) {
977 const uchar *from = rect_from + stride_from *
y * 4;
979 rect_left + stride_to *
y * 4,
980 rect_right + stride_to *
y * 4,
983 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
994 for (
y = 0;
y < height;
y++) {
995 const uchar *from = rect_from + stride_from *
y;
997 rect_left + stride_to *
y,
998 rect_right + stride_to *
y,
1001 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
1008 else if (channels == 3) {
1009 char i = char(
swap);
1010 for (
y = 0;
y < height;
y++) {
1011 const uchar *from = rect_from + stride_from *
y * 3;
1013 rect_left + stride_to *
y * 3,
1014 rect_right + stride_to *
y * 3,
1017 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
1024 else if (channels == 4) {
1025 char i = char(
swap);
1026 for (
y = 0;
y < height;
y++) {
1027 const uchar *from = rect_from + stride_from *
y * 4;
1029 rect_left + stride_to *
y * 4,
1030 rect_right + stride_to *
y * 4,
1033 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
static void imb_stereo3d_data_init(Stereo3DData *s3d_data, const bool is_float, const size_t x, const size_t y, const size_t channels, int *rect_left, int *rect_right, int *rect_stereo, float *rectf_left, float *rectf_right, float *rectf_stereo)