summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorJack Yoo <jyoo@codeaurora.org>2016-05-10 14:11:19 -0700
committerJack Yoo <jyoo@codeaurora.org>2016-06-08 14:22:28 -0700
commit53cd3dd1a139d495fe25d06d439bd8fd0ea1d683 (patch)
tree9f5a48e869e2e7318cfd6e7da5e72a7438963b58 /rs
parentcea7d5bfe6694009d7d4fa97e8bedaca8aff3e32 (diff)
downloadandroid_packages_apps_Snap-53cd3dd1a139d495fe25d06d439bd8fd0ea1d683.zip
android_packages_apps_Snap-53cd3dd1a139d495fe25d06d439bd8fd0ea1d683.tar.gz
android_packages_apps_Snap-53cd3dd1a139d495fe25d06d439bd8fd0ea1d683.tar.bz2
SnapdragonCamera: Sharpshooter post filter
Adding Sharpshooter post process filter Change-Id: I8f3c1962db437e7dfbe2973f806a3f9a26480eb7 CRs-Fixed: 1023183
Diffstat (limited to 'rs')
-rw-r--r--rs/YuvToRgb.rs6
-rw-r--r--rs/rotator.rs24
2 files changed, 23 insertions, 7 deletions
diff --git a/rs/YuvToRgb.rs b/rs/YuvToRgb.rs
index 25771c5..57076e9 100644
--- a/rs/YuvToRgb.rs
+++ b/rs/YuvToRgb.rs
@@ -41,9 +41,9 @@ uchar4 __attribute__((kernel)) nv21ToRgb(uint32_t x, uint32_t y) {
int vV = (int)(rsGetElementAt_uchar(gIn, index) & 0xFF ) -128;
int uV = (int)(rsGetElementAt_uchar(gIn, index+1) & 0xFF ) -128;
- int r = (int) (1.164f * yV + 1.596f * vV );
- int g = (int) (1.164f * yV - 0.813f * vV - 0.391f * uV);
- int b = (int) (1.164f * yV + 2.018f * uV );
+ int r = (int) (yV + 1.370705f * vV );
+ int g = (int) (yV - 0.698001f * vV - 0.337633f* uV);
+ int b = (int) (yV + 1.732446 * uV );
r = r>255? 255 : r<0 ? 0 : r;
g = g>255? 255 : g<0 ? 0 : g;
diff --git a/rs/rotator.rs b/rs/rotator.rs
index cd9da43..5a27e00 100644
--- a/rs/rotator.rs
+++ b/rs/rotator.rs
@@ -34,18 +34,34 @@ rs_allocation gOut;
rs_allocation gIn;
uint32_t width;
uint32_t height;
+uint32_t pad;
+bool gFlip;
uchar __attribute__((kernel)) rotate90andMerge(uint32_t x, uint32_t y) {
uchar yValue = rsGetElementAt_uchar(gIn, x + y*width);
- rsSetElementAt_uchar(gOut, yValue, x*height + height - 1 - y);
- if(x%2 == 0 && y%2==1) {
+ if(gFlip) {
+ if(x >= width - pad)
+ return (uchar)0;
+ rsSetElementAt_uchar(gOut, yValue, (width-1-x-pad)*height + height - 1 - y);
+ } else {
+ rsSetElementAt_uchar(gOut, yValue, x*height + height - 1 - 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);
- rsSetElementAt_uchar(gOut, vValue, ySize + x/2*height + height - 1 - y);
- rsSetElementAt_uchar(gOut, uValue, ySize + x/2*height + height - 1 - y - 1);
+ if(gFlip) {
+ 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 {
+ rsSetElementAt_uchar(gOut, uValue, ySize + x/2*height + height - 1 - y);
+ rsSetElementAt_uchar(gOut, vValue, ySize + x/2*height + height - 1 - y - 1);
+ }
}
return (uchar)0;
} \ No newline at end of file