diff options
author | Xavier Thomas <xavier.thomas.1980@gmail.com> | 2010-05-10 07:42:22 +0400 |
---|---|---|
committer | Xavier Thomas <xavier.thomas.1980@gmail.com> | 2010-05-10 07:42:22 +0400 |
commit | bd4fe1b71dea85947f4d670ea749d7e07a2ed83c (patch) | |
tree | 484d9f6d007e9d5bcb07263b257bfe2da2e063ee | |
parent | 413c4c91ca26d087db9c0b42937a95fa235c6a28 (diff) |
Fix for histogram Luma mode not working when waveform is in RGB mode.
Also unified the scope vocabulary.
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 6 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_color_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 10 |
4 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 2856a333a5f..c8a01b1c12f 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -918,7 +918,7 @@ DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, f scopes->waveform_3[idx + 0] = fx; scopes->waveform_3[idx + 1] = rgb[2]; break; - case SCOPES_WAVEFRM_LUM: + case SCOPES_WAVEFRM_LUMA: scopes->waveform_1[idx + 0] = fx; scopes->waveform_1[idx + 1] = ycc[0]; break; @@ -943,7 +943,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) unsigned char *rc=NULL; unsigned int *bin_r, *bin_g, *bin_b, *bin_lum; int savedlines, saveline; - float rgb[3], ycc[3]; + float rgb[3], ycc[3], luma; int ycc_mode=-1; if (scopes->ok == 1 ) return; @@ -959,7 +959,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) case SCOPES_WAVEFRM_RGB: ycc_mode = -1; break; - case SCOPES_WAVEFRM_LUM: + case SCOPES_WAVEFRM_LUMA: case SCOPES_WAVEFRM_YCC_JPEG: ycc_mode = BLI_YCC_JFIF_0_255; break; @@ -1027,6 +1027,10 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) for (c=0; c<3; c++) rgb[c] = rc[c] * INV_255; } + + /* we still need luma for histogram */ + luma = 0.299*rgb[0] + 0.587*rgb[1] + 0.114 * rgb[2]; + /* check for min max */ if(ycc_mode == -1 ) { for (c=0; c<3; c++) { @@ -1046,7 +1050,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) bin_r[ get_bin_float(rgb[0]) ] += 1; bin_g[ get_bin_float(rgb[1]) ] += 1; bin_b[ get_bin_float(rgb[2]) ] += 1; - bin_lum[ get_bin_float(ycc[0]) ] += 1; + bin_lum[ get_bin_float(luma) ] += 1; /* save sample if needed */ if(saveline) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 20359b2c3a4..0dd333dc387 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -861,7 +861,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); } /* 3 vertical separation */ - if (scopes->wavefrm_mode!= SCOPES_WAVEFRM_LUM) { + if (scopes->wavefrm_mode!= SCOPES_WAVEFRM_LUMA) { for (i=1; i<3; i++) { fdrawline(rect.xmin+i*w3, rect.ymin, rect.xmin+i*w3, rect.ymax); } @@ -878,7 +878,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r fdrawline(rect.xmin+w3, yofs+h*240.0f/255.0f, rect.xmax+1, yofs+h*240.0f/255.0f); } /* 7.5 IRE black point level for NTSC */ - if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUM) + if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUMA) fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f); if (scopes->ok && scopes->waveform_1 != NULL) { @@ -886,7 +886,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r /* LUMA (1 channel) */ glBlendFunc(GL_ONE,GL_ONE); glColor3f(alpha, alpha, alpha); - if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUM){ + if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA){ glBlendFunc(GL_ONE,GL_ONE); diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index 2881ec127c8..bc35d379334 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -133,7 +133,7 @@ typedef struct Scopes { } Scopes; /* scopes->wavefrm_mode */ -#define SCOPES_WAVEFRM_LUM 0 +#define SCOPES_WAVEFRM_LUMA 0 #define SCOPES_WAVEFRM_RGB 1 #define SCOPES_WAVEFRM_YCC_601 2 #define SCOPES_WAVEFRM_YCC_709 3 diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 754f0270210..218ca55e72d 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -453,10 +453,10 @@ static void rna_def_histogram(BlenderRNA *brna) static EnumPropertyItem prop_mode_items[] = { {HISTO_MODE_LUMA, "Luma", ICON_COLOR, "Luma", ""}, - {HISTO_MODE_RGB, "RGB", ICON_COLOR, "RGB", ""}, - {HISTO_MODE_R, "R", ICON_COLOR, "R", ""}, - {HISTO_MODE_G, "G", ICON_COLOR, "G", ""}, - {HISTO_MODE_B, "B", ICON_COLOR, "B", ""}, + {HISTO_MODE_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""}, + {HISTO_MODE_R, "R", ICON_COLOR, "Red", ""}, + {HISTO_MODE_G, "G", ICON_COLOR, "Green", ""}, + {HISTO_MODE_B, "B", ICON_COLOR, "Blue", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Histogram", NULL); @@ -475,7 +475,7 @@ static void rna_def_scopes(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_wavefrm_mode_items[] = { - {SCOPES_WAVEFRM_LUM, "LUMINANCE", ICON_COLOR, "Luminance", ""}, + {SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""}, {SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""}, {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""}, {SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""}, |