DngCreator: Improve black level support; avoid large stack allocation
- Switch the BlackLevel entry to be RATIONAL
- Switch to heap allocation instead of stack allocation for lens
shading map construction
- Add orientation enums for convenience
Bug: 25862995
Bug: 27073274
Change-Id: I7031a33c4797dc8b2c8030d26b749066e03bff9e
diff --git a/media/img_utils/src/DngUtils.cpp b/media/img_utils/src/DngUtils.cpp
index 9473dce..9dc5f05 100644
--- a/media/img_utils/src/DngUtils.cpp
+++ b/media/img_utils/src/DngUtils.cpp
@@ -18,6 +18,7 @@
#include <inttypes.h>
+#include <vector>
#include <math.h>
namespace android {
@@ -63,10 +64,17 @@
double spacingV = 1.0 / lsmHeight;
double spacingH = 1.0 / lsmWidth;
- float redMap[lsmWidth * lsmHeight];
- float greenEvenMap[lsmWidth * lsmHeight];
- float greenOddMap[lsmWidth * lsmHeight];
- float blueMap[lsmWidth * lsmHeight];
+ std::vector<float> redMapVector(lsmWidth * lsmHeight);
+ float *redMap = redMapVector.data();
+
+ std::vector<float> greenEvenMapVector(lsmWidth * lsmHeight);
+ float *greenEvenMap = greenEvenMapVector.data();
+
+ std::vector<float> greenOddMapVector(lsmWidth * lsmHeight);
+ float *greenOddMap = greenOddMapVector.data();
+
+ std::vector<float> blueMapVector(lsmWidth * lsmHeight);
+ float *blueMap = blueMapVector.data();
size_t lsmMapSize = lsmWidth * lsmHeight * 4;