more ffmpeg cmodel changes, listbox fix
authorGood Guy <[email protected]>
Wed, 4 Jan 2017 00:01:13 +0000 (17:01 -0700)
committerGood Guy <[email protected]>
Wed, 4 Jan 2017 00:01:13 +0000 (17:01 -0700)
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/vrender.C
cinelerra-5.1/guicast/bclistbox.C

index 474d7c135da3f26cb3dbef4f8eee8c18803e7921..3ba2224468d290324c8f48da196a71ab97808efc 100644 (file)
@@ -948,9 +948,11 @@ int FFVideoConvert::convert_cmodel(VFrame *frame, AVFrame *ip)
                if( bits > max_bits ) max_bits = bits;
        }
        int imodel = pix_fmt_to_color_model(ifmt);
-       if( imodel < 0 )  {
-               int cmodel = frame->get_color_model();
-               BC_CModels::is_yuv(cmodel) ?
+       int imodel_is_yuv = BC_CModels::is_yuv(imodel);
+       int cmodel = frame->get_color_model();
+       int cmodel_is_yuv = BC_CModels::is_yuv(cmodel);
+       if( imodel < 0 || imodel_is_yuv != cmodel_is_yuv ) {
+               imodel = cmodel_is_yuv ?
                    (BC_CModels::has_alpha(cmodel) ?
                        BC_AYUV16161616 :
                        (max_bits > 8 ? BC_AYUV16161616 : BC_YUV444P)) :
@@ -1039,19 +1041,20 @@ int FFVideoConvert::convert_pixfmt(VFrame *frame, AVFrame *op)
        if( !convert_vframe_picture(frame, op) ) return 1;
        // use indirect transfer
        int cmodel = frame->get_color_model();
-       int bits = BC_CModels::calculate_pixelsize(cmodel) * 8;
-       bits /= BC_CModels::components(cmodel);
+       int max_bits = BC_CModels::calculate_pixelsize(cmodel) * 8;
+       max_bits /= BC_CModels::components(cmodel);
        AVPixelFormat ofmt = (AVPixelFormat)op->format;
        int imodel = pix_fmt_to_color_model(ofmt);
-       if( imodel < 0 ) {
-               imodel =
-                   BC_CModels::is_yuv(cmodel) ?
-                       (BC_CModels::has_alpha(cmodel) ?
+       int imodel_is_yuv = BC_CModels::is_yuv(imodel);
+       int cmodel_is_yuv = BC_CModels::is_yuv(cmodel);
+       if( imodel < 0 || imodel_is_yuv != cmodel_is_yuv ) {
+               imodel = cmodel_is_yuv ?
+                   (BC_CModels::has_alpha(cmodel) ?
                        BC_AYUV16161616 :
-                       (bits > 8 ? BC_AYUV16161616 : BC_YUV444P)) :
+                       (max_bits > 8 ? BC_AYUV16161616 : BC_YUV444P)) :
                    (BC_CModels::has_alpha(cmodel) ?
-                       (bits > 8 ? BC_RGBA16161616 : BC_RGBA8888) :
-                       (bits > 8 ? BC_RGB161616 : BC_RGB888)) ;
+                       (max_bits > 8 ? BC_RGBA16161616 : BC_RGBA8888) :
+                       (max_bits > 8 ? BC_RGB161616 : BC_RGB888)) ;
        }
        VFrame vframe(frame->get_w(), frame->get_h(), imodel);
        vframe.transfer_from(frame);
index 0b424c6440d7714310a4af3bf3686644adce8b61..ae3503cdad4515016275eb3def3aaaca58ea84d8 100644 (file)
@@ -345,8 +345,8 @@ int VRender::get_colormodel(VEdit *playable_edit,
                                current_position,
                                renderengine->command->get_direction());
                }
-
-               if(asset)
+// ffmpeg files are side effected by color_model, affects colorspace,color_range
+               if( asset && asset->format != FILE_FFMPEG )
                {
                        file = renderengine->get_vcache()->check_out(asset,
                                renderengine->get_edl());
index 1b5c66fdb077c5dc1826bdf6827c711cda96fe6e..76f8fde1eee13f042d592db2f3f2793977d4bda1 100644 (file)
@@ -1130,8 +1130,8 @@ int BC_ListBox::get_items_height(ArrayList<BC_ListBoxItem*> *data,
                int x, y, w, h;
                BC_ListBoxItem *item = data[master_column].values[j];
 
-               if(display_format == LISTBOX_ICONS)
-               {
+               if( display_format == LISTBOX_ICONS ||
+                   display_format == LISTBOX_ICON_LIST ) {
                        get_icon_mask(item, x, y, w, h);
                        if(y + h + yposition > highest) highest = y + h + yposition;
 
@@ -1142,8 +1142,6 @@ int BC_ListBox::get_items_height(ArrayList<BC_ListBoxItem*> *data,
                {
                        get_text_mask(item, x, y, w, h);
                        *result += h;
-
-
 // Descend into sublist
                        if(item->get_sublist() &&
                                item->get_expand())
@@ -1155,9 +1153,7 @@ int BC_ListBox::get_items_height(ArrayList<BC_ListBoxItem*> *data,
                }
        }
 
-       if((display_format == LISTBOX_TEXT ||
-               display_format == LISTBOX_ICON_LIST) &&
-               top_level)
+       if( display_format == LISTBOX_TEXT && top_level )
        {
                highest = LISTBOX_MARGIN + *result;
        }