From 797e9efbb608b95ed8ef297d2552e99a59a92c60 Mon Sep 17 00:00:00 2001 From: junjiez Date: Wed, 7 Dec 2016 15:44:46 +0800 Subject: SnapdragonCamera:Fix front camera preview flipped Modidfy render script to implement new flip way according to the front camera mounting position. Change-Id: I5681447aa17c0499bcb7dc47eef6d4793ee68818 CRs-Fixed: 1097179 --- rs/rotator.rs | 9 +++++++++ src/com/android/camera/imageprocessor/FrameProcessor.java | 3 +++ 2 files changed, 12 insertions(+) diff --git a/rs/rotator.rs b/rs/rotator.rs index 2c57951d6..62257d2cf 100755 --- a/rs/rotator.rs +++ b/rs/rotator.rs @@ -50,6 +50,10 @@ uchar __attribute__((kernel)) rotate90andMerge(uint32_t x, uint32_t y) { if(x >= width - pad) return (uchar)0; rsSetElementAt_uchar(gOut, yValue, (width-1-x-pad)*height + y); + } else if (degree == 0) { + if(x >= width - pad) + return (uchar)0; + rsSetElementAt_uchar(gOut, yValue, x*height + y); } @@ -71,6 +75,11 @@ uchar __attribute__((kernel)) rotate90andMerge(uint32_t x, uint32_t y) { return (uchar)0; rsSetElementAt_uchar(gOut, uValue, ySize + (width-1-x-pad)/2*height + y -1); rsSetElementAt_uchar(gOut, vValue, ySize + (width-1-x-pad)/2*height + y); + } else if (degree == 0) { + if(x >= (width - pad)) + return (uchar)0; + rsSetElementAt_uchar(gOut, uValue, ySize + x/2*height + y - 1); + rsSetElementAt_uchar(gOut, vValue, ySize + x/2*height + y); } } return (uchar)0; diff --git a/src/com/android/camera/imageprocessor/FrameProcessor.java b/src/com/android/camera/imageprocessor/FrameProcessor.java index 5dc50c4e5..519d77458 100755 --- a/src/com/android/camera/imageprocessor/FrameProcessor.java +++ b/src/com/android/camera/imageprocessor/FrameProcessor.java @@ -160,6 +160,9 @@ public class FrameProcessor { if(mModule.getMainCameraCharacteristics() != null) { degree = mModule.getMainCameraCharacteristics(). get(CameraCharacteristics.SENSOR_ORIENTATION); + if (mModule.getMainCameraId() == CaptureModule.FRONT_ID) { + degree = Math.abs(degree - 90); + } } mRsRotator.set_degree(degree); mRsYuvToRGB.set_gIn(mProcessAllocation); -- cgit v1.2.3