Skip to content

Commit

Permalink
Close CFAReader once we are done with it
Browse files Browse the repository at this point in the history
Signed-off-by: Yan Burman <yanburman@users.noreply.github.com>
  • Loading branch information
yanburman committed Jul 14, 2016
1 parent b1b2ff3 commit d10fab1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/DNGConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,24 +328,26 @@ dng_error_code DNGConverter::ConvertToDNG(const std::string &m_szInputFile, cons
// BAYER input file settings
// -------------------------------------------------------------

CFAReader reader;
ret = reader.open(m_szInputFile.c_str(), oCamProfile->m_ulFileSize);
if (ret)
return dng_error_unknown;

unsigned int ulNumPixels = oCamProfile->m_ulWidth * oCamProfile->m_ulHeight;
AutoPtr<dng_memory_block> oBayerData(oDNGHost.Allocate(ulNumPixels * TagTypeSize(ttShort)));

{
CFAReader reader;
ret = reader.open(m_szInputFile.c_str(), oCamProfile->m_ulFileSize);
if (ret)
return dng_error_unknown;

#ifdef TIME_PROFILE
oProfiler.reset();
oProfiler.run();
oProfiler.reset();
oProfiler.run();
#endif
reader.read((uint8_t *)oBayerData->Buffer(), ulNumPixels);
reader.read((uint8_t *)oBayerData->Buffer(), ulNumPixels);

#ifdef TIME_PROFILE
oProfiler.stop();
printf("CFAReader::read() time: %lu usec\n", oProfiler.elapsed_usec());
oProfiler.stop();
printf("CFAReader::read() time: %lu usec\n", oProfiler.elapsed_usec());
#endif
}

// -------------------------------------------------------------
// DNG Host Settings
Expand Down

0 comments on commit d10fab1

Please sign in to comment.