Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8796ed8 authored by Mark Harman's avatar Mark Harman
Browse files

Fixed possible misalignment for HDR scenes with very bright or very dark...

Fixed possible misalignment for HDR scenes with very bright or very dark images; new testHDR61 for this.
parent c49d660d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ FIXED Photos would sometimes fail to save on some devices with Storage Access
        Camera2 API).
FIXED   Fix for HDR scenes with both very bright and very dark regions, result would be over
        exposed.
FIXED   Fixed possible misalignment for HDR scenes with very bright or very dark images.
FIXED   Corrupt videos could be left over if video failed to start.
FIXED   Possible problem taking photos on some devices with LIMITED Camera2 API support.
FIXED   Possible problem with default edge mode and noise reduction mode behaviours on some devices
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class HDRTests {
        suite.addTest(TestSuite.createTest(MainActivityTest.class, "testHDR58"));
        suite.addTest(TestSuite.createTest(MainActivityTest.class, "testHDR59"));
        suite.addTest(TestSuite.createTest(MainActivityTest.class, "testHDR60"));
        suite.addTest(TestSuite.createTest(MainActivityTest.class, "testHDR61"));
        return suite;
    }
}
+24 −1
Original line number Diff line number Diff line
@@ -13554,7 +13554,8 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        //checkHistogramDetails(hdrHistogramDetails, 3, 101, 251);
        //checkHistogramDetails(hdrHistogramDetails, 3, 109, 251);
        checkHistogramDetails(hdrHistogramDetails, 6, 111, 252);
        //checkHistogramDetails(hdrHistogramDetails, 6, 111, 252);
        checkHistogramDetails(hdrHistogramDetails, 2, 111, 252);
    }
    /** Tests HDR algorithm on test samples "testHDR33".
@@ -14336,6 +14337,28 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        //checkHistogramDetails(hdrHistogramDetails, 0, 75, 255);
    }
    /** Tests HDR algorithm on test samples "testHDR61".
     */
    public void testHDR61() throws IOException, InterruptedException {
        Log.d(TAG, "testHDR61");
        setToDefault();
        // list assets
        List<Bitmap> inputs = new ArrayList<>();
        inputs.add( getBitmapFromFile(hdr_images_path + "testHDR61/IMG_20191111_145230_0.jpg") );
        inputs.add( getBitmapFromFile(hdr_images_path + "testHDR61/IMG_20191111_145230_1.jpg") );
        inputs.add( getBitmapFromFile(hdr_images_path + "testHDR61/IMG_20191111_145230_2.jpg") );
        HistogramDetails hdrHistogramDetails = subTestHDR(inputs, "testHDR61_output.jpg", false, 50, 1000000000L/5025);
        checkHistogramDetails(hdrHistogramDetails, 0, 86, 254);
        int [] exp_offsets_x = {0, 0, 1};
        int [] exp_offsets_y = {0, 0, -2};
        checkHDROffsets(exp_offsets_x, exp_offsets_y);
    }
    /** Tests HDR algorithm on test samples "testHDRtemp".
     *  Used for one-off testing, or to recreate HDR images from the base exposures to test an updated alorithm.
     *  The test images should be copied to the test device into DCIM/testOpenCamera/testdata/hdrsamples/testHDRtemp/ .
+10 −0
Original line number Diff line number Diff line
@@ -1898,6 +1898,16 @@ public class HDRProcessor {

            mtb_allocations[i] = Allocation.createTyped(rs, Type.createXY(rs, Element.U8(rs), mtb_width, mtb_height));

            // avoid too low/high median_values, otherwise we'll detect dark or light pixels as "noisy" - needed for testHDR61
            final int min_diff_c = 4; // should be same value as in create_mtb.rs/create_mtb()
            /*if( median_value < min_diff_c+1 || median_value > 255-(min_diff_c+1) ) {
                throw new RuntimeException("image " + i + " has median_value: " + median_value); // test
            }*/
            median_value = Math.max(median_value, min_diff_c+1);
            median_value = Math.min(median_value, 255-(min_diff_c+1));
            if( MyDebug.LOG )
                Log.d(TAG, i + ": median_value is now: " + median_value);

            // set parameters
            if( use_mtb )
                createMTBScript.set_median_value(median_value);
+1 −1
Original line number Diff line number Diff line
@@ -1107,7 +1107,7 @@ public class ImageSaver extends Thread {
                default:
                    // Using local contrast enhancement helps scenes where the dynamic range is very large, which tends to be when we choose
                    // a short exposure time, due to fixing problems where some regions are too dark.
                    // This helps: testHDR11, testHDR19, testHDR34, testHDR53.
                    // This helps: testHDR11, testHDR19, testHDR34, testHDR53, testHDR61.
                    // Using local contrast enhancement in all cases can increase noise in darker scenes. This problem would occur
                    // (if we used local contrast enhancement) is: testHDR2, testHDR12, testHDR17, testHDR43, testHDR50, testHDR51,
                    // testHDR54, testHDR55, testHDR56.
Loading