{"action":"created","comment":{"url":"https://api.github.com/repos/darktable-org/darktable/pulls/comments/53127844","id":53127844,"diff_hunk":"@@ -1202,6 +1202,38 @@ static void vng_interpolate(float *out, const float *const in, const dt_iop_roi_\n     for(int i = 0; i < height * width; i++) out[i * 4 + 1] = (out[i * 4 + 1] + out[i * 4 + 3]) / 2.0f;\n }\n \n+/** monochrome \"demosaic\" where input is RGB buffer and output is R=G=B=average(R,G,G,B) */\n+static void rgb_monochrome(float *out, float *in, const dt_iop_roi_t *const roi_out,\n+                           const dt_iop_roi_t *const roi_in)\n+{\n+  // If we're not doing 1:1 first scale roi_in into roi_out\n+  if (roi_in->width != roi_out->width || roi_in->height != roi_out->height)\n+  {\n+    dt_iop_clip_and_zoom_roi(out, in, roi_in, roi_out, roi_in->width, roi_out->width);\n+    in = out;\n+  }\n+\n+  int width = roi_out->width;\n+  int height = roi_out->height;\n+\n+#ifdef _OPENMP\n+#pragma omp parallel for default(none) shared(out, in, height, width) schedule(static) collapse(2)\n+#endif\n+  for(int row = 0; row < height; row++)\n+  {\n+    for(int col = 0; col < width; col++)\n+    {\n+      int pos = 4*(row*width+col);\n+\n+      // Average four pixels giving green twice the weight because of RGGB\n+      float avg = (in[pos] + (in[pos+1] * 2.0f) + in[pos+2]) / 4.0f;","path":"src/iop/demosaic.c","position":28,"original_position":28,"commit_id":"e18b76285a19606c012f18b495ac0932e98ea934","original_commit_id":"e18b76285a19606c012f18b495ac0932e98ea934","user":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"body":"So where does that `* 2.0f` come from?\r\nAnd what about X-Trans, it is not RGGB?","created_at":"2016-02-17T07:14:29Z","updated_at":"2016-02-17T07:14:29Z","html_url":"https://github.com/darktable-org/darktable/pull/1141#discussion_r53127844","pull_request_url":"https://api.github.com/repos/darktable-org/darktable/pulls/1141","_links":{"self":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/comments/53127844"},"html":{"href":"https://github.com/darktable-org/darktable/pull/1141#discussion_r53127844"},"pull_request":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/1141"}}},"pull_request":{"url":"https://api.github.com/repos/darktable-org/darktable/pulls/1141","id":58554314,"html_url":"https://github.com/darktable-org/darktable/pull/1141","diff_url":"https://github.com/darktable-org/darktable/pull/1141.diff","patch_url":"https://github.com/darktable-org/darktable/pull/1141.patch","issue_url":"https://api.github.com/repos/darktable-org/darktable/issues/1141","number":1141,"state":"open","locked":false,"title":"Do all monochrome passthrough in demosaic.c, even for MIPF","user":{"login":"pedrocr","id":246322,"avatar_url":"https://avatars.githubusercontent.com/u/246322?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrocr","html_url":"https://github.com/pedrocr","followers_url":"https://api.github.com/users/pedrocr/followers","following_url":"https://api.github.com/users/pedrocr/following{/other_user}","gists_url":"https://api.github.com/users/pedrocr/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrocr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrocr/subscriptions","organizations_url":"https://api.github.com/users/pedrocr/orgs","repos_url":"https://api.github.com/users/pedrocr/repos","events_url":"https://api.github.com/users/pedrocr/events{/privacy}","received_events_url":"https://api.github.com/users/pedrocr/received_events","type":"User","site_admin":false},"body":"The experimental monochrome demosaic feature required changes to init_f() to handle the preview pipe case. Instead do something simpler and in the MIPF case enable demosaic and do a very simple process() where R=G=B=average(R,G,G,B). Since the image is small and the MIPF was created by half-size demosaic anyway the output doesn't have any artifacts. This makes the init_f code go back to not having to know anything about passthrough monochrome and fixes the non-updating preview when an image was switched to monochrome and back.\r\n\r\nAlso while I was looking at this I made the monochrome apply to xtrans images as well. This feature is meant for cameras where the CFA filter has been removed so there's no point in restricting it only to cameras that happened to have bayer filters originally.","created_at":"2016-02-07T19:17:16Z","updated_at":"2016-02-17T07:14:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0432a458dfe7044eb7ed6c4a96c648802a57ecc8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/darktable-org/darktable/pulls/1141/commits","review_comments_url":"https://api.github.com/repos/darktable-org/darktable/pulls/1141/comments","review_comment_url":"https://api.github.com/repos/darktable-org/darktable/pulls/comments{/number}","comments_url":"https://api.github.com/repos/darktable-org/darktable/issues/1141/comments","statuses_url":"https://api.github.com/repos/darktable-org/darktable/statuses/e18b76285a19606c012f18b495ac0932e98ea934","head":{"label":"pedrocr:demosaic-monochrome","ref":"demosaic-monochrome","sha":"e18b76285a19606c012f18b495ac0932e98ea934","user":{"login":"pedrocr","id":246322,"avatar_url":"https://avatars.githubusercontent.com/u/246322?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrocr","html_url":"https://github.com/pedrocr","followers_url":"https://api.github.com/users/pedrocr/followers","following_url":"https://api.github.com/users/pedrocr/following{/other_user}","gists_url":"https://api.github.com/users/pedrocr/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrocr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrocr/subscriptions","organizations_url":"https://api.github.com/users/pedrocr/orgs","repos_url":"https://api.github.com/users/pedrocr/repos","events_url":"https://api.github.com/users/pedrocr/events{/privacy}","received_events_url":"https://api.github.com/users/pedrocr/received_events","type":"User","site_admin":false},"repo":{"id":18138228,"name":"darktable","full_name":"pedrocr/darktable","owner":{"login":"pedrocr","id":246322,"avatar_url":"https://avatars.githubusercontent.com/u/246322?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrocr","html_url":"https://github.com/pedrocr","followers_url":"https://api.github.com/users/pedrocr/followers","following_url":"https://api.github.com/users/pedrocr/following{/other_user}","gists_url":"https://api.github.com/users/pedrocr/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrocr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrocr/subscriptions","organizations_url":"https://api.github.com/users/pedrocr/orgs","repos_url":"https://api.github.com/users/pedrocr/repos","events_url":"https://api.github.com/users/pedrocr/events{/privacy}","received_events_url":"https://api.github.com/users/pedrocr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pedrocr/darktable","description":"darktable main repository","fork":true,"url":"https://api.github.com/repos/pedrocr/darktable","forks_url":"https://api.github.com/repos/pedrocr/darktable/forks","keys_url":"https://api.github.com/repos/pedrocr/darktable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pedrocr/darktable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pedrocr/darktable/teams","hooks_url":"https://api.github.com/repos/pedrocr/darktable/hooks","issue_events_url":"https://api.github.com/repos/pedrocr/darktable/issues/events{/number}","events_url":"https://api.github.com/repos/pedrocr/darktable/events","assignees_url":"https://api.github.com/repos/pedrocr/darktable/assignees{/user}","branches_url":"https://api.github.com/repos/pedrocr/darktable/branches{/branch}","tags_url":"https://api.github.com/repos/pedrocr/darktable/tags","blobs_url":"https://api.github.com/repos/pedrocr/darktable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pedrocr/darktable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pedrocr/darktable/git/refs{/sha}","trees_url":"https://api.github.com/repos/pedrocr/darktable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pedrocr/darktable/statuses/{sha}","languages_url":"https://api.github.com/repos/pedrocr/darktable/languages","stargazers_url":"https://api.github.com/repos/pedrocr/darktable/stargazers","contributors_url":"https://api.github.com/repos/pedrocr/darktable/contributors","subscribers_url":"https://api.github.com/repos/pedrocr/darktable/subscribers","subscription_url":"https://api.github.com/repos/pedrocr/darktable/subscription","commits_url":"https://api.github.com/repos/pedrocr/darktable/commits{/sha}","git_commits_url":"https://api.github.com/repos/pedrocr/darktable/git/commits{/sha}","comments_url":"https://api.github.com/repos/pedrocr/darktable/comments{/number}","issue_comment_url":"https://api.github.com/repos/pedrocr/darktable/issues/comments{/number}","contents_url":"https://api.github.com/repos/pedrocr/darktable/contents/{+path}","compare_url":"https://api.github.com/repos/pedrocr/darktable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pedrocr/darktable/merges","archive_url":"https://api.github.com/repos/pedrocr/darktable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pedrocr/darktable/downloads","issues_url":"https://api.github.com/repos/pedrocr/darktable/issues{/number}","pulls_url":"https://api.github.com/repos/pedrocr/darktable/pulls{/number}","milestones_url":"https://api.github.com/repos/pedrocr/darktable/milestones{/number}","notifications_url":"https://api.github.com/repos/pedrocr/darktable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pedrocr/darktable/labels{/name}","releases_url":"https://api.github.com/repos/pedrocr/darktable/releases{/id}","deployments_url":"https://api.github.com/repos/pedrocr/darktable/deployments","created_at":"2014-03-26T13:06:45Z","updated_at":"2015-05-05T13:14:31Z","pushed_at":"2016-02-14T20:25:46Z","git_url":"git://github.com/pedrocr/darktable.git","ssh_url":"git@github.com:pedrocr/darktable.git","clone_url":"https://github.com/pedrocr/darktable.git","svn_url":"https://github.com/pedrocr/darktable","homepage":"http://www.darktable.org","size":213005,"stargazers_count":0,"watchers_count":0,"language":"C","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":"darktable-org:master","ref":"master","sha":"1184e5e6394361a0d5dbfd9a59b1bcff7a2dca59","user":{"login":"darktable-org","id":1561544,"avatar_url":"https://avatars.githubusercontent.com/u/1561544?v=3","gravatar_id":"","url":"https://api.github.com/users/darktable-org","html_url":"https://github.com/darktable-org","followers_url":"https://api.github.com/users/darktable-org/followers","following_url":"https://api.github.com/users/darktable-org/following{/other_user}","gists_url":"https://api.github.com/users/darktable-org/gists{/gist_id}","starred_url":"https://api.github.com/users/darktable-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darktable-org/subscriptions","organizations_url":"https://api.github.com/users/darktable-org/orgs","repos_url":"https://api.github.com/users/darktable-org/repos","events_url":"https://api.github.com/users/darktable-org/events{/privacy}","received_events_url":"https://api.github.com/users/darktable-org/received_events","type":"Organization","site_admin":false},"repo":{"id":3791835,"name":"darktable","full_name":"darktable-org/darktable","owner":{"login":"darktable-org","id":1561544,"avatar_url":"https://avatars.githubusercontent.com/u/1561544?v=3","gravatar_id":"","url":"https://api.github.com/users/darktable-org","html_url":"https://github.com/darktable-org","followers_url":"https://api.github.com/users/darktable-org/followers","following_url":"https://api.github.com/users/darktable-org/following{/other_user}","gists_url":"https://api.github.com/users/darktable-org/gists{/gist_id}","starred_url":"https://api.github.com/users/darktable-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darktable-org/subscriptions","organizations_url":"https://api.github.com/users/darktable-org/orgs","repos_url":"https://api.github.com/users/darktable-org/repos","events_url":"https://api.github.com/users/darktable-org/events{/privacy}","received_events_url":"https://api.github.com/users/darktable-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/darktable-org/darktable","description":"darktable main repository","fork":false,"url":"https://api.github.com/repos/darktable-org/darktable","forks_url":"https://api.github.com/repos/darktable-org/darktable/forks","keys_url":"https://api.github.com/repos/darktable-org/darktable/keys{/key_id}","collaborators_url":"https://api.github.com/repos/darktable-org/darktable/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/darktable-org/darktable/teams","hooks_url":"https://api.github.com/repos/darktable-org/darktable/hooks","issue_events_url":"https://api.github.com/repos/darktable-org/darktable/issues/events{/number}","events_url":"https://api.github.com/repos/darktable-org/darktable/events","assignees_url":"https://api.github.com/repos/darktable-org/darktable/assignees{/user}","branches_url":"https://api.github.com/repos/darktable-org/darktable/branches{/branch}","tags_url":"https://api.github.com/repos/darktable-org/darktable/tags","blobs_url":"https://api.github.com/repos/darktable-org/darktable/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/darktable-org/darktable/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/darktable-org/darktable/git/refs{/sha}","trees_url":"https://api.github.com/repos/darktable-org/darktable/git/trees{/sha}","statuses_url":"https://api.github.com/repos/darktable-org/darktable/statuses/{sha}","languages_url":"https://api.github.com/repos/darktable-org/darktable/languages","stargazers_url":"https://api.github.com/repos/darktable-org/darktable/stargazers","contributors_url":"https://api.github.com/repos/darktable-org/darktable/contributors","subscribers_url":"https://api.github.com/repos/darktable-org/darktable/subscribers","subscription_url":"https://api.github.com/repos/darktable-org/darktable/subscription","commits_url":"https://api.github.com/repos/darktable-org/darktable/commits{/sha}","git_commits_url":"https://api.github.com/repos/darktable-org/darktable/git/commits{/sha}","comments_url":"https://api.github.com/repos/darktable-org/darktable/comments{/number}","issue_comment_url":"https://api.github.com/repos/darktable-org/darktable/issues/comments{/number}","contents_url":"https://api.github.com/repos/darktable-org/darktable/contents/{+path}","compare_url":"https://api.github.com/repos/darktable-org/darktable/compare/{base}...{head}","merges_url":"https://api.github.com/repos/darktable-org/darktable/merges","archive_url":"https://api.github.com/repos/darktable-org/darktable/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/darktable-org/darktable/downloads","issues_url":"https://api.github.com/repos/darktable-org/darktable/issues{/number}","pulls_url":"https://api.github.com/repos/darktable-org/darktable/pulls{/number}","milestones_url":"https://api.github.com/repos/darktable-org/darktable/milestones{/number}","notifications_url":"https://api.github.com/repos/darktable-org/darktable/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/darktable-org/darktable/labels{/name}","releases_url":"https://api.github.com/repos/darktable-org/darktable/releases{/id}","deployments_url":"https://api.github.com/repos/darktable-org/darktable/deployments","created_at":"2012-03-21T21:53:04Z","updated_at":"2016-02-16T18:44:15Z","pushed_at":"2016-02-17T01:25:07Z","git_url":"git://github.com/darktable-org/darktable.git","ssh_url":"git@github.com:darktable-org/darktable.git","clone_url":"https://github.com/darktable-org/darktable.git","svn_url":"https://github.com/darktable-org/darktable","homepage":"http://www.darktable.org","size":216850,"stargazers_count":795,"watchers_count":795,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"open_issues_count":23,"forks":264,"open_issues":23,"watchers":795,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/1141"},"html":{"href":"https://github.com/darktable-org/darktable/pull/1141"},"issue":{"href":"https://api.github.com/repos/darktable-org/darktable/issues/1141"},"comments":{"href":"https://api.github.com/repos/darktable-org/darktable/issues/1141/comments"},"review_comments":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/1141/comments"},"review_comment":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/darktable-org/darktable/pulls/1141/commits"},"statuses":{"href":"https://api.github.com/repos/darktable-org/darktable/statuses/e18b76285a19606c012f18b495ac0932e98ea934"}}}}