Skip to content

Commit

Permalink
DenoiseSharpen: only fetch the require area. TODO: also do this in Im…
Browse files Browse the repository at this point in the history
…ageStatistics
  • Loading branch information
devernay committed Jun 7, 2018
1 parent d2abda5 commit 4641187
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
17 changes: 9 additions & 8 deletions DenoiseSharpen/DenoiseSharpen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2992,14 +2992,21 @@ DenoiseSharpenPlugin::analyzeNoiseLevelsForBitDepth(const InstanceChangedArgs &a
assert(args.renderScale.x == 1. && args.renderScale.y == 1.);
const double time = args.time;

OfxRectD cropRect;
_btmLeft->getValueAtTime(time, cropRect.x1, cropRect.y1);
double w, h;
_size->getValueAtTime(time, w, h);
cropRect.x2 = cropRect.x1 + w;
cropRect.y2 = cropRect.y1 + h;

auto_ptr<const Image> src;
auto_ptr<const Image> mask;

if ( _analysisSrcClip && _analysisSrcClip->isConnected() ) {
src.reset( _analysisSrcClip->fetchImage(time) );
src.reset( _analysisSrcClip->fetchImage(time, cropRect) );
} else {
src.reset( ( _srcClip && _srcClip->isConnected() ) ?
_srcClip->fetchImage(time) : 0 );
_srcClip->fetchImage(time, cropRect) : 0 );
}
if ( src.get() ) {
if ( (src->getRenderScale().x != args.renderScale.x) ||
Expand Down Expand Up @@ -3027,12 +3034,6 @@ DenoiseSharpenPlugin::analyzeNoiseLevelsForBitDepth(const InstanceChangedArgs &a
int premultChannel = (premult && _premultChannel) ? _premultChannel->getValueAtTime(time) : 3;
ColorModelEnum colorModel = (ColorModelEnum)_colorModel->getValueAtTime(time);
bool b3 = _b3->getValueAtTime(time);
OfxRectD cropRect;
_btmLeft->getValueAtTime(time, cropRect.x1, cropRect.y1);
double w, h;
_size->getValueAtTime(time, w, h);
cropRect.x2 = cropRect.x1 + w;
cropRect.y2 = cropRect.y1 + h;

OfxRectI cropRectI;
cropRectI.x1 = std::ceil(cropRect.x1);
Expand Down
1 change: 1 addition & 0 deletions ImageStatistics/ImageStatistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,6 +1597,7 @@ ImageStatisticsPlugin::changedParam(const InstanceChangedArgs &args,
doAnalyzeLuma = (k != -1);
}
// RGBA analysis
#pragma message WARN("TODO: only fetchImage() the required region.")
if ( (doAnalyzeRGBA || doAnalyzeHSVL || doAnalyzeLuma) && _srcClip && _srcClip->isConnected() ) {
auto_ptr<Image> src( ( _srcClip && _srcClip->isConnected() ) ?
_srcClip->fetchImage(args.time) : 0 );
Expand Down

0 comments on commit 4641187

Please sign in to comment.