Copy link to clipboard
Copied
Hi,
I’m hoping to improve the performance of our Exporter Plugin. Currently sequenceRenderSuite->RenderVideoFrame() is taking about 30ms to render a video frame.
In the documentation (page 194 of Premiere_SDK_Guide.pdf) released with the Premiere SDK (https://www.adobe.com/devnet/premiere/sdk/cc.html), it mentions that CS6 exports can use the new push model:
Get Video Frames and Audio Samples
Starting in CS6, exporters can use the new push model, or the legacy pull model for obtaining
frames. The new push model is supported starting in CS6, and the pull model is still supported.
Developing for Encore and previous versions of Premiere Pro and Media Encoder requires using
the pull model.
Push Model
Using the push model, the exporter host can simply push frames to a thread-safe exporter-specified
callback. Use DoMultiPassExportLoop in the Exporter Utility Suite to register the callback.
Compared with the pull model, this will cut down on the code previously required for render
loop management. It should also yield substantial performance increases for exporters that
haven’t finely tuned their multithreaded rendering.
Please can I have some examples of how to implement the push model via DoMultiPassExportLoop() and the Exporter Utility Suite.
Many thanks in advance,
Andy.
Keywords: kPrSDKExporterUtilitySuite, DoMultiPassExportLoop(), ReportIntermediateProgressForRepeatedVideoFrame(), ReportEvent()
Hi tit_toinou,
1) Thanks, it is good to confirm the order.
2) I'm afraid inReservedProgressPreRender and inReservedProgressPostRender didn't work for me. The progress dialog is displayed but the progress bar is stuck on zero. I tried inReservedProgressPreRender/inReservedProgressPostRender in several combinations, but couldn't get the progress bar to update. If you have got the progress bar working, please can you show me some code or pseudocode?
3) After looking around the headers, I couldn't see
...Copy link to clipboard
Copied
Hi tit_toinou,
Thanks very much for your response.
Please can you explain what the parameters ExportLoopRenderParams.inRenderParamsSize and ExportLoopRenderParams.inRenderParamsVersion are.
There is no documentation on them and I'm not sure how I should initialise them. Can I just set to a default zero value?
For example:
ExportLoopRenderParams exRenderParams;
exRenderParams.inRenderParamsSize = 0;
exRenderParams.inRenderParamsVersion = 0;
exRenderParams.inFinalPixelFormat = PrPixelFormat_V210_422_10u_709;
exRenderParams.inStartTime = range.Start;
exRenderParams.inEndTime = range.End;
exRenderParams.inReservedProgressPreRender = 20;
exRenderParams.inReservedProgressPostRender = 80;
mySettings->exportUtilitySuite->DoMultiPassExportLoop(exportInfoP->exporterPluginID, &exRenderParams, 1, MultipassExportFrame, (void*)mySettings);
Many thanks, Andy.
Copy link to clipboard
Copied
Hi tit_toinou,
Thanks for your help. I think I'm almost there. I've just got a few more questions:
1) I just wanted to confirm that the callback function (MultipassExportFrame()), always presents frames in order e.g. 1, 2, 3? Or could it potentially call frames out of order e.g. 3, 1, 2? Whilst debugging it has always presented frames in order but I don't want to assume this is always the case.
2) Is it OK to update the progress bar within the callback function. As the callback is invoked from multiple-threads, is this thread-safe?
prSuiteError MultipassExportFrame(...)
{
...
// Update progress dialog
float renderProgress = float((inFrameNumber - callbackData->mStartTime) + callbackData->mCurrentRenderPos);
mySettings->exportProgressSuite->UpdateProgressPercent(callbackData->mExID, renderProgress / (float)callbackData->mTotalRenderDuration);
...
}
I tried using exRenderParams.inReservedProgressPreRender and exRenderParams.inReservedProgressPostRender but these don't appear to do anything.
3) In sequenceRenderSuite->RenderVideoFrame(), there is a render quality setting (renderParms.inRenderQuality = kPrRenderQuality_High). Is there a similar setting for DoMultiPassExportLoop(), or is everything rendered at the same quality?
Many thanks,
Andy.
Copy link to clipboard
Copied
Hi tit_toinou,
1) Thanks, it is good to confirm the order.
2) I'm afraid inReservedProgressPreRender and inReservedProgressPostRender didn't work for me. The progress dialog is displayed but the progress bar is stuck on zero. I tried inReservedProgressPreRender/inReservedProgressPostRender in several combinations, but couldn't get the progress bar to update. If you have got the progress bar working, please can you show me some code or pseudocode?
3) After looking around the headers, I couldn't see any quality settings. I just wanted to confirm I'm not missing anything.
Thanks once again for your help. It is much appreciated
Andy.
Copy link to clipboard
Copied
I came across this question as I'm looking into modifying my exporter to use the "push model" with DoMultiPassExportLoop(), but it seems as though only the posts by the asker are present (i.e. the responses from "tit_toinou" etc are missing).
As Andy says above, "some examples of how to implement the push model via DoMultiPassExportLoop() and the Exporter Utility Suite" would be very helpful!
Copy link to clipboard
Copied
My experimentation with this seems to work - if I've done anything wrong, let me know.
If this is of use to anyone in the future, here it is (using the SDK Exporter sample as the basis):
prMALError exSDKExport(
exportStdParms* stdParmsP,
exDoExportRec* exportInfoP)
{
prMALError result = malNoError;
csSDK_uint32 exID = exportInfoP->exporterPluginID;
ExportSettings* mySettings = reinterpret_cast<ExportSettings*>(exportInfoP->privateData);
ExportLoopRenderParams renderParams;
renderParams.inRenderParamsSize = sizeof(ExportLoopRenderParams);
renderParams.inRenderParamsVersion = 0;
renderParams.inFinalPixelFormat = PrPixelFormat_BGRA_4444_32f;
renderParams.inStartTime = exportInfoP->startTime;
renderParams.inEndTime = exportInfoP->endTime;
renderParams.inReservedProgressPreRender = 0;
renderParams.inReservedProgressPostRender = 0;
constexpr csSDK_uint32 numberOfPasses = 1;
void* inCompletionParam = reinterpret_cast<void*>(exportInfoP);
result = mySettings->exporterUtilitySuite->DoMultiPassExportLoop(exID, &renderParams, numberOfPasses, multipassExportLoopFrameCompletion, inCompletionParam);
return result;
}
prSuiteError multipassExportLoopFrameCompletion(csSDK_uint32 inWhichPass, csSDK_uint32 inFrameNumber, csSDK_uint32 inFrameRepeatCount, PPixHand inRenderedFrame, void* inCallbackData)
{
prSuiteError result = suiteError_NoError;
exDoExportRec* exportInfoP = reinterpret_cast<exDoExportRec*>(inCallbackData);
if (!exportInfoP)
{
return suiteError_InvalidParms;
}
result = YourFrameProcessingFunction(exportInfoP, inRenderedFrame);
return result;
}
My other question on exporting still frames may also be useful in this context: