45 size_t width = s3d->
x;
46 size_t height = s3d->
y;
47 const size_t channels = s3d->
channels;
49 const int stride_from = width;
50 const int stride_to = width;
52 const int anaglyph_encoding[3][3] = {
60 r = anaglyph_encoding[mode][0];
61 g = anaglyph_encoding[mode][1];
62 b = anaglyph_encoding[mode][2];
65 float *rect_left = s3d->
rectf.left;
66 float *rect_right = s3d->
rectf.right;
67 float *rect_to = s3d->
rectf.stereo;
70 for (
y = 0;
y < height;
y++) {
71 float *to = rect_to + stride_to *
y * 3;
73 rect_left + stride_from *
y * 3,
74 rect_right + stride_from *
y * 3,
77 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
84 else if (channels == 4) {
85 for (
y = 0;
y < height;
y++) {
86 float *to = rect_to + stride_to *
y * 4;
88 rect_left + stride_from *
y * 4,
89 rect_right + stride_from *
y * 4,
92 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
96 to[3] = std::max(from[0][3], from[1][3]);
107 for (
y = 0;
y < height;
y++) {
108 uchar *to = rect_to + stride_to *
y * 3;
110 rect_left + stride_from *
y * 3,
111 rect_right + stride_from *
y * 3,
114 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
121 else if (channels == 4) {
122 for (
y = 0;
y < height;
y++) {
123 uchar *to = rect_to + stride_to *
y * 4;
125 rect_left + stride_from *
y * 4,
126 rect_right + stride_from *
y * 4,
129 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
133 to[3] = std::max(from[0][3], from[1][3]);
145 size_t width = s3d->
x;
146 size_t height = s3d->
y;
147 const size_t channels = s3d->
channels;
149 const int stride_from = width;
150 const int stride_to = width;
153 const float *rect_left = s3d->
rectf.left;
154 const float *rect_right = s3d->
rectf.right;
155 float *rect_to = s3d->
rectf.stereo;
160 for (
y = 0;
y < height;
y++) {
161 float *to = rect_to + stride_to *
y * channels;
162 const float *from[2] = {
163 rect_left + stride_from *
y * channels,
164 rect_right + stride_from *
y * channels,
166 memcpy(to, from[i],
sizeof(
float) * channels * stride_from);
173 for (
y = 0;
y < height;
y++) {
174 float *to = rect_to + stride_to *
y;
175 const float *from[2] = {
176 rect_left + stride_from *
y,
177 rect_right + stride_from *
y,
181 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
187 else if (channels == 3) {
188 for (
y = 0;
y < height;
y++) {
189 float *to = rect_to + stride_to *
y * 3;
190 const float *from[2] = {
191 rect_left + stride_from *
y * 3,
192 rect_right + stride_from *
y * 3,
196 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
202 else if (channels == 4) {
203 for (
y = 0;
y < height;
y++) {
204 float *to = rect_to + stride_to *
y * channels;
205 const float *from[2] = {
206 rect_left + stride_from *
y * channels,
207 rect_right + stride_from *
y * channels,
211 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
222 for (
y = 0;
y < height;
y++) {
223 float *to = rect_to + stride_to *
y;
224 const float *from[2] = {
225 rect_left + stride_from *
y,
226 rect_right + stride_from *
y,
229 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
236 else if (channels == 3) {
238 for (
y = 0;
y < height;
y++) {
239 float *to = rect_to + stride_to *
y * 3;
240 const float *from[2] = {
241 rect_left + stride_from *
y * 3,
242 rect_right + stride_from *
y * 3,
245 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
252 else if (channels == 4) {
254 for (
y = 0;
y < height;
y++) {
255 float *to = rect_to + stride_to *
y * 4;
256 const float *from[2] = {
257 rect_left + stride_from *
y * 4,
258 rect_right + stride_from *
y * 4,
261 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
277 const uchar *rect_right = s3d->
rect.right;
283 for (
y = 0;
y < height;
y++) {
284 uchar *to = rect_to + stride_to *
y * channels;
285 const uchar *from[2] = {
286 rect_left + stride_from *
y * channels,
287 rect_right + stride_from *
y * channels,
289 memcpy(to, from[i],
sizeof(
uchar) * channels * stride_from);
296 for (
y = 0;
y < height;
y++) {
297 uchar *to = rect_to + stride_to *
y;
298 const uchar *from[2] = {
299 rect_left + stride_from *
y,
300 rect_right + stride_from *
y,
303 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
309 else if (channels == 3) {
310 for (
y = 0;
y < height;
y++) {
311 uchar *to = rect_to + stride_to *
y * 3;
312 const uchar *from[2] = {
313 rect_left + stride_from *
y * 3,
314 rect_right + stride_from *
y * 3,
317 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
323 else if (channels == 4) {
324 for (
y = 0;
y < height;
y++) {
325 uchar *to = rect_to + stride_to *
y * 4;
326 const uchar *from[2] = {
327 rect_left + stride_from *
y * 4,
328 rect_right + stride_from *
y * 4,
331 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
342 for (
y = 0;
y < height;
y++) {
343 uchar *to = rect_to + stride_to *
y;
344 const uchar *from[2] = {
345 rect_left + stride_from *
y,
346 rect_right + stride_from *
y,
349 for (
x = 0;
x < width;
x++, from[0] += 1, from[1] += 1, to += 1) {
356 else if (channels == 3) {
358 for (
y = 0;
y < height;
y++) {
359 uchar *to = rect_to + stride_to *
y * 3;
360 const uchar *from[2] = {
361 rect_left + stride_from *
y * 3,
362 rect_right + stride_from *
y * 3,
365 for (
x = 0;
x < width;
x++, from[0] += 3, from[1] += 3, to += 3) {
372 else if (channels == 4) {
374 for (
y = 0;
y < height;
y++) {
375 uchar *to = rect_to + stride_to *
y * 4;
376 const uchar *from[2] = {
377 rect_left + stride_from *
y * 4,
378 rect_right + stride_from *
y * 4,
381 for (
x = 0;
x < width;
x++, from[0] += 4, from[1] += 4, to += 4) {
401 size_t width = s3d->
x;
402 size_t height = s3d->
y;
403 const size_t channels = s3d->
channels;
405 const int stride_from = width;
406 const int stride_to = width * 2;
408 const int l = int(crosseyed);
412 const float *rect_left = s3d->
rectf.left;
413 const float *rect_right = s3d->
rectf.right;
414 float *rect_to = s3d->
rectf.stereo;
416 for (
y = 0;
y < height;
y++) {
417 float *to = rect_to + stride_to *
y * channels;
418 const float *from[2] = {
419 rect_left + stride_from *
y * channels,
420 rect_right + stride_from *
y * channels,
423 memcpy(to, from[
l],
sizeof(
float) * channels * stride_from);
424 memcpy(to + channels * stride_from, from[r],
sizeof(
float) * channels * stride_from);
429 const uchar *rect_right = s3d->
rect.right;
432 for (
y = 0;
y < height;
y++) {
433 uchar *to = rect_to + stride_to *
y * channels;
434 const uchar *from[2] = {
435 rect_left + stride_from *
y * channels,
436 rect_right + stride_from *
y * channels,
439 memcpy(to, from[
l],
sizeof(
uchar) * channels * stride_from);
440 memcpy(to + channels * stride_from, from[r],
sizeof(
uchar) * channels * stride_from);
449 size_t width = s3d->
x;
450 size_t height = s3d->
y;
451 const size_t channels = s3d->
channels;
453 const int stride_from = width;
454 const int stride_to = width;
457 const float *rect_left = s3d->
rectf.left;
458 const float *rect_right = s3d->
rectf.right;
459 float *rect_to = s3d->
rectf.stereo;
461 for (
y = 0;
y < height;
y++) {
462 float *to = rect_to + stride_to *
y * channels;
463 const float *from[2] = {
464 rect_left + stride_from *
y * channels,
465 rect_right + stride_from *
y * channels,
468 memcpy(to, from[1],
sizeof(
float) * channels * stride_from);
470 to + channels * height * stride_from, from[0],
sizeof(
float) * channels * stride_from);
475 const uchar *rect_right = s3d->
rect.right;
478 for (
y = 0;
y < height;
y++) {
479 uchar *to = rect_to + stride_to *
y * channels;
480 const uchar *from[2] = {
481 rect_left + stride_from *
y * channels,
482 rect_right + stride_from *
y * channels,
485 memcpy(to, from[1],
sizeof(
uchar) * channels * stride_from);
487 to + channels * height * stride_from, from[0],
sizeof(
uchar) * channels * stride_from);
700 size_t width = s3d->
x;
701 size_t height = s3d->
y;
702 const size_t channels = s3d->
channels;
704 const int stride_from = width;
705 const int stride_to = width;
707 const int anaglyph_encoding[3][3] = {
715 r = anaglyph_encoding[mode][0];
716 g = anaglyph_encoding[mode][1];
717 b = anaglyph_encoding[mode][2];
720 float *rect_left = s3d->
rectf.left;
721 float *rect_right = s3d->
rectf.right;
722 float *rect_from = s3d->
rectf.stereo;
725 for (
y = 0;
y < height;
y++) {
726 float *from = rect_from + stride_from *
y * 3;
728 rect_left + stride_to *
y * 3,
729 rect_right + stride_to *
y * 3,
732 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
739 else if (channels == 4) {
740 for (
y = 0;
y < height;
y++) {
741 float *from = rect_from + stride_from *
y * 4;
743 rect_left + stride_to *
y * 4,
744 rect_right + stride_to *
y * 4,
747 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
751 to[0][3] = to[1][3] = from[3];
762 for (
y = 0;
y < height;
y++) {
763 uchar *from = rect_from + stride_from *
y * 3;
765 rect_left + stride_to *
y * 3,
766 rect_right + stride_to *
y * 3,
769 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
776 else if (channels == 4) {
777 for (
y = 0;
y < height;
y++) {
778 uchar *from = rect_from + stride_from *
y * 4;
780 rect_left + stride_to *
y * 4,
781 rect_right + stride_to *
y * 4,
784 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
788 to[0][3] = to[1][3] = from[3];
800 size_t width = s3d->
x;
801 size_t height = s3d->
y;
802 const size_t channels = s3d->
channels;
804 const int stride_from = width;
805 const int stride_to = width;
808 float *rect_left = s3d->
rectf.left;
809 float *rect_right = s3d->
rectf.right;
810 const float *rect_from = s3d->
rectf.stereo;
815 for (
y = 0;
y < height;
y++) {
816 const float *from = rect_from + stride_from *
y * channels;
818 rect_left + stride_to *
y * channels,
819 rect_right + stride_to *
y * channels,
821 memcpy(to[i], from,
sizeof(
float) * channels * stride_to);
828 for (
y = 0;
y < height;
y++) {
829 const float *from = rect_from + stride_from *
y;
831 rect_left + stride_to *
y,
832 rect_right + stride_to *
y,
836 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
842 else if (channels == 3) {
843 for (
y = 0;
y < height;
y++) {
844 const float *from = rect_from + stride_from *
y * 3;
846 rect_left + stride_to *
y * 3,
847 rect_right + stride_to *
y * 3,
851 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
857 else if (channels == 4) {
858 for (
y = 0;
y < height;
y++) {
859 const float *from = rect_from + stride_from *
y * channels;
861 rect_left + stride_to *
y * channels,
862 rect_right + stride_to *
y * channels,
866 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
877 for (
y = 0;
y < height;
y++) {
878 const float *from = rect_from + stride_from *
y;
880 rect_left + stride_to *
y,
881 rect_right + stride_to *
y,
884 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
891 else if (channels == 3) {
893 for (
y = 0;
y < height;
y++) {
894 const float *from = rect_from + stride_from *
y * 3;
896 rect_left + stride_to *
y * 3,
897 rect_right + stride_to *
y * 3,
900 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
907 else if (channels == 4) {
909 for (
y = 0;
y < height;
y++) {
910 const float *from = rect_from + stride_from *
y * 4;
912 rect_left + stride_to *
y * 4,
913 rect_right + stride_to *
y * 4,
916 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
933 const uchar *rect_from = s3d->
rect.stereo;
938 for (
y = 0;
y < height;
y++) {
939 const uchar *from = rect_from + stride_from *
y * channels;
941 rect_left + stride_to *
y * channels,
942 rect_right + stride_to *
y * channels,
944 memcpy(to[i], from,
sizeof(
uchar) * channels * stride_to);
951 for (
y = 0;
y < height;
y++) {
952 const uchar *from = rect_from + stride_from *
y;
954 rect_left + stride_to *
y,
955 rect_right + stride_to *
y,
958 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
964 else if (channels == 3) {
965 for (
y = 0;
y < height;
y++) {
966 const uchar *from = rect_from + stride_from *
y * 3;
968 rect_left + stride_to *
y * 3,
969 rect_right + stride_to *
y * 3,
972 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
978 else if (channels == 4) {
979 for (
y = 0;
y < height;
y++) {
980 const uchar *from = rect_from + stride_from *
y * 4;
982 rect_left + stride_to *
y * 4,
983 rect_right + stride_to *
y * 4,
986 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
997 for (
y = 0;
y < height;
y++) {
998 const uchar *from = rect_from + stride_from *
y;
1000 rect_left + stride_to *
y,
1001 rect_right + stride_to *
y,
1004 for (
x = 0;
x < width;
x++, from += 1, to[0] += 1, to[1] += 1) {
1011 else if (channels == 3) {
1012 char i = char(
swap);
1013 for (
y = 0;
y < height;
y++) {
1014 const uchar *from = rect_from + stride_from *
y * 3;
1016 rect_left + stride_to *
y * 3,
1017 rect_right + stride_to *
y * 3,
1020 for (
x = 0;
x < width;
x++, from += 3, to[0] += 3, to[1] += 3) {
1027 else if (channels == 4) {
1028 char i = char(
swap);
1029 for (
y = 0;
y < height;
y++) {
1030 const uchar *from = rect_from + stride_from *
y * 4;
1032 rect_left + stride_to *
y * 4,
1033 rect_right + stride_to *
y * 4,
1036 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)