diff options
Diffstat (limited to 'jni')
-rw-r--r-- | jni/filters/bwfilter.c | 1 | ||||
-rw-r--r-- | jni/filters/contrast.c | 20 | ||||
-rw-r--r-- | jni/filters/edge.c | 1 | ||||
-rw-r--r-- | jni/filters/exposure.c | 1 | ||||
-rw-r--r-- | jni/filters/filters.h | 20 | ||||
-rw-r--r-- | jni/filters/fx.c | 3 | ||||
-rw-r--r-- | jni/filters/geometry.c | 21 | ||||
-rw-r--r-- | jni/filters/gradient.c | 1 | ||||
-rw-r--r-- | jni/filters/highlight.c | 1 | ||||
-rw-r--r-- | jni/filters/hue.c | 1 | ||||
-rw-r--r-- | jni/filters/kmeans.cc | 1 | ||||
-rw-r--r-- | jni/filters/negative.c | 1 | ||||
-rw-r--r-- | jni/filters/redEyeMath.c | 4 | ||||
-rw-r--r-- | jni/filters/redeye.c | 1 | ||||
-rw-r--r-- | jni/filters/saturated.c | 2 | ||||
-rw-r--r-- | jni/filters/shadows.c | 1 | ||||
-rw-r--r-- | jni/filters/tinyplanet.cc | 1 | ||||
-rw-r--r-- | jni/filters/vibrance.c | 2 | ||||
-rw-r--r-- | jni/filters/wbalance.c | 9 | ||||
-rw-r--r-- | jni/jni_egl_fence.cpp | 3 |
20 files changed, 59 insertions, 36 deletions
diff --git a/jni/filters/bwfilter.c b/jni/filters/bwfilter.c index f7fb31ad1..415223af0 100644 --- a/jni/filters/bwfilter.c +++ b/jni/filters/bwfilter.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilterBwFilter, nativeApplyFilter, jobject bitmap, jint width, jint height, jint rw, jint gw, jint bw) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/contrast.c b/jni/filters/contrast.c index b04e9364e..fbd9c7689 100644 --- a/jni/filters/contrast.c +++ b/jni/filters/contrast.c @@ -17,27 +17,9 @@ #include <math.h> #include "filters.h" -unsigned char clamp(int c) -{ - int N = 255; - c &= ~(c >> 31); - c -= N; - c &= (c >> 31); - c += N; - return (unsigned char) c; -} - -int clampMax(int c,int max) -{ - c &= ~(c >> 31); - c -= max; - c &= (c >> 31); - c += max; - return c; -} - void JNIFUNCF(ImageFilterContrast, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat bright) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/edge.c b/jni/filters/edge.c index 9f5d88f77..6c40675be 100644 --- a/jni/filters/edge.c +++ b/jni/filters/edge.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilterEdge, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat p) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); diff --git a/jni/filters/exposure.c b/jni/filters/exposure.c index 6b32798c8..a2df70945 100644 --- a/jni/filters/exposure.c +++ b/jni/filters/exposure.c @@ -18,6 +18,7 @@ void JNIFUNCF(ImageFilterExposure, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat bright) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/filters.h b/jni/filters/filters.h index 3f8c3a07e..55c260f06 100644 --- a/jni/filters/filters.h +++ b/jni/filters/filters.h @@ -44,8 +44,24 @@ typedef unsigned int Color; #define ALPHA i+3 #define CLAMP(c) (MAX(0, MIN(255, c))) -__inline__ unsigned char clamp(int c); -__inline__ int clampMax(int c,int max); +__inline__ unsigned char clamp(int c) +{ + int N = 255; + c &= ~(c >> 31); + c -= N; + c &= (c >> 31); + c += N; + return (unsigned char) c; +} + +__inline__ int clampMax(int c,int max) +{ + c &= ~(c >> 31); + c -= max; + c &= (c >> 31); + c += max; + return c; +} extern void rgb2hsv( unsigned char *rgb,int rgbOff,unsigned short *hsv,int hsvOff); extern void hsv2rgb(unsigned short *hsv,int hsvOff,unsigned char *rgb,int rgbOff); diff --git a/jni/filters/fx.c b/jni/filters/fx.c index c3c9cbdc6..d577e6183 100644 --- a/jni/filters/fx.c +++ b/jni/filters/fx.c @@ -33,6 +33,9 @@ void JNIFUNCF(ImageFilterFx, nativeApplyFilter, jobject bitmap, jint width, jint jobject lutbitmap, jint lutwidth, jint lutheight, jint start, jint end) { + (void)obj; + (void)width; + (void)height; char* destination = 0; char* lut = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); diff --git a/jni/filters/geometry.c b/jni/filters/geometry.c index b308213c6..9fbf7334c 100644 --- a/jni/filters/geometry.c +++ b/jni/filters/geometry.c @@ -19,6 +19,8 @@ static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){ //Vertical + (void)dstWidth; + (void)dstHeight; size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; int length = srcHeight; @@ -33,6 +35,8 @@ static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){ //Horizontal + (void)dstWidth; + (void)dstHeight; size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; int length = srcHeight; @@ -71,12 +75,13 @@ static __inline__ void flip_fun(int flip, char * source, int srcWidth, int srcHe //90 CCW (opposite of what's used in UI?) static __inline__ void rotate90(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){ + (void)dstWidth; + (void)dstHeight; size_t cpy_bytes = sizeof(char) * 4; int width = cpy_bytes * srcWidth; int length = srcHeight; - int total = length * width; int i = 0; - int j = 0; + unsigned int j = 0; for (j = 0; j < length * cpy_bytes; j+= cpy_bytes){ for (i = 0; i < width; i+=cpy_bytes){ int column_disp = (width - cpy_bytes - i) * length; @@ -120,7 +125,6 @@ static __inline__ void crop(char * source, int srcWidth, int srcHeight, char * d if ((srcWidth > dstWidth + offsetWidth) || (srcHeight > dstHeight + offsetHeight)){ return; } - int i = 0; int j = 0; for (j = offsetHeight; j < offsetHeight + dstHeight; j++){ memcpy(destination + (j - offsetHeight) * new_row_width, source + j * row_width + offsetWidth * cpy_bytes, cpy_bytes * dstWidth ); @@ -128,6 +132,7 @@ static __inline__ void crop(char * source, int srcWidth, int srcHeight, char * d } void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterFlip, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint flip) { + (void)obj; char* destination = 0; char* source = 0; if (srcWidth != dstWidth || srcHeight != dstHeight) { @@ -141,9 +146,9 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterFlip, jobject src, jint srcW } void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint rotate) { + (void)obj; char* destination = 0; char* source = 0; - int len = dstWidth * dstHeight * 4; AndroidBitmap_lockPixels(env, src, (void**) &source); AndroidBitmap_lockPixels(env, dst, (void**) &destination); rotate_fun(rotate, source, srcWidth, srcHeight, destination, dstWidth, dstHeight); @@ -152,9 +157,9 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint sr } void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint offsetWidth, jint offsetHeight) { + (void)obj; char* destination = 0; char* source = 0; - int len = dstWidth * dstHeight * 4; AndroidBitmap_lockPixels(env, src, (void**) &source); AndroidBitmap_lockPixels(env, dst, (void**) &destination); crop(source, srcWidth, srcHeight, destination, dstWidth, dstHeight, offsetWidth, offsetHeight); @@ -163,6 +168,10 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcW } void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jfloat straightenAngle) { + (void)obj; + (void)srcWidth; + (void)srcHeight; + (void)straightenAngle; char* destination = 0; char* source = 0; int len = dstWidth * dstHeight * 4; @@ -171,9 +180,7 @@ void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jin // TODO: implement straighten int i = 0; for (; i < len; i += 4) { - int r = source[RED]; int g = source[GREEN]; - int b = source[BLUE]; destination[RED] = 128; destination[GREEN] = g; destination[BLUE] = 128; diff --git a/jni/filters/gradient.c b/jni/filters/gradient.c index 1a8569786..1501d5eed 100644 --- a/jni/filters/gradient.c +++ b/jni/filters/gradient.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilter, nativeApplyGradientFilter, jobject bitmap, jint width, jint height, jintArray redGradient, jintArray greenGradient, jintArray blueGradient) { + (void)obj; char* destination = 0; jint* redGradientArray = 0; jint* greenGradientArray = 0; diff --git a/jni/filters/highlight.c b/jni/filters/highlight.c index fe9b88f94..2d49e6baa 100644 --- a/jni/filters/highlight.c +++ b/jni/filters/highlight.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilterHighlights, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloatArray luminanceMap){ + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/hue.c b/jni/filters/hue.c index a4aef936d..974e1e2b0 100644 --- a/jni/filters/hue.c +++ b/jni/filters/hue.c @@ -18,6 +18,7 @@ void JNIFUNCF(ImageFilterHue, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloatArray matrix) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/kmeans.cc b/jni/filters/kmeans.cc index 97cead7bc..f0aa54b78 100644 --- a/jni/filters/kmeans.cc +++ b/jni/filters/kmeans.cc @@ -34,6 +34,7 @@ void JNIFUNCF(ImageFilterKMeans, nativeApplyFilter, jobject bitmap, jint width, jobject large_ds_bitmap, jint lwidth, jint lheight, jobject small_ds_bitmap, jint swidth, jint sheight, jint p, jint seed) { + (void)obj; char* destination = 0; char* larger_ds_dst = 0; char* smaller_ds_dst = 0; diff --git a/jni/filters/negative.c b/jni/filters/negative.c index 735e583c9..69c76708c 100644 --- a/jni/filters/negative.c +++ b/jni/filters/negative.c @@ -18,6 +18,7 @@ void JNIFUNCF(ImageFilterNegative, nativeApplyFilter, jobject bitmap, jint width, jint height) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); diff --git a/jni/filters/redEyeMath.c b/jni/filters/redEyeMath.c index 26f3f76a4..d0885631e 100644 --- a/jni/filters/redEyeMath.c +++ b/jni/filters/redEyeMath.c @@ -32,6 +32,7 @@ int isRed(unsigned char *src, int p) { void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih, short *rect) { + (void)ih; int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -53,6 +54,7 @@ void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih, void findReds(unsigned char *src, unsigned char *mask, int iw, int ih, short *rect) { + (void)ih; int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -70,6 +72,7 @@ void findReds(unsigned char *src, unsigned char *mask, int iw, int ih, void dialateMaskIfRed(unsigned char *src, int iw, int ih, unsigned char *mask, unsigned char *out, short *rect) { + (void)ih; int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; int y, x; @@ -111,7 +114,6 @@ void filterRedEye(unsigned char *src, unsigned char *dest, int iw, int ih, short int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3]; unsigned char *mask1 = (unsigned char *) malloc(recW * recH); unsigned char *mask2 = (unsigned char *)malloc(recW*recH); - int QUE_LEN = 100; int y, x, i; rect[0] = MAX(rect[0],0); diff --git a/jni/filters/redeye.c b/jni/filters/redeye.c index 9a358dd3d..a7d12a8b3 100644 --- a/jni/filters/redeye.c +++ b/jni/filters/redeye.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilterRedEye, nativeApplyFilter, jobject bitmap, jint width, jint height, jshortArray vrect) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); unsigned char * rgb = (unsigned char * )destination; diff --git a/jni/filters/saturated.c b/jni/filters/saturated.c index 1bc0cc56b..5ea361bc9 100644 --- a/jni/filters/saturated.c +++ b/jni/filters/saturated.c @@ -18,6 +18,7 @@ void JNIFUNCF(ImageFilterSaturated, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat saturation) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); int i; @@ -36,7 +37,6 @@ void JNIFUNCF(ImageFilterSaturated, nativeApplyFilter, jobject bitmap, jint widt int r = destination[RED]; int g = destination[GREEN]; int b = destination[BLUE]; - int t = (r + g) / 2; R = r; G = g; B = b; diff --git a/jni/filters/shadows.c b/jni/filters/shadows.c index 38d64c8b5..af3dba470 100644 --- a/jni/filters/shadows.c +++ b/jni/filters/shadows.c @@ -18,6 +18,7 @@ #include "filters.h" void JNIFUNCF(ImageFilterShadows, nativeApplyFilter, jobject bitmap, jint width, jint height, float scale){ + (void)obj; double shadowFilterMap[] = { -0.00591, 0.0001, 1.16488, 0.01668, diff --git a/jni/filters/tinyplanet.cc b/jni/filters/tinyplanet.cc index beac0861a..56d125375 100644 --- a/jni/filters/tinyplanet.cc +++ b/jni/filters/tinyplanet.cc @@ -131,6 +131,7 @@ void StereographicProjection(float scale, float angle, unsigned char* input_imag void JNIFUNCF(ImageFilterTinyPlanet, nativeApplyFilter, jobject bitmap_in, jint width, jint height, jobject bitmap_out, jint output_size, jfloat scale,jfloat angle) { + (void)obj; char* source = 0; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap_in, (void**) &source); diff --git a/jni/filters/vibrance.c b/jni/filters/vibrance.c index cb5c536e5..43e73db79 100644 --- a/jni/filters/vibrance.c +++ b/jni/filters/vibrance.c @@ -19,6 +19,7 @@ void JNIFUNCF(ImageFilterVibrance, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat vibrance) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); int i; @@ -45,7 +46,6 @@ void JNIFUNCF(ImageFilterVibrance, nativeApplyFilter, jobject bitmap, jint width Rt = Rf * MS; Gt = Gf * MS; Bt = Bf * MS; - int t = (r + g) / 2; R = r; G = g; B = b; diff --git a/jni/filters/wbalance.c b/jni/filters/wbalance.c index 2b92b9978..3e1eac64c 100644 --- a/jni/filters/wbalance.c +++ b/jni/filters/wbalance.c @@ -99,10 +99,10 @@ void estmateWhite(unsigned char *src, int len, int *wr, int *wb, int *wg){ } void estmateWhiteBox(unsigned char *src, int iw, int ih, int x,int y, int *wr, int *wb, int *wg){ - int r; - int g; - int b; - int sum; + int r = 0; + int g = 0; + int b = 0; + int sum = 0; int xp,yp; int bounds = 5; if (x<0) x = bounds; @@ -130,6 +130,7 @@ void estmateWhiteBox(unsigned char *src, int iw, int ih, int x,int y, int *wr, i void JNIFUNCF(ImageFilterWBalance, nativeApplyFilter, jobject bitmap, jint width, jint height, int locX,int locY) { + (void)obj; char* destination = 0; AndroidBitmap_lockPixels(env, bitmap, (void**) &destination); int i; diff --git a/jni/jni_egl_fence.cpp b/jni/jni_egl_fence.cpp index cf15e2f5d..7e788928f 100644 --- a/jni/jni_egl_fence.cpp +++ b/jni/jni_egl_fence.cpp @@ -37,7 +37,6 @@ static bool egl_khr_fence_sync_supported = false; bool IsEglKHRFenceSyncSupported() { if (!initialized) { - EGLDisplay display = eglGetCurrentDisplay(); const char* eglExtensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS); if (eglExtensions && strstr(eglExtensions, "EGL_KHR_fence_sync")) { FuncEglCreateSyncKHR = (TypeEglCreateSyncKHR) eglGetProcAddress("eglCreateSyncKHR"); @@ -56,6 +55,8 @@ bool IsEglKHRFenceSyncSupported() { void Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env, jobject thiz) { + (void)env; + (void)thiz; if (!IsEglKHRFenceSyncSupported()) return; EGLDisplay display = eglGetCurrentDisplay(); |