Loading app/src/main/java/net/sourceforge/opencamera/HDRProcessor.java +3 −20 Original line number Diff line number Diff line Loading @@ -523,12 +523,6 @@ public class HDRProcessor { } /** Core implementation of HDR algorithm. * Requires Android 4.4 (API level 19, Kitkat), due to using Renderscript without the support libraries. * And we now need Android 5.0 (API level 21, Lollipop) for forEach_Dot with LaunchOptions. * Using the support libraries (set via project.properties renderscript.support.mode) would bloat the APK * by around 1799KB! We don't care about pre-Android 4.4 (HDR requires CameraController2 which requires * Android 5.0 anyway; even if we later added support for CameraController1, we can simply say HDR requires * Android 5.0). */ private void processHDRCore(List<Bitmap> bitmaps, boolean release_bitmaps, Bitmap output_bitmap, boolean assume_sorted, SortCallback sort_cb, float hdr_alpha, int n_tiles, boolean ce_preserve_blacks, TonemappingAlgorithm tonemapping_algorithm) { if( MyDebug.LOG ) Loading Loading @@ -1387,8 +1381,6 @@ public class HDRProcessor { AvgData avg_data = processAvgCore(null, bitmap_avg, bitmap_new, width, height, avg_factor, iso, exposure_time, zoom_factor, time_s); //allocation_avg.copyTo(bitmap_avg); if( MyDebug.LOG ) Log.d(TAG, "### time for processAvg: " + (System.currentTimeMillis() - time_s)); Loading Loading @@ -1420,11 +1412,6 @@ public class HDRProcessor { long time_s = System.currentTimeMillis(); // create allocations /*Allocation allocation_new = Allocation.createFromBitmap(rs, bitmap_new); if( MyDebug.LOG ) Log.d(TAG, "### time after creating allocations from bitmaps: " + (System.currentTimeMillis() - time_s));*/ processAvgCore(avg_data, null, bitmap_new, width, height, avg_factor, iso, exposure_time, zoom_factor, time_s); if( MyDebug.LOG ) Loading Loading @@ -1511,7 +1498,7 @@ public class HDRProcessor { { // use scaled down and/or cropped bitmaps for alignment if( MyDebug.LOG ) Log.d(TAG, "### time before creating allocations for autoalignment: " + (System.currentTimeMillis() - time_s)); Log.d(TAG, "### time before creating bitmaps for autoalignment: " + (System.currentTimeMillis() - time_s)); Matrix align_scale_matrix = new Matrix(); align_scale_matrix.postScale(1.0f/scale_align_size, 1.0f/scale_align_size); full_alignment_width /= scale_align_size; Loading Loading @@ -1558,7 +1545,7 @@ public class HDRProcessor { align_allocations[1] = allocation_new_align; } if( MyDebug.LOG ) Log.d(TAG, "### time after creating allocations for autoalignment: " + (System.currentTimeMillis() - time_s)); Log.d(TAG, "### time after creating bitmaps for autoalignment: " + (System.currentTimeMillis() - time_s)); } // misalignment more likely in "dark" images with more images and/or longer exposures Loading Loading @@ -2348,7 +2335,7 @@ public class HDRProcessor { pixel_step_size = step_size; if( MyDebug.LOG ) { Log.d(TAG, "call alignMTBScript for image: " + i); Log.d(TAG, "call align for image: " + i); Log.d(TAG, " versus base image: " + base_bitmap); Log.d(TAG, "step_size: " + step_size); Log.d(TAG, "pixel_step_size: " + pixel_step_size); Loading Loading @@ -3524,10 +3511,6 @@ public class HDRProcessor { // testAvg43 (55), testAvg44 (82) // tests that are better at 50%: testAvg12 (8), testAvg13 (38), testAvg15 (10), testAvg18 (39), testAvg19 (37) // other tests improved by doing contrast enhancement: testAvg32, testAvg40 //adjustHistogram(allocation_out, allocation_out, width, height, 0.5f, 4, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.25f, 4, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.25f, 1, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.5f, 1, time_s); final int median_lo = 60, median_hi = 35; float alpha = (histogramInfo.median_brightness - median_lo) / (float)(median_hi - median_lo); alpha = Math.max(alpha, 0.0f); Loading app/src/main/java/net/sourceforge/opencamera/ImageSaver.java +0 −2 Original line number Diff line number Diff line Loading @@ -1503,8 +1503,6 @@ public class ImageSaver extends Thread { { try { long time_s = System.currentTimeMillis(); // initialise allocation from first two bitmaps //int inSampleSize = hdrProcessor.getAvgSampleSize(request.jpeg_images.size()); int inSampleSize = hdrProcessor.getAvgSampleSize(request.iso, request.exposure_time); //final boolean use_smp = false; final boolean use_smp = true; Loading app/src/main/java/net/sourceforge/opencamera/JavaImageFunctions.java +0 −21 Original line number Diff line number Diff line Loading @@ -892,11 +892,6 @@ public class JavaImageFunctions { L = diff_r*diff_r + diff_g*diff_g + diff_b*diff_b; } // diff based on compute_diff (separate pass on scaled down alignment bitmaps) //int align_x = x/scale_align_size; //int align_y = y/scale_align_size; //float L = rsGetElementAt_float(allocation_diffs, align_x, align_y); // debug mode: only works if limited to 2 images being merged /*L = sqrt(L); L = fmin(L, 255.0f); Loading Loading @@ -1617,22 +1612,6 @@ public class JavaImageFunctions { break; } } /* // test if( x+offset_x0 < 0 || y+offset_y0 < 0 || x+offset_x0 >= rsAllocationGetDimX(bitmap0) || y+offset_y0 >= rsAllocationGetDimY(bitmap0) ) { out.r = 255; out.g = 0; out.b = 255; out.a = 255; } else if( x+offset_x2 < 0 || y+offset_y2 < 0 || x+offset_x2 >= rsAllocationGetDimX(bitmap2) || y+offset_y2 >= rsAllocationGetDimY(bitmap2) ) { out.r = 255; out.g = 255; out.b = 0; out.a = 255; } */ //return out; } Loading app/src/main/java/net/sourceforge/opencamera/MainActivity.java +1 −6 Original line number Diff line number Diff line Loading @@ -6304,13 +6304,11 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen public boolean supportsDRO() { if( applicationInterface.isRawOnly(MyApplicationInterface.PhotoMode.DRO) ) return false; // if not saving JPEGs, no point having DRO mode, as it won't affect the RAW images // require at least Android 5, for the Renderscript support in HDRProcessor return true; } public boolean supportsHDR() { // we also require the device have sufficient memory to do the processing // also require at least Android 5, for the Renderscript support in HDRProcessor return large_heap_memory >= 128 && preview.supportsExpoBracketing(); } Loading Loading @@ -6340,7 +6338,6 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen if( applicationInterface.isImageCaptureIntent() ) return false; // require 256MB just to be safe, due to the large number of images that may be created // also require at least Android 5, for Renderscript // remember to update the FAQ "Why isn't Panorama supported on my device?" if this changes return large_heap_memory >= 256 && applicationInterface.getGyroSensor().hasSensors(); //return false; // currently blocked for release Loading @@ -6354,8 +6351,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen } public boolean supportsNoiseReduction() { // require at least Android 5, for the Renderscript support in HDRProcessor, but we require // Android 7 to limit to more modern devices (for performance reasons) // we require Android 7 to limit to more modern devices (for performance reasons) return( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && preview.usingCamera2API() && large_heap_memory >= 512 && preview.supportsBurst() && preview.supportsExposureTime() ); //return false; // currently blocked for release } Loading Loading @@ -6383,7 +6379,6 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen public boolean supportsPreviewBitmaps() { // In practice we only use TextureView on Android 5+ (with Camera2 API enabled) anyway, but have put an explicit check here - // even if in future we allow TextureView pre-Android 5, we still need Android 5+ for Renderscript. return preview.getView() instanceof TextureView && large_heap_memory >= 128; } Loading app/src/main/java/net/sourceforge/opencamera/PanoramaProcessor.java +0 −69 Original line number Diff line number Diff line Loading @@ -628,29 +628,13 @@ public class PanoramaProcessor { for(int i=0;i<gaussianPyramid.size()-1;i++) { if( MyDebug.LOG ) Log.d(TAG, "createLaplacianPyramid: i = " + i); //Allocation this_gauss_rs = gaussianPyramid_rs.get(i); Bitmap this_gauss = gaussianPyramid.get(i); //Allocation next_gauss_rs = gaussianPyramid_rs.get(i+1); Bitmap next_gauss = gaussianPyramid.get(i+1); //Allocation next_gauss_expanded_rs = expandBitmap(script, next_gauss); Bitmap next_gauss_expanded = expandBitmap(next_gauss); if( MyDebug.LOG ) Log.d(TAG, "### createLaplacianPyramid: time after expandBitmap for level " + i + ": " + (System.currentTimeMillis() - time_s)); /*if( MyDebug.LOG ) { // debug saveAllocation(name + "_this_gauss_" + i + ".jpg", this_gauss); saveAllocation(name + "_next_gauss_expanded_" + i + ".jpg", next_gauss_expanded); }*/ //Allocation next_gauss_expanded_rs = Allocation.createFromBitmap(rs, next_gauss_expanded); //Allocation difference = subtractBitmapRS(script, this_gauss_rs, next_gauss_expanded_rs); float [] difference_rgbf = subtractBitmap(this_gauss, next_gauss_expanded); /*Allocation difference = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), this_gauss.getWidth(), this_gauss.getHeight())); HDRProcessor.RGBfToAllocation(difference_rgbf, difference, this_gauss.getWidth(), this_gauss.getHeight()); pyramid.add(difference); //pyramid.add(this_gauss); */ pyramid.addDiff(difference_rgbf, this_gauss.getWidth(), this_gauss.getHeight()); if( MyDebug.LOG ) Log.d(TAG, "### createLaplacianPyramid: time after subtractBitmap for level " + i + ": " + (System.currentTimeMillis() - time_s)); Loading Loading @@ -1074,20 +1058,6 @@ public class PanoramaProcessor { saveBitmap(lhs, "lhs.jpg"); saveBitmap(rhs, "rhs.jpg"); }*/ // debug /*if( MyDebug.LOG ) { List<Allocation> lhs_pyramid = createGaussianPyramid(script, lhs, blend_n_levels); List<Allocation> rhs_pyramid = createGaussianPyramid(script, rhs, blend_n_levels); savePyramid("lhs_gauss", lhs_pyramid); savePyramid("rhs_gauss", rhs_pyramid); for(Allocation allocation : lhs_pyramid) { allocation.destroy(); } for(Allocation allocation : rhs_pyramid) { allocation.destroy(); } }*/ if( lhs.getWidth() != rhs.getWidth() || lhs.getHeight() != rhs.getHeight() ) { Log.e(TAG, "lhs/rhs bitmaps of different dimensions"); Loading Loading @@ -1231,49 +1201,10 @@ public class PanoramaProcessor { if( MyDebug.LOG ) Log.d(TAG, "### blendPyramids: time after createLaplacianPyramid 2nd call: " + (System.currentTimeMillis() - time_s)); /*{ lhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<lhs_pyramid.diffs.size();i++) { float [] difference_rgbf = lhs_pyramid.diffs.get(i); int width = lhs_pyramid.widths.get(i); int height = lhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); lhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, lhs_pyramid.top_level); lhs_pyramid_rs.add(allocation); } { rhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<rhs_pyramid.diffs.size();i++) { float [] difference_rgbf = rhs_pyramid.diffs.get(i); int width = rhs_pyramid.widths.get(i); int height = rhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); rhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, rhs_pyramid.top_level); rhs_pyramid_rs.add(allocation); }*/ mergePyramids(lhs_pyramid, rhs_pyramid, best_path, best_path_n_x); if( MyDebug.LOG ) Log.d(TAG, "### blendPyramids: time after mergePyramids: " + (System.currentTimeMillis() - time_s)); /*{ lhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<lhs_pyramid.diffs.size();i++) { float [] difference_rgbf = lhs_pyramid.diffs.get(i); int width = lhs_pyramid.widths.get(i); int height = lhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); lhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, lhs_pyramid.top_level); lhs_pyramid_rs.add(allocation); }*/ merged_bitmap = collapseLaplacianPyramid(lhs_pyramid); if( MyDebug.LOG ) Loading Loading
app/src/main/java/net/sourceforge/opencamera/HDRProcessor.java +3 −20 Original line number Diff line number Diff line Loading @@ -523,12 +523,6 @@ public class HDRProcessor { } /** Core implementation of HDR algorithm. * Requires Android 4.4 (API level 19, Kitkat), due to using Renderscript without the support libraries. * And we now need Android 5.0 (API level 21, Lollipop) for forEach_Dot with LaunchOptions. * Using the support libraries (set via project.properties renderscript.support.mode) would bloat the APK * by around 1799KB! We don't care about pre-Android 4.4 (HDR requires CameraController2 which requires * Android 5.0 anyway; even if we later added support for CameraController1, we can simply say HDR requires * Android 5.0). */ private void processHDRCore(List<Bitmap> bitmaps, boolean release_bitmaps, Bitmap output_bitmap, boolean assume_sorted, SortCallback sort_cb, float hdr_alpha, int n_tiles, boolean ce_preserve_blacks, TonemappingAlgorithm tonemapping_algorithm) { if( MyDebug.LOG ) Loading Loading @@ -1387,8 +1381,6 @@ public class HDRProcessor { AvgData avg_data = processAvgCore(null, bitmap_avg, bitmap_new, width, height, avg_factor, iso, exposure_time, zoom_factor, time_s); //allocation_avg.copyTo(bitmap_avg); if( MyDebug.LOG ) Log.d(TAG, "### time for processAvg: " + (System.currentTimeMillis() - time_s)); Loading Loading @@ -1420,11 +1412,6 @@ public class HDRProcessor { long time_s = System.currentTimeMillis(); // create allocations /*Allocation allocation_new = Allocation.createFromBitmap(rs, bitmap_new); if( MyDebug.LOG ) Log.d(TAG, "### time after creating allocations from bitmaps: " + (System.currentTimeMillis() - time_s));*/ processAvgCore(avg_data, null, bitmap_new, width, height, avg_factor, iso, exposure_time, zoom_factor, time_s); if( MyDebug.LOG ) Loading Loading @@ -1511,7 +1498,7 @@ public class HDRProcessor { { // use scaled down and/or cropped bitmaps for alignment if( MyDebug.LOG ) Log.d(TAG, "### time before creating allocations for autoalignment: " + (System.currentTimeMillis() - time_s)); Log.d(TAG, "### time before creating bitmaps for autoalignment: " + (System.currentTimeMillis() - time_s)); Matrix align_scale_matrix = new Matrix(); align_scale_matrix.postScale(1.0f/scale_align_size, 1.0f/scale_align_size); full_alignment_width /= scale_align_size; Loading Loading @@ -1558,7 +1545,7 @@ public class HDRProcessor { align_allocations[1] = allocation_new_align; } if( MyDebug.LOG ) Log.d(TAG, "### time after creating allocations for autoalignment: " + (System.currentTimeMillis() - time_s)); Log.d(TAG, "### time after creating bitmaps for autoalignment: " + (System.currentTimeMillis() - time_s)); } // misalignment more likely in "dark" images with more images and/or longer exposures Loading Loading @@ -2348,7 +2335,7 @@ public class HDRProcessor { pixel_step_size = step_size; if( MyDebug.LOG ) { Log.d(TAG, "call alignMTBScript for image: " + i); Log.d(TAG, "call align for image: " + i); Log.d(TAG, " versus base image: " + base_bitmap); Log.d(TAG, "step_size: " + step_size); Log.d(TAG, "pixel_step_size: " + pixel_step_size); Loading Loading @@ -3524,10 +3511,6 @@ public class HDRProcessor { // testAvg43 (55), testAvg44 (82) // tests that are better at 50%: testAvg12 (8), testAvg13 (38), testAvg15 (10), testAvg18 (39), testAvg19 (37) // other tests improved by doing contrast enhancement: testAvg32, testAvg40 //adjustHistogram(allocation_out, allocation_out, width, height, 0.5f, 4, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.25f, 4, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.25f, 1, time_s); //adjustHistogram(allocation_out, allocation_out, width, height, 0.5f, 1, time_s); final int median_lo = 60, median_hi = 35; float alpha = (histogramInfo.median_brightness - median_lo) / (float)(median_hi - median_lo); alpha = Math.max(alpha, 0.0f); Loading
app/src/main/java/net/sourceforge/opencamera/ImageSaver.java +0 −2 Original line number Diff line number Diff line Loading @@ -1503,8 +1503,6 @@ public class ImageSaver extends Thread { { try { long time_s = System.currentTimeMillis(); // initialise allocation from first two bitmaps //int inSampleSize = hdrProcessor.getAvgSampleSize(request.jpeg_images.size()); int inSampleSize = hdrProcessor.getAvgSampleSize(request.iso, request.exposure_time); //final boolean use_smp = false; final boolean use_smp = true; Loading
app/src/main/java/net/sourceforge/opencamera/JavaImageFunctions.java +0 −21 Original line number Diff line number Diff line Loading @@ -892,11 +892,6 @@ public class JavaImageFunctions { L = diff_r*diff_r + diff_g*diff_g + diff_b*diff_b; } // diff based on compute_diff (separate pass on scaled down alignment bitmaps) //int align_x = x/scale_align_size; //int align_y = y/scale_align_size; //float L = rsGetElementAt_float(allocation_diffs, align_x, align_y); // debug mode: only works if limited to 2 images being merged /*L = sqrt(L); L = fmin(L, 255.0f); Loading Loading @@ -1617,22 +1612,6 @@ public class JavaImageFunctions { break; } } /* // test if( x+offset_x0 < 0 || y+offset_y0 < 0 || x+offset_x0 >= rsAllocationGetDimX(bitmap0) || y+offset_y0 >= rsAllocationGetDimY(bitmap0) ) { out.r = 255; out.g = 0; out.b = 255; out.a = 255; } else if( x+offset_x2 < 0 || y+offset_y2 < 0 || x+offset_x2 >= rsAllocationGetDimX(bitmap2) || y+offset_y2 >= rsAllocationGetDimY(bitmap2) ) { out.r = 255; out.g = 255; out.b = 0; out.a = 255; } */ //return out; } Loading
app/src/main/java/net/sourceforge/opencamera/MainActivity.java +1 −6 Original line number Diff line number Diff line Loading @@ -6304,13 +6304,11 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen public boolean supportsDRO() { if( applicationInterface.isRawOnly(MyApplicationInterface.PhotoMode.DRO) ) return false; // if not saving JPEGs, no point having DRO mode, as it won't affect the RAW images // require at least Android 5, for the Renderscript support in HDRProcessor return true; } public boolean supportsHDR() { // we also require the device have sufficient memory to do the processing // also require at least Android 5, for the Renderscript support in HDRProcessor return large_heap_memory >= 128 && preview.supportsExpoBracketing(); } Loading Loading @@ -6340,7 +6338,6 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen if( applicationInterface.isImageCaptureIntent() ) return false; // require 256MB just to be safe, due to the large number of images that may be created // also require at least Android 5, for Renderscript // remember to update the FAQ "Why isn't Panorama supported on my device?" if this changes return large_heap_memory >= 256 && applicationInterface.getGyroSensor().hasSensors(); //return false; // currently blocked for release Loading @@ -6354,8 +6351,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen } public boolean supportsNoiseReduction() { // require at least Android 5, for the Renderscript support in HDRProcessor, but we require // Android 7 to limit to more modern devices (for performance reasons) // we require Android 7 to limit to more modern devices (for performance reasons) return( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && preview.usingCamera2API() && large_heap_memory >= 512 && preview.supportsBurst() && preview.supportsExposureTime() ); //return false; // currently blocked for release } Loading Loading @@ -6383,7 +6379,6 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen public boolean supportsPreviewBitmaps() { // In practice we only use TextureView on Android 5+ (with Camera2 API enabled) anyway, but have put an explicit check here - // even if in future we allow TextureView pre-Android 5, we still need Android 5+ for Renderscript. return preview.getView() instanceof TextureView && large_heap_memory >= 128; } Loading
app/src/main/java/net/sourceforge/opencamera/PanoramaProcessor.java +0 −69 Original line number Diff line number Diff line Loading @@ -628,29 +628,13 @@ public class PanoramaProcessor { for(int i=0;i<gaussianPyramid.size()-1;i++) { if( MyDebug.LOG ) Log.d(TAG, "createLaplacianPyramid: i = " + i); //Allocation this_gauss_rs = gaussianPyramid_rs.get(i); Bitmap this_gauss = gaussianPyramid.get(i); //Allocation next_gauss_rs = gaussianPyramid_rs.get(i+1); Bitmap next_gauss = gaussianPyramid.get(i+1); //Allocation next_gauss_expanded_rs = expandBitmap(script, next_gauss); Bitmap next_gauss_expanded = expandBitmap(next_gauss); if( MyDebug.LOG ) Log.d(TAG, "### createLaplacianPyramid: time after expandBitmap for level " + i + ": " + (System.currentTimeMillis() - time_s)); /*if( MyDebug.LOG ) { // debug saveAllocation(name + "_this_gauss_" + i + ".jpg", this_gauss); saveAllocation(name + "_next_gauss_expanded_" + i + ".jpg", next_gauss_expanded); }*/ //Allocation next_gauss_expanded_rs = Allocation.createFromBitmap(rs, next_gauss_expanded); //Allocation difference = subtractBitmapRS(script, this_gauss_rs, next_gauss_expanded_rs); float [] difference_rgbf = subtractBitmap(this_gauss, next_gauss_expanded); /*Allocation difference = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), this_gauss.getWidth(), this_gauss.getHeight())); HDRProcessor.RGBfToAllocation(difference_rgbf, difference, this_gauss.getWidth(), this_gauss.getHeight()); pyramid.add(difference); //pyramid.add(this_gauss); */ pyramid.addDiff(difference_rgbf, this_gauss.getWidth(), this_gauss.getHeight()); if( MyDebug.LOG ) Log.d(TAG, "### createLaplacianPyramid: time after subtractBitmap for level " + i + ": " + (System.currentTimeMillis() - time_s)); Loading Loading @@ -1074,20 +1058,6 @@ public class PanoramaProcessor { saveBitmap(lhs, "lhs.jpg"); saveBitmap(rhs, "rhs.jpg"); }*/ // debug /*if( MyDebug.LOG ) { List<Allocation> lhs_pyramid = createGaussianPyramid(script, lhs, blend_n_levels); List<Allocation> rhs_pyramid = createGaussianPyramid(script, rhs, blend_n_levels); savePyramid("lhs_gauss", lhs_pyramid); savePyramid("rhs_gauss", rhs_pyramid); for(Allocation allocation : lhs_pyramid) { allocation.destroy(); } for(Allocation allocation : rhs_pyramid) { allocation.destroy(); } }*/ if( lhs.getWidth() != rhs.getWidth() || lhs.getHeight() != rhs.getHeight() ) { Log.e(TAG, "lhs/rhs bitmaps of different dimensions"); Loading Loading @@ -1231,49 +1201,10 @@ public class PanoramaProcessor { if( MyDebug.LOG ) Log.d(TAG, "### blendPyramids: time after createLaplacianPyramid 2nd call: " + (System.currentTimeMillis() - time_s)); /*{ lhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<lhs_pyramid.diffs.size();i++) { float [] difference_rgbf = lhs_pyramid.diffs.get(i); int width = lhs_pyramid.widths.get(i); int height = lhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); lhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, lhs_pyramid.top_level); lhs_pyramid_rs.add(allocation); } { rhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<rhs_pyramid.diffs.size();i++) { float [] difference_rgbf = rhs_pyramid.diffs.get(i); int width = rhs_pyramid.widths.get(i); int height = rhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); rhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, rhs_pyramid.top_level); rhs_pyramid_rs.add(allocation); }*/ mergePyramids(lhs_pyramid, rhs_pyramid, best_path, best_path_n_x); if( MyDebug.LOG ) Log.d(TAG, "### blendPyramids: time after mergePyramids: " + (System.currentTimeMillis() - time_s)); /*{ lhs_pyramid_rs = new ArrayList<>(); for(int i=0;i<lhs_pyramid.diffs.size();i++) { float [] difference_rgbf = lhs_pyramid.diffs.get(i); int width = lhs_pyramid.widths.get(i); int height = lhs_pyramid.heights.get(i); Allocation allocation = Allocation.createTyped(rs, Type.createXY(rs, Element.F32_3(rs), width, height)); HDRProcessor.RGBfToAllocation(difference_rgbf, allocation, width, height); lhs_pyramid_rs.add(allocation); } Allocation allocation = Allocation.createFromBitmap(rs, lhs_pyramid.top_level); lhs_pyramid_rs.add(allocation); }*/ merged_bitmap = collapseLaplacianPyramid(lhs_pyramid); if( MyDebug.LOG ) Loading