Skip to content

Commit cec61c7

Browse files
author
Clement Champetier
committed
AudioVideo reader: optimization of beginSequenceRender
1 parent 3979bbe commit cec61c7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

plugins/image/io/AudioVideo/src/reader/AVReaderPlugin.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ AVReaderPlugin::AVReaderPlugin( OfxImageEffectHandle handle )
3636
, _lastVideoStreamIndex( 0 )
3737
, _lastFrame( -1 )
3838
, _initVideo( false )
39+
, _isSetUp( false )
3940
{
4041
_clipDst = fetchClip( kOfxImageEffectOutputClipName );
4142

@@ -483,6 +484,11 @@ void AVReaderPlugin::beginSequenceRender( const OFX::BeginSequenceRenderArgument
483484
{
484485
ReaderPlugin::beginSequenceRender( args );
485486

487+
// To be sure to execute the following code only once
488+
// Optimization in some hosts when rendering several frames (nuke...)
489+
if( _isSetUp )
490+
return;
491+
486492
ensureVideoIsOpen();
487493

488494
AVReaderParams params = getProcessParams();
@@ -522,6 +528,8 @@ void AVReaderPlugin::beginSequenceRender( const OFX::BeginSequenceRenderArgument
522528
// get image to decode
523529
const avtranscoder::VideoFrameDesc imageToDecodeDesc( sourceImageDesc.getWidth(), sourceImageDesc.getHeight(), "rgb24" );
524530
_imageToDecode.reset( new avtranscoder::VideoFrame( imageToDecodeDesc ) );
531+
532+
_isSetUp = true;
525533
}
526534

527535
void AVReaderPlugin::render( const OFX::RenderArguments& args )

plugins/image/io/AudioVideo/src/reader/AVReaderPlugin.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class AVReaderPlugin : public ReaderPlugin
109109

110110
int _lastFrame;
111111

112-
bool _initVideo;
112+
bool _initVideo; ///< Is the video init
113+
bool _isSetUp; ///< Is the unwrapping and decoding setup
113114
};
114115

115116
}

0 commit comments

Comments
 (0)