@@ -38,7 +38,7 @@ FFmpegReader::FFmpegReader(string path)
3838 check_fps(false ), enable_seek(true ), is_open(false ), seek_audio_frame_found(0 ), seek_video_frame_found(0 ),
3939 prev_samples(0 ), prev_pts(0 ), pts_total(0 ), pts_counter(0 ), is_duration_known(false ), largest_frame_processed(0 ),
4040 current_video_frame(0 ), has_missing_frames(false ), num_packets_since_video_frame(0 ), num_checks_since_final(0 ),
41- packet(NULL ), use_omp_threads( true ) {
41+ packet(NULL ) {
4242
4343 // Initialize FFMpeg, and register all formats and codecs
4444 AV_REGISTER_ALL
@@ -60,7 +60,7 @@ FFmpegReader::FFmpegReader(string path, bool inspect_reader)
6060 check_fps(false ), enable_seek(true ), is_open(false ), seek_audio_frame_found(0 ), seek_video_frame_found(0 ),
6161 prev_samples(0 ), prev_pts(0 ), pts_total(0 ), pts_counter(0 ), is_duration_known(false ), largest_frame_processed(0 ),
6262 current_video_frame(0 ), has_missing_frames(false ), num_packets_since_video_frame(0 ), num_checks_since_final(0 ),
63- packet(NULL ), use_omp_threads( true ) {
63+ packet(NULL ) {
6464
6565 // Initialize FFMpeg, and register all formats and codecs
6666 AV_REGISTER_ALL
@@ -229,9 +229,6 @@ void FFmpegReader::Open()
229229 missing_frames.SetMaxBytesFromInfo (OPEN_MP_NUM_PROCESSORS * 2 , info.width , info.height , info.sample_rate , info.channels );
230230 final_cache.SetMaxBytesFromInfo (OPEN_MP_NUM_PROCESSORS * 2 , info.width , info.height , info.sample_rate , info.channels );
231231
232- // Initialize OMP threading support
233- use_omp_threads = openshot::IsOMPEnabled ();
234-
235232 // Mark as "open"
236233 is_open = true ;
237234 }
@@ -613,7 +610,7 @@ std::shared_ptr<Frame> FFmpegReader::ReadStream(int64_t requested_frame)
613610 // Process Video Packet
614611 ProcessVideoPacket (requested_frame);
615612
616- if (!use_omp_threads ) {
613+ if (openshot::Settings::Instance ()-> WAIT_FOR_VIDEO_PROCESSING_TASK ) {
617614 // Wait on each OMP task to complete before moving on to the next one. This slows
618615 // down processing considerably, but might be more stable on some systems.
619616 #pragma omp taskwait
@@ -628,16 +625,16 @@ std::shared_ptr<Frame> FFmpegReader::ReadStream(int64_t requested_frame)
628625 num_packets_since_video_frame++;
629626
630627 // Check the status of a seek (if any)
631- if (is_seeking)
632- #pragma omp critical (openshot_seek)
633- check_seek = CheckSeek (false );
634- else
635- check_seek = false ;
636-
637- if (check_seek) {
638- // Jump to the next iteration of this loop
639- continue ;
640- }
628+ if (is_seeking)
629+ #pragma omp critical (openshot_seek)
630+ check_seek = CheckSeek (false );
631+ else
632+ check_seek = false ;
633+
634+ if (check_seek) {
635+ // Jump to the next iteration of this loop
636+ continue ;
637+ }
641638
642639 // Update PTS / Frame Offset (if any)
643640 UpdatePTSOffset (false );
@@ -919,8 +916,12 @@ void FFmpegReader::ProcessVideoPacket(int64_t requested_frame)
919916 // Copy picture data from one AVFrame (or AVPicture) to another one.
920917 AV_COPY_PICTURE_DATA (pFrameRGB, buffer, PIX_FMT_RGBA, width, height);
921918
919+ int scale_mode = SWS_FAST_BILINEAR;
920+ if (openshot::Settings::Instance ()->HIGH_QUALITY_SCALING ) {
921+ scale_mode = SWS_LANCZOS;
922+ }
922923 SwsContext *img_convert_ctx = sws_getContext (info.width , info.height , AV_GET_CODEC_PIXEL_FORMAT (pStream, pCodecCtx), width,
923- height, PIX_FMT_RGBA, SWS_LANCZOS , NULL , NULL , NULL );
924+ height, PIX_FMT_RGBA, scale_mode , NULL , NULL , NULL );
924925
925926 // Resize / Convert to RGB
926927 sws_scale (img_convert_ctx, my_frame->data , my_frame->linesize , 0 ,
0 commit comments