static void imb_stereo3d_unsqueeze_ImBuf(ImBuf *ibuf, Stereo3dFormat *s3d, const size_t x, const size_t y) { if (ELEM(s3d->display_mode, S3D_DISPLAY_SIDEBYSIDE, S3D_DISPLAY_TOPBOTTOM) == false) return; if ((s3d->flag & S3D_SQUEEZED_FRAME) == 0) return; IMB_scaleImBuf_threaded(ibuf, x, y); }
static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, int proxy_render_size, bool undistorted, bool threaded) { char name[FILE_MAX]; int quality, rectx, recty; int size = rendersize_to_number(proxy_render_size); ImBuf *scaleibuf; get_proxy_fname(clip, proxy_render_size, undistorted, cfra, name); rectx = ibuf->x * size / 100.0f; recty = ibuf->y * size / 100.0f; scaleibuf = IMB_dupImBuf(ibuf); if (threaded) IMB_scaleImBuf_threaded(scaleibuf, (short)rectx, (short)recty); else IMB_scaleImBuf(scaleibuf, (short)rectx, (short)recty); quality = clip->proxy.quality; scaleibuf->ftype = JPG | quality; /* unsupported feature only confuses other s/w */ if (scaleibuf->planes == 32) scaleibuf->planes = 24; /* TODO: currently the most weak part of multithreaded proxies, * could be solved in a way that thread only prepares memory * buffer and write to disk happens separately */ BLI_lock_thread(LOCK_MOVIECLIP); BLI_make_existing_file(name); if (IMB_saveiff(scaleibuf, name, IB_rect) == 0) perror(name); BLI_unlock_thread(LOCK_MOVIECLIP); IMB_freeImBuf(scaleibuf); }
static void imb_stereo3d_squeeze_rect(int *rect, Stereo3dFormat *s3d, const size_t x, const size_t y, const size_t channels) { ImBuf *ibuf; size_t width, height; if (ELEM(s3d->display_mode, S3D_DISPLAY_SIDEBYSIDE, S3D_DISPLAY_TOPBOTTOM) == false) return; if ((s3d->flag & S3D_SQUEEZED_FRAME) == 0) return; /* creates temporary imbuf to store the rectf */ IMB_stereo3d_write_dimensions(s3d->display_mode, false, x, y, &width, &height); ibuf = IMB_allocImBuf(width, height, channels, IB_rect); IMB_buffer_byte_from_byte( (unsigned char *)ibuf->rect, (unsigned char *)rect, IB_PROFILE_SRGB, IB_PROFILE_SRGB, false, width, height, width, width); IMB_scaleImBuf_threaded(ibuf, x, y); memcpy(rect, ibuf->rect, x * y * sizeof(unsigned int)); IMB_freeImBuf(ibuf); }