{"action":"created","comment":{"url":"https://api.github.com/repos/halide/Halide/pulls/comments/29879577","id":29879577,"diff_hunk":"@@ -0,0 +1,338 @@\n+#include <jni.h>\n+#include <android/log.h>\n+#include <android/bitmap.h>\n+#include <android/native_window_jni.h>\n+\n+#include <algorithm>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <time.h>\n+\n+#include \"deinterleave.h\"\n+#include \"edge_detect.h\"\n+#include \"HalideRuntime.h\"\n+#include \"HalideRuntimeOpenCL.h\"\n+\n+#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, \"halide_native\", __VA_ARGS__)\n+#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, \"halide_native\", __VA_ARGS__)\n+\n+#define DEBUG 1\n+#define IMAGE_FORMAT_YV12 842094169\n+\n+// Round x up to a multiple of mask.\n+// E.g., ALIGN(x, 16) means round x up to the nearest multiple of 16.\n+#define ALIGN(x, mask) (((x) + (mask)-1) & ~((mask)-1))\n+\n+extern \"C\" void halide_set_error_handler(int (*handler)(void *user_context, const char *));\n+extern \"C\" int halide_host_cpu_count();\n+extern \"C\" int halide_start_clock(void *user_context);\n+extern \"C\" int64_t halide_current_time_ns();\n+extern \"C\" int halide_copy_to_host(void *, buffer_t *);\n+\n+int handler(void * /* user_context */, const char *msg) {\n+    LOGE(\"%s\", msg);\n+}\n+\n+extern \"C\" {\n+JNIEXPORT void JNICALL Java_com_example_helloandroidcamera2_JNIUtils_configureSurfaceNative(\n+    JNIEnv *env, jobject obj, jobject surface, int width, int height) {\n+    LOGD(\"[configureSurfaceNative] desired width = %d, height = %d\", width,\n+         height);\n+\n+    ANativeWindow *win = ANativeWindow_fromSurface(env, surface);\n+    ANativeWindow_acquire(win);\n+\n+#if 0\n+    ANativeWindow_Buffer buf;","path":"apps/HelloAndroidCamera2/jni/native.cpp","position":46,"original_position":46,"commit_id":"8e62400236dfc59d59843489f225f161a0d706ee","original_commit_id":"06447b132956933ef28b897701299b002a23dfe2","user":{"login":"jiawen","id":85107,"avatar_url":"https://avatars.githubusercontent.com/u/85107?v=3","gravatar_id":"","url":"https://api.github.com/users/jiawen","html_url":"https://github.com/jiawen","followers_url":"https://api.github.com/users/jiawen/followers","following_url":"https://api.github.com/users/jiawen/following{/other_user}","gists_url":"https://api.github.com/users/jiawen/gists{/gist_id}","starred_url":"https://api.github.com/users/jiawen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiawen/subscriptions","organizations_url":"https://api.github.com/users/jiawen/orgs","repos_url":"https://api.github.com/users/jiawen/repos","events_url":"https://api.github.com/users/jiawen/events{/privacy}","received_events_url":"https://api.github.com/users/jiawen/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-05-07T18:13:13Z","updated_at":"2015-05-07T18:13:13Z","html_url":"https://github.com/halide/Halide/pull/778#discussion_r29879577","pull_request_url":"https://api.github.com/repos/halide/Halide/pulls/778","_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments/29879577"},"html":{"href":"https://github.com/halide/Halide/pull/778#discussion_r29879577"},"pull_request":{"href":"https://api.github.com/repos/halide/Halide/pulls/778"}}},"pull_request":{"url":"https://api.github.com/repos/halide/Halide/pulls/778","id":34782728,"html_url":"https://github.com/halide/Halide/pull/778","diff_url":"https://github.com/halide/Halide/pull/778.diff","patch_url":"https://github.com/halide/Halide/pull/778.patch","issue_url":"https://api.github.com/repos/halide/Halide/issues/778","number":778,"state":"open","locked":false,"title":"Add Android camera2 + Halide edge detector example.","user":{"login":"jiawen","id":85107,"avatar_url":"https://avatars.githubusercontent.com/u/85107?v=3","gravatar_id":"","url":"https://api.github.com/users/jiawen","html_url":"https://github.com/jiawen","followers_url":"https://api.github.com/users/jiawen/followers","following_url":"https://api.github.com/users/jiawen/following{/other_user}","gists_url":"https://api.github.com/users/jiawen/gists{/gist_id}","starred_url":"https://api.github.com/users/jiawen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiawen/subscriptions","organizations_url":"https://api.github.com/users/jiawen/orgs","repos_url":"https://api.github.com/users/jiawen/repos","events_url":"https://api.github.com/users/jiawen/events{/privacy}","received_events_url":"https://api.github.com/users/jiawen/received_events","type":"User","site_admin":false},"body":"Also added minor fixes to the HelloAndroid build scripts.","created_at":"2015-05-06T01:21:25Z","updated_at":"2015-05-07T18:13:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/halide/Halide/pulls/778/commits","review_comments_url":"https://api.github.com/repos/halide/Halide/pulls/778/comments","review_comment_url":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}","comments_url":"https://api.github.com/repos/halide/Halide/issues/778/comments","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/8e62400236dfc59d59843489f225f161a0d706ee","head":{"label":"jiawen:camera2tutorial","ref":"camera2tutorial","sha":"8e62400236dfc59d59843489f225f161a0d706ee","user":{"login":"jiawen","id":85107,"avatar_url":"https://avatars.githubusercontent.com/u/85107?v=3","gravatar_id":"","url":"https://api.github.com/users/jiawen","html_url":"https://github.com/jiawen","followers_url":"https://api.github.com/users/jiawen/followers","following_url":"https://api.github.com/users/jiawen/following{/other_user}","gists_url":"https://api.github.com/users/jiawen/gists{/gist_id}","starred_url":"https://api.github.com/users/jiawen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiawen/subscriptions","organizations_url":"https://api.github.com/users/jiawen/orgs","repos_url":"https://api.github.com/users/jiawen/repos","events_url":"https://api.github.com/users/jiawen/events{/privacy}","received_events_url":"https://api.github.com/users/jiawen/received_events","type":"User","site_admin":false},"repo":{"id":13105445,"name":"Halide","full_name":"jiawen/Halide","owner":{"login":"jiawen","id":85107,"avatar_url":"https://avatars.githubusercontent.com/u/85107?v=3","gravatar_id":"","url":"https://api.github.com/users/jiawen","html_url":"https://github.com/jiawen","followers_url":"https://api.github.com/users/jiawen/followers","following_url":"https://api.github.com/users/jiawen/following{/other_user}","gists_url":"https://api.github.com/users/jiawen/gists{/gist_id}","starred_url":"https://api.github.com/users/jiawen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiawen/subscriptions","organizations_url":"https://api.github.com/users/jiawen/orgs","repos_url":"https://api.github.com/users/jiawen/repos","events_url":"https://api.github.com/users/jiawen/events{/privacy}","received_events_url":"https://api.github.com/users/jiawen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiawen/Halide","description":"a language for image processing and computational photography","fork":true,"url":"https://api.github.com/repos/jiawen/Halide","forks_url":"https://api.github.com/repos/jiawen/Halide/forks","keys_url":"https://api.github.com/repos/jiawen/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiawen/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiawen/Halide/teams","hooks_url":"https://api.github.com/repos/jiawen/Halide/hooks","issue_events_url":"https://api.github.com/repos/jiawen/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/jiawen/Halide/events","assignees_url":"https://api.github.com/repos/jiawen/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/jiawen/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/jiawen/Halide/tags","blobs_url":"https://api.github.com/repos/jiawen/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiawen/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiawen/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiawen/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiawen/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/jiawen/Halide/languages","stargazers_url":"https://api.github.com/repos/jiawen/Halide/stargazers","contributors_url":"https://api.github.com/repos/jiawen/Halide/contributors","subscribers_url":"https://api.github.com/repos/jiawen/Halide/subscribers","subscription_url":"https://api.github.com/repos/jiawen/Halide/subscription","commits_url":"https://api.github.com/repos/jiawen/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiawen/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiawen/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiawen/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiawen/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/jiawen/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiawen/Halide/merges","archive_url":"https://api.github.com/repos/jiawen/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiawen/Halide/downloads","issues_url":"https://api.github.com/repos/jiawen/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/jiawen/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/jiawen/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/jiawen/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiawen/Halide/labels{/name}","releases_url":"https://api.github.com/repos/jiawen/Halide/releases{/id}","created_at":"2013-09-25T21:07:29Z","updated_at":"2013-09-25T21:07:32Z","pushed_at":"2015-05-07T17:27:41Z","git_url":"git://github.com/jiawen/Halide.git","ssh_url":"git@github.com:jiawen/Halide.git","clone_url":"https://github.com/jiawen/Halide.git","svn_url":"https://github.com/jiawen/Halide","homepage":"http://halide-lang.org","size":81932,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"halide:master","ref":"master","sha":"3616892f6af2aad4a2d725f365c1fcb7d4daf57f","user":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"repo":{"id":5241312,"name":"Halide","full_name":"halide/Halide","owner":{"login":"halide","id":1548551,"avatar_url":"https://avatars.githubusercontent.com/u/1548551?v=3","gravatar_id":"","url":"https://api.github.com/users/halide","html_url":"https://github.com/halide","followers_url":"https://api.github.com/users/halide/followers","following_url":"https://api.github.com/users/halide/following{/other_user}","gists_url":"https://api.github.com/users/halide/gists{/gist_id}","starred_url":"https://api.github.com/users/halide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halide/subscriptions","organizations_url":"https://api.github.com/users/halide/orgs","repos_url":"https://api.github.com/users/halide/repos","events_url":"https://api.github.com/users/halide/events{/privacy}","received_events_url":"https://api.github.com/users/halide/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/halide/Halide","description":"a language for image processing and computational photography","fork":false,"url":"https://api.github.com/repos/halide/Halide","forks_url":"https://api.github.com/repos/halide/Halide/forks","keys_url":"https://api.github.com/repos/halide/Halide/keys{/key_id}","collaborators_url":"https://api.github.com/repos/halide/Halide/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/halide/Halide/teams","hooks_url":"https://api.github.com/repos/halide/Halide/hooks","issue_events_url":"https://api.github.com/repos/halide/Halide/issues/events{/number}","events_url":"https://api.github.com/repos/halide/Halide/events","assignees_url":"https://api.github.com/repos/halide/Halide/assignees{/user}","branches_url":"https://api.github.com/repos/halide/Halide/branches{/branch}","tags_url":"https://api.github.com/repos/halide/Halide/tags","blobs_url":"https://api.github.com/repos/halide/Halide/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/halide/Halide/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/halide/Halide/git/refs{/sha}","trees_url":"https://api.github.com/repos/halide/Halide/git/trees{/sha}","statuses_url":"https://api.github.com/repos/halide/Halide/statuses/{sha}","languages_url":"https://api.github.com/repos/halide/Halide/languages","stargazers_url":"https://api.github.com/repos/halide/Halide/stargazers","contributors_url":"https://api.github.com/repos/halide/Halide/contributors","subscribers_url":"https://api.github.com/repos/halide/Halide/subscribers","subscription_url":"https://api.github.com/repos/halide/Halide/subscription","commits_url":"https://api.github.com/repos/halide/Halide/commits{/sha}","git_commits_url":"https://api.github.com/repos/halide/Halide/git/commits{/sha}","comments_url":"https://api.github.com/repos/halide/Halide/comments{/number}","issue_comment_url":"https://api.github.com/repos/halide/Halide/issues/comments{/number}","contents_url":"https://api.github.com/repos/halide/Halide/contents/{+path}","compare_url":"https://api.github.com/repos/halide/Halide/compare/{base}...{head}","merges_url":"https://api.github.com/repos/halide/Halide/merges","archive_url":"https://api.github.com/repos/halide/Halide/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/halide/Halide/downloads","issues_url":"https://api.github.com/repos/halide/Halide/issues{/number}","pulls_url":"https://api.github.com/repos/halide/Halide/pulls{/number}","milestones_url":"https://api.github.com/repos/halide/Halide/milestones{/number}","notifications_url":"https://api.github.com/repos/halide/Halide/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/halide/Halide/labels{/name}","releases_url":"https://api.github.com/repos/halide/Halide/releases{/id}","created_at":"2012-07-31T04:05:25Z","updated_at":"2015-05-07T00:54:45Z","pushed_at":"2015-05-07T17:48:42Z","git_url":"git://github.com/halide/Halide.git","ssh_url":"git@github.com:halide/Halide.git","clone_url":"https://github.com/halide/Halide.git","svn_url":"https://github.com/halide/Halide","homepage":"http://halide-lang.org","size":128456,"stargazers_count":949,"watchers_count":949,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":173,"mirror_url":null,"open_issues_count":103,"forks":173,"open_issues":103,"watchers":949,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/halide/Halide/pulls/778"},"html":{"href":"https://github.com/halide/Halide/pull/778"},"issue":{"href":"https://api.github.com/repos/halide/Halide/issues/778"},"comments":{"href":"https://api.github.com/repos/halide/Halide/issues/778/comments"},"review_comments":{"href":"https://api.github.com/repos/halide/Halide/pulls/778/comments"},"review_comment":{"href":"https://api.github.com/repos/halide/Halide/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/halide/Halide/pulls/778/commits"},"statuses":{"href":"https://api.github.com/repos/halide/Halide/statuses/8e62400236dfc59d59843489f225f161a0d706ee"}}}}