include $(CLEAR_VARS)
LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -Wno-unused-parameter
+LOCAL_CFLAGS += -Wall -Wextra -Werror
LOCAL_SRC_FILES := jni_egl_fence.cpp
filters/kmeans.cc
LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops -Wno-unused-parameter
+LOCAL_CFLAGS += -Wall -Wextra -Werror
LOCAL_LDLIBS := -llog -ljnigraphics
LOCAL_ARM_MODE := arm
#define LOG(msg...) __android_log_print(ANDROID_LOG_VERBOSE, "NativeFilters", msg)
-#define JNIFUNCF(cls, name, vars...) Java_com_android_gallery3d_filtershow_filters_ ## cls ## _ ## name(JNIEnv* env, jobject obj, vars)
+#define JNIFUNCF(cls, name, vars...) Java_com_android_gallery3d_filtershow_filters_ ## cls ## _ ## name(JNIEnv* env, jobject obj_unused __unused, vars)
#define RED i
#define GREEN (i+1)
return (int)frbg ;
}
-void JNIFUNCF(ImageFilterFx, nativeApplyFilter, jobject bitmap, jint width, jint height,
- jobject lutbitmap, jint lutwidth, jint lutheight,
+void JNIFUNCF(ImageFilterFx, nativeApplyFilter, jobject bitmap, jint width __unused,
+ jint height __unused, jobject lutbitmap, jint lutwidth, jint lutheight,
jint start, jint end)
{
char* destination = 0;
#include "filters.h"
-static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){
+static __inline__ void flipVertical(char * source, int srcWidth, int srcHeight, char * destination,
+ int dstWidth __unused, int dstHeight __unused) {
//Vertical
size_t cpy_bytes = sizeof(char) * 4;
int width = cpy_bytes * srcWidth;
}
}
-static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight, char * destination, int dstWidth, int dstHeight){
+static __inline__ void flipHorizontal(char * source, int srcWidth, int srcHeight,
+ char * destination, int dstWidth __unused, int dstHeight __unused) {
//Horizontal
size_t cpy_bytes = sizeof(char) * 4;
int width = cpy_bytes * srcWidth;
}
//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){
+static __inline__ void rotate90(char * source, int srcWidth, int srcHeight, char * destination,
+ int dstWidth __unused, int dstHeight __unused) {
size_t cpy_bytes = sizeof(char) * 4;
int width = cpy_bytes * srcWidth;
int length = srcHeight;
- int total = length * width;
for (size_t j = 0; j < length * cpy_bytes; j+= cpy_bytes){
for (int i = 0; i < width; i+=cpy_bytes){
int column_disp = (width - cpy_bytes - i) * length;
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 );
void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterRotate, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint rotate) {
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);
void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterCrop, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jint offsetWidth, jint offsetHeight) {
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);
AndroidBitmap_unlockPixels(env, src);
}
-void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth, jint srcHeight, jobject dst, jint dstWidth, jint dstHeight, jfloat straightenAngle) {
+void JNIFUNCF(ImageFilterGeometry, nativeApplyFilterStraighten, jobject src, jint srcWidth __unused,
+ jint srcHeight __unused, jobject dst, jint dstWidth, jint dstHeight,
+ jfloat straightenAngle __unused) {
char* destination = 0;
char* source = 0;
int len = dstWidth * dstHeight * 4;
// 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[GREEN] = source[GREEN];
destination[BLUE] = 128;
}
AndroidBitmap_unlockPixels(env, dst);
return ((r * 100 / (max + 2) > 160) & (max < 80));
}
-void findPossible(unsigned char *src, unsigned char *mask, int iw, int ih,
- short *rect) {
+void findPossible(unsigned char *src, unsigned char *mask, int iw,
+ int ih __unused, short *rect) {
int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
int y, x;
}
}
-void findReds(unsigned char *src, unsigned char *mask, int iw, int ih,
+void findReds(unsigned char *src, unsigned char *mask, int iw, int ih __unused,
short *rect) {
int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
int y, x;
}
}
-void dialateMaskIfRed(unsigned char *src, int iw, int ih, unsigned char *mask,
- unsigned char *out, short *rect) {
+void dialateMaskIfRed(unsigned char *src, int iw, int ih __unused,
+ unsigned char *mask, unsigned char *out, short *rect) {
int recX = rect[0], recY = rect[1], recW = rect[2], recH = rect[3];
int y, x;
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);
int r = destination[RED];
int g = destination[GREEN];
int b = destination[BLUE];
- int t = (r + g) / 2;
R = r;
G = g;
B = b;
Rt = Rf * MS;
Gt = Gf * MS;
Bt = Bf * MS;
- int t = (r + g) / 2;
R = r;
G = g;
B = b;
bool IsEglKHRFenceSyncSupported() {
if (!initialized) {
EGLDisplay display = eglGetCurrentDisplay();
- const char* eglExtensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS);
+ const char* eglExtensions = eglQueryString(display, EGL_EXTENSIONS);
if (eglExtensions && strstr(eglExtensions, "EGL_KHR_fence_sync")) {
FuncEglCreateSyncKHR = (TypeEglCreateSyncKHR) eglGetProcAddress("eglCreateSyncKHR");
FuncEglClientWaitSyncKHR = (TypeEglClientWaitSyncKHR) eglGetProcAddress("eglClientWaitSyncKHR");
}
void
-Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(JNIEnv* env,
- jobject thiz) {
+Java_com_android_gallery3d_photoeditor_FilterStack_nativeEglSetFenceAndWait(
+ JNIEnv* env __unused, jobject thiz __unused) {
if (!IsEglKHRFenceSyncSupported()) return;
EGLDisplay display = eglGetCurrentDisplay();
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS += -ffast-math -O3 -funroll-loops
+LOCAL_CFLAGS += -Wall -Wextra -Werror
LOCAL_LDLIBS := -llog
LOCAL_CPP_EXTENSION := .cpp
* to logcat's error log.
*/
void ErrOutput(j_common_ptr cinfo) {
- ErrManager* mgr = reinterpret_cast<ErrManager*>(cinfo->err);
char buf[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, buf);
buf[JMSG_LENGTH_MAX - 1] = '\0'; // Force null terminator
return;
}
SourceManager *src = reinterpret_cast<SourceManager*>(cinfo->src);
- if (src->mgr.bytes_in_buffer >= num_bytes) {
+ if (src->mgr.bytes_in_buffer >= (size_t)num_bytes) {
src->mgr.bytes_in_buffer -= num_bytes;
src->mgr.next_input_byte += num_bytes;
} else {
}
}
-void Mgr_term_source_fcn(j_decompress_ptr cinfo) {
+void Mgr_term_source_fcn(j_decompress_ptr cinfo __unused) {
//noop
}
// Do endianness and alpha for output format
if (mFormat == Jpeg_Config::FORMAT_RGBA) {
// Set alphas to 255
- uint8_t* end = buf + len - 1;
for (int i = len - 1; i >= 0; i -= 4) {
buf[i] = 255;
buf[i - 1] = *--iter;
}
} else if (mFormat == Jpeg_Config::FORMAT_ABGR) {
// Reverse endianness and set alphas to 255
- uint8_t* end = buf + len - 1;
int r, g, b;
for (int i = len - 1; i >= 0; i -= 4) {
b = *--iter;
return JNI_TRUE;
}
-jint JNI_OnLoad(JavaVM* vm, void* reserved) {
+jint JNI_OnLoad(JavaVM* vm, void* reserved __unused) {
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
LOGE("Error: GetEnv failed in JNI_OnLoad");