From: Good Guy Date: Wed, 20 Sep 2017 19:39:19 +0000 (-0600) Subject: add proxy scaler option, add sams icons X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=ea0dfe3cd57bb60ef824cd0d3512fcd251020c76;p=goodguy%2Fhistory.git add proxy scaler option, add sams icons --- diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index dc43432c..7275070e 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -871,26 +871,6 @@ AssetEditPath::~AssetEditPath() {} - - -AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y) - : FormatPopup(fwindow->mwindow->plugindb, 90, y) -{ - this->fwindow = fwindow; -} -AssetEditFormat::~AssetEditFormat() -{ -} -int AssetEditFormat::handle_event() -{ - Asset *asset = fwindow->asset_edit->changed_params; - asset->format = File::strtoformat(get_selection(0, 0)->get_text()); - return 1; -} - - - - DetailAssetButton::DetailAssetButton(AssetEditWindow *fwindow, int x, int y) : BC_GenericButton(x, y, _("Detail")) { diff --git a/cinelerra-5.1/cinelerra/assetedit.h b/cinelerra-5.1/cinelerra/assetedit.h index d1f3c536..47a59164 100644 --- a/cinelerra-5.1/cinelerra/assetedit.h +++ b/cinelerra-5.1/cinelerra/assetedit.h @@ -114,17 +114,6 @@ public: -class AssetEditFormat : public FormatPopup -{ -public: - AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y); - ~AssetEditFormat(); - - int handle_event(); - AssetEditWindow *fwindow; -}; - - class AssetEditChannels : public BC_TumbleTextBox { public: diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 591b4ca9..5d9ff496 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -1061,8 +1061,7 @@ int EDL::dump(FILE *fp) " output_h: %d\n" " aspect_w: %f\n" " aspect_h: %f\n" - " color_model: %d\n" - " proxy_scale: %d\n", + " color_model: %d\n", session->video_channels, session->video_tracks, session->frame_rate, @@ -1071,8 +1070,7 @@ int EDL::dump(FILE *fp) session->output_h, session->aspect_w, session->aspect_h, - session->color_model, - session->proxy_scale); + session->color_model); fprintf(fp," CLIPS\n"); fprintf(fp," total: %d\n", clips.total); diff --git a/cinelerra-5.1/cinelerra/edlsession.C b/cinelerra-5.1/cinelerra/edlsession.C index c65e53f1..1ad03070 100644 --- a/cinelerra-5.1/cinelerra/edlsession.C +++ b/cinelerra-5.1/cinelerra/edlsession.C @@ -98,6 +98,7 @@ EDLSession::EDLSession(EDL *edl) playback_buffer = 4096; playback_cursor_visible = 0; playback_preload = 0; + proxy_use_scaler = 0; proxy_scale = 1; decode_subtitles = 0; subtitle_number = 0; @@ -167,6 +168,7 @@ int EDLSession::need_rerender(EDLSession *ptr) (subtitle_number != ptr->subtitle_number) || (interpolate_raw != ptr->interpolate_raw) || (white_balance_raw != ptr->white_balance_raw) || + (proxy_use_scaler != ptr->proxy_use_scaler) || (proxy_scale != ptr->proxy_scale)); } @@ -182,6 +184,7 @@ void EDLSession::equivalent_output(EDLSession *session, double *result) session->mpeg4_deblock != mpeg4_deblock || session->decode_subtitles != decode_subtitles || session->subtitle_number != subtitle_number || + session->proxy_use_scaler != proxy_use_scaler || session->proxy_scale != proxy_scale ) *result = 0; @@ -284,7 +287,6 @@ int EDLSession::load_defaults(BC_Hash *defaults) delete playback_config; playback_config = new PlaybackConfig; playback_config->load_defaults(defaults); -// proxy_scale = defaults->get("PROXY_SCALE", 1); real_time_playback = defaults->get("PLAYBACK_REALTIME", 0); real_time_record = defaults->get("REALTIME_RECORD", 0); record_positioning = defaults->get("RECORD_POSITIONING", 1); @@ -426,7 +428,6 @@ int EDLSession::save_defaults(BC_Hash *defaults) defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position); playback_config->save_defaults(defaults); defaults->update("PLAYBACK_REALTIME", real_time_playback); -// defaults->update("PROXY_SCALE", proxy_scale); defaults->update("REALTIME_RECORD", real_time_record); defaults->update("RECORD_POSITIONING", record_positioning); defaults->update("RECORD_RAW_STREAM", record_raw_stream); @@ -552,6 +553,7 @@ int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_ output_h = file->tag.get_property("OUTPUTH", output_h); aspect_w = file->tag.get_property("ASPECTW", aspect_w); aspect_h = file->tag.get_property("ASPECTH", aspect_h); + proxy_use_scaler = file->tag.get_property("PROXY_USE_SCALER", proxy_use_scaler); proxy_scale = file->tag.get_property("PROXY_SCALE", proxy_scale); return 0; } @@ -742,6 +744,7 @@ int EDLSession::save_video_config(FileXML *file) file->tag.set_property("OUTPUTH", output_h); file->tag.set_property("ASPECTW", aspect_w); file->tag.set_property("ASPECTH", aspect_h); + file->tag.set_property("PROXY_USE_SCALER", proxy_use_scaler); file->tag.set_property("PROXY_SCALE", proxy_scale); file->append_tag(); file->tag.set_title("/VIDEO"); @@ -881,6 +884,7 @@ int EDLSession::copy(EDLSession *session) view_follows_playback = session->view_follows_playback; vwindow_meter = session->vwindow_meter; vwindow_zoom = session->vwindow_zoom; + proxy_use_scaler = session->proxy_use_scaler; proxy_scale = session->proxy_scale; subtitle_number = session->subtitle_number; @@ -897,10 +901,10 @@ void EDLSession::dump() printf(" audio_tracks=%d audio_channels=%d sample_rate=%jd\n" " video_tracks=%d frame_rate=%f output_w=%d output_h=%d aspect_w=%f aspect_h=%f\n" " decode subtitles=%d subtitle_number=%d label_cells=%d program_no=%d\n" - " proxy_scale=%d\n", + " proxy_use_scaler=%d, proxy_scale=%d\n", audio_tracks, audio_channels, sample_rate, video_tracks, frame_rate, output_w, output_h, aspect_w, aspect_h, decode_subtitles, subtitle_number, label_cells, program_no, - proxy_scale); + proxy_use_scaler, proxy_scale); } diff --git a/cinelerra-5.1/cinelerra/edlsession.h b/cinelerra-5.1/cinelerra/edlsession.h index eddced8e..28c3c623 100644 --- a/cinelerra-5.1/cinelerra/edlsession.h +++ b/cinelerra-5.1/cinelerra/edlsession.h @@ -160,7 +160,7 @@ public: int program_no; int playback_software_position; // current settings are scaled this much from the original settings - int proxy_scale; + int proxy_use_scaler, proxy_scale; // int playback_strategy; // Play audio in realtime priority int real_time_playback; diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index 63a1196a..511d37dd 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -33,6 +33,7 @@ #define AUDIO_INBUF_SIZE 0x10000 #define VIDEO_REFILL_THRESH 0 #define AUDIO_REFILL_THRESH 0x1000 +#define AUDIO_MIN_FRAME_SZ 128 Mutex FFMPEG::fflock("FFMPEG::fflock"); @@ -588,6 +589,7 @@ FFAudioStream::FFAudioStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx) channel0 = channels = 0; sample_rate = 0; mbsz = 0; + frame_sz = AUDIO_MIN_FRAME_SZ; length = 0; resample_context = 0; swr_ichs = swr_ifmt = swr_irate = 0; @@ -2113,7 +2115,8 @@ int FFMPEG::decode_activate() if( st->start_time == AV_NOPTS_VALUE ) continue; int vidx = ffvideo.size(); while( --vidx >= 0 && ffvideo[vidx]->fidx != i ); - if( vidx >= 0 && ffvideo[vidx]->nudge != AV_NOPTS_VALUE ) continue; + if( vidx < 0 ) continue; + if( ffvideo[vidx]->nudge != AV_NOPTS_VALUE ) continue; if( vstart_time < st->start_time ) vstart_time = st->start_time; break; } @@ -2121,11 +2124,12 @@ int FFMPEG::decode_activate() if( st->start_time == AV_NOPTS_VALUE ) continue; int aidx = ffaudio.size(); while( --aidx >= 0 && ffaudio[aidx]->fidx != i ); - if( aidx >= 0 && ffaudio[aidx]->nudge != AV_NOPTS_VALUE ) continue; + if( aidx < 0 ) continue; + if( ffaudio[aidx]->frame_sz < avpar->frame_size ) + ffaudio[aidx]->frame_sz = avpar->frame_size; + if( ffaudio[aidx]->nudge != AV_NOPTS_VALUE ) continue; if( astart_time < st->start_time ) astart_time = st->start_time; - ffaudio[aidx]->frame_sz = - avpar->frame_size < 128 ? 128 : avpar->frame_size; break; } default: break; } diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 2da3eff1..0fb926b2 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1394,10 +1394,9 @@ int64_t File::get_memory_usage() } -int File::renders_video(Asset *asset) +int File::renders_video(int format) { -//printf("File::supports_video %d\n", format); - switch( asset->format ) { + switch( format ) { case FILE_OGG: case FILE_JPEG: case FILE_JPEG_LIST: @@ -1413,16 +1412,21 @@ int File::renders_video(Asset *asset) case FILE_TIFF_LIST: case FILE_VMPEG: case FILE_RAWDV: - return 1; case FILE_FFMPEG: - return FileFFMPEG::renders_video(asset->fformat); + return 1; } return 0; } +int File::renders_video(Asset *asset) +{ + return asset->format == FILE_FFMPEG ? + FileFFMPEG::renders_video(asset->fformat) : + renders_video(asset->format); +} -int File::renders_audio(Asset *asset) +int File::renders_audio(int format) { - switch( asset->format ) { + switch( format ) { case FILE_AC3: case FILE_FLAC: case FILE_PCM: @@ -1434,12 +1438,17 @@ int File::renders_audio(Asset *asset) case FILE_AIFF: case FILE_SND: case FILE_RAWDV: - return 1; case FILE_FFMPEG: - return FileFFMPEG::renders_audio(asset->fformat); + return 1; } return 0; } +int File::renders_audio(Asset *asset) +{ + return asset->format == FILE_FFMPEG ? + FileFFMPEG::renders_audio(asset->fformat) : + renders_audio(asset->format); +} int File::is_image_render(int format) { diff --git a/cinelerra-5.1/cinelerra/file.h b/cinelerra-5.1/cinelerra/file.h index 5e695bcb..4d80870a 100644 --- a/cinelerra-5.1/cinelerra/file.h +++ b/cinelerra-5.1/cinelerra/file.h @@ -246,7 +246,9 @@ public: // The minimum setting for cache_size should be bigger than 1MB. int64_t get_memory_usage(); + static int renders_video(int format); static int renders_video(Asset *asset); + static int renders_audio(int format); static int renders_audio(Asset *asset); // Get the extension for the filename static const char* get_tag(int format); diff --git a/cinelerra-5.1/cinelerra/formatpopup.C b/cinelerra-5.1/cinelerra/formatpopup.C index 06e41453..d6ff3363 100644 --- a/cinelerra-5.1/cinelerra/formatpopup.C +++ b/cinelerra-5.1/cinelerra/formatpopup.C @@ -20,7 +20,7 @@ */ #include "bcsignals.h" -#include "file.inc" +#include "file.h" #include "filesystem.h" #include "ffmpeg.h" #include "formatpopup.h" @@ -29,43 +29,49 @@ -FormatPopup::FormatPopup(ArrayList *plugindb, - int x, int y, int use_brender) +FormatPopup::FormatPopup(int x, int y, int do_audio, int do_video, int use_brender) : BC_ListBox(x, y, 200, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1) { this->plugindb = plugindb; + this->do_audio = do_audio; + this->do_video = do_video; this->use_brender = use_brender; set_tooltip(_("Change file format")); } +void FormatPopup::post_item(int format) +{ + if( (do_audio && File::renders_audio(format)) || + (do_video && File::renders_video(format)) ) + format_items.append(new BC_ListBoxItem(File::formattostr(format))); +} + void FormatPopup::create_objects() { - if(!use_brender) - { - format_items.append(new BC_ListBoxItem(_(FFMPEG_NAME))); - format_items.append(new BC_ListBoxItem(_(AC3_NAME))); - format_items.append(new BC_ListBoxItem(_(AIFF_NAME))); - format_items.append(new BC_ListBoxItem(_(AU_NAME))); - format_items.append(new BC_ListBoxItem(_(FLAC_NAME))); - format_items.append(new BC_ListBoxItem(_(JPEG_NAME))); + if(!use_brender) { + post_item(FILE_FFMPEG); + post_item(FILE_AC3); + post_item(FILE_AIFF); + post_item(FILE_AU); + post_item(FILE_FLAC); + post_item(FILE_JPEG); } - format_items.append(new BC_ListBoxItem(_(JPEG_LIST_NAME))); + post_item(FILE_JPEG_LIST); - if(!use_brender) - { + if(!use_brender) { #ifdef HAVE_OPENEXR - format_items.append(new BC_ListBoxItem(_(EXR_NAME))); - format_items.append(new BC_ListBoxItem(_(EXR_LIST_NAME))); + post_item(FILE_EXR); + post_item(FILE_EXR_LIST); #endif - format_items.append(new BC_ListBoxItem(_(WAV_NAME))); - format_items.append(new BC_ListBoxItem(_(RAWDV_NAME))); - format_items.append(new BC_ListBoxItem(_(AMPEG_NAME))); - format_items.append(new BC_ListBoxItem(_(VMPEG_NAME))); - format_items.append(new BC_ListBoxItem(_(VORBIS_NAME))); - format_items.append(new BC_ListBoxItem(_(OGG_NAME))); - format_items.append(new BC_ListBoxItem(_(PCM_NAME))); - format_items.append(new BC_ListBoxItem(_(PNG_NAME))); + post_item(FILE_WAV); + post_item(FILE_RAWDV); + post_item(FILE_AMPEG); + post_item(FILE_VMPEG); + post_item(FILE_VORBIS); + post_item(FILE_OGG); + post_item(FILE_PCM); + post_item(FILE_PNG); } format_items.append(new BC_ListBoxItem(_(PNG_LIST_NAME))); diff --git a/cinelerra-5.1/cinelerra/formatpopup.h b/cinelerra-5.1/cinelerra/formatpopup.h index 8eb3b20a..f7ba7975 100644 --- a/cinelerra-5.1/cinelerra/formatpopup.h +++ b/cinelerra-5.1/cinelerra/formatpopup.h @@ -31,15 +31,17 @@ class FormatPopup : public BC_ListBox { public: - FormatPopup(ArrayList *plugindb, int x, int y, + FormatPopup(int x, int y, + int do_audio=1, int do_video=1, int use_brender=0); // Show formats useful in background rendering ~FormatPopup(); void create_objects(); + void post_item(int format); virtual int handle_event(); // user copies text to value here ArrayList *plugindb; ArrayList format_items; - int use_brender; + int use_brender, do_audio, do_video; }; diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index e8cbef4e..60d0b6c2 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -103,19 +103,17 @@ SET_TRACE if(channels_tumbler) delete channels_tumbler; } -void FormatTools::create_objects(int &init_x, - int &init_y, - int do_audio, // Include support for audio - int do_video, // Include support for video - int prompt_audio, // Include checkbox for audio - int prompt_video, - int prompt_audio_channels, - int prompt_video_compression, - const char *locked_compressor, - int recording, - int *strategy, - int brender, - int horizontal_layout) +void FormatTools::create_objects( + int &init_x, int &init_y, + int do_audio, int do_video, // Include support for audio, video + int prompt_audio, int prompt_video, // Include checkbox for audio, video + int prompt_audio_channels, + int prompt_video_compression, + const char *locked_compressor, + int recording, + int *strategy, + int brender, + int horizontal_layout) { int x = init_x; int y = init_y; @@ -770,7 +768,7 @@ int FormatVideo::handle_event() FormatFormat::FormatFormat(int x, int y, FormatTools *format) - : FormatPopup(format->plugindb, x, y, format->use_brender) + : FormatPopup(x, y, format->do_audio, format->do_video, format->use_brender) { this->format = format; } diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 22f43e54..a97e85ba 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -492,7 +492,7 @@ public: int modify_edithandles(); int modify_pluginhandles(); void finish_modify_handles(); - void set_proxy(int new_scale, + void set_proxy(int use_scaler, int new_scale, ArrayList *orig_assets, ArrayList *proxy_assets); void dump_plugins(FILE *fp=stdout); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index a0e9b955..85b5f743 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -2274,40 +2274,54 @@ void MWindow::remap_audio(int pattern) } } -void MWindow::set_proxy(int new_scale, +void MWindow::set_proxy(int use_scaler, int new_scale, ArrayList *orig_assets, ArrayList *proxy_assets) { + int orig_use_scaler = edl->session->proxy_use_scaler; int orig_scale = edl->session->proxy_scale; +// rescale to full size asset in read_frame + edl->session->proxy_use_scaler = use_scaler; edl->session->proxy_scale = new_scale; + if( use_scaler ) { + for( int i=0; isize(); ++i ) { + Asset *proxy_asset = (Asset *)proxy_assets->get(i); + proxy_asset->width = orig_assets->get(i)->get_w(); + proxy_asset->height = orig_assets->get(i)->get_h(); + } + new_scale = 1; + } + + if( !orig_use_scaler && new_scale != orig_scale ) { // project size - float orig_w = (float)edl->session->output_w * orig_scale; - float orig_h = (float)edl->session->output_h * orig_scale; - edl->session->output_w = Units::round(orig_w / new_scale); - edl->session->output_h = Units::round(orig_h / new_scale); + float orig_w = (float)edl->session->output_w * orig_scale; + float orig_h = (float)edl->session->output_h * orig_scale; + edl->session->output_w = Units::round(orig_w / new_scale); + edl->session->output_h = Units::round(orig_h / new_scale); // track sizes - for( Track *track=edl->tracks->first; track; track=track->next ) { - if( track->data_type != TRACK_VIDEO ) continue; - orig_w = (float)track->track_w * orig_scale; - orig_h = (float)track->track_h * orig_scale; - track->track_w = Units::round(orig_w / new_scale); - track->track_h = Units::round(orig_h / new_scale); - ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])-> - set_proxy(orig_scale, new_scale); - ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])-> - set_proxy(orig_scale, new_scale); - ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])-> - set_proxy(orig_scale, new_scale); - ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])-> - set_proxy(orig_scale, new_scale); - ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])-> - set_proxy(orig_scale, new_scale); + for( Track *track=edl->tracks->first; track; track=track->next ) { + if( track->data_type != TRACK_VIDEO ) continue; + orig_w = (float)track->track_w * orig_scale; + orig_h = (float)track->track_h * orig_scale; + track->track_w = Units::round(orig_w / new_scale); + track->track_h = Units::round(orig_h / new_scale); + ((MaskAutos*)track->automation->autos[AUTOMATION_MASK])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_X])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_CAMERA_Y])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_X])-> + set_proxy(orig_scale, new_scale); + ((FloatAutos*)track->automation->autos[AUTOMATION_PROJECTOR_Y])-> + set_proxy(orig_scale, new_scale); + } } -// assets +// change original assets to proxy assets for( int i=0; isize(); i++ ) { - Asset *proxy_asset = edl->assets->update((Asset*)proxy_assets->get(i)); + Asset *proxy_asset = edl->assets->update((Asset *)proxy_assets->get(i)); // replace track contents for( Track *track = edl->tracks->first; track; track = track->next ) { if( track->data_type != TRACK_VIDEO ) continue; diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index b9a5ef59..537fc40a 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -79,8 +79,7 @@ ProxyThread::ProxyThread(MWindow *mwindow) } ProxyThread::~ProxyThread() { - for( int i=0; iedl->session->output_w * orig_scale; int orig_h = mwindow->edl->session->output_h * orig_scale; - total_sizes = 0; - - size_text[0] = cstrdup(_("Original size")); - size_factors[0] = 1; - - int current_factor = 2; - total_sizes = 1; - for( current_factor = 2; current_factor < MAX_SCALE; current_factor++ ) { - if( current_factor * (orig_w / current_factor) == orig_w && - current_factor * (orig_h / current_factor) == orig_h ) { -//printf("ProxyThread::calculate_sizes %d\n", current_factor); - char string[BCTEXTLEN]; - sprintf(string, "1/%d", current_factor); - size_text[total_sizes] = cstrdup(string); - size_factors[total_sizes] = current_factor; - total_sizes++; + + if( !use_scaler ) { + for( int i=2; isave_defaults(mwindow->defaults, "PROXY_", 1, 1, 0, 0, 0); - if( !result ) { + if( !result ) to_proxy(); - } } void ProxyThread::to_proxy() @@ -172,125 +168,96 @@ void ProxyThread::to_proxy() mwindow->save_backup(); mwindow->undo->update_undo_before(_("proxy"), this); + EDL *&edl = mwindow->edl; + EDLSession *&session = edl->session; + Assets *&assets = edl->assets; + // revert project to original size from current size - if( mwindow->edl->session->proxy_scale > 1 ) { - for( orig_asset = mwindow->edl->assets->first; - orig_asset; - orig_asset = orig_asset->next ) { +// remove all session proxy assets at the at the current proxy_scale + if( session->proxy_scale > 1 ) { + orig_asset = assets->first; + for( ; orig_asset; orig_asset=orig_asset->next ) { char new_path[BCTEXTLEN]; - to_proxy_path(new_path, orig_asset, mwindow->edl->session->proxy_scale); - -// test if proxy asset was already added to proxy assets + to_proxy_path(new_path, orig_asset, session->proxy_scale); + proxy_asset = assets->get_asset(new_path); + if( !proxy_asset ) continue; +// test if proxy asset was already added to proxy_assets int got_it = 0; - proxy_asset = 0; - for( int i = 0; i < proxy_assets.size(); i++ ) { - if( !strcmp(proxy_assets.get(i)->path, new_path) ) { - got_it = 1; - break; - } - } - + for( int i = 0; !got_it && ipath, new_path); + if( got_it ) continue; // add pointer to existing EDL asset if it exists // EDL won't delete it unless it's the same pointer. - if( !got_it ) { - proxy_asset = mwindow->edl->assets->get_asset(new_path); - - if( proxy_asset ) { - proxy_assets.append(proxy_asset); - proxy_asset->Garbage::add_user(); - - orig_assets.append(orig_asset); - orig_asset->Garbage::add_user(); - } - - } + proxy_assets.append(proxy_asset); + proxy_asset->Garbage::add_user(); + orig_assets.append(orig_asset); + orig_asset->Garbage::add_user(); } // convert from the proxy assets to the original assets - mwindow->set_proxy(1, &proxy_assets, &orig_assets); + mwindow->set_proxy(0, 1, &proxy_assets, &orig_assets); // remove the proxy assets mwindow->remove_assets_from_project(0, 0, &proxy_assets, NULL); - - - for( int i = 0; i < proxy_assets.size(); i++ ) { + for( int i=0; iGarbage::remove_user(); - } proxy_assets.remove_all(); - - for( int i = 0; i < orig_assets.size(); i++ ) { + for( int i = 0; i < orig_assets.size(); i++ ) orig_assets.get(i)->Garbage::remove_user(); - } orig_assets.remove_all(); } // convert to new size if not original size if( new_scale != 1 ) { - for( orig_asset = mwindow->edl->assets->first; - orig_asset; - orig_asset = orig_asset->next ) { - if( orig_asset->video_data ) { - char new_path[BCTEXTLEN]; - to_proxy_path(new_path, orig_asset, new_scale); + orig_asset = assets->first; + for( ; orig_asset; orig_asset=orig_asset->next ) { + if( !orig_asset->video_data ) continue; + char new_path[BCTEXTLEN]; + to_proxy_path(new_path, orig_asset, new_scale); // add to proxy_assets & orig_assets if it isn't already there. - int got_it = 0; - proxy_asset = 0; - for( int i = 0; i < proxy_assets.size(); i++ ) { - if( !strcmp(proxy_assets.get(i)->path, new_path) ) { - got_it = 1; - proxy_asset = (Asset*)proxy_assets.get(i); - break; - } - } - - if( !got_it ) { - proxy_asset = new Asset; + int got_it = 0; + for( int i = 0; !got_it && ipath, new_path); + if( !got_it ) { + proxy_asset = new Asset; // new compression parameters - proxy_asset->copy_format(asset, 0); - proxy_asset->update_path(new_path); - proxy_asset->audio_data = 0; - proxy_asset->video_data = 1; - proxy_asset->layers = 1; - proxy_asset->width = orig_asset->width / new_scale; - proxy_asset->height = orig_asset->height / new_scale; - proxy_asset->frame_rate = orig_asset->frame_rate; - proxy_asset->video_length = orig_asset->video_length; - - proxy_assets.append(proxy_asset); - orig_asset->add_user(); - orig_assets.append(orig_asset); - } + proxy_asset->copy_format(asset, 0); + proxy_asset->update_path(new_path); + proxy_asset->audio_data = 0; + proxy_asset->video_data = 1; + proxy_asset->layers = 1; + proxy_asset->width = orig_asset->width / new_scale; + proxy_asset->actual_width = proxy_asset->width; + proxy_asset->height = orig_asset->height / new_scale; + proxy_asset->actual_height = proxy_asset->height; + proxy_asset->frame_rate = orig_asset->frame_rate; + proxy_asset->video_length = orig_asset->video_length; + proxy_assets.append(proxy_asset); + orig_asset->add_user(); + orig_assets.append(orig_asset); + } // test if proxy file exists. - int exists = 0; - FILE *fd = fopen(new_path, "r"); - if( fd ) { - got_it = 1; - exists = 1; - fclose(fd); - - FileSystem fs; -// test if proxy file is newer than original. - if( fs.get_date(new_path) < fs.get_date(asset->path) ) { - got_it = 0; - } - } - else { -// proxy doesn't exist - got_it = 0; - } + int exists = 0; + FILE *fd = fopen(new_path, "r"); + if( fd ) { + exists = 1; + fclose(fd); + FileSystem fs; +// got it if proxy file is newer than original. + got_it = fs.get_date(new_path) > fs.get_date(asset->path); + } + else + got_it = 0; - if( !got_it ) { -// prompt user to overwrite - if( exists ) { - confirm_paths.append(cstrdup(new_path)); - } + if( !got_it ) { + if( exists ) // prompt user to overwrite + confirm_paths.append(cstrdup(new_path)); - needed_assets.append(proxy_asset); - proxy_asset->add_user(); - needed_orig_assets.append(orig_asset); - orig_asset->add_user(); - } + needed_assets.append(proxy_asset); + proxy_asset->add_user(); + needed_orig_assets.append(orig_asset); + orig_asset->add_user(); //printf("ProxyThread::handle_close_event %d %s\n", __LINE__, new_path); } } @@ -316,24 +283,20 @@ void ProxyThread::to_proxy() start_progress(_("Creating proxy files..."), total_len); total_rendered = 0; - ProxyFarm engine(mwindow, - this, - &needed_assets, - &needed_orig_assets); + ProxyFarm engine(mwindow, this, + &needed_assets, &needed_orig_assets); engine.process_packages(); - printf("failed=%d canceled=%d\n", failed, progress->is_cancelled()); - // stop progress bar +// stop progress bar canceled = progress->is_cancelled(); progress->stop_progress(); - delete progress; - progress = 0; + delete progress; progress = 0; if( failed && !canceled ) { - ErrorBox error_box(PROGRAM_NAME ": Error", - mwindow->gui->get_abs_cursor_x(1), - mwindow->gui->get_abs_cursor_y(1)); + int cx, cy; + mwindow->gui->get_abs_cursor_xy(cx, cy, 1); + ErrorBox error_box(PROGRAM_NAME ": Error", cx, cy); error_box.create_objects(_("Error making proxy.")); error_box.raise_window(); error_box.run_window(); @@ -342,31 +305,22 @@ printf("failed=%d canceled=%d\n", failed, progress->is_cancelled()); // resize project if( !failed && !canceled ) { - mwindow->set_proxy(new_scale, &orig_assets, &proxy_assets); + mwindow->set_proxy(use_scaler, new_scale, &orig_assets, &proxy_assets); } } - for( int i = 0; i < proxy_assets.size(); i++ ) { + for( int i = 0; i < proxy_assets.size(); i++ ) proxy_assets.get(i)->Garbage::remove_user(); - } - - for( int i = 0; i < orig_assets.size(); i++ ) { + for( int i = 0; i < orig_assets.size(); i++ ) orig_assets.get(i)->Garbage::remove_user(); - } - - for( int i = 0; i < needed_assets.size(); i++ ) { + for( int i = 0; i < needed_assets.size(); i++ ) needed_assets.get(i)->Garbage::remove_user(); - } - - for( int i = 0; i < needed_orig_assets.size(); i++ ) { + for( int i = 0; i < needed_orig_assets.size(); i++ ) needed_orig_assets.get(i)->Garbage::remove_user(); - } } mwindow->undo->update_undo_after(_("proxy"), LOAD_ALL); - mwindow->edl->Garbage::remove_user(); - mwindow->restart_brender(); mwindow->gui->lock_window("ProxyThread::to_proxy"); @@ -444,44 +398,41 @@ ProxyWindow::~ProxyWindow() void ProxyWindow::create_objects() { lock_window("ProxyWindow::create_objects"); - + int margin = mwindow->theme->widget_border; int x = margin; int y = margin; - thread->orig_scale = - thread->new_scale = - mwindow->edl->session->proxy_scale; - + thread->use_scaler = mwindow->edl->session->proxy_use_scaler; + thread->orig_scale = mwindow->edl->session->proxy_scale; + thread->new_scale = thread->orig_scale; + BC_Title *text; add_subwindow(text = new BC_Title(x, y, _("What size should the project\n" "be scaled to for editing?"))); y += text->get_h() * 2 + margin; - - + add_subwindow(text = new BC_Title(x, y, _("Scale factor:"))); x += text->get_w() + margin; - - thread->calculate_sizes(); + thread->size_text[0] = cstrdup(_("Original size")); + thread->size_factors[0] = 1; + thread->total_sizes = 1; int popupmenu_w = BC_PopupMenu::calculate_w(get_text_width(MEDIUMFONT, thread->size_text[0])); add_subwindow(scale_factor = new ProxyMenu(mwindow, this, x, y, popupmenu_w, "")); - for( int i = 0; i < thread->total_sizes; i++ ) { - scale_factor->add_item(new BC_MenuItem(thread->size_text[i])); - } + scale_factor->update_sizes(); x += scale_factor->get_w() + margin; - + ProxyTumbler *tumbler; add_subwindow(tumbler = new ProxyTumbler(mwindow, this, x, y)); - - x = margin; y += tumbler->get_h() + margin; - ProxyReset *reset; - add_subwindow(reset = new ProxyReset(mwindow, this, x, y)); - - y += reset->get_h() * 2 + margin; x = margin; - add_subwindow(text = new BC_Title(x, y, _("New project dimensions: "))); + add_subwindow(use_scaler = new ProxyUseScaler(mwindow, this, x, y)); + y += use_scaler->get_h() + margin; + y += 25; + + x = margin; + add_subwindow(text = new BC_Title(x, y, _("New media dimensions: "))); x += text->get_w() + margin; add_subwindow(new_dimensions = new BC_Title(x, y, "")); @@ -489,18 +440,30 @@ void ProxyWindow::create_objects() y += new_dimensions->get_h() * 2 + margin; - format_tools = new FormatTools(mwindow, this, thread->asset); + format_tools = new ProxyFormatTools(mwindow, this, thread->asset); format_tools->create_objects(x, y, 0, 1, 0, 0, 0, 1, 0, 1, // skip the path 0, 0); update(); - + add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this)); show_window(1); unlock_window(); } +ProxyFormatTools::ProxyFormatTools(MWindow *mwindow, ProxyWindow *pwindow, Asset *asset) + : FormatTools(mwindow, pwindow, asset) +{ + this->pwindow = pwindow; +} + +void ProxyFormatTools::update_format() +{ + FormatTools::update_format(); + pwindow->use_scaler->update(); +} + void ProxyWindow::update() { // preview the new size @@ -515,19 +478,32 @@ void ProxyWindow::update() new_dimensions->update(string); thread->scale_to_text(string, thread->new_scale); scale_factor->set_text(string); + use_scaler->update(); } -ProxyReset::ProxyReset(MWindow *mwindow, ProxyWindow *pwindow, int x, int y) - : BC_GenericButton(x, y, _("Reset")) +ProxyUseScaler::ProxyUseScaler(MWindow *mwindow, ProxyWindow *pwindow, int x, int y) + : BC_CheckBox(x, y, pwindow->thread->use_scaler, _("Use scaler (FFMPEG only)")) { this->mwindow = mwindow; this->pwindow = pwindow; } -int ProxyReset::handle_event() +void ProxyUseScaler::update() { - pwindow->thread->new_scale = pwindow->thread->orig_scale; + ProxyThread *thread = pwindow->thread; + if( thread->asset->format != FILE_FFMPEG ) thread->use_scaler = 0; + BC_CheckBox::update(thread->use_scaler); + int scaler_avail = thread->asset->format == FILE_FFMPEG ? 1 : 0; + if( !scaler_avail && enabled ) disable(); + if( scaler_avail && !enabled ) enable(); +} + +int ProxyUseScaler::handle_event() +{ + pwindow->thread->new_scale = 1; + pwindow->thread->use_scaler = get_value(); + pwindow->scale_factor->update_sizes(); pwindow->update(); return 1; } @@ -541,11 +517,22 @@ ProxyMenu::ProxyMenu(MWindow *mwindow, ProxyWindow *pwindow, this->pwindow = pwindow; } +void ProxyMenu::update_sizes() +{ + while( total_items() > 0 ) del_item(0); + ProxyThread *thread = pwindow->thread; + thread->calculate_sizes(); + for( int i=0; i < thread->total_sizes; i++ ) + add_item(new BC_MenuItem(thread->size_text[i])); +} + int ProxyMenu::handle_event() { for( int i = 0; i < pwindow->thread->total_sizes; i++ ) { if( !strcmp(get_text(), pwindow->thread->size_text[i]) ) { pwindow->thread->new_scale = pwindow->thread->size_factors[i]; + if( pwindow->thread->new_scale == 1 ) + pwindow->thread->use_scaler = 0; pwindow->update(); break; } @@ -634,21 +621,21 @@ void ProxyClient::process_package(LoadPackage *ptr) // thread->failed = 1; return; } - + dst_file.set_processors(processors); result = dst_file.open_file(preferences, package->proxy_asset, 0, 1); if( result ) { thread->failed = 1; return; } - + dst_file.start_video_thread(1, edl->session->color_model, processors > 1 ? 2 : 1, 0); - + VFrame src_frame(0, -1, package->orig_asset->width, package->orig_asset->height, edl->session->color_model, -1); - + OverlayFrame scaler(processors); for( int64_t i = 0; i < package->orig_asset->video_length && diff --git a/cinelerra-5.1/cinelerra/proxy.h b/cinelerra-5.1/cinelerra/proxy.h index 5436daf9..553ef481 100644 --- a/cinelerra-5.1/cinelerra/proxy.h +++ b/cinelerra-5.1/cinelerra/proxy.h @@ -85,26 +85,38 @@ public: int orig_scale; int total_rendered; int failed; + int use_scaler; char *size_text[MAX_SIZES]; int size_factors[MAX_SIZES]; int total_sizes; }; -class ProxyReset : public BC_GenericButton +class ProxyUseScaler : public BC_CheckBox { public: - ProxyReset(MWindow *mwindow, ProxyWindow *pwindow, + ProxyUseScaler(MWindow *mwindow, ProxyWindow *pwindow, int x, int y); + void update(); int handle_event(); MWindow *mwindow; ProxyWindow *pwindow; }; +class ProxyFormatTools : public FormatTools +{ +public: + ProxyFormatTools(MWindow *mwindow, ProxyWindow *window, Asset *asset); + + void update_format(); + ProxyWindow *pwindow; +}; + class ProxyMenu : public BC_PopupMenu { public: ProxyMenu(MWindow *mwindow, ProxyWindow *pwindow, int x, int y, int w, const char *text); + void update_sizes(); int handle_event(); MWindow *mwindow; ProxyWindow *pwindow; @@ -138,8 +150,8 @@ public: ProxyThread *thread; FormatTools *format_tools; BC_Title *new_dimensions; - BC_PopupMenu *scale_factor; - ProxyReset *reset; + ProxyMenu *scale_factor; + ProxyUseScaler *use_scaler; }; class ProxyFarm; diff --git a/cinelerra-5.1/picon_cinfinity/ff_atadenoise.png b/cinelerra-5.1/picon_cinfinity/ff_atadenoise.png new file mode 100644 index 00000000..dbf5f65c Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_atadenoise.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_avgblur.png b/cinelerra-5.1/picon_cinfinity/ff_avgblur.png new file mode 100644 index 00000000..636b5344 Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_avgblur.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_bbox.png b/cinelerra-5.1/picon_cinfinity/ff_bbox.png new file mode 100644 index 00000000..586368cd Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_bbox.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_bench.png b/cinelerra-5.1/picon_cinfinity/ff_bench.png new file mode 100644 index 00000000..ef1abfc6 Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_bench.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_bitplanenoise.png b/cinelerra-5.1/picon_cinfinity/ff_bitplanenoise.png new file mode 100644 index 00000000..ecbf677a Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_bitplanenoise.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_blackdetect.png b/cinelerra-5.1/picon_cinfinity/ff_blackdetect.png new file mode 100644 index 00000000..65cca340 Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_blackdetect.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_blackframe.png b/cinelerra-5.1/picon_cinfinity/ff_blackframe.png new file mode 100644 index 00000000..0f6db1f5 Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_blackframe.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_boxblur.png b/cinelerra-5.1/picon_cinfinity/ff_boxblur.png new file mode 100644 index 00000000..5dcd1cee Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_boxblur.png differ diff --git a/cinelerra-5.1/picon_cinfinity/ff_bwdif.png b/cinelerra-5.1/picon_cinfinity/ff_bwdif.png new file mode 100644 index 00000000..42ae4a83 Binary files /dev/null and b/cinelerra-5.1/picon_cinfinity/ff_bwdif.png differ diff --git a/cinelerra-5.1/plugins/findobject/picon_cinfinity.png b/cinelerra-5.1/plugins/findobject/picon_cinfinity.png index aa543231..902d8b69 100644 Binary files a/cinelerra-5.1/plugins/findobject/picon_cinfinity.png and b/cinelerra-5.1/plugins/findobject/picon_cinfinity.png differ diff --git a/cinelerra-5.1/plugins/rumbler/picon_cinfinity.png b/cinelerra-5.1/plugins/rumbler/picon_cinfinity.png index 3eba0727..49d392e1 100644 Binary files a/cinelerra-5.1/plugins/rumbler/picon_cinfinity.png and b/cinelerra-5.1/plugins/rumbler/picon_cinfinity.png differ