opengl dot() fix, add file dates, sort file name/time, fix icon image lookup, sync...
authorGood Guy <good1.2guy@gmail.com>
Fri, 8 Dec 2017 02:09:01 +0000 (19:09 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 8 Dec 2017 02:09:01 +0000 (19:09 -0700)
45 files changed:
cinelerra-5.1/cinelerra/assetpopup.C
cinelerra-5.1/cinelerra/assetpopup.h
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/clippopup.C
cinelerra-5.1/cinelerra/playback3d.h
cinelerra-5.1/cinelerra/vattachmentpoint.C
cinelerra-5.1/guicast/bccolors.C
cinelerra-5.1/guicast/bccolors.h
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/guicast/bctheme.C
cinelerra-5.1/guicast/filesystem.C
cinelerra-5.1/guicast/filesystem.h
cinelerra-5.1/plugins/chromakey/chromakey.C
cinelerra-5.1/plugins/diffkey/diffkey.C
cinelerra-5.1/plugins/theme_blond/blondtheme.C
cinelerra-5.1/plugins/theme_blond/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blond_cv/blondcvtheme.C
cinelerra-5.1/plugins/theme_blond_cv/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue/bluetheme.C
cinelerra-5.1/plugins/theme_blue/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/bluedottheme.C
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checked.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checkedhi.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_dn.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_hi.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_up.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_img.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_rgb.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/picture.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/scope.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/waveform.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_blue_dot/data/waveform_rgb.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_bright/brighttheme.C
cinelerra-5.1/plugins/theme_bright/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_hulk/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_hulk/hulktheme.C
cinelerra-5.1/plugins/theme_pinklady/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_pinklady/pinkladytheme.C
cinelerra-5.1/plugins/theme_suv/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_suv/suv.C
cinelerra-5.1/plugins/theme_unflat/data/histogram_toggle.png [new file with mode: 0644]
cinelerra-5.1/plugins/theme_unflat/unflattheme.C
cinelerra-5.1/plugins/threshold/threshold.C

index 47cc7f2ada894d6fc01dc66307d3c29b7d631fdf..677b8bab4093b833315fa59ef78f272b19695786 100644 (file)
@@ -64,7 +64,10 @@ void AssetPopup::create_objects()
        BC_SubMenu *submenu;
        add_item(info = new AssetPopupInfo(mwindow, this));
        add_item(format = new AWindowListFormat(mwindow, gui));
-       add_item(new AssetPopupSort(mwindow, this));
+       add_item(menu_item = new BC_MenuItem(_("Sort...")));
+       menu_item->add_submenu(submenu = new BC_SubMenu());
+       submenu->add_submenuitem(new AssetPopupSortNames(mwindow, this));
+       submenu->add_submenuitem(new AssetPopupSortTimes(mwindow, this));
        add_item(index = new AssetPopupBuildIndex(mwindow, this));
        add_item(view = new AssetPopupView(mwindow, this));
        add_item(view_window = new AssetPopupViewWindow(mwindow, this));
@@ -180,20 +183,37 @@ int AssetPopupBuildIndex::handle_event()
 }
 
 
-AssetPopupSort::AssetPopupSort(MWindow *mwindow, AssetPopup *popup)
- : BC_MenuItem(_("Sort items"))
+AssetPopupSortNames::AssetPopupSortNames(MWindow *mwindow, AssetPopup *popup)
+ : BC_MenuItem(_("Sort names"))
+{
+       this->mwindow = mwindow;
+       this->popup = popup;
+}
+
+AssetPopupSortNames::~AssetPopupSortNames()
+{
+}
+
+int AssetPopupSortNames::handle_event()
+{
+       mwindow->awindow->gui->sort_assets(0);
+       return 1;
+}
+
+AssetPopupSortTimes::AssetPopupSortTimes(MWindow *mwindow, AssetPopup *popup)
+ : BC_MenuItem(_("Sort times"))
 {
        this->mwindow = mwindow;
        this->popup = popup;
 }
 
-AssetPopupSort::~AssetPopupSort()
+AssetPopupSortTimes::~AssetPopupSortTimes()
 {
 }
 
-int AssetPopupSort::handle_event()
+int AssetPopupSortTimes::handle_event()
 {
-       mwindow->awindow->gui->sort_assets();
+       mwindow->awindow->gui->sort_assets(1);
        return 1;
 }
 
index ee1a3d1f719ec78c98027fb1fdbafc8a644d996c..b9191a77c765b09f629a2d6b51f2c9c19a6eb8a1 100644 (file)
@@ -71,11 +71,23 @@ public:
        AssetPopup *popup;
 };
 
-class AssetPopupSort : public BC_MenuItem
+class AssetPopupSortNames : public BC_MenuItem
 {
 public:
-       AssetPopupSort(MWindow *mwindow, AssetPopup *popup);
-       ~AssetPopupSort();
+       AssetPopupSortNames(MWindow *mwindow, AssetPopup *popup);
+       ~AssetPopupSortNames();
+
+       int handle_event();
+
+       MWindow *mwindow;
+       AssetPopup *popup;
+};
+
+class AssetPopupSortTimes : public BC_MenuItem
+{
+public:
+       AssetPopupSortTimes(MWindow *mwindow, AssetPopup *popup);
+       ~AssetPopupSortTimes();
 
        int handle_event();
 
index d2777c93a74edb902295233ccc6e12da7735ba86..7195d4e78b2bcb1d35ba3497634bedc1070fd2af 100644 (file)
@@ -222,6 +222,7 @@ void AssetPicon::reset()
        icon_vframe = 0;
        vicon = 0;
        in_use = 1;
+       mtime = 0;
        id = 0;
        persistent = 0;
 }
@@ -311,7 +312,8 @@ void AssetPicon::create_objects()
                        icon = gui->audio_icon;
                        icon_vframe = gui->audio_vframe;
                }
-
+               struct stat st;
+               mtime = !stat(asset->path, &st) ? st.st_mtime : 0;
        }
        else
        if( indexable && !indexable->is_asset ) {
@@ -1135,7 +1137,7 @@ void AWindowGUI::update_picon(Indexable *indexable)
        }
 }
 
-void AWindowGUI::sort_assets()
+void AWindowGUI::sort_assets(int use_mtime)
 {
        switch( mwindow->edl->session->awindow_folder ) {
        case AW_AEFFECT_FOLDER:
@@ -1154,7 +1156,7 @@ void AWindowGUI::sort_assets()
                sort_picons(&labellist);
                break;
        default:
-               sort_picons(&assets);
+               sort_picons(&assets, use_mtime);
        }
 // reset xyposition
        asset_list->update_format(asset_list->get_format(), 0);
@@ -1207,6 +1209,14 @@ void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
                        else
                        if( picon->label && picon->label->textstr )
                                dst[1].append(item2 = new BC_ListBoxItem(picon->label->textstr));
+                       else if( picon->mtime ) {
+                               char date_time[BCSTRLEN];
+                               struct tm stm;  localtime_r(&picon->mtime, &stm);
+                               sprintf(date_time,"%04d.%02d.%02d %02d:%02d:%02d",
+                                        stm.tm_year+1900, stm.tm_mon+1, stm.tm_mday,
+                                        stm.tm_hour, stm.tm_min, stm.tm_sec);
+                               dst[1].append(item2 = new BC_ListBoxItem(date_time));
+                       }
                        else
                                dst[1].append(item2 = new BC_ListBoxItem(""));
                        item1->set_autoplace_text(1);  item1->set_autoplace_icon(1);
@@ -1215,26 +1225,29 @@ void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
        }
 }
 
-void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src)
+void AWindowGUI::sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime)
 {
-       int done = 0;
-       while(!done)
-       {
+       int done = 0, changed = 0;
+       while( !done ) {
                done = 1;
-               for( int i = 0; i < src->total - 1; i++ ) {
-                       BC_ListBoxItem *item1 = src->values[i];
-                       BC_ListBoxItem *item2 = src->values[i + 1];
-                       item1->set_autoplace_icon(1);
-                       item2->set_autoplace_icon(1);
-                       item1->set_autoplace_text(1);
-                       item2->set_autoplace_text(1);
-                       if( strcmp(item1->get_text(), item2->get_text()) > 0 ) {
+               for( int i=0; i<src->total-1; ++i ) {
+                       AssetPicon *item1 = (AssetPicon *)src->values[i];
+                       AssetPicon *item2 = (AssetPicon *)src->values[i + 1];
+                       if( use_mtime ? item1->mtime > item2->mtime :
+                           strcmp(item1->get_text(), item2->get_text()) > 0 ) {
                                src->values[i + 1] = item1;
                                src->values[i] = item2;
-                               done = 0;
+                               done = 0;  changed = 1;
                        }
                }
        }
+       if( changed ) {
+               for( int i=0; i<src->total; ++i ) {
+                       AssetPicon *item = (AssetPicon *)src->values[i];
+                       item->set_autoplace_icon(1);
+                       item->set_autoplace_text(1);
+               }
+       }
 }
 
 
@@ -2122,7 +2135,7 @@ AWindowListSort::AWindowListSort(MWindow *mwindow, AWindowGUI *gui)
 
 int AWindowListSort::handle_event()
 {
-       gui->sort_assets();
+       gui->sort_assets(0);
        return 1;
 }
 
index 2e9228694b73fb2d62aa538e6e0f70ce74d1e7c4..3068ac99f00eb79164541d55807074fca08740d5 100644 (file)
@@ -71,7 +71,7 @@ public:
        EDL *edl;
 
        int in_use;
-
+       time_t mtime;
 
        int persistent;
        PluginServer *plugin;
@@ -138,7 +138,7 @@ public:
        int keypress_event();
        void async_update_assets();     // Sends update asset event
        void update_effects();
-       void sort_assets();
+       void sort_assets(int use_mtime);
        void sort_folders();
        void reposition_objects();
        static int folder_number(const char *name);
@@ -155,7 +155,7 @@ public:
        void create_label_folder();
        void copy_picons(ArrayList<BC_ListBoxItem*> *dst,
                ArrayList<BC_ListBoxItem*> *src, int folder);
-       void sort_picons(ArrayList<BC_ListBoxItem*> *src);
+       void sort_picons(ArrayList<BC_ListBoxItem*> *src, int use_mtime=0);
 // Return the selected asset in asset_list
        Indexable* selected_asset();
        PluginServer* selected_plugin();
index 0eeee34e2e9856fadaecf92c29289d9245252ea2..f6ca8231e148626888397746caa3317cd7192195 100644 (file)
@@ -167,7 +167,7 @@ ClipPopupSort::~ClipPopupSort()
 
 int ClipPopupSort::handle_event()
 {
-       mwindow->awindow->gui->sort_assets();
+       mwindow->awindow->gui->sort_assets(0);
        return 1;
 }
 
index 314f392a30c19ab976b6726f2d5c3d597364a11b..452b367c2facaa0aa127dcc8fffe8e6f2b367cbd 100644 (file)
 // use static presets YUV in bccolors.h
 #define BC_GL_MATRIX(shader, mat) \
        glUniformMatrix3fv(glGetUniformLocation(shader, #mat), 1, 0, YUV::mat)
+#define BC_GL_VECTOR(shader, vec) \
+       glUniform3fv(glGetUniformLocation(shader, #vec), 1, YUV::vec)
 
-#define BC_GL_YMINF(shader,mat) \
-       glUniform1f(glGetUniformLocation(shader, "yminf"), YUV::mat[9])
+#define BC_GL_YMINF(shader) \
+       glUniform1f(glGetUniformLocation(shader, "yminf"), YUV::yuv.get_yminf())
 
 #define BC_GL_RGB_TO_YUV(shader) do { \
        BC_GL_MATRIX(shader, rgb_to_yuv_matrix); \
-       BC_GL_YMINF(shader, rgb_to_yuv_matrix); \
+       BC_GL_YMINF(shader); \
+} while(0)
+
+#define BC_GL_RGB_TO_Y(shader) do { \
+       BC_GL_VECTOR(shader, rgb_to_y_vector); \
+       BC_GL_YMINF(shader); \
 } while(0)
 
 #define BC_GL_YUV_TO_RGB(shader) do { \
        BC_GL_MATRIX(shader, yuv_to_rgb_matrix); \
-       BC_GL_YMINF(shader, yuv_to_rgb_matrix); \
+       BC_GL_YMINF(shader); \
 } while(0)
 
 #define BC_GL_COLORS(shader) do { \
        BC_GL_MATRIX(shader, yuv_to_rgb_matrix); \
        BC_GL_MATRIX(shader, rgb_to_yuv_matrix); \
-       BC_GL_YMINF(shader, rgb_to_yuv_matrix); \
+       BC_GL_YMINF(shader); \
 } while(0)
 
 
 #define bc_gl_yuv_to_rgb "uniform mat3 yuv_to_rgb_matrix;\n"
 #define bc_gl_rgb_to_yuv "uniform mat3 rgb_to_yuv_matrix;\n"
+#define bc_gl_rgb_to_y   "uniform vec3 rgb_to_y_vector;\n"
 #define bc_gl_yminf      "uniform float yminf;\n"
 #define bc_gl_colors bc_gl_yuv_to_rgb bc_gl_rgb_to_yuv bc_gl_yminf
 
index 9ee8fe35b814b4873dc1dee5368b210d9a26b753..c9b491bbe26639fad389bc5a5e9edf13f078b9e1 100644 (file)
@@ -126,11 +126,13 @@ void VAttachmentPoint::render(VFrame *output,
                }
 //printf("VAttachmentPoint::render 3\n");
 // Need to copy PBuffer if OpenGL, regardless of use_opengl
-               if( buffer_vector[buffer_number]->get_opengl_state() == VFrame::RAM ) {
+               int opengl_state = buffer_vector[buffer_number]->get_opengl_state();
+               if( opengl_state == VFrame::RAM ) {
                        output->copy_from(buffer_vector[buffer_number]);
                        output->set_opengl_state(VFrame::RAM);
                }
-               else if(renderengine && renderengine->video) {
+               else if( opengl_state != VFrame::UNKNOWN &&
+                        renderengine && renderengine->video) {
 // Need to copy PBuffer to texture
 // printf("VAttachmentPoint::render temp=%p output=%p\n",
 // buffer_vector[buffer_number],
index 78aaf64f05852adaf999efb5929b90a5844c1f1a..5d181696488497b91c093c29a28f74ffab806dd4 100644 (file)
@@ -126,8 +126,9 @@ int HSV::hsv_to_yuv(int &y, int &u, int &v, float h, float s, float va, int max)
 
 
 YUV YUV::yuv;
-float YUV::rgb_to_yuv_matrix[10];
-float YUV::yuv_to_rgb_matrix[10];
+float YUV::yuv_to_rgb_matrix[9];
+float YUV::rgb_to_yuv_matrix[9];
+float YUV::rgb_to_y_vector[3];
 
 YUV::YUV()
 {
@@ -232,7 +233,10 @@ void YUV::init(double Kr, double Kb, int mpeg)
        rgb_to_yuv_matrix[6] = b_to_y;
        rgb_to_yuv_matrix[7] = b_to_u;
        rgb_to_yuv_matrix[8] = b_to_v;
-       rgb_to_yuv_matrix[9] = yminf;
+
+       rgb_to_y_vector[0] = r_to_y;
+       rgb_to_y_vector[1] = g_to_y;
+       rgb_to_y_vector[2] = b_to_y;
 
        float yscale = 1.f / yrangef;
        yuv_to_rgb_matrix[0] = yscale;
@@ -244,7 +248,6 @@ void YUV::init(double Kr, double Kb, int mpeg)
        yuv_to_rgb_matrix[6] = v_to_r;
        yuv_to_rgb_matrix[7] = v_to_g;
        yuv_to_rgb_matrix[8] = 0;
-       yuv_to_rgb_matrix[9] = yminf;
 }
 
 void YUV::init_tables(int len,
index 720735cede3e24c2f0f6ee4e8998a7a0a1788e53..8687735268ff21b8c0ac7eeb0a665daa94477b02 100644 (file)
@@ -186,8 +186,10 @@ public:
        inline int is_mpeg() { return mpeg; }
 
        static YUV yuv;
-       static float rgb_to_yuv_matrix[10];
-       static float yuv_to_rgb_matrix[10];
+       static float yuv_to_rgb_matrix[9];
+       static float rgb_to_yuv_matrix[9];
+       static float rgb_to_y_vector[3];
+       inline float get_yminf() { return yminf; }
 
 #define YUV_rgb_to_yuv_8(r,g,b, y,u,v) \
        y = iclip((rtoy8[r] + gtoy8[g] + btoy8[b] +  yzero) >> 16,  ymin8,  ymax8); \
index 7ca7e4ab8962428b933dbcee3b05ba9f84d3f9c2..6c1ceb314b61d0a65aa3087919ae0c1ba826c544 100644 (file)
@@ -835,15 +835,11 @@ int BC_FileBox::create_tables()
 // Date entry
                if(!is_dir || 1)
                {
-                       static const char *month_text[13] = { "Nul",
-                               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-                       };
-                       sprintf(string,
-                               "%s %d, %d",
-                               month_text[file_item->month],
-                               file_item->day,
-                               file_item->year);
+                       struct tm mod_time;
+                       localtime_r(&file_item->mtime, &mod_time);
+                       sprintf(string, "%04d.%02d.%02d  %02d:%02d:%02d",
+                               mod_time.tm_year+1900, mod_time.tm_mon+1, mod_time.tm_mday,
+                               mod_time.tm_hour, mod_time.tm_min, mod_time.tm_sec);
                        new_item = new BC_ListBoxItem(string, get_resources()->file_color);
                }
                else
index b79988c0eaad6f62ed92f0d6f818a9040796a9d2..c587ed250037b185cdc47fe0040f1dc8bbc52dbe 100644 (file)
@@ -471,7 +471,7 @@ int BC_Theme::images_cmpr(const void *ap, const void *bp)
 unsigned char* BC_Theme::get_image_data(const char *name, int log_errs)
 {
 // Image is the same as the last one
-       if( last_image_data && !strcasecmp(last_image_data->name, name) )
+       if( last_image_data && !strcmp(last_image_data->name, name) )
                return last_image_data->data;
 
 // look forwards thru data sets for name
@@ -484,7 +484,7 @@ unsigned char* BC_Theme::get_image_data(const char *name, int log_errs)
                while( r-l > 1 ) {
                        m = (l + r) / 2;
                        BC_ImageData *image_data = images[m];
-                       if( !(v=strcasecmp(name, image_data->name)) ) {
+                       if( !(v=strcmp(name, image_data->name)) ) {
                                image_data->used = 1;
                                last_image_data = image_data;
                                return image_data->data;
index c58296964a91e8102962f2b9d87773173da3e147..1d0aee887127385affb67d6f34dec726389437cd 100644 (file)
@@ -44,8 +44,7 @@ FileItem::FileItem()
 }
 
 FileItem::FileItem(char *path, char *name, int is_dir,
-       int64_t size, int month, int day, int year,
-       int64_t calendar_time, int item_no)
+       int64_t size, time_t mtime, int item_no)
 {
        this->path = new char[strlen(path)];
        this->name = new char[strlen(name)];
@@ -53,10 +52,7 @@ FileItem::FileItem(char *path, char *name, int is_dir,
        if(this->name) strcpy(this->name, name);
        this->is_dir = is_dir;
        this->size = size;
-       this->month = month;
-       this->day = day;
-       this->year = year;
-       this->calendar_time = calendar_time;
+       this->mtime = mtime;
        this->item_no = item_no;
 }
 
@@ -73,10 +69,7 @@ int FileItem::reset()
        name = 0;
        is_dir = 0;
        size = 0;
-       month = 0;
-       day = 0;
-       year = 0;
-       calendar_time = 0;
+       mtime = 0;
        item_no = -1;
        return 0;
 }
@@ -206,18 +199,18 @@ int FileSystem::date_ascending(const void *ptr1, const void *ptr2)
 {
        FileItem *item1 = *(FileItem**)ptr1;
        FileItem *item2 = *(FileItem**)ptr2;
-       return item1->calendar_time == item2->calendar_time ?
+       return item1->mtime == item2->mtime ?
                item1->item_no - item2->item_no :
-               item1->calendar_time > item2->calendar_time;
+               item1->mtime > item2->mtime;
 }
 
 int FileSystem::date_descending(const void *ptr1, const void *ptr2)
 {
        FileItem *item1 = *(FileItem**)ptr1;
        FileItem *item2 = *(FileItem**)ptr2;
-       return item2->calendar_time == item1->calendar_time ?
+       return item2->mtime == item1->mtime ?
                item2->item_no - item1->item_no :
-               item2->calendar_time > item1->calendar_time;
+               item2->mtime > item1->mtime;
 }
 
 int FileSystem::ext_ascending(const void *ptr1, const void *ptr2)
@@ -449,11 +442,7 @@ int FileSystem::scan_directory(const char *new_dir)
                        if(!stat(full_path, &ostat))
                        {
                                new_file->size = ostat.st_size;
-                               struct tm *mod_time = localtime(&(ostat.st_mtime));
-                               new_file->month = mod_time->tm_mon + 1;
-                               new_file->day = mod_time->tm_mday;
-                               new_file->year = mod_time->tm_year + 1900;
-                               new_file->calendar_time = ostat.st_mtime;
+                               new_file->mtime = ostat.st_mtime;
 
                                if(S_ISDIR(ostat.st_mode))
                                {
index 7226c11ea91c8fe547619a91843f89a0ee3484a7..75110c6af9d48341091f7863f5e494897b4691b8 100644 (file)
@@ -31,8 +31,7 @@ class FileItem
 public:
        FileItem();
        FileItem(char *path, char *name, int is_dir,
-               int64_t size, int month, int day, int year,
-               int64_t calendar_time, int item_no=-1);
+               int64_t size, time_t mtime, int item_no=-1);
        ~FileItem();
 
        int set_path(char *path);
@@ -47,10 +46,7 @@ public:
        char *name;
        int is_dir;
        int64_t size;
-       int month;
-       int day;
-       int year;
-       int64_t calendar_time;
+       time_t mtime;
        int item_no;
 };
 
index 7314037196d2506ba36e088f7c4a8a4eabfda175..fe52fec66e0601302ada2b326646100ddab20857 100644 (file)
@@ -687,11 +687,11 @@ int ChromaKey::handle_opengl()
                "}\n";
 
        static const char *get_rgbvalue_frag =
-               "uniform mat3 rgb_to_yuv_matrix;\n"
+               "uniform vec3 rgb_to_y_vector;\n"
                "uniform float yminf;\n"
                "float get_value(vec4 color)\n"
                "{\n"
-               "       return dot(color.rgb, rgb_to_yuv_matrix[0]) + yminf;\n"
+               "       return dot(color.rgb, rgb_to_y_vector) + yminf;\n"
                "}\n";
 
        static const char *value_frag =
@@ -784,7 +784,7 @@ SET_TRACE
                        glUniform3f(glGetUniformLocation(shader, "key"),
                                (float)y_key / 0xff, (float)u_key / 0xff, (float)v_key / 0xff);
                if(config.use_value)
-                       BC_GL_RGB_TO_YUV(shader);
+                       BC_GL_RGB_TO_Y(shader);
        }
 SET_TRACE
 
index 9ce891ea5f4cfd0944282ae03349a2d62a894b20..2f24a58783bd6ea2190f3eee7bef17cc5a346b2e 100644 (file)
@@ -452,8 +452,8 @@ int DiffKey::handle_opengl()
 
        static const char *rgb_value =
                "       float difference = abs("
-               "               dot(foreground.rgb, rgb_to_yuv_matrix[0]) - "
-               "               dot(background.rgb, rgb_to_yuv_matrix[0]));\n";
+               "               dot(foreground.rgb, rgb_to_y_vector) - "
+               "               dot(background.rgb, rgb_to_y_vector));\n";
 
        static const char *diffkey_tail =
                "       vec4 result;\n"
@@ -468,22 +468,28 @@ int DiffKey::handle_opengl()
                "       gl_FragColor = result;\n"
                "}\n";
 
-       top_frame->enable_opengl();
-       top_frame->init_screen();
-
        top_frame->to_texture();
        bottom_frame->to_texture();
 
        top_frame->enable_opengl();
        top_frame->init_screen();
 
-       int need_color_matrix = 0;
+       const char *shader_stack[16];
+       memset(shader_stack,0, sizeof(shader_stack));
+       int current_shader = 0;
+
+       int need_rgb_to_y = 0;
        const char *shader_frag = !config.do_value ? colorcube :
                BC_CModels::is_yuv(top_frame->get_color_model()) ?
-                       yuv_value : (need_color_matrix = 1, rgb_value);
-
-       unsigned int shader = VFrame::make_shader(0,
-                               diffkey_head, shader_frag, diffkey_tail, 0);
+                       yuv_value : (need_rgb_to_y = 1, rgb_value);
+       if( need_rgb_to_y )
+               shader_stack[current_shader++] = bc_gl_rgb_to_y;
+       shader_stack[current_shader++] = diffkey_head;
+       shader_stack[current_shader++] = shader_frag;
+       shader_stack[current_shader++] = diffkey_tail;
+
+       shader_stack[current_shader] = 0;
+       unsigned int shader = VFrame::make_shader(shader_stack);
        DIFFKEY_VARS(this)
 
        bottom_frame->bind_texture(1);
@@ -496,8 +502,8 @@ int DiffKey::handle_opengl()
                glUniform1f(glGetUniformLocation(shader, "threshold"), threshold);
                glUniform1f(glGetUniformLocation(shader, "pad"), pad);
                glUniform1f(glGetUniformLocation(shader, "threshold_pad"), threshold_pad);
-               if( need_color_matrix )
-                       BC_GL_MATRIX(shader, rgb_to_yuv_matrix);
+               if( need_rgb_to_y )
+                       BC_GL_MATRIX(shader, rgb_to_y_vector);
        }
 
        if(BC_CModels::components(get_output()->get_color_model()) == 3)
@@ -511,10 +517,8 @@ int DiffKey::handle_opengl()
        glUseProgram(0);
        top_frame->set_opengl_state(VFrame::SCREEN);
        glDisable(GL_BLEND);
-
-// does not work, fails in playback3d
 // Fastest way to discard output
-//     bottom_frame->set_opengl_state(VFrame::TEXTURE);
+       bottom_frame->set_opengl_state(VFrame::UNKNOWN);
 
 // kludge ahead
        top_frame->screen_to_ram();
index 31d29f891fd201c654d866d0f51edaff076fefc9..de0343ba9bee87e506819c3d90d2ed6e01c3a3d5 100644 (file)
@@ -661,7 +661,7 @@ void BlondTheme::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
diff --git a/cinelerra-5.1/plugins/theme_blond/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_blond/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blond/data/histogram_toggle.png differ
index 52951ba5566c3c5ec4f22b1ad59a1a33ac68478a..6c7a073263f32a1f713940fc220084959cb720c1 100644 (file)
@@ -672,6 +672,44 @@ void BlondCVTheme::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
+       new_toggle("histogram_toggle.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "histogram_toggle");
+       new_toggle("histogram_rgb.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "histogram_rgb_toggle");
+       new_toggle("waveform.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "waveform_toggle");
+       new_toggle("waveform_rgb.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "waveform_rgb_toggle");
+       new_toggle("scope.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "scope_toggle");
+
+       new_button("picture.png", editpanel_up, editpanel_hi, editpanel_dn, "picture");
+       new_button("histogram_img.png", editpanel_up, editpanel_hi, editpanel_dn, "histogram_img");
 
        //bottom_justify = new_button("bottom_justify.png", editpanel_up, editpanel_hi, editpanel_dn);
        //center_justify = new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn);
diff --git a/cinelerra-5.1/plugins/theme_blond_cv/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_blond_cv/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blond_cv/data/histogram_toggle.png differ
index 33a3fb87e385a98744d6ab4ca5bb13bc85035a29..c66ff351ea081e77390834fe236bf3cb432efd37 100644 (file)
@@ -661,7 +661,7 @@ void BlueDotTheme::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
@@ -700,7 +700,6 @@ void BlueDotTheme::initialize()
        new_button("picture.png", editpanel_up, editpanel_hi, editpanel_dn, "picture");
        new_button("histogram_img.png", editpanel_up, editpanel_hi, editpanel_dn, "histogram_img");
 
-
        new_button("copy.png", editpanel_up, editpanel_hi, editpanel_dn, "copy");
        new_button("commercial.png", editpanel_up, editpanel_hi, editpanel_dn, "commercial");
        new_button("cut.png", editpanel_up, editpanel_hi, editpanel_dn, "cut");
diff --git a/cinelerra-5.1/plugins/theme_blue/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_blue/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue/data/histogram_toggle.png differ
index 260afb7e2a576c8f07fa7cb6f6636f0f548b0a96..b2cb0e7bd5ecbcc5b89cde9274876052b29d0014 100644 (file)
@@ -698,6 +698,44 @@ void BlueDotTheme::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
+       new_toggle("histogram_toggle.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "histogram_toggle");
+       new_toggle("histogram_rgb.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "histogram_rgb_toggle");
+       new_toggle("waveform.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "waveform_toggle");
+       new_toggle("waveform_rgb.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "waveform_rgb_toggle");
+       new_toggle("scope.png",
+               editpanel_up,
+               editpanel_hi,
+               editpanel_checked,
+               editpanel_dn,
+               editpanel_checkedhi,
+               "scope_toggle");
+
+       new_button("picture.png", editpanel_up, editpanel_hi, editpanel_dn, "picture");
+       new_button("histogram_img.png", editpanel_up, editpanel_hi, editpanel_dn, "histogram_img");
 
        new_button("copy.png", editpanel_up, editpanel_hi, editpanel_dn, "copy");
        new_button("commercial.png", editpanel_up, editpanel_hi, editpanel_dn, "commercial");
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checked.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checked.png
new file mode 100644 (file)
index 0000000..8e5840a
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checked.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checkedhi.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checkedhi.png
new file mode 100644 (file)
index 0000000..1fcfff6
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_checkedhi.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_dn.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_dn.png
new file mode 100644 (file)
index 0000000..0fb61fb
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_dn.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_hi.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_hi.png
new file mode 100644 (file)
index 0000000..81d7899
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_hi.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_up.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_up.png
new file mode 100644 (file)
index 0000000..cfd43b2
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_carrot_up.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_img.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_img.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_img.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_rgb.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_rgb.png
new file mode 100644 (file)
index 0000000..a68050a
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_rgb.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/histogram_toggle.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/picture.png b/cinelerra-5.1/plugins/theme_blue_dot/data/picture.png
new file mode 100644 (file)
index 0000000..c634d40
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/picture.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/scope.png b/cinelerra-5.1/plugins/theme_blue_dot/data/scope.png
new file mode 100644 (file)
index 0000000..bef250d
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/scope.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/waveform.png b/cinelerra-5.1/plugins/theme_blue_dot/data/waveform.png
new file mode 100644 (file)
index 0000000..fb81e31
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/waveform.png differ
diff --git a/cinelerra-5.1/plugins/theme_blue_dot/data/waveform_rgb.png b/cinelerra-5.1/plugins/theme_blue_dot/data/waveform_rgb.png
new file mode 100644 (file)
index 0000000..c529ce1
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_blue_dot/data/waveform_rgb.png differ
index 1bfb1666d57b18e3759619b520b927d78ed3b3d3..9e02df4acc45efde8695112de35f505a416b9d4d 100644 (file)
@@ -667,7 +667,7 @@ void BrightTheme::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
diff --git a/cinelerra-5.1/plugins/theme_bright/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_bright/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..c07d97d
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_bright/data/histogram_toggle.png differ
diff --git a/cinelerra-5.1/plugins/theme_hulk/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_hulk/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_hulk/data/histogram_toggle.png differ
index 518a2cccf272fd6aae7959593ef693adb0ddaae4..f05a9829a5adc5e2160dbfa675353dd65c263dca 100644 (file)
@@ -662,7 +662,7 @@ void HULKTHEME::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
diff --git a/cinelerra-5.1/plugins/theme_pinklady/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_pinklady/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_pinklady/data/histogram_toggle.png differ
index 321ec319b6fd154a8e24e8bb73ec616cfd470b37..094796ad69fc50c0c16632ad4025b6af80bb0b29 100644 (file)
@@ -647,7 +647,7 @@ void PINKLADY::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
diff --git a/cinelerra-5.1/plugins/theme_suv/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_suv/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_suv/data/histogram_toggle.png differ
index e294c888277bf0d037d59fba22542b6b4bed083f..5f66b1546bff001173de08e1599a83f43c5f6736 100644 (file)
@@ -649,7 +649,7 @@ void SUV::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
diff --git a/cinelerra-5.1/plugins/theme_unflat/data/histogram_toggle.png b/cinelerra-5.1/plugins/theme_unflat/data/histogram_toggle.png
new file mode 100644 (file)
index 0000000..0f7da6e
Binary files /dev/null and b/cinelerra-5.1/plugins/theme_unflat/data/histogram_toggle.png differ
index 26859167cae28a689b2b3f5c714a2dedc3faa059..3273ed8995fb860c56f55a5c927b35a89e75cdf5 100644 (file)
@@ -656,7 +656,7 @@ void UNFLATTHEME::initialize()
        new_button("center_justify.png", editpanel_up, editpanel_hi, editpanel_dn, "center_justify");
        new_button("channel.png", editpanel_up, editpanel_hi, editpanel_dn, "channel");
 
-       new_toggle("histogram.png",
+       new_toggle("histogram_toggle.png",
                editpanel_up,
                editpanel_hi,
                editpanel_checked,
index 09a3680b58a9b501c73458455e55f9da1888f7ad..13231b6e653c9719b82936a88ba596129fbcd6bd 100644 (file)
@@ -259,12 +259,12 @@ int ThresholdMain::handle_opengl()
                "uniform vec4 low_color;\n"
                "uniform vec4 mid_color;\n"
                "uniform vec4 high_color;\n"
-               "uniform mat3 rgb_to_yuv_matrix;\n"
+               "uniform vec3 rgb_to_y_vector;\n"
                "uniform float yminf;\n"
                "void main()\n"
                "{\n"
                "       vec4 pixel = texture2D(tex, gl_TexCoord[0].st);\n"
-               "       float v = dot(pixel.rgb, rgb_to_yuv_matrix[0]) + yminf;\n"
+               "       float v = dot(pixel.rgb, rgb_to_y_vector) + yminf;\n"
                "       if(v < min)\n"
                "               pixel = low_color;\n"
                "       else if(v < max)\n"
@@ -356,7 +356,7 @@ int ThresholdMain::handle_opengl()
                                        (float)config.high_color.g / 0xff,
                                        (float)config.high_color.b / 0xff,
                                        has_alpha ? (float)config.high_color.a / 0xff : 1.0);
-                       BC_GL_RGB_TO_YUV(shader);
+                       BC_GL_RGB_TO_Y(shader);
                }
        }