summaryrefslogtreecommitdiffstats
path: root/rs/rotator.rs
diff options
context:
space:
mode:
authorjunjiez <junjiez@codeaurora.org>2016-11-28 14:09:34 +0800
committerArne Coucheron <arco68@gmail.com>2017-06-13 07:18:39 +0200
commit9d21c697f4bd8f62892c374e993ff41d6d98722b (patch)
tree6bb1e9c1ffe182fda3ac116aa81203e6eaa18f22 /rs/rotator.rs
parentcc08b441ef6e94b95babc9f93420798bc6f52311 (diff)
downloadandroid_packages_apps_Snap-9d21c697f4bd8f62892c374e993ff41d6d98722b.tar.gz
android_packages_apps_Snap-9d21c697f4bd8f62892c374e993ff41d6d98722b.tar.bz2
android_packages_apps_Snap-9d21c697f4bd8f62892c374e993ff41d6d98722b.zip
SnapdragonCamera: Fix preview is flipped on 8996
Modidfy render script to implement flip another way not 90 according to the camera mounting position. Change-Id: Id6b305fd2b00bc4193f1ba73d4253794e04ee3a6 CRs-Fixed: 1087483
Diffstat (limited to 'rs/rotator.rs')
-rwxr-xr-x[-rw-r--r--]rs/rotator.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/rs/rotator.rs b/rs/rotator.rs
index 5a27e00f7..2c57951d6 100644..100755
--- a/rs/rotator.rs
+++ b/rs/rotator.rs
@@ -35,32 +35,42 @@ rs_allocation gIn;
uint32_t width;
uint32_t height;
uint32_t pad;
-bool gFlip;
+uint32_t degree;
uchar __attribute__((kernel)) rotate90andMerge(uint32_t x, uint32_t y) {
uchar yValue = rsGetElementAt_uchar(gIn, x + y*width);
- if(gFlip) {
+ if(degree == 180) {
if(x >= width - pad)
return (uchar)0;
rsSetElementAt_uchar(gOut, yValue, (width-1-x-pad)*height + height - 1 - y);
- } else {
+ } else if (degree == 90) {
rsSetElementAt_uchar(gOut, yValue, x*height + height - 1 - y);
+ } else if (degree == 270) {
+ if(x >= width - pad)
+ return (uchar)0;
+ rsSetElementAt_uchar(gOut, yValue, (width-1-x-pad)*height + y);
}
+
if(x%2 == 0 && y%2 == 0) {
uint32_t ySize = width*height;
uint32_t index = ySize + x + ((y/2) * width);
uchar vValue = rsGetElementAt_uchar(gIn, index);
uchar uValue = rsGetElementAt_uchar(gIn, index + 1);
- if(gFlip) {
+ if(degree == 180) {
if(x >= width - pad)
return (uchar)0;
rsSetElementAt_uchar(gOut, uValue, ySize + (width-2-x-pad)/2*height + height - 1 - y);
rsSetElementAt_uchar(gOut, vValue, ySize + (width-2-x-pad)/2*height + height - 1 - y - 1);
- } else {
+ } else if (degree == 90) {
rsSetElementAt_uchar(gOut, uValue, ySize + x/2*height + height - 1 - y);
rsSetElementAt_uchar(gOut, vValue, ySize + x/2*height + height - 1 - y - 1);
+ } else if (degree == 270) {
+ if(x >= (width - pad))
+ 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);
}
}
return (uchar)0;