{"action":"created","comment":{"url":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments/218038889","pull_request_review_id":155885763,"id":218038889,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODAzODg4OQ==","diff_hunk":"@@ -0,0 +1,129 @@\n+// Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+#include \"dali/image/tiff.h\"\n+\n+namespace dali {\n+\n+namespace {\n+\n+const std::vector<int> header_intel = {77, 77, 0, 42};\n+const std::vector<int> header_motorola = {73, 73, 42, 0};\n+const int COUNT_SIZE = 2;\n+const int ENTRY_SIZE = 12;\n+const int WIDTH_TAG = 256;\n+const int HEIGHT_TAG = 257;\n+const int TYPE_WORD = 3;\n+const int TYPE_DWORD = 4;\n+\n+\n+cv::Mat DecodeTiff(const unsigned char *tiff, int size, DALIImageType image_type) {\n+    std::vector<char> buf(tiff, tiff + size);\n+    return cv::imdecode(buf, image_type == DALI_GRAY ? 0 : 1);\n+}\n+\n+\n+bool check_header(const unsigned char *tiff, const std::vector<int> &header) {\n+    for (unsigned int i = 0; i < header.size(); i++) {\n+        if (tiff[i] != header[i]) {\n+            return false;\n+        }\n+    }\n+    return true;\n+}\n+\n+\n+bool is_little_endian(const unsigned char *tiff) {\n+    return check_header(tiff, header_intel);\n+}\n+\n+}  // namespace\n+\n+bool CheckIsTiff(const unsigned char *tiff) {\n+    assert(tiff);\n+    return check_header(tiff, header_intel) || check_header(tiff, header_motorola);\n+}\n+\n+\n+DALIError_t GetTiffImageDims(const unsigned char *tiff, int size, int *h, int *w) {\n+    assert(h && w && tiff);\n+    assert(CheckIsTiff(tiff));\n+\n+    tiff_buffer buffer(std::string(reinterpret_cast<const char *>(tiff), static_cast<size_t>(size)),\n+                       is_little_endian(tiff));\n+\n+    auto ifd_offset = buffer.read<uint32_t>(4);","path":"dali/image/tiff.cc","position":null,"original_position":66,"commit_id":"b6738bd02da58110c21dd457ff0dc0d23699ccfc","original_commit_id":"edf82a848779e42d5c4b7b85239d488f8062f4ee","user":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2018-09-17T11:48:29Z","updated_at":"2018-09-17T11:48:30Z","html_url":"https://github.com/NVIDIA/DALI/pull/166#discussion_r218038889","pull_request_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/166","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments/218038889"},"html":{"href":"https://github.com/NVIDIA/DALI/pull/166#discussion_r218038889"},"pull_request":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/166"}},"in_reply_to_id":218016907},"pull_request":{"url":"https://api.github.com/repos/NVIDIA/DALI/pulls/166","id":214933647,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0OTMzNjQ3","html_url":"https://github.com/NVIDIA/DALI/pull/166","diff_url":"https://github.com/NVIDIA/DALI/pull/166.diff","patch_url":"https://github.com/NVIDIA/DALI/pull/166.patch","issue_url":"https://api.github.com/repos/NVIDIA/DALI/issues/166","number":166,"state":"open","locked":false,"title":"Tiff fallback","user":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"body":"Add TIFF fallback.\r\nAlso minor changes:\r\n1. Changed Debug configuration, so that there's no optimization (it prevents good debugging).\r\n2. Added few asserts","created_at":"2018-09-12T11:54:21Z","updated_at":"2018-09-17T11:48:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"011c68c4da25f8bc181bf6497709ce1832e4f32e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"klecki","id":8121971,"node_id":"MDQ6VXNlcjgxMjE5NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/8121971?v=4","gravatar_id":"","url":"https://api.github.com/users/klecki","html_url":"https://github.com/klecki","followers_url":"https://api.github.com/users/klecki/followers","following_url":"https://api.github.com/users/klecki/following{/other_user}","gists_url":"https://api.github.com/users/klecki/gists{/gist_id}","starred_url":"https://api.github.com/users/klecki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klecki/subscriptions","organizations_url":"https://api.github.com/users/klecki/orgs","repos_url":"https://api.github.com/users/klecki/repos","events_url":"https://api.github.com/users/klecki/events{/privacy}","received_events_url":"https://api.github.com/users/klecki/received_events","type":"User","site_admin":false},{"login":"ptrendx","id":8398980,"node_id":"MDQ6VXNlcjgzOTg5ODA=","avatar_url":"https://avatars1.githubusercontent.com/u/8398980?v=4","gravatar_id":"","url":"https://api.github.com/users/ptrendx","html_url":"https://github.com/ptrendx","followers_url":"https://api.github.com/users/ptrendx/followers","following_url":"https://api.github.com/users/ptrendx/following{/other_user}","gists_url":"https://api.github.com/users/ptrendx/gists{/gist_id}","starred_url":"https://api.github.com/users/ptrendx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ptrendx/subscriptions","organizations_url":"https://api.github.com/users/ptrendx/orgs","repos_url":"https://api.github.com/users/ptrendx/repos","events_url":"https://api.github.com/users/ptrendx/events{/privacy}","received_events_url":"https://api.github.com/users/ptrendx/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/166/commits","review_comments_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/166/comments","review_comment_url":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NVIDIA/DALI/issues/166/comments","statuses_url":"https://api.github.com/repos/NVIDIA/DALI/statuses/b6738bd02da58110c21dd457ff0dc0d23699ccfc","head":{"label":"szalpal:tiff_fallback","ref":"tiff_fallback","sha":"b6738bd02da58110c21dd457ff0dc0d23699ccfc","user":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"repo":{"id":148139188,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgxMzkxODg=","name":"DALI","full_name":"szalpal/DALI","private":false,"owner":{"login":"szalpal","id":7101064,"node_id":"MDQ6VXNlcjcxMDEwNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/7101064?v=4","gravatar_id":"","url":"https://api.github.com/users/szalpal","html_url":"https://github.com/szalpal","followers_url":"https://api.github.com/users/szalpal/followers","following_url":"https://api.github.com/users/szalpal/following{/other_user}","gists_url":"https://api.github.com/users/szalpal/gists{/gist_id}","starred_url":"https://api.github.com/users/szalpal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szalpal/subscriptions","organizations_url":"https://api.github.com/users/szalpal/orgs","repos_url":"https://api.github.com/users/szalpal/repos","events_url":"https://api.github.com/users/szalpal/events{/privacy}","received_events_url":"https://api.github.com/users/szalpal/received_events","type":"User","site_admin":false},"html_url":"https://github.com/szalpal/DALI","description":"A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications","fork":true,"url":"https://api.github.com/repos/szalpal/DALI","forks_url":"https://api.github.com/repos/szalpal/DALI/forks","keys_url":"https://api.github.com/repos/szalpal/DALI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/szalpal/DALI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/szalpal/DALI/teams","hooks_url":"https://api.github.com/repos/szalpal/DALI/hooks","issue_events_url":"https://api.github.com/repos/szalpal/DALI/issues/events{/number}","events_url":"https://api.github.com/repos/szalpal/DALI/events","assignees_url":"https://api.github.com/repos/szalpal/DALI/assignees{/user}","branches_url":"https://api.github.com/repos/szalpal/DALI/branches{/branch}","tags_url":"https://api.github.com/repos/szalpal/DALI/tags","blobs_url":"https://api.github.com/repos/szalpal/DALI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/szalpal/DALI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/szalpal/DALI/git/refs{/sha}","trees_url":"https://api.github.com/repos/szalpal/DALI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/szalpal/DALI/statuses/{sha}","languages_url":"https://api.github.com/repos/szalpal/DALI/languages","stargazers_url":"https://api.github.com/repos/szalpal/DALI/stargazers","contributors_url":"https://api.github.com/repos/szalpal/DALI/contributors","subscribers_url":"https://api.github.com/repos/szalpal/DALI/subscribers","subscription_url":"https://api.github.com/repos/szalpal/DALI/subscription","commits_url":"https://api.github.com/repos/szalpal/DALI/commits{/sha}","git_commits_url":"https://api.github.com/repos/szalpal/DALI/git/commits{/sha}","comments_url":"https://api.github.com/repos/szalpal/DALI/comments{/number}","issue_comment_url":"https://api.github.com/repos/szalpal/DALI/issues/comments{/number}","contents_url":"https://api.github.com/repos/szalpal/DALI/contents/{+path}","compare_url":"https://api.github.com/repos/szalpal/DALI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/szalpal/DALI/merges","archive_url":"https://api.github.com/repos/szalpal/DALI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/szalpal/DALI/downloads","issues_url":"https://api.github.com/repos/szalpal/DALI/issues{/number}","pulls_url":"https://api.github.com/repos/szalpal/DALI/pulls{/number}","milestones_url":"https://api.github.com/repos/szalpal/DALI/milestones{/number}","notifications_url":"https://api.github.com/repos/szalpal/DALI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/szalpal/DALI/labels{/name}","releases_url":"https://api.github.com/repos/szalpal/DALI/releases{/id}","deployments_url":"https://api.github.com/repos/szalpal/DALI/deployments","created_at":"2018-09-10T10:33:14Z","updated_at":"2018-09-14T13:16:13Z","pushed_at":"2018-09-17T11:48:01Z","git_url":"git://github.com/szalpal/DALI.git","ssh_url":"git@github.com:szalpal/DALI.git","clone_url":"https://github.com/szalpal/DALI.git","svn_url":"https://github.com/szalpal/DALI","homepage":"https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/index.html","size":35445,"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,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NVIDIA:master","ref":"master","sha":"3bf6859dd5abae00b1190b82d9eaba3318934c69","user":{"login":"NVIDIA","id":1728152,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjgxNTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1728152?v=4","gravatar_id":"","url":"https://api.github.com/users/NVIDIA","html_url":"https://github.com/NVIDIA","followers_url":"https://api.github.com/users/NVIDIA/followers","following_url":"https://api.github.com/users/NVIDIA/following{/other_user}","gists_url":"https://api.github.com/users/NVIDIA/gists{/gist_id}","starred_url":"https://api.github.com/users/NVIDIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NVIDIA/subscriptions","organizations_url":"https://api.github.com/users/NVIDIA/orgs","repos_url":"https://api.github.com/users/NVIDIA/repos","events_url":"https://api.github.com/users/NVIDIA/events{/privacy}","received_events_url":"https://api.github.com/users/NVIDIA/received_events","type":"Organization","site_admin":false},"repo":{"id":135768037,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU3NjgwMzc=","name":"DALI","full_name":"NVIDIA/DALI","private":false,"owner":{"login":"NVIDIA","id":1728152,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MjgxNTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1728152?v=4","gravatar_id":"","url":"https://api.github.com/users/NVIDIA","html_url":"https://github.com/NVIDIA","followers_url":"https://api.github.com/users/NVIDIA/followers","following_url":"https://api.github.com/users/NVIDIA/following{/other_user}","gists_url":"https://api.github.com/users/NVIDIA/gists{/gist_id}","starred_url":"https://api.github.com/users/NVIDIA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NVIDIA/subscriptions","organizations_url":"https://api.github.com/users/NVIDIA/orgs","repos_url":"https://api.github.com/users/NVIDIA/repos","events_url":"https://api.github.com/users/NVIDIA/events{/privacy}","received_events_url":"https://api.github.com/users/NVIDIA/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/NVIDIA/DALI","description":"A library containing both highly optimized building blocks and an execution engine for data pre-processing in deep learning applications","fork":false,"url":"https://api.github.com/repos/NVIDIA/DALI","forks_url":"https://api.github.com/repos/NVIDIA/DALI/forks","keys_url":"https://api.github.com/repos/NVIDIA/DALI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NVIDIA/DALI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NVIDIA/DALI/teams","hooks_url":"https://api.github.com/repos/NVIDIA/DALI/hooks","issue_events_url":"https://api.github.com/repos/NVIDIA/DALI/issues/events{/number}","events_url":"https://api.github.com/repos/NVIDIA/DALI/events","assignees_url":"https://api.github.com/repos/NVIDIA/DALI/assignees{/user}","branches_url":"https://api.github.com/repos/NVIDIA/DALI/branches{/branch}","tags_url":"https://api.github.com/repos/NVIDIA/DALI/tags","blobs_url":"https://api.github.com/repos/NVIDIA/DALI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NVIDIA/DALI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NVIDIA/DALI/git/refs{/sha}","trees_url":"https://api.github.com/repos/NVIDIA/DALI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NVIDIA/DALI/statuses/{sha}","languages_url":"https://api.github.com/repos/NVIDIA/DALI/languages","stargazers_url":"https://api.github.com/repos/NVIDIA/DALI/stargazers","contributors_url":"https://api.github.com/repos/NVIDIA/DALI/contributors","subscribers_url":"https://api.github.com/repos/NVIDIA/DALI/subscribers","subscription_url":"https://api.github.com/repos/NVIDIA/DALI/subscription","commits_url":"https://api.github.com/repos/NVIDIA/DALI/commits{/sha}","git_commits_url":"https://api.github.com/repos/NVIDIA/DALI/git/commits{/sha}","comments_url":"https://api.github.com/repos/NVIDIA/DALI/comments{/number}","issue_comment_url":"https://api.github.com/repos/NVIDIA/DALI/issues/comments{/number}","contents_url":"https://api.github.com/repos/NVIDIA/DALI/contents/{+path}","compare_url":"https://api.github.com/repos/NVIDIA/DALI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NVIDIA/DALI/merges","archive_url":"https://api.github.com/repos/NVIDIA/DALI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NVIDIA/DALI/downloads","issues_url":"https://api.github.com/repos/NVIDIA/DALI/issues{/number}","pulls_url":"https://api.github.com/repos/NVIDIA/DALI/pulls{/number}","milestones_url":"https://api.github.com/repos/NVIDIA/DALI/milestones{/number}","notifications_url":"https://api.github.com/repos/NVIDIA/DALI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NVIDIA/DALI/labels{/name}","releases_url":"https://api.github.com/repos/NVIDIA/DALI/releases{/id}","deployments_url":"https://api.github.com/repos/NVIDIA/DALI/deployments","created_at":"2018-06-01T22:18:01Z","updated_at":"2018-09-17T11:14:39Z","pushed_at":"2018-09-17T11:48:02Z","git_url":"git://github.com/NVIDIA/DALI.git","ssh_url":"git@github.com:NVIDIA/DALI.git","clone_url":"https://github.com/NVIDIA/DALI.git","svn_url":"https://github.com/NVIDIA/DALI","homepage":"https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/index.html","size":35431,"stargazers_count":686,"watchers_count":686,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":75,"open_issues":21,"watchers":686,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/166"},"html":{"href":"https://github.com/NVIDIA/DALI/pull/166"},"issue":{"href":"https://api.github.com/repos/NVIDIA/DALI/issues/166"},"comments":{"href":"https://api.github.com/repos/NVIDIA/DALI/issues/166/comments"},"review_comments":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/166/comments"},"review_comment":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NVIDIA/DALI/pulls/166/commits"},"statuses":{"href":"https://api.github.com/repos/NVIDIA/DALI/statuses/b6738bd02da58110c21dd457ff0dc0d23699ccfc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"szalpal"}}