48 size_t width = s3d->
x;
49 size_t height = s3d->
y;
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) {
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) {
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;
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] = {
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) {
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) {
206 for (
y = 0;
y < height;
y++) {
207 float *to = rect_to + stride_to *
y *
channels;
208 const float *from[2] = {
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) {
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) {
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] = {
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) {
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) {
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) {
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) {
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) {
404 size_t width = s3d->
x;
405 size_t height = s3d->
y;
408 const int stride_from = width;
409 const int stride_to = width * 2;
411 const int l =
int(crosseyed);
415 const float *rect_left = s3d->
rectf.
left;
419 for (
y = 0;
y < height;
y++) {
420 float *to = rect_to + stride_to *
y *
channels;
421 const float *from[2] = {
426 memcpy(to, from[
l],
sizeof(
float) *
channels * stride_from);
427 memcpy(to +
channels * stride_from, from[r],
sizeof(
float) *
channels * stride_from);
435 for (
y = 0;
y < height;
y++) {
437 const uchar *from[2] = {
452 size_t width = s3d->
x;
453 size_t height = s3d->
y;
456 const int stride_from = width;
457 const int stride_to = width;
460 const float *rect_left = s3d->
rectf.
left;
464 for (
y = 0;
y < height;
y++) {
465 float *to = rect_to + stride_to *
y *
channels;
466 const float *from[2] = {
471 memcpy(to, from[1],
sizeof(
float) *
channels * stride_from);
473 to +
channels * height * stride_from, from[0],
sizeof(
float) *
channels * stride_from);
481 for (
y = 0;
y < height;
y++) {
483 const uchar *from[2] = {
502 const bool is_squeezed,
510 *r_width = is_squeezed ? width : width * 2;
516 *r_height = is_squeezed ? height : height * 2;
530 const bool is_squeezed,
538 *r_width = is_squeezed ? width / 2 : width;
544 *r_height = is_squeezed ? height / 2 : height;
599 size_t width, height;
633 size_t width, height;
701 size_t width, height;
702 const bool is_float = im_format->
depth > 8;
706 rect_result =
static_cast<int *
>(
MEM_mallocN(
channels *
sizeof(
int) * width * height, __func__));
734 size_t width, height;
735 const bool is_float = im_format->
depth > 8;
739 rectf_result =
static_cast<float *
>(
761 ImBuf *ibuf_stereo =
nullptr;
763 size_t width, height;
764 const bool is_float = im_format->
depth > 8;
830 size_t width = s3d->
x;
831 size_t height = s3d->
y;
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) {
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) {
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;
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;
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) {
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) {
988 for (
y = 0;
y < height;
y++) {
989 const float *from = rect_from + stride_from *
y *
channels;
996 for (
x = 0;
x < width;
x++, from += 4, to[0] += 4, to[1] += 4) {
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) {
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) {
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++) {
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) {
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) {
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) {
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) {
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) {
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) {
1186 size_t width = s3d->
x;
1187 size_t height = s3d->
y;
1190 const int stride_from = width * 2;
1191 const int stride_to = width;
1193 const int l =
int(crosseyed);
1201 for (
y = 0;
y < height;
y++) {
1202 const float *from = rect_from + stride_from *
y *
channels;
1208 memcpy(to[
l], from,
sizeof(
float) *
channels * stride_to);
1209 memcpy(to[r], from +
channels * stride_to,
sizeof(
float) *
channels * stride_to);
1218 for (
y = 0;
y < height;
y++) {
1235 size_t width = s3d->
x;
1236 size_t height = s3d->
y;
1239 const int stride_from = width;
1240 const int stride_to = width;
1247 for (
y = 0;
y < height;
y++) {
1248 const float *from = rect_from + stride_from *
y *
channels;
1254 memcpy(to[1], from,
sizeof(
float) *
channels * stride_to);
1255 memcpy(to[0], from +
channels * height * stride_to,
sizeof(
float) *
channels * stride_to);
1263 for (
y = 0;
y < height;
y++) {
1283 ImBuf *ibuf_stereo3d,
1284 ImBuf **r_ibuf_left,
1285 ImBuf **r_ibuf_right)
1288 ImBuf *ibuf_left, *ibuf_right;
1289 size_t width, height;
1339 *r_ibuf_left = ibuf_left;
1340 *r_ibuf_right = ibuf_right;
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
@ S3D_SIDEBYSIDE_CROSSEYED
@ S3D_INTERLACE_CHECKERBOARD
void IMB_buffer_byte_from_byte(unsigned char *rect_to, const unsigned char *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
void IMB_buffer_float_from_float(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
bool imb_addrectImBuf(ImBuf *ibuf, bool initialize_pixels=true)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
bool imb_addrectfloatImBuf(ImBuf *ibuf, const unsigned int channels, bool initialize_pixels=true)
Contains defines and structs used throughout the imbuf module.
#define IB_PROFILE_LINEAR_RGB
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
ATTR_WARN_UNUSED_RESULT const BMLoop * l
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
struct ImBuf * IMB_allocImBuf(unsigned int, unsigned int, unsigned char, unsigned int)
void IMB_freeImBuf(ImBuf *)
void *(* MEM_mallocN)(size_t len, const char *str)
static void imb_stereo3d_squeeze_ImBuf(ImBuf *ibuf, const Stereo3dFormat *s3d, const size_t x, const size_t y)
static void imb_stereo3d_read_interlace(const Stereo3DData *s3d, enum eStereo3dInterlaceType mode, const bool swap)
static void imb_stereo3d_write_interlace(const Stereo3DData *s3d, enum eStereo3dInterlaceType mode, const bool swap)
static void imb_stereo3d_squeeze_rectf(float *rectf, const Stereo3dFormat *s3d, const size_t x, const size_t y, const size_t channels)
static void imb_stereo3d_squeeze_rect(int *rect, const Stereo3dFormat *s3d, const size_t x, const size_t y, const size_t channels)
static void imb_stereo3d_write_doit(Stereo3DData *s3d_data, const Stereo3dFormat *s3d)
void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d, ImBuf *ibuf_stereo3d, ImBuf **r_ibuf_left, ImBuf **r_ibuf_right)
static void imb_stereo3d_write_anaglyph(const Stereo3DData *s3d, enum eStereo3dAnaglyphType mode)
static void imb_stereo3d_write_sidebyside(const Stereo3DData *s3d, const bool crosseyed)
void IMB_stereo3d_write_dimensions(const char mode, const bool is_squeezed, const size_t width, const size_t height, size_t *r_width, size_t *r_height)
static void imb_stereo3d_read_anaglyph(const Stereo3DData *s3d, enum eStereo3dAnaglyphType mode)
int * IMB_stereo3d_from_rect(const ImageFormatData *im_format, const size_t x, const size_t y, const size_t channels, int *rect_left, int *rect_right)
static void imb_stereo3d_read_sidebyside(const Stereo3DData *s3d, const bool crosseyed)
ImBuf * IMB_stereo3d_ImBuf(const ImageFormatData *im_format, ImBuf *ibuf_left, ImBuf *ibuf_right)
float * IMB_stereo3d_from_rectf(const ImageFormatData *im_format, const size_t x, const size_t y, const size_t channels, float *rectf_left, float *rectf_right)
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)
static void imb_stereo3d_unsqueeze_ImBuf(ImBuf *ibuf, const Stereo3dFormat *s3d, const size_t x, const size_t y)
static void imb_stereo3d_read_doit(Stereo3DData *s3d_data, const Stereo3dFormat *s3d)
void IMB_stereo3d_read_dimensions(const char mode, const bool is_squeezed, const size_t width, const size_t height, size_t *r_width, size_t *r_height)
static void imb_stereo3d_write_topbottom(const Stereo3DData *s3d)
static void imb_stereo3d_read_topbottom(const Stereo3DData *s3d)
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
struct Stereo3DData::@064177012366126046105206334375310125316261214263 rectf
struct Stereo3DData::@016255276062343104251335077351353231077316347222 rect