From d487c455c679829f94dee4ea8276ad3116f76de9 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 3 Jan 2017 17:01:13 -0700 Subject: [PATCH] more ffmpeg cmodel changes, listbox fix --- cinelerra-5.1/cinelerra/ffmpeg.C | 27 +++++++++++++++------------ cinelerra-5.1/cinelerra/vrender.C | 4 ++-- cinelerra-5.1/guicast/bclistbox.C | 10 +++------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 474d7c13..3ba22244 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -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); diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index 0b424c64..ae3503cd 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -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()); diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 1b5c66fd..76f8fde1 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -1130,8 +1130,8 @@ int BC_ListBox::get_items_height(ArrayList *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 *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 *data, } } - if((display_format == LISTBOX_TEXT || - display_format == LISTBOX_ICON_LIST) && - top_level) + if( display_format == LISTBOX_TEXT && top_level ) { highest = LISTBOX_MARGIN + *result; } -- 2.26.2