summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorjunjiez <junjiez@codeaurora.org>2016-11-28 14:09:34 +0800
committerjunjiez <junjiez@codeaurora.org>2016-11-29 10:42:55 +0800
commit6ca2ccc20d75ac92e2423c71e03d04a579838050 (patch)
tree9604eda3750fca000f8b77dbf79bc63bbfceb4a6 /rs
parenteba671dc09fd92c345868655f7a20571b09d1e95 (diff)
downloadandroid_packages_apps_Snap-6ca2ccc20d75ac92e2423c71e03d04a579838050.tar.gz
android_packages_apps_Snap-6ca2ccc20d75ac92e2423c71e03d04a579838050.tar.bz2
android_packages_apps_Snap-6ca2ccc20d75ac92e2423c71e03d04a579838050.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')
-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;