From patchwork Mon Mar 17 11:26:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 22968 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 586AEC32F5 for ; Mon, 17 Mar 2025 11:27:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 11D6368947; Mon, 17 Mar 2025 12:27:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="bEt9po+S"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 16F84617F8 for ; Mon, 17 Mar 2025 12:27:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742210825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MXn+hW63M4UHNrMqg4WXkr+15ZXSB4UaGwFE6PwlUUY=; b=bEt9po+SEwnkbyBeKZx84GnEMlPJCVoJD1ZK/jyAE8iGdOE0RCyz0IEe/IAFEox3o+sWag fLUnt7zbvsQASKQC2Bj/Ec78Y3s7iXa0K3MBeCroTWf3xMPQzvJkfu+5l33W0op3W8Sl8A CZFe8J2Iiq6EV/JYnbGdKhO2GLBQQI4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-8F6wEeeAPoulBNJssAjiMw-1; Mon, 17 Mar 2025 07:27:04 -0400 X-MC-Unique: 8F6wEeeAPoulBNJssAjiMw-1 X-Mimecast-MFC-AGG-ID: 8F6wEeeAPoulBNJssAjiMw_1742210823 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2FE26180AF59; Mon, 17 Mar 2025 11:27:03 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.88]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BD29E1956095; Mon, 17 Mar 2025 11:27:01 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Robert Mader Subject: [PATCH] libcamera: software_isp: Reset stored exposure in black level Date: Mon, 17 Mar 2025 12:26:58 +0100 Message-ID: <20250317112658.15084-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: k0rd7gg2A5YKNHVQholfkM-nYJJehS5RpyQfYq_oTO8_1742210823 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Automatic black level setting in software ISP updates the determined black level value when exposure or gain change. It stores the last exposure and gain values to detect the change. BlackLevel::configure() resets the stored black level value but not the exposure and gain values. This can prevent updating the black value and cause bad image output e.g. after suspending and resuming a camera, if exposure and gain remain unchanged. Let's reset the stored exposure and gain values in BlackLevel::configure() to fix the problem. Bug: https://bugs.libcamera.org/show_bug.cgi?id=259 Signed-off-by: Milan Zamazal Tested-by: Robert Mader --- src/ipa/simple/algorithms/blc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 1d7d370b..14cf31bf 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* - * Copyright (C) 2024, Red Hat Inc. + * Copyright (C) 2024-2025, Red Hat Inc. * * Black level handling */ @@ -38,6 +38,9 @@ int BlackLevel::init([[maybe_unused]] IPAContext &context, int BlackLevel::configure(IPAContext &context, [[maybe_unused]] const IPAConfigInfo &configInfo) { + exposure_ = 0; + gain_ = 0; + if (definedLevel_.has_value()) context.configuration.black.level = definedLevel_; context.activeState.blc.level =