summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-10-03 11:11:46 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-03 11:11:46 -0700
commita90deafe482fafe3109668491287c94710c02fdc (patch)
tree510a5db86c9064b0990a8824c2dde98d5fe4e873 /jni
parentd519d3bff76107eda37dfc81b6d1a7c6e0091e42 (diff)
parent317e8c783928e5eddfa7af260218dc36bb47a826 (diff)
downloadLegacyCamera-a90deafe482fafe3109668491287c94710c02fdc.zip
LegacyCamera-a90deafe482fafe3109668491287c94710c02fdc.tar.gz
LegacyCamera-a90deafe482fafe3109668491287c94710c02fdc.tar.bz2
Merge "Reduce the frame memory we allocate."
Diffstat (limited to 'jni')
-rw-r--r--jni/feature_mos_jni.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/jni/feature_mos_jni.cpp b/jni/feature_mos_jni.cpp
index db9fd7d..e3fdea5 100644
--- a/jni/feature_mos_jni.cpp
+++ b/jni/feature_mos_jni.cpp
@@ -38,15 +38,14 @@ extern "C" {
char buffer[1024];
-const int MAX_FRAMES_HR = 100;
-const int MAX_FRAMES_LR = 200;
+const int MAX_FRAMES = 100;
static double mTx;
int tWidth[NR];
int tHeight[NR];
-ImageType tImage[NR][MAX_FRAMES_LR];// = {{ImageUtils::IMAGE_TYPE_NOIMAGE}}; // YVU24 format image
+ImageType tImage[NR][MAX_FRAMES];// = {{ImageUtils::IMAGE_TYPE_NOIMAGE}}; // YVU24 format image
Mosaic *mosaic[NR] = {NULL,NULL};
ImageType resultYVU = ImageUtils::IMAGE_TYPE_NOIMAGE;
ImageType resultBGR = ImageUtils::IMAGE_TYPE_NOIMAGE;
@@ -283,13 +282,10 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_allocateMosaicMem
tWidth[LR] = int(width / H2L_FACTOR);
tHeight[LR] = int(height / H2L_FACTOR);
- for(int i=0; i<MAX_FRAMES_LR; i++)
+ for(int i=0; i<MAX_FRAMES; i++)
{
tImage[LR][i] = ImageUtils::allocateImage(tWidth[LR], tHeight[LR],
ImageUtils::IMAGE_TYPE_NUM_CHANNELS);
- }
- for(int i=0; i<MAX_FRAMES_HR; i++)
- {
tImage[HR][i] = ImageUtils::allocateImage(tWidth[HR], tHeight[HR],
ImageUtils::IMAGE_TYPE_NUM_CHANNELS);
}
@@ -300,12 +296,9 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_allocateMosaicMem
JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_freeMosaicMemory(
JNIEnv* env, jobject thiz)
{
- for(int i = 0; i < MAX_FRAMES_LR; i++)
+ for(int i = 0; i < MAX_FRAMES; i++)
{
ImageUtils::freeImage(tImage[LR][i]);
- }
- for(int i = 0; i < MAX_FRAMES_HR; i++)
- {
ImageUtils::freeImage(tImage[HR][i]);
}
@@ -375,7 +368,7 @@ JNIEXPORT jfloatArray JNICALL Java_com_android_camera_panorama_Mosaic_setSourceI
t0 = now_ms();
int ret_code;
- if(frame_number_HR<MAX_FRAMES_HR && frame_number_LR<MAX_FRAMES_LR)
+ if(frame_number_HR<MAX_FRAMES && frame_number_LR<MAX_FRAMES)
{
double last_tx = mTx;
@@ -428,7 +421,7 @@ JNIEXPORT jfloatArray JNICALL Java_com_android_camera_panorama_Mosaic_setSourceI
int ret_code;
- if(frame_number_HR<MAX_FRAMES_HR && frame_number_LR<MAX_FRAMES_LR)
+ if(frame_number_HR<MAX_FRAMES && frame_number_LR<MAX_FRAMES)
{
jbyte *pixels = env->GetByteArrayElements(photo_data, 0);
@@ -501,7 +494,7 @@ JNIEXPORT void JNICALL Java_com_android_camera_panorama_Mosaic_reset(
gCancelComputation[LR] = false;
gCancelComputation[HR] = false;
- Init(LR,MAX_FRAMES_LR);
+ Init(LR,MAX_FRAMES);
}
JNIEXPORT jint JNICALL Java_com_android_camera_panorama_Mosaic_reportProgress(