{"action":"created","comment":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/47951442","id":47951442,"diff_hunk":"@@ -12,23 +13,81 @@ median_3x3(__global __read_only float *in_values,\n     // Note: It may be easier for you to implement median filtering\n     // without using the local buffer, first, then adjust your code to\n     // use such a buffer after you have that working.\n+    int gID, lID, x, y, lx, ly, gSizeX, gSizeY, \n+        lSizeX, lSizeY, xTemp, yTemp, xUse, yUse,\n+        buf_corner_x, buf_corner_y, buf_x, buf_y, row;\n+    // the code below is adapted from the lecture code on halos\n+    x = get_global_id(0);\n+    y = get_global_id(1);\n+    lx = get_local_id(0);\n+    ly = get_local_id(1);\n+    gSizeX = get_global_size(0);\n+    gSizeY = get_global_size(1);\n+    lSizeX = get_local_size(0);\n+    lSizeY = get_local_size(1);\n+    \n+    \n+    gID = gSizeX*y + x;\n+    lID = lSizeX*ly + lx;\n \n+    buf_corner_x = x - lx - halo;\n+    buf_corner_y = y - ly - halo;\n \n-    // Load into buffer (with 1-pixel halo).\n-    //\n-    // It may be helpful to consult HW3 Problem 5, and\n-    // https://github.com/harvard-cs205/OpenCL-examples/blob/master/load_halo.cl\n-    //\n-    // Note that globally out-of-bounds pixels should be replaced\n-    // with the nearest valid pixel's value.\n+    buf_x = lx + halo;\n+    buf_y = ly + halo;\n \n+    if ((y < h) && (x < w)){\n+        if (lID < buf_w){ // only work with buf_w threads\n+            xTemp = buf_corner_x + lID;\n+            xUse = xTemp;\n+            if (xTemp < 0){ // if pixel out of bounds, add compensation steps to find closest in bound pixel\n+                    xUse += 1;\n+            }\n+            if (xTemp > w - 1){\n+                xUse -= 1;\n+            }\n+            for (row = 0; row < buf_h; row++) {\n+                yTemp = buf_corner_y + row;\n+                yUse = yTemp;\n+                if (yTemp < 0){\n+                    yUse += 1;\n+                }\n+                if (yTemp > h - 1){\n+                    yUse -= 1;","path":"HW3/P4/median_filter.cl","position":58,"original_position":58,"commit_id":"522f842d7c9c6cff9e89a987df9332bd0f7b6817","original_commit_id":"522f842d7c9c6cff9e89a987df9332bd0f7b6817","user":{"login":"adisuissa","id":4787431,"avatar_url":"https://avatars.githubusercontent.com/u/4787431?v=3","gravatar_id":"","url":"https://api.github.com/users/adisuissa","html_url":"https://github.com/adisuissa","followers_url":"https://api.github.com/users/adisuissa/followers","following_url":"https://api.github.com/users/adisuissa/following{/other_user}","gists_url":"https://api.github.com/users/adisuissa/gists{/gist_id}","starred_url":"https://api.github.com/users/adisuissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adisuissa/subscriptions","organizations_url":"https://api.github.com/users/adisuissa/orgs","repos_url":"https://api.github.com/users/adisuissa/repos","events_url":"https://api.github.com/users/adisuissa/events{/privacy}","received_events_url":"https://api.github.com/users/adisuissa/received_events","type":"User","site_admin":false},"body":"This would lead to accessing wrong values if the buffer size has more than 1 value out of bounds with the bottom of the input matrix.","created_at":"2015-12-17T19:44:27Z","updated_at":"2015-12-17T19:44:27Z","html_url":"https://github.com/harvard-cs205/cs205-homework/pull/430#discussion_r47951442","pull_request_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430","_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments/47951442"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/430#discussion_r47951442"},"pull_request":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430"}}},"pull_request":{"url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430","id":51429455,"html_url":"https://github.com/harvard-cs205/cs205-homework/pull/430","diff_url":"https://github.com/harvard-cs205/cs205-homework/pull/430.diff","patch_url":"https://github.com/harvard-cs205/cs205-homework/pull/430.patch","issue_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/430","number":430,"state":"open","locked":false,"title":"Hw3","user":{"login":"draj36","id":11443072,"avatar_url":"https://avatars.githubusercontent.com/u/11443072?v=3","gravatar_id":"","url":"https://api.github.com/users/draj36","html_url":"https://github.com/draj36","followers_url":"https://api.github.com/users/draj36/followers","following_url":"https://api.github.com/users/draj36/following{/other_user}","gists_url":"https://api.github.com/users/draj36/gists{/gist_id}","starred_url":"https://api.github.com/users/draj36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draj36/subscriptions","organizations_url":"https://api.github.com/users/draj36/orgs","repos_url":"https://api.github.com/users/draj36/repos","events_url":"https://api.github.com/users/draj36/events{/privacy}","received_events_url":"https://api.github.com/users/draj36/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-21T01:38:01Z","updated_at":"2015-12-17T19:44:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3e356994b8d025a7f7c7c9ed76f981b45761313","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430/commits","review_comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430/comments","review_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/430/comments","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/522f842d7c9c6cff9e89a987df9332bd0f7b6817","head":{"label":"draj36:HW3","ref":"HW3","sha":"522f842d7c9c6cff9e89a987df9332bd0f7b6817","user":{"login":"draj36","id":11443072,"avatar_url":"https://avatars.githubusercontent.com/u/11443072?v=3","gravatar_id":"","url":"https://api.github.com/users/draj36","html_url":"https://github.com/draj36","followers_url":"https://api.github.com/users/draj36/followers","following_url":"https://api.github.com/users/draj36/following{/other_user}","gists_url":"https://api.github.com/users/draj36/gists{/gist_id}","starred_url":"https://api.github.com/users/draj36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draj36/subscriptions","organizations_url":"https://api.github.com/users/draj36/orgs","repos_url":"https://api.github.com/users/draj36/repos","events_url":"https://api.github.com/users/draj36/events{/privacy}","received_events_url":"https://api.github.com/users/draj36/received_events","type":"User","site_admin":false},"repo":{"id":41892442,"name":"cs205-homework","full_name":"draj36/cs205-homework","owner":{"login":"draj36","id":11443072,"avatar_url":"https://avatars.githubusercontent.com/u/11443072?v=3","gravatar_id":"","url":"https://api.github.com/users/draj36","html_url":"https://github.com/draj36","followers_url":"https://api.github.com/users/draj36/followers","following_url":"https://api.github.com/users/draj36/following{/other_user}","gists_url":"https://api.github.com/users/draj36/gists{/gist_id}","starred_url":"https://api.github.com/users/draj36/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/draj36/subscriptions","organizations_url":"https://api.github.com/users/draj36/orgs","repos_url":"https://api.github.com/users/draj36/repos","events_url":"https://api.github.com/users/draj36/events{/privacy}","received_events_url":"https://api.github.com/users/draj36/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/draj36/cs205-homework","description":"","fork":true,"url":"https://api.github.com/repos/draj36/cs205-homework","forks_url":"https://api.github.com/repos/draj36/cs205-homework/forks","keys_url":"https://api.github.com/repos/draj36/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/draj36/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/draj36/cs205-homework/teams","hooks_url":"https://api.github.com/repos/draj36/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/draj36/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/draj36/cs205-homework/events","assignees_url":"https://api.github.com/repos/draj36/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/draj36/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/draj36/cs205-homework/tags","blobs_url":"https://api.github.com/repos/draj36/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/draj36/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/draj36/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/draj36/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/draj36/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/draj36/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/draj36/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/draj36/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/draj36/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/draj36/cs205-homework/subscription","commits_url":"https://api.github.com/repos/draj36/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/draj36/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/draj36/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/draj36/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/draj36/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/draj36/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/draj36/cs205-homework/merges","archive_url":"https://api.github.com/repos/draj36/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/draj36/cs205-homework/downloads","issues_url":"https://api.github.com/repos/draj36/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/draj36/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/draj36/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/draj36/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/draj36/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/draj36/cs205-homework/releases{/id}","created_at":"2015-09-04T01:37:50Z","updated_at":"2015-09-04T01:37:50Z","pushed_at":"2015-11-21T04:04:51Z","git_url":"git://github.com/draj36/cs205-homework.git","ssh_url":"git@github.com:draj36/cs205-homework.git","clone_url":"https://github.com/draj36/cs205-homework.git","svn_url":"https://github.com/draj36/cs205-homework","homepage":null,"size":3763,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"harvard-cs205:HW3","ref":"HW3","sha":"16ef17cde6304ffd1fb372ec676aa0ea791f8f6e","user":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"repo":{"id":40614104,"name":"cs205-homework","full_name":"harvard-cs205/cs205-homework","owner":{"login":"harvard-cs205","id":13456002,"avatar_url":"https://avatars.githubusercontent.com/u/13456002?v=3","gravatar_id":"","url":"https://api.github.com/users/harvard-cs205","html_url":"https://github.com/harvard-cs205","followers_url":"https://api.github.com/users/harvard-cs205/followers","following_url":"https://api.github.com/users/harvard-cs205/following{/other_user}","gists_url":"https://api.github.com/users/harvard-cs205/gists{/gist_id}","starred_url":"https://api.github.com/users/harvard-cs205/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harvard-cs205/subscriptions","organizations_url":"https://api.github.com/users/harvard-cs205/orgs","repos_url":"https://api.github.com/users/harvard-cs205/repos","events_url":"https://api.github.com/users/harvard-cs205/events{/privacy}","received_events_url":"https://api.github.com/users/harvard-cs205/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/harvard-cs205/cs205-homework","description":"","fork":false,"url":"https://api.github.com/repos/harvard-cs205/cs205-homework","forks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/forks","keys_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/teams","hooks_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/hooks","issue_events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/events{/number}","events_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/events","assignees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/assignees{/user}","branches_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/branches{/branch}","tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/tags","blobs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/{sha}","languages_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/languages","stargazers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/stargazers","contributors_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contributors","subscribers_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscribers","subscription_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/subscription","commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/contents/{+path}","compare_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/merges","archive_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/downloads","issues_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues{/number}","pulls_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls{/number}","milestones_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/milestones{/number}","notifications_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/labels{/name}","releases_url":"https://api.github.com/repos/harvard-cs205/cs205-homework/releases{/id}","created_at":"2015-08-12T17:18:15Z","updated_at":"2015-10-21T19:21:28Z","pushed_at":"2015-11-21T12:21:39Z","git_url":"git://github.com/harvard-cs205/cs205-homework.git","ssh_url":"git@github.com:harvard-cs205/cs205-homework.git","clone_url":"https://github.com/harvard-cs205/cs205-homework.git","svn_url":"https://github.com/harvard-cs205/cs205-homework","homepage":null,"size":162893,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"open_issues_count":421,"forks":100,"open_issues":421,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430"},"html":{"href":"https://github.com/harvard-cs205/cs205-homework/pull/430"},"issue":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/430"},"comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/issues/430/comments"},"review_comments":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430/comments"},"review_comment":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/pulls/430/commits"},"statuses":{"href":"https://api.github.com/repos/harvard-cs205/cs205-homework/statuses/522f842d7c9c6cff9e89a987df9332bd0f7b6817"}}}}