39 yuv[0] = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];
40 yuv[1] = 0.492f * (rgb[2] - yuv[0]);
41 yuv[2] = 0.877f * (rgb[0] - yuv[0]);
44 yuv[1] *= 255.0f / (122 * 2.0f);
47 yuv[2] *= 255.0f / (157 * 2.0f);
60 char newval = table[
pos[
col]];
67 if (last_pos > new_pos) {
68 uchar *temp = new_pos;
73 while (last_pos < new_pos) {
74 if (last_pos[0] == 0) {
75 last_pos[0] = last_pos[1] = last_pos[2] = 32;
84 if (last_pos > new_pos) {
85 uchar *temp = new_pos;
90 while (last_pos < new_pos) {
91 if (last_pos[
col] == 0) {
103 for (
x = 0;
x <
w;
x++) {
106 p[4 *
w + 1] = p[4 *
w + 3] = 155;
107 p = tgt + 4 * (
w * (h - 1) +
x);
109 p[-4 *
w + 1] = p[-4 *
w + 3] = 155;
112 for (
y = 0;
y < h;
y++) {
115 p[4 + 1] = p[4 + 3] = 155;
116 p = tgt + 4 * (
w *
y +
w - 1);
118 p[-4 + 1] = p[-4 + 3] = 155;
124 tgt += (int)(perc / 100.0f * h) *
w * 4;
126 for (
int i = 0; i <
w * 2; i++) {
148 float waveform_gamma = 0.2;
154 for (
x = 0;
x < 256;
x++) {
155 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, waveform_gamma) * 255);
158 for (
y = 0;
y < ibuf->
y;
y++) {
161 for (
x = 0;
x < ibuf->
x;
x++) {
162 const uchar *rgb = src + 4 * (ibuf->
x *
y +
x);
165 p += 4 * (
w * ((int)(
v * (h - 3)) + 1) +
x + 1);
171 if (last_p !=
NULL) {
189 float waveform_gamma = 0.2;
194 for (
x = 0;
x < 256;
x++) {
195 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, waveform_gamma) * 255);
198 for (
y = 0;
y < ibuf->
y;
y++) {
201 for (
x = 0;
x < ibuf->
x;
x++) {
202 const float *rgb = src + 4 * (ibuf->
x *
y +
x);
208 p += 4 * (
w * ((int)(
v * (h - 3)) + 1) +
x + 1);
214 if (last_p !=
NULL) {
241 int sw = ibuf->
x / 3;
243 float waveform_gamma = 0.2;
248 for (
x = 0;
x < 256;
x++) {
249 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, waveform_gamma) * 255);
252 for (
y = 0;
y < ibuf->
y;
y++) {
255 for (
x = 0;
x < ibuf->
x;
x++) {
257 const uchar *rgb = src + 4 * (ibuf->
x *
y +
x);
258 for (
c = 0;
c < 3;
c++) {
260 p += 4 * (
w * ((rgb[
c] * (h - 3)) / 255 + 1) +
c * sw +
x / 3 + 1);
266 if (last_p[
c] !=
NULL) {
286 int sw = ibuf->
x / 3;
288 float waveform_gamma = 0.2;
293 for (
x = 0;
x < 256;
x++) {
294 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, waveform_gamma) * 255);
297 for (
y = 0;
y < ibuf->
y;
y++) {
300 for (
x = 0;
x < ibuf->
x;
x++) {
302 const float *rgb = src + 4 * (ibuf->
x *
y +
x);
303 for (
c = 0;
c < 3;
c++) {
309 p += 4 * (
w * ((int)(
v * (h - 3)) + 1) +
c * sw +
x / 3 + 1);
315 if (last_p[
c] !=
NULL) {
338 uint limit = 255.0f * perc / 100.0f;
344 for (
y = 0;
y < ibuf->
y;
y++) {
345 for (
x = 0;
x < ibuf->
x;
x++) {
351 if (
r >= limit || g >= limit || b >= limit) {
352 if (((
x +
y) & 0x08) != 0) {
368 float limit = perc / 100.0f;
374 for (
y = 0;
y < ibuf->
y;
y++) {
375 for (
x = 0;
x < ibuf->
x;
x++) {
381 if (
r >= limit || g >= limit || b >= limit) {
382 if (((
x +
y) & 0x08) != 0) {
413 int barh = ibuf->
y * 0.1;
415 p += 4 * (
x + ibuf->
x * (ibuf->
y - barh + 1));
417 for (
int i = 0; i < barh - 1; i++) {
418 p[0] = p[1] = p[2] = 255;
426 int barh = ibuf->
y * val * 0.9f;
428 p += 4 * (
x + ibuf->
x);
430 for (
int i = 0; i < barh; i++) {
436 #define HIS_STEPS 512
452 for (
int x = 0;
x < ibuf->
x;
x++) {
453 const uchar *pixel = src + (
y * ibuf->
x +
x) * 4;
455 for (
int j = 3; j--;) {
456 cur_bins[j][pixel[j]]++;
462 void *__restrict chunk_join,
463 void *__restrict chunk)
468 for (
int j = 3; j--;) {
470 join_bins[j][i] += bins[j][i];
483 memset(bins, 0,
sizeof(bins));
498 if (bins[0][
x] > nr) {
501 if (bins[1][
x] > ng) {
504 if (bins[2][
x] > nb) {
538 return (
int)(((f + 0.25f) / 1.5f) * 512);
551 for (
int x = 0;
x < ibuf->
x;
x++) {
552 const float *pixel = src + (
y * ibuf->
x +
x) * 4;
554 for (
int j = 3; j--;) {
568 memset(bins, 0,
sizeof(bins));
583 if (bins[0][
x] > nr) {
586 if (bins[1][
x] > ng) {
589 if (bins[2][
x] > nb) {
625 float rgb[3], yuv[3];
630 rgb[0] = (
float)
r / 255.0f;
631 rgb[1] = (
float)g / 255.0f;
632 rgb[2] = (
float)b / 255.0f;
635 p = tgt + 4 * (
w * (int)((yuv[2] * (h - 3) + 1)) + (
int)((yuv[1] * (
w - 3) + 1)));
637 if (
r == 0 && g == 0 && b == 0) {
643 char *q = p + 4 * (
y *
w +
x);
656 const char *src = (
const char *)ibuf->
rect;
657 char *tgt = (
char *)rval->
rect;
658 float rgb[3], yuv[3];
661 float scope_gamma = 0.2;
664 for (
x = 0;
x < 256;
x++) {
665 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, scope_gamma) * 255);
668 for (
x = 0;
x < 256;
x++) {
677 for (
y = 0;
y < ibuf->
y;
y++) {
678 for (
x = 0;
x < ibuf->
x;
x++) {
679 const char *src1 = src + 4 * (ibuf->
x *
y +
x);
682 rgb[0] = (
float)src1[0] / 255.0f;
683 rgb[1] = (
float)src1[1] / 255.0f;
684 rgb[2] = (
float)src1[2] / 255.0f;
687 p = tgt + 4 * (
w * (int)((yuv[2] * (h - 3) + 1)) + (
int)((yuv[1] * (
w - 3) + 1)));
702 char *tgt = (
char *)rval->
rect;
703 float rgb[3], yuv[3];
706 float scope_gamma = 0.2;
709 for (
x = 0;
x < 256;
x++) {
710 wtable[
x] = (
uchar)(
pow(((
float)
x + 1) / 256, scope_gamma) * 255);
713 for (
x = 0;
x <= 255;
x++) {
722 for (
y = 0;
y < ibuf->
y;
y++) {
723 for (
x = 0;
x < ibuf->
x;
x++) {
724 const float *src1 = src + 4 * (ibuf->
x *
y +
x);
727 memcpy(rgb, src1,
sizeof(
float[3]));
733 p = tgt + 4 * (
w * (int)((yuv[2] * (h - 3) + 1)) + (
int)((yuv[1] * (
w - 3) + 1)));
typedef float(TangentPoint)[2]
MINLINE void clamp_v3(float vec[3], const float min, const float max)
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
BLI_INLINE unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char[3])
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
struct ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
Contains defines and structs used throughout the imbuf module.
Group RGB to Bright Vector Camera CLAMP
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
ImBuf * make_histogram_view_from_ibuf(ImBuf *ibuf)
static ImBuf * make_waveform_view_from_ibuf_float(ImBuf *ibuf)
static void draw_histogram_marker(ImBuf *ibuf, int x)
static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col)
static void make_histogram_view_from_ibuf_byte_fn(void *__restrict userdata, const int y, const TaskParallelTLS *__restrict tls)
ImBuf * make_zebra_view_from_ibuf(ImBuf *ibuf, float perc)
ImBuf * make_waveform_view_from_ibuf(ImBuf *ibuf)
static void wform_put_line_single(int w, uchar *last_pos, uchar *new_pos, int col)
static void wform_put_grid(uchar *tgt, int w, int h)
ImBuf * make_vectorscope_view_from_ibuf(ImBuf *ibuf)
static ImBuf * make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
static ImBuf * make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf)
static ImBuf * make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
static void wform_put_line(int w, uchar *last_pos, uchar *new_pos)
BLI_INLINE int get_bin_float(float f)
ImBuf * make_sep_waveform_view_from_ibuf(ImBuf *ibuf)
static ImBuf * make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf)
static ImBuf * make_histogram_view_from_ibuf_float(ImBuf *ibuf)
static void wform_put_border(uchar *tgt, int w, int h)
struct MakeHistogramViewData MakeHistogramViewData
static void scope_put_pixel(const uchar *table, uchar *pos)
static void wform_put_gridrow(uchar *tgt, float perc, int w, int h)
static void scope_put_pixel_single(const uchar *table, uchar *pos, int col)
static void vectorscope_put_cross(uchar r, uchar g, uchar b, char *tgt, int w, int h, int size)
static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc)
static ImBuf * make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
static void make_histogram_view_from_ibuf_float_fn(void *__restrict userdata, const int y, const TaskParallelTLS *__restrict tls)
static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3])
static ImBuf * make_waveform_view_from_ibuf_byte(ImBuf *ibuf)
static void make_histogram_view_from_ibuf_reduce(const void *__restrict UNUSED(userdata), void *__restrict chunk_join, void *__restrict chunk)
static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc)
TaskParallelReduceFunc func_reduce
size_t userdata_chunk_size