From patchwork Mon Jul 11 15:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rishikesh Donadkar X-Patchwork-Id: 16587 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5B721BD1F1 for ; Mon, 11 Jul 2022 15:37:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AC6C562752; Mon, 11 Jul 2022 17:37:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657553846; bh=F/yITT206bgTdL2YwSwEqm0tKtKqYWI+yTPz5IlG3Rg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ZsYijXZehtls433uPm9+TQKa8Gw+TuAJFwBXoxgYvhzUzq4swVmUgvadIA+NQAIxo 6CJvhbX0RdTzN4OTuwFSkwoDp+858gduNFhPK5+43bnhy71JUWpkaY3ZfUsbgr/Fx/ 2sztPHN6rZdzQseycrG44K36eolEM1ET17G39Boip+POWEkJV7g4INBoZRa62Gvm3u ywEZDvxSHyzD8lkVBqag2pH/ZWuhcu+G76b935T/9/VdIfkxSwNTSpstOU5P055Rec pPSg92dwmUFC4CGzpcLRUFEpiuh236evc8AZAISuwAowcqLKRhVc9YAgo76KAamU9N 4Bn4MKnjNr3ww== Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B388260401 for ; Mon, 11 Jul 2022 17:37:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="JMvuCTDZ"; dkim-atps=neutral Received: by mail-pf1-x42e.google.com with SMTP id l124so5076253pfl.8 for ; Mon, 11 Jul 2022 08:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9LtfPhc5+iHDtppR5xnGVZj6dGZbrLlkGO277y26yV8=; b=JMvuCTDZVoIU4bpS6yxJ05jBqiCn7d9ADg22+/JmPJhkj4/C7pNG/KvkHrB27irX2K FhZf0c5FvcidjCBR7gBxDgHmSoY/D5WtVaTqVutFVfgGDto3aaNwzEsPWmJmKTbO02uR Xfn9ZcskPOkXZIqYX6bgDQ5udLJpQD+E1ycvbOXvZtaTOAmAmDBJxYakxsawqyTnlGlT sa764VAYURjsug7GsWN5jsPcRfVySWPNvHj4UwvqvSjKDcX3hy/pbYk78Rwp2r6d9gVj EMivt7iVAvPQDVgB0f2iXL3lRwmn/RC2rhFA9pl54evBClq+/bRe/vrYWpu2gReTTjaJ DZ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9LtfPhc5+iHDtppR5xnGVZj6dGZbrLlkGO277y26yV8=; b=UfHdddc2X0tKak2zWXLupwxygLgR3dgB6RJpE+eRr7f+ZQOPELRD9G3yGSkHY2Es93 49qamwvBUBHne/o9GLdOGqCNNXtfTkUTnOx8T6m/jLBk3kij445OrvmuBwCtuNqWfFtZ 41uIfKI83KSl33TOmJgkKy5+zPqmFN5t2UYeb+AhoL9bHXpfxwie1TP4/xCYi+SMqJ6Q TSUfGzNav26wq0OyeqMIwcSpHsV3Zd/KuJYbLWu3ps19xdul4/NnjEHBqR1VJyvQd0l4 TCD3HrWwLUWPokQHJTzu/7tflgQkiwwhrWA8vuBTmN6KxcaCLI3Db4T/I+UvFDH8pPCw y0aw== X-Gm-Message-State: AJIora/pZE2HW+3P10+uqB/ZQOsEGLatJaFrZGrr1FhMEf6F/OzRcXEK m06Yly6+U8+HJf46Z8jVS6NiRtwUi4g= X-Google-Smtp-Source: AGRyM1slTFiowaiqN2CrLZxC1qPAq8eB93t2j5ArzbJpjLumSc7MQs4l3n4CzErwzmO6TAXf25e0HQ== X-Received: by 2002:aa7:8895:0:b0:528:c6c7:c603 with SMTP id z21-20020aa78895000000b00528c6c7c603mr19216331pfe.46.1657553842442; Mon, 11 Jul 2022 08:37:22 -0700 (PDT) Received: from localhost.localdomain ([103.124.170.70]) by smtp.googlemail.com with ESMTPSA id u18-20020a17090a891200b001ef87123615sm4891268pjn.37.2022.07.11.08.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 08:37:22 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 11 Jul 2022 21:07:06 +0530 Message-Id: <20220711153711.36679-1-rishikeshdonadkar@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/5] Add colorimetry support to libcamera gstreamer element. X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Rishikesh Donadkar via libcamera-devel From: Rishikesh Donadkar Reply-To: Rishikesh Donadkar Cc: Rishikesh Donadkar , nicolas.dufresne@collabora.com, vedantparanjape160201@gmail.com Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This series aims to add colorimetry support to the libcamera gstreamer element. If colorimetry is specified by the user in the gstreamer pipeline, try to apply the libcamera colorspace corresponding to the GStreamer colorimetry to the camera if the colorspace passes the validation then push the colorimetry corresponding to the valid colorspace in the caps. If the colorimetry pushed into the caps is same as requested negotiation will succeed, else negotiation will fail. If no colorimetry is specified by the user in the gstreamer pipeline, push the GStreamer colorimetry corresponding to the current colorspace applied to the camera into the caps and the negotiation will be take care of by the gstreamer. If the colorimetry corresponding to the current libcamera colorspace is not available in gstreamer then remove the colorimetry field if present in the caps. [PATCH 1/5] - Made a verbose commit message. Introduced a new helper function for converting std::string representation of colorimetry into G_STRING_TYPE. Removed unnecessary g_free(). Removed the std::optional wrapper around the colorSpace when converting into colorspace and passed the value of the colorSpace instead to the function as it is checked to have value before passing to the function. Eliminated the code which was checking if the colorimetry is valid colorimetry will be valid always because we are working with predefined colorimetries in gstreamer. [PATCH 2/5] - Simplified the if-else block. Eliminated the code where colorimetry was set to nullptr when it was not known. Insted the field is left unset. If the field is present and is unset then remove the field. [PATCH 3/5] - colorSpace was passed by reference as a function argument in the function colorimetry_form_colorspace(), Changed the function to return the colorspace instead and setting the colorspace in the StreamConfiguration was done after the colorspace is returned from the function. The local functions that were used in the same file were declared static. [PATCH 4/5] - Made the changes required due to the changes made in patch 3 [PATCH 5/5] - If the camera cannot deliver the colorspace requested in the gstreamer pipeline then the colorspace is reset to the value that was present before the attempt was made to set the colorspace corresponding to the requested colorimetry. Rishikesh Donadkar (5): gstreamer: convert from libcamera colorspace to GStreamer colorimetry. gstreamer: Update the obtained colorimetry in caps. gstreamer: Convert from GStreamer colorimetry to libcamera ColorSpace gstreamer: Configure the colorSpace in the Stream configuration. gstreamer: Reset the colorSpace if not the same after validation. src/gstreamer/gstlibcamera-utils.cpp | 69 ++++++++++++++++++++++++++++ src/gstreamer/gstlibcamerasrc.cpp | 12 +++++ 2 files changed, 81 insertions(+)