summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorJack Yoo <jyoo@codeaurora.org>2016-05-10 14:11:19 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-25 21:55:20 -0700
commiteb2e8a2a4da18f97462ca7f67429a135d2dc2df5 (patch)
treeafb53e1c1652cef9ed5d35266fa58d8be21e450c /rs
parent3e54ea242b405155fade948203ddd3d3143be986 (diff)
downloadandroid_packages_apps_Snap-eb2e8a2a4da18f97462ca7f67429a135d2dc2df5.tar.gz
android_packages_apps_Snap-eb2e8a2a4da18f97462ca7f67429a135d2dc2df5.tar.bz2
android_packages_apps_Snap-eb2e8a2a4da18f97462ca7f67429a135d2dc2df5.zip
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 25771c5c7..57076e979 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 cd9da4396..5a27e00f7 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