forked from bartvdbraak/blender
Fix for histogram Luma mode not working when waveform is in RGB mode.
Also unified the scope vocabulary.
This commit is contained in:
parent
413c4c91ca
commit
bd4fe1b71d
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)", ""},
|
||||
|
Loading…
Reference in New Issue
Block a user