CTS test failed ----- android.graphics.cts.YuvImageTest#testCompressYuvToJpeg

    技术2022-05-18  9

    From:http://code.google.com/p/android/issues/detail?id=11290 Reported by udaykira...@gmail.com, Sep 16, 2010 Below test was executed on emulator. cts_host > start test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg ============================================================== Test package: android.graphics android.graphics.cts.YuvImageTest#testCompressYuvToJpeg........................(fail) junit.framework.AssertionFailedError: MSE too large for normal case: 850.3241935483871 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) ============================================================== Time: 9388.689s ************************************************************************** Second Trial on another PC. ============================ result for standard android2.2 sdk njred202:/remoterepo/a20234/venus2/sdk_upload/android-cts[1009] $ ./tools/startcts Android CTS version 2.2_r2 Device(emulator-5554) connected cts_host > start --plan CTS -t android.graphics.cts.YuvImageTest#testCompressYuvToJpeg cts_host > start test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg ============================================================== Test package: android.graphics android.graphics.cts.YuvImageTest#testCompressYuvToJpeg....(fail) junit.framework.AssertionFailedError: MSE too large for normal case: 850.3241935483871 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) ============================================================== Time: 2557.41s ************************************************************************ Third Trial on another PC. ============================ cts_host > result for venus2 sdk: njred202:/remoterepo/a20234/venus2/sdk_upload/android-cts[1007] $ ./tools/startcts Android CTS version 2.2_r2 Device(emulator-5554) connected cts_host > cts_host > start --plan CTS -t android.graphics.cts.YuvImageTest#testCompressYuvToJpeg start test android.graphics.cts.YuvImageTest#testCompressYuvToJpeg ============================================================== Test package: android.graphics android.graphics.cts.YuvImageTest#testCompressYuvToJpeg....(fail) junit.framework.AssertionFailedError: MSE too large for normal case: 849.296370967742 at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) at android.graphics.cts.YuvImageTest.compareBitmaps(YuvImageTest.java:355) at android.graphics.cts.YuvImageTest.compressRects(YuvImageTest.java:251) at android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447) ============================================================== Time: 1834.855s Comment 1 by project member e...@google.com, Sep 20, 2010 (No comment was entered for this change.) Owner: btm...@android.com Comment 2 by khanhlv...@gmail.com, Nov 14, 2010 I also get the same problem. Does anyone have solution and what is the cause? Comment 3 by myamase...@gmail.com, Nov 14, 2010 Hello. I get the same problem. I applied the patch (A). So this test passed! (A) http://android.git.kernel.org/?p=platform/cts.git;a=commit;h=cac69966080b824fe6c10a011f7d2658681ae8de Comment 4 by project member btm...@android.com, Nov 15, 2010 Yes, that patch should fix things. It will included in the next release. Status: FutureRelease Comment 5 by t4tina...@gmail.com, Nov 15, 2010 android.graphics.cts.YuvImageTest.testCompressYuvToJpeg(YuvImageTest.java:189) at this line we pass two copies of the same rect[l], so effectively the altered code is doing the same job as that of unchanged code.. how is this fix solving the issue? Comment 6 by project member btm...@android.com, Nov 16, 2010 t4tina007, the compressRects method (line 243) changed to pass in a different argument to compareBitmaps (line 255) depending on whether or not the rect1 and rect2 arguments passed to compressRects was the same. Beyond that, I can't tell you much, since this is not my area of expertise. However, here is what the reviewer commented before approving it: "...the issue is that the requested rectangle region for doing the YuvToJpeg compression may be adjusted in the cases that the left-top point of the region is located in odd-indexed position. In such cases, the rectangle in the golden test image should be adjusted accordingly." 看看补丁最新的补丁:比较一下新、旧YuvImageTest.java的不同。 修改后,测试通过! 个人觉得是因为 actual = compressDecompress(image, rect2),当rect2的left,top是奇数时,这一句会将rect2的left,top改变。 此时而rect1和rect2是指向同一个的,所以rect1在被compressToJpeg()后,其left,top也会改变,由(11,11)变成(10,10) diff -u /source/android-2.2/cts/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java /home/yhluo/tmp/YuvImageTest_new.txt--- /source/android-2.2/cts/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java 2010-12-02 03:49:41.000000000 +0800+++ /home/yhluo/tmp/YuvImageTest_new.txt 2011-03-24 14:58:59.000000000 +0800@@ -245,9 +245,13 @@         Bitmap expected = null;         Bitmap actual = null;         boolean sameRect = rect1.equals(rect2) ? true : false;-        expected = Bitmap.createBitmap(testBitmap, rect1.left, rect1.top,-                rect1.width(), rect1.height());-        actual = compressDecompress(image, rect2);++  Rect actualRect = new Rect(rect2);+        actual = compressDecompress(image, actualRect);++        Rect expectedRect = sameRect ? actualRect : rect1;+        expected = Bitmap.createBitmap(testBitmap, expectedRect.left, expectedRect.top, expectedRect.width(), expectedRect.height());+                 compareBitmaps(expected, actual, mMseMargin, sameRect);     } @@ -422,3 +426,4 @@         }     } }+

    最新回复(0)