{"action":"created","comment":{"url":"https://api.github.com/repos/OSGeo/gdal/pulls/comments/196147628","pull_request_review_id":129644105,"id":196147628,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjE0NzYyOA==","diff_hunk":"@@ -0,0 +1,183 @@\n+/******************************************************************************\n+ *\n+ * Project:  Raster Matrix Format\n+ * Purpose:  Implementation of the JPEG decompression algorithm as used in\n+ *           GIS \"Panorama\" raster files.\n+ * Author:   Andrew Sudorgin (drons [a] list dot ru)\n+ *\n+ ******************************************************************************\n+ * Copyright (c) 2018, Andrew Sudorgin\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a\n+ * copy of this software and associated documentation files (the \"Software\"),\n+ * to deal in the Software without restriction, including without limitation\n+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+ * and/or sell copies of the Software, and to permit persons to whom the\n+ * Software is furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included\n+ * in all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+ * DEALINGS IN THE SOFTWARE.\n+ ****************************************************************************/\n+\n+#ifdef HAVE_LIBJPEG\n+#include <algorithm>\n+#include \"cpl_conv.h\"\n+\n+#include \"rmfdataset.h\"\n+#include <setjmp.h>\n+CPL_C_START\n+#include <jpeglib.h>\n+CPL_C_END\n+\n+\n+static void RMFJPEGMessage(j_common_ptr poInfo, int iMsgLevel)\n+{\n+    if(iMsgLevel > 0)\n+    {\n+        return;\n+    }\n+\n+    poInfo->err->num_warnings++;\n+\n+    if(poInfo->err->num_warnings > 10)\n+    {\n+        return;\n+    }\n+\n+    char aszBuffer[JMSG_LENGTH_MAX] = {0};\n+\n+    poInfo->err->format_message(poInfo, aszBuffer);\n+    CPLError(CE_Failure, CPLE_AppDefined, \"RMF JPEG:%s\", aszBuffer);\n+}\n+\n+static void RMFJPEGError(j_common_ptr poInfo)\n+{\n+    jmp_buf* poJmpBuf = reinterpret_cast<jmp_buf*>(poInfo->client_data);\n+    char     aszBuffer[JMSG_LENGTH_MAX] = {0};\n+\n+    poInfo->err->format_message(poInfo, aszBuffer);\n+    CPLError(CE_Failure, CPLE_AppDefined, \"RMF JPEG: %s\", aszBuffer);\n+    longjmp(*poJmpBuf, 1);\n+}\n+\n+static void RMFJPEGNoop(j_decompress_ptr)\n+{\n+}\n+\n+/************************************************************************/\n+/*                          JPEGDecompress()                            */\n+/************************************************************************/\n+\n+int RMFDataset::JPEGDecompress(const GByte* pabyIn, GUInt32 nSizeIn,\n+                               GByte* pabyOut, GUInt32 nSizeOut,\n+                               GUInt32 nRawXSize, GUInt32 nRawYSize)\n+{\n+    if(pabyIn == nullptr ||\n+       pabyOut == nullptr ||\n+       nSizeOut < nSizeIn ||\n+       nSizeIn < 2)\n+       return 0;\n+\n+    jpeg_decompress_struct  oJpegInfo;\n+    jpeg_source_mgr         oSrc;\n+    jpeg_error_mgr          oJpegErr;\n+    jmp_buf                 oJmpBuf;\n+\n+    oJpegInfo.err = jpeg_std_error(&oJpegErr);\n+    oJpegErr.error_exit = RMFJPEGError;\n+    oJpegErr.emit_message = RMFJPEGMessage;\n+    oJpegInfo.client_data = reinterpret_cast<void*>(&oJmpBuf);\n+\n+    memset(&oSrc, 0, sizeof(jpeg_source_mgr));\n+\n+    oSrc.next_input_byte = (JOCTET *)pabyIn;\n+    oSrc.bytes_in_buffer = (size_t)nSizeIn;\n+    oSrc.term_source = RMFJPEGNoop;\n+    oSrc.init_source = RMFJPEGNoop;\n+\n+    jpeg_create_decompress(&oJpegInfo);\n+\n+    memset(&oJmpBuf, 0, sizeof(jmp_buf));\n+\n+    if(setjmp(oJmpBuf))\n+    {\n+        CPLError(CE_Failure, CPLE_AppDefined,\n+                 \"RMF JPEG: Error decompress JPEG tile\");\n+        jpeg_destroy_decompress(&oJpegInfo);\n+        return 0;\n+    }\n+\n+    oJpegInfo.src = &oSrc;\n+    jpeg_read_header(&oJpegInfo, TRUE);\n+\n+    oJpegInfo.dct_method = JDCT_FLOAT;\n+    oJpegInfo.out_color_space = JCS_RGB;\n+\n+    jpeg_start_decompress(&oJpegInfo);\n+\n+    JDIMENSION  nImageHeight = std::min(oJpegInfo.image_height,","path":"gdal/frmts/rmf/rmfjpeg.cpp","position":126,"original_position":126,"commit_id":"3a41a23f95fa3a74ce4b80baac20a230f3e52573","original_commit_id":"3a41a23f95fa3a74ce4b80baac20a230f3e52573","user":{"login":"rouault","id":1192433,"node_id":"MDQ6VXNlcjExOTI0MzM=","avatar_url":"https://avatars2.githubusercontent.com/u/1192433?v=4","gravatar_id":"","url":"https://api.github.com/users/rouault","html_url":"https://github.com/rouault","followers_url":"https://api.github.com/users/rouault/followers","following_url":"https://api.github.com/users/rouault/following{/other_user}","gists_url":"https://api.github.com/users/rouault/gists{/gist_id}","starred_url":"https://api.github.com/users/rouault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rouault/subscriptions","organizations_url":"https://api.github.com/users/rouault/orgs","repos_url":"https://api.github.com/users/rouault/repos","events_url":"https://api.github.com/users/rouault/events{/privacy}","received_events_url":"https://api.github.com/users/rouault/received_events","type":"User","site_admin":false},"body":"shouldn't there be a check that the number of components is 3 ?","created_at":"2018-06-18T16:44:58Z","updated_at":"2018-06-18T16:45:42Z","html_url":"https://github.com/OSGeo/gdal/pull/691#discussion_r196147628","pull_request_url":"https://api.github.com/repos/OSGeo/gdal/pulls/691","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/comments/196147628"},"html":{"href":"https://github.com/OSGeo/gdal/pull/691#discussion_r196147628"},"pull_request":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/691"}}},"pull_request":{"url":"https://api.github.com/repos/OSGeo/gdal/pulls/691","id":195393717,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MzkzNzE3","html_url":"https://github.com/OSGeo/gdal/pull/691","diff_url":"https://github.com/OSGeo/gdal/pull/691.diff","patch_url":"https://github.com/OSGeo/gdal/pull/691.patch","issue_url":"https://api.github.com/repos/OSGeo/gdal/issues/691","number":691,"state":"open","locked":false,"title":" RMF: Add support JPEG compressed RMF datasets ","user":{"login":"drons","id":14954199,"node_id":"MDQ6VXNlcjE0OTU0MTk5","avatar_url":"https://avatars3.githubusercontent.com/u/14954199?v=4","gravatar_id":"","url":"https://api.github.com/users/drons","html_url":"https://github.com/drons","followers_url":"https://api.github.com/users/drons/followers","following_url":"https://api.github.com/users/drons/following{/other_user}","gists_url":"https://api.github.com/users/drons/gists{/gist_id}","starred_url":"https://api.github.com/users/drons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drons/subscriptions","organizations_url":"https://api.github.com/users/drons/orgs","repos_url":"https://api.github.com/users/drons/repos","events_url":"https://api.github.com/users/drons/events{/privacy}","received_events_url":"https://api.github.com/users/drons/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-17T20:26:24Z","updated_at":"2018-06-18T16:45:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d59ed53b59cb573a67135dc4beee3e9c16af1fc4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OSGeo/gdal/pulls/691/commits","review_comments_url":"https://api.github.com/repos/OSGeo/gdal/pulls/691/comments","review_comment_url":"https://api.github.com/repos/OSGeo/gdal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OSGeo/gdal/issues/691/comments","statuses_url":"https://api.github.com/repos/OSGeo/gdal/statuses/3a41a23f95fa3a74ce4b80baac20a230f3e52573","head":{"label":"drons:rmfJpeg","ref":"rmfJpeg","sha":"3a41a23f95fa3a74ce4b80baac20a230f3e52573","user":{"login":"drons","id":14954199,"node_id":"MDQ6VXNlcjE0OTU0MTk5","avatar_url":"https://avatars3.githubusercontent.com/u/14954199?v=4","gravatar_id":"","url":"https://api.github.com/users/drons","html_url":"https://github.com/drons","followers_url":"https://api.github.com/users/drons/followers","following_url":"https://api.github.com/users/drons/following{/other_user}","gists_url":"https://api.github.com/users/drons/gists{/gist_id}","starred_url":"https://api.github.com/users/drons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drons/subscriptions","organizations_url":"https://api.github.com/users/drons/orgs","repos_url":"https://api.github.com/users/drons/repos","events_url":"https://api.github.com/users/drons/events{/privacy}","received_events_url":"https://api.github.com/users/drons/received_events","type":"User","site_admin":false},"repo":{"id":43601820,"node_id":"MDEwOlJlcG9zaXRvcnk0MzYwMTgyMA==","name":"gdal","full_name":"drons/gdal","owner":{"login":"drons","id":14954199,"node_id":"MDQ6VXNlcjE0OTU0MTk5","avatar_url":"https://avatars3.githubusercontent.com/u/14954199?v=4","gravatar_id":"","url":"https://api.github.com/users/drons","html_url":"https://github.com/drons","followers_url":"https://api.github.com/users/drons/followers","following_url":"https://api.github.com/users/drons/following{/other_user}","gists_url":"https://api.github.com/users/drons/gists{/gist_id}","starred_url":"https://api.github.com/users/drons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drons/subscriptions","organizations_url":"https://api.github.com/users/drons/orgs","repos_url":"https://api.github.com/users/drons/repos","events_url":"https://api.github.com/users/drons/events{/privacy}","received_events_url":"https://api.github.com/users/drons/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/drons/gdal","description":"GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats. This is a mirror of the GDAL Subversion repository.","fork":true,"url":"https://api.github.com/repos/drons/gdal","forks_url":"https://api.github.com/repos/drons/gdal/forks","keys_url":"https://api.github.com/repos/drons/gdal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drons/gdal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drons/gdal/teams","hooks_url":"https://api.github.com/repos/drons/gdal/hooks","issue_events_url":"https://api.github.com/repos/drons/gdal/issues/events{/number}","events_url":"https://api.github.com/repos/drons/gdal/events","assignees_url":"https://api.github.com/repos/drons/gdal/assignees{/user}","branches_url":"https://api.github.com/repos/drons/gdal/branches{/branch}","tags_url":"https://api.github.com/repos/drons/gdal/tags","blobs_url":"https://api.github.com/repos/drons/gdal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drons/gdal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drons/gdal/git/refs{/sha}","trees_url":"https://api.github.com/repos/drons/gdal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drons/gdal/statuses/{sha}","languages_url":"https://api.github.com/repos/drons/gdal/languages","stargazers_url":"https://api.github.com/repos/drons/gdal/stargazers","contributors_url":"https://api.github.com/repos/drons/gdal/contributors","subscribers_url":"https://api.github.com/repos/drons/gdal/subscribers","subscription_url":"https://api.github.com/repos/drons/gdal/subscription","commits_url":"https://api.github.com/repos/drons/gdal/commits{/sha}","git_commits_url":"https://api.github.com/repos/drons/gdal/git/commits{/sha}","comments_url":"https://api.github.com/repos/drons/gdal/comments{/number}","issue_comment_url":"https://api.github.com/repos/drons/gdal/issues/comments{/number}","contents_url":"https://api.github.com/repos/drons/gdal/contents/{+path}","compare_url":"https://api.github.com/repos/drons/gdal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drons/gdal/merges","archive_url":"https://api.github.com/repos/drons/gdal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drons/gdal/downloads","issues_url":"https://api.github.com/repos/drons/gdal/issues{/number}","pulls_url":"https://api.github.com/repos/drons/gdal/pulls{/number}","milestones_url":"https://api.github.com/repos/drons/gdal/milestones{/number}","notifications_url":"https://api.github.com/repos/drons/gdal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drons/gdal/labels{/name}","releases_url":"https://api.github.com/repos/drons/gdal/releases{/id}","deployments_url":"https://api.github.com/repos/drons/gdal/deployments","created_at":"2015-10-03T14:31:47Z","updated_at":"2017-04-24T21:11:31Z","pushed_at":"2018-06-18T14:09:39Z","git_url":"git://github.com/drons/gdal.git","ssh_url":"git@github.com:drons/gdal.git","clone_url":"https://github.com/drons/gdal.git","svn_url":"https://github.com/drons/gdal","homepage":"http://www.gdal.org/","size":195231,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"OSGeo:master","ref":"master","sha":"496edf2698c929a8a45160cbdbf09a864314986d","user":{"login":"OSGeo","id":1058467,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNTg0Njc=","avatar_url":"https://avatars3.githubusercontent.com/u/1058467?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGeo","html_url":"https://github.com/OSGeo","followers_url":"https://api.github.com/users/OSGeo/followers","following_url":"https://api.github.com/users/OSGeo/following{/other_user}","gists_url":"https://api.github.com/users/OSGeo/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGeo/subscriptions","organizations_url":"https://api.github.com/users/OSGeo/orgs","repos_url":"https://api.github.com/users/OSGeo/repos","events_url":"https://api.github.com/users/OSGeo/events{/privacy}","received_events_url":"https://api.github.com/users/OSGeo/received_events","type":"Organization","site_admin":false},"repo":{"id":6148317,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQ4MzE3","name":"gdal","full_name":"OSGeo/gdal","owner":{"login":"OSGeo","id":1058467,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNTg0Njc=","avatar_url":"https://avatars3.githubusercontent.com/u/1058467?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGeo","html_url":"https://github.com/OSGeo","followers_url":"https://api.github.com/users/OSGeo/followers","following_url":"https://api.github.com/users/OSGeo/following{/other_user}","gists_url":"https://api.github.com/users/OSGeo/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGeo/subscriptions","organizations_url":"https://api.github.com/users/OSGeo/orgs","repos_url":"https://api.github.com/users/OSGeo/repos","events_url":"https://api.github.com/users/OSGeo/events{/privacy}","received_events_url":"https://api.github.com/users/OSGeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSGeo/gdal","description":"GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats.","fork":false,"url":"https://api.github.com/repos/OSGeo/gdal","forks_url":"https://api.github.com/repos/OSGeo/gdal/forks","keys_url":"https://api.github.com/repos/OSGeo/gdal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSGeo/gdal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSGeo/gdal/teams","hooks_url":"https://api.github.com/repos/OSGeo/gdal/hooks","issue_events_url":"https://api.github.com/repos/OSGeo/gdal/issues/events{/number}","events_url":"https://api.github.com/repos/OSGeo/gdal/events","assignees_url":"https://api.github.com/repos/OSGeo/gdal/assignees{/user}","branches_url":"https://api.github.com/repos/OSGeo/gdal/branches{/branch}","tags_url":"https://api.github.com/repos/OSGeo/gdal/tags","blobs_url":"https://api.github.com/repos/OSGeo/gdal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSGeo/gdal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSGeo/gdal/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSGeo/gdal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSGeo/gdal/statuses/{sha}","languages_url":"https://api.github.com/repos/OSGeo/gdal/languages","stargazers_url":"https://api.github.com/repos/OSGeo/gdal/stargazers","contributors_url":"https://api.github.com/repos/OSGeo/gdal/contributors","subscribers_url":"https://api.github.com/repos/OSGeo/gdal/subscribers","subscription_url":"https://api.github.com/repos/OSGeo/gdal/subscription","commits_url":"https://api.github.com/repos/OSGeo/gdal/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSGeo/gdal/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSGeo/gdal/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSGeo/gdal/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSGeo/gdal/contents/{+path}","compare_url":"https://api.github.com/repos/OSGeo/gdal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSGeo/gdal/merges","archive_url":"https://api.github.com/repos/OSGeo/gdal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSGeo/gdal/downloads","issues_url":"https://api.github.com/repos/OSGeo/gdal/issues{/number}","pulls_url":"https://api.github.com/repos/OSGeo/gdal/pulls{/number}","milestones_url":"https://api.github.com/repos/OSGeo/gdal/milestones{/number}","notifications_url":"https://api.github.com/repos/OSGeo/gdal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSGeo/gdal/labels{/name}","releases_url":"https://api.github.com/repos/OSGeo/gdal/releases{/id}","deployments_url":"https://api.github.com/repos/OSGeo/gdal/deployments","created_at":"2012-10-09T21:39:58Z","updated_at":"2018-06-18T16:37:35Z","pushed_at":"2018-06-18T16:37:32Z","git_url":"git://github.com/OSGeo/gdal.git","ssh_url":"git@github.com:OSGeo/gdal.git","clone_url":"https://github.com/OSGeo/gdal.git","svn_url":"https://github.com/OSGeo/gdal","homepage":"http://www.gdal.org/","size":209366,"stargazers_count":728,"watchers_count":728,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":487,"mirror_url":null,"archived":false,"open_issues_count":23,"license":null,"forks":487,"open_issues":23,"watchers":728,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/691"},"html":{"href":"https://github.com/OSGeo/gdal/pull/691"},"issue":{"href":"https://api.github.com/repos/OSGeo/gdal/issues/691"},"comments":{"href":"https://api.github.com/repos/OSGeo/gdal/issues/691/comments"},"review_comments":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/691/comments"},"review_comment":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OSGeo/gdal/pulls/691/commits"},"statuses":{"href":"https://api.github.com/repos/OSGeo/gdal/statuses/3a41a23f95fa3a74ce4b80baac20a230f3e52573"}},"author_association":"NONE"}}
{"actor":{"display_login":"rouault"}}