{"id":9785,"url":"https://patchwork.libcamera.org/api/patches/9785/?format=json","web_url":"https://patchwork.libcamera.org/patch/9785/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200924095008.338920-1-kieran.bingham@ideasonboard.com>","date":"2020-09-24T09:50:08","name":"[libcamera-devel] src: android: exif: Set the class byte ordering","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e0acfe28a29f8989ffade794426be7985df48d37","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9785/mbox/","series":[{"id":1319,"url":"https://patchwork.libcamera.org/api/series/1319/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1319","date":"2020-09-24T09:50:08","name":"[libcamera-devel] src: android: exif: Set the class byte ordering","version":1,"mbox":"https://patchwork.libcamera.org/series/1319/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9785/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9785/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8C8EDC3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Sep 2020 09:50:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5C1B262FF1;\n\tThu, 24 Sep 2020 11:50:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7EC8662FD8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Sep 2020 11:50:12 +0200 (CEST)","from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0B19B2FD;\n\tThu, 24 Sep 2020 11:50:11 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jFZ75e9P\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600941012;\n\tbh=PIDcw/gkrxsioFDiTw/zrGf+wR2oddoKwHSX6gJeL7U=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=jFZ75e9PwmhbwuCPet5UxG/pkvnTnBnJpWu9olWSHbthmtkAHE+o7BqAR+zIdhAnx\n\tOSU7QnEA8RvH7HvOekL0pOQ90dW2t/09ih6jvwVXCgEK7lZPO0+3vPH52ZEwH6XFnO\n\tRWByhWdyS6YIJgqhbNNu63v6jiCkc1lZSOl0eY/w=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tUmang Jain <email@uajain.com>","Date":"Thu, 24 Sep 2020 10:50:08 +0100","Message-Id":"<20200924095008.338920-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] src: android: exif: Set the class byte\n\tordering","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The exif object sets the byte ordering on construction, and then\nduring later calls re-states the byte ordering when setting values.\n\nIt could be argued that this ordering should already be known to the exif\nlibrary and is redudant, but even so we must provide it.\n\nEnsure we are consistent in always using the same byte ordering by setting\na private class member to re-use a single value.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nThis patch itself feels like it might be a bit redundant, but I saw the\nrepetition, and whilst we're not likely to change the byte order, I\nthought it might make sense to ensure it's always set from the same\nstate variable.\n\nIf this is helpful we can add it, but if this is overkill I don't mind\ndropping it. It's just an idea.\n\n src/android/jpeg/exif.cpp | 11 ++++++-----\n src/android/jpeg/exif.h   |  1 +\n 2 files changed, 7 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 1ced55343ee9..f29a7c71d1ec 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -25,7 +25,8 @@ LOG_DEFINE_CATEGORY(EXIF)\n  * data can be obtained using the data() method.\n  */\n Exif::Exif()\n-\t: valid_(false), data_(nullptr), exifData_(0), size_(0)\n+\t: valid_(false), data_(nullptr), order_(EXIF_BYTE_ORDER_INTEL),\n+\t  exifData_(0), size_(0)\n {\n \t/* Create an ExifMem allocator to construct entries. */\n \tmem_ = exif_mem_new_default();\n@@ -49,7 +50,7 @@ Exif::Exif()\n \t * Big-Endian: EXIF_BYTE_ORDER_MOTOROLA\n \t * Little Endian: EXIF_BYTE_ORDER_INTEL\n \t */\n-\texif_data_set_byte_order(data_, EXIF_BYTE_ORDER_INTEL);\n+\texif_data_set_byte_order(data_, order_);\n \n \t/* Create the mandatory EXIF fields with default data. */\n \texif_data_fix(data_);\n@@ -131,7 +132,7 @@ void Exif::setShort(ExifIfd ifd, ExifTag tag, uint16_t item)\n \tif (!entry)\n \t\treturn;\n \n-\texif_set_short(entry->data, EXIF_BYTE_ORDER_INTEL, item);\n+\texif_set_short(entry->data, order_, item);\n \texif_entry_unref(entry);\n }\n \n@@ -141,7 +142,7 @@ void Exif::setLong(ExifIfd ifd, ExifTag tag, uint32_t item)\n \tif (!entry)\n \t\treturn;\n \n-\texif_set_long(entry->data, EXIF_BYTE_ORDER_INTEL, item);\n+\texif_set_long(entry->data, order_, item);\n \texif_entry_unref(entry);\n }\n \n@@ -151,7 +152,7 @@ void Exif::setRational(ExifIfd ifd, ExifTag tag, ExifRational item)\n \tif (!entry)\n \t\treturn;\n \n-\texif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, item);\n+\texif_set_rational(entry->data, order_, item);\n \texif_entry_unref(entry);\n }\n \ndiff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h\nindex 622de4cfd593..6e8ce04a2e67 100644\n--- a/src/android/jpeg/exif.h\n+++ b/src/android/jpeg/exif.h\n@@ -46,6 +46,7 @@ private:\n \n \tExifData *data_;\n \tExifMem *mem_;\n+\tExifByteOrder order_;\n \n \tunsigned char *exifData_;\n \tunsigned int size_;\n","prefixes":["libcamera-devel"]}