{"action":"closed","number":53,"pull_request":{"url":"https://api.github.com/repos/caffe2/AICamera/pulls/53","id":174549549,"html_url":"https://github.com/caffe2/AICamera/pull/53","diff_url":"https://github.com/caffe2/AICamera/pull/53.diff","patch_url":"https://github.com/caffe2/AICamera/pull/53.patch","issue_url":"https://api.github.com/repos/caffe2/AICamera/issues/53","number":53,"state":"closed","locked":false,"title":"Fix the conversion error from YUV to RGB","user":{"login":"spencial","id":12582069,"avatar_url":"https://avatars3.githubusercontent.com/u/12582069?v=4","gravatar_id":"","url":"https://api.github.com/users/spencial","html_url":"https://github.com/spencial","followers_url":"https://api.github.com/users/spencial/followers","following_url":"https://api.github.com/users/spencial/following{/other_user}","gists_url":"https://api.github.com/users/spencial/gists{/gist_id}","starred_url":"https://api.github.com/users/spencial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencial/subscriptions","organizations_url":"https://api.github.com/users/spencial/orgs","repos_url":"https://api.github.com/users/spencial/repos","events_url":"https://api.github.com/users/spencial/events{/privacy}","received_events_url":"https://api.github.com/users/spencial/received_events","type":"User","site_admin":false},"body":"The structure for YUV420 in Android is not the same as the one in [this](https://en.wikipedia.org/wiki/YUV#Y.E2.80.B2UV420p_.28and_Y.E2.80.B2V12_or_YV12.29_to_RGB888_conversion).There are several formats for YUV420. And when I print the length for Y U V channel, I got 'Y_len:76800 U_len:38399 V_len:38399'. And I think the reason for this result is that the YUV420 [format](https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx) in Android is NV12 rather than YV12.  The U and V channels share the same plane, so the memory location for U and V channels should be divided by 2 rather than 4. \r\n\r\nI have also done some experiments: print the input_data in JNI to a file\r\n```\r\nif(writingdata){\r\n        alog(\"Writing input data\\n\");\r\n        std::ofstream ofs(\"/sdcard/test.txt\",std::ios::out|std::ios::trunc);\r\n        for (int i=0;i<MAX_DATA_SIZE;i++){\r\n            ofs<<input_data[i]<<std::endl;\r\n        }\r\n        ofs.close();\r\n    }\r\n```\r\npull the file with ADB and restore the picture with [this](https://gist.github.com/spencial/528a1531436613d4230bb8d9f89fff9e) on PC. If dividing the memory location for U and V by 4, the location of color in restored pictures will shift greatly. However, if the location is divided by 2, the restored picture is correct. I have tested on OnePlus 5 and Pixel. And after this revision, the accuracy of the output became better and can compete with the results on PC.","created_at":"2018-03-13T03:31:02Z","updated_at":"2018-03-19T19:39:09Z","closed_at":"2018-03-19T19:39:09Z","merged_at":"2018-03-19T19:39:09Z","merge_commit_sha":"cae036e0a1a24b7824094401fba86d7d27af649f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/caffe2/AICamera/pulls/53/commits","review_comments_url":"https://api.github.com/repos/caffe2/AICamera/pulls/53/comments","review_comment_url":"https://api.github.com/repos/caffe2/AICamera/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caffe2/AICamera/issues/53/comments","statuses_url":"https://api.github.com/repos/caffe2/AICamera/statuses/8738503cd91a1f9473d6db9ed77b33f45fe69e46","head":{"label":"spencial:spencial-patch-1","ref":"spencial-patch-1","sha":"8738503cd91a1f9473d6db9ed77b33f45fe69e46","user":{"login":"spencial","id":12582069,"avatar_url":"https://avatars3.githubusercontent.com/u/12582069?v=4","gravatar_id":"","url":"https://api.github.com/users/spencial","html_url":"https://github.com/spencial","followers_url":"https://api.github.com/users/spencial/followers","following_url":"https://api.github.com/users/spencial/following{/other_user}","gists_url":"https://api.github.com/users/spencial/gists{/gist_id}","starred_url":"https://api.github.com/users/spencial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencial/subscriptions","organizations_url":"https://api.github.com/users/spencial/orgs","repos_url":"https://api.github.com/users/spencial/repos","events_url":"https://api.github.com/users/spencial/events{/privacy}","received_events_url":"https://api.github.com/users/spencial/received_events","type":"User","site_admin":false},"repo":{"id":124978355,"name":"AICamera","full_name":"spencial/AICamera","owner":{"login":"spencial","id":12582069,"avatar_url":"https://avatars3.githubusercontent.com/u/12582069?v=4","gravatar_id":"","url":"https://api.github.com/users/spencial","html_url":"https://github.com/spencial","followers_url":"https://api.github.com/users/spencial/followers","following_url":"https://api.github.com/users/spencial/following{/other_user}","gists_url":"https://api.github.com/users/spencial/gists{/gist_id}","starred_url":"https://api.github.com/users/spencial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencial/subscriptions","organizations_url":"https://api.github.com/users/spencial/orgs","repos_url":"https://api.github.com/users/spencial/repos","events_url":"https://api.github.com/users/spencial/events{/privacy}","received_events_url":"https://api.github.com/users/spencial/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spencial/AICamera","description":"Demonstration of using Caffe2 inside an Android application.","fork":true,"url":"https://api.github.com/repos/spencial/AICamera","forks_url":"https://api.github.com/repos/spencial/AICamera/forks","keys_url":"https://api.github.com/repos/spencial/AICamera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spencial/AICamera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spencial/AICamera/teams","hooks_url":"https://api.github.com/repos/spencial/AICamera/hooks","issue_events_url":"https://api.github.com/repos/spencial/AICamera/issues/events{/number}","events_url":"https://api.github.com/repos/spencial/AICamera/events","assignees_url":"https://api.github.com/repos/spencial/AICamera/assignees{/user}","branches_url":"https://api.github.com/repos/spencial/AICamera/branches{/branch}","tags_url":"https://api.github.com/repos/spencial/AICamera/tags","blobs_url":"https://api.github.com/repos/spencial/AICamera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spencial/AICamera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spencial/AICamera/git/refs{/sha}","trees_url":"https://api.github.com/repos/spencial/AICamera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spencial/AICamera/statuses/{sha}","languages_url":"https://api.github.com/repos/spencial/AICamera/languages","stargazers_url":"https://api.github.com/repos/spencial/AICamera/stargazers","contributors_url":"https://api.github.com/repos/spencial/AICamera/contributors","subscribers_url":"https://api.github.com/repos/spencial/AICamera/subscribers","subscription_url":"https://api.github.com/repos/spencial/AICamera/subscription","commits_url":"https://api.github.com/repos/spencial/AICamera/commits{/sha}","git_commits_url":"https://api.github.com/repos/spencial/AICamera/git/commits{/sha}","comments_url":"https://api.github.com/repos/spencial/AICamera/comments{/number}","issue_comment_url":"https://api.github.com/repos/spencial/AICamera/issues/comments{/number}","contents_url":"https://api.github.com/repos/spencial/AICamera/contents/{+path}","compare_url":"https://api.github.com/repos/spencial/AICamera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spencial/AICamera/merges","archive_url":"https://api.github.com/repos/spencial/AICamera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spencial/AICamera/downloads","issues_url":"https://api.github.com/repos/spencial/AICamera/issues{/number}","pulls_url":"https://api.github.com/repos/spencial/AICamera/pulls{/number}","milestones_url":"https://api.github.com/repos/spencial/AICamera/milestones{/number}","notifications_url":"https://api.github.com/repos/spencial/AICamera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spencial/AICamera/labels{/name}","releases_url":"https://api.github.com/repos/spencial/AICamera/releases{/id}","deployments_url":"https://api.github.com/repos/spencial/AICamera/deployments","created_at":"2018-03-13T02:10:25Z","updated_at":"2018-03-13T02:10:31Z","pushed_at":"2018-03-13T03:35:15Z","git_url":"git://github.com/spencial/AICamera.git","ssh_url":"git@github.com:spencial/AICamera.git","clone_url":"https://github.com/spencial/AICamera.git","svn_url":"https://github.com/spencial/AICamera","homepage":"","size":53428,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"caffe2:master","ref":"master","sha":"58f32cd596303affb95bf2e1876196aa268a717b","user":{"login":"caffe2","id":13072719,"avatar_url":"https://avatars0.githubusercontent.com/u/13072719?v=4","gravatar_id":"","url":"https://api.github.com/users/caffe2","html_url":"https://github.com/caffe2","followers_url":"https://api.github.com/users/caffe2/followers","following_url":"https://api.github.com/users/caffe2/following{/other_user}","gists_url":"https://api.github.com/users/caffe2/gists{/gist_id}","starred_url":"https://api.github.com/users/caffe2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caffe2/subscriptions","organizations_url":"https://api.github.com/users/caffe2/orgs","repos_url":"https://api.github.com/users/caffe2/repos","events_url":"https://api.github.com/users/caffe2/events{/privacy}","received_events_url":"https://api.github.com/users/caffe2/received_events","type":"Organization","site_admin":false},"repo":{"id":80150993,"name":"AICamera","full_name":"caffe2/AICamera","owner":{"login":"caffe2","id":13072719,"avatar_url":"https://avatars0.githubusercontent.com/u/13072719?v=4","gravatar_id":"","url":"https://api.github.com/users/caffe2","html_url":"https://github.com/caffe2","followers_url":"https://api.github.com/users/caffe2/followers","following_url":"https://api.github.com/users/caffe2/following{/other_user}","gists_url":"https://api.github.com/users/caffe2/gists{/gist_id}","starred_url":"https://api.github.com/users/caffe2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caffe2/subscriptions","organizations_url":"https://api.github.com/users/caffe2/orgs","repos_url":"https://api.github.com/users/caffe2/repos","events_url":"https://api.github.com/users/caffe2/events{/privacy}","received_events_url":"https://api.github.com/users/caffe2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caffe2/AICamera","description":"Demonstration of using Caffe2 inside an Android application.","fork":false,"url":"https://api.github.com/repos/caffe2/AICamera","forks_url":"https://api.github.com/repos/caffe2/AICamera/forks","keys_url":"https://api.github.com/repos/caffe2/AICamera/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caffe2/AICamera/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caffe2/AICamera/teams","hooks_url":"https://api.github.com/repos/caffe2/AICamera/hooks","issue_events_url":"https://api.github.com/repos/caffe2/AICamera/issues/events{/number}","events_url":"https://api.github.com/repos/caffe2/AICamera/events","assignees_url":"https://api.github.com/repos/caffe2/AICamera/assignees{/user}","branches_url":"https://api.github.com/repos/caffe2/AICamera/branches{/branch}","tags_url":"https://api.github.com/repos/caffe2/AICamera/tags","blobs_url":"https://api.github.com/repos/caffe2/AICamera/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caffe2/AICamera/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caffe2/AICamera/git/refs{/sha}","trees_url":"https://api.github.com/repos/caffe2/AICamera/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caffe2/AICamera/statuses/{sha}","languages_url":"https://api.github.com/repos/caffe2/AICamera/languages","stargazers_url":"https://api.github.com/repos/caffe2/AICamera/stargazers","contributors_url":"https://api.github.com/repos/caffe2/AICamera/contributors","subscribers_url":"https://api.github.com/repos/caffe2/AICamera/subscribers","subscription_url":"https://api.github.com/repos/caffe2/AICamera/subscription","commits_url":"https://api.github.com/repos/caffe2/AICamera/commits{/sha}","git_commits_url":"https://api.github.com/repos/caffe2/AICamera/git/commits{/sha}","comments_url":"https://api.github.com/repos/caffe2/AICamera/comments{/number}","issue_comment_url":"https://api.github.com/repos/caffe2/AICamera/issues/comments{/number}","contents_url":"https://api.github.com/repos/caffe2/AICamera/contents/{+path}","compare_url":"https://api.github.com/repos/caffe2/AICamera/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caffe2/AICamera/merges","archive_url":"https://api.github.com/repos/caffe2/AICamera/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caffe2/AICamera/downloads","issues_url":"https://api.github.com/repos/caffe2/AICamera/issues{/number}","pulls_url":"https://api.github.com/repos/caffe2/AICamera/pulls{/number}","milestones_url":"https://api.github.com/repos/caffe2/AICamera/milestones{/number}","notifications_url":"https://api.github.com/repos/caffe2/AICamera/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caffe2/AICamera/labels{/name}","releases_url":"https://api.github.com/repos/caffe2/AICamera/releases{/id}","deployments_url":"https://api.github.com/repos/caffe2/AICamera/deployments","created_at":"2017-01-26T20:12:34Z","updated_at":"2018-03-19T02:19:20Z","pushed_at":"2018-03-19T19:39:09Z","git_url":"git://github.com/caffe2/AICamera.git","ssh_url":"git@github.com:caffe2/AICamera.git","clone_url":"https://github.com/caffe2/AICamera.git","svn_url":"https://github.com/caffe2/AICamera","homepage":"","size":53423,"stargazers_count":153,"watchers_count":153,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":77,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":77,"open_issues":21,"watchers":153,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/caffe2/AICamera/pulls/53"},"html":{"href":"https://github.com/caffe2/AICamera/pull/53"},"issue":{"href":"https://api.github.com/repos/caffe2/AICamera/issues/53"},"comments":{"href":"https://api.github.com/repos/caffe2/AICamera/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/caffe2/AICamera/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/caffe2/AICamera/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caffe2/AICamera/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/caffe2/AICamera/statuses/8738503cd91a1f9473d6db9ed77b33f45fe69e46"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"bwasti","id":4842908,"avatar_url":"https://avatars2.githubusercontent.com/u/4842908?v=4","gravatar_id":"","url":"https://api.github.com/users/bwasti","html_url":"https://github.com/bwasti","followers_url":"https://api.github.com/users/bwasti/followers","following_url":"https://api.github.com/users/bwasti/following{/other_user}","gists_url":"https://api.github.com/users/bwasti/gists{/gist_id}","starred_url":"https://api.github.com/users/bwasti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwasti/subscriptions","organizations_url":"https://api.github.com/users/bwasti/orgs","repos_url":"https://api.github.com/users/bwasti/repos","events_url":"https://api.github.com/users/bwasti/events{/privacy}","received_events_url":"https://api.github.com/users/bwasti/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":2,"deletions":2,"changed_files":1}}
{"actor":{"display_login":"bwasti"}}