From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 20E9947618 for ; Tue, 14 Nov 2023 13:14:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 50E3568CD2A; Tue, 14 Nov 2023 15:14:44 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6316168CC56 for ; Tue, 14 Nov 2023 15:14:38 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id F396246D1E for ; Tue, 14 Nov 2023 14:14:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1699967678; bh=wa8IsLn3QQ7mU4IVNsFI8Jdg6UkIAi0I4QeSKnAzJnM=; h=Date:From:To:Subject:In-Reply-To:References:From; b=dIzT9mBMBd5OKHOPY15o+yBAv7wHu5vPBUg7YgcnH0WGOmH+0Py9eMk3AIxE+sBuK RmtvfdTCbrILV4/kJu0NnUQ5VlTLzqFfjE3jjHENSl95PsAynXKR9q0w0/zKp5AT3j xrjEua4hdk7tyuRqqFYupyPbqFFks7MBLVQnJg/Q= Date: Tue, 14 Nov 2023 14:14:37 +0100 Message-ID: <20231114141437.GB16959@haasn.xyz> From: Niklas Haas To: FFmpeg development discussions and patches In-Reply-To: <20231113183008.GK3543730@pb2> References: <20231113153234.8812-1-ffmpeg@haasn.xyz> <20231113153234.8812-2-ffmpeg@haasn.xyz> <20231113183008.GK3543730@pb2> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH 2/3] swscale/utils: correctly return from sws_init_single_context X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 13 Nov 2023 19:30:08 +0100 Michael Niedermayer wrote: > but i dont feel like i fully understand the issue here so maybe iam missing > the goal of this patchset somewhat So, to summarize the main problem: 1. sws_init_single_context() previously hard-coded decisions based on c->srcRange and c->dstRange. This is fundamentally broken, as srcRange/dstRange can change at any time with sws_setColorspaceDetails. 2. To fix this, this function was made to not early-return, and instead run the rest of the init code just in case range conversion is needed later. (With the check for whether or not the special converter can be used being moved to the callsite instead of the setup site) 3. This caused problems for non-YUV inputs, because previously these would always early return, but now they run the rest of the code, which triggers at least one assertion for float32 formats. 4. To fix this, this commit restores the early-return for non-YUV, preserving the status quo of existing behavior w.r.t not hitting the rest of the init function. 5. Separately, this commit fixes an error in previous condition (2) at the callsite, which relied on c->lumConvertRange being unset when no range conversion is needed. However, that condition did not match the condition used in the setup check before. > * convert_unscaled should only be set when used > OR > * if these are set "always" if not alphablend and convert_unscaled should be > two seperate fields. But i have not at all looked at what consequences that > would have so maybe that has issues convert_unscaled cannot be set only when used because we don't yet know if it will be used or not. There is also no advantage I see to splitting the fields, as they have basically the same logic attached to them - being dependent only on whether or not range conversion is needed. > Also if some range convert should not be used/set for some cases then > the check should maybe be where the range convert is setup not far away > from it. I mean a check close to the related code is easier to understand > One alternative that would make this possible would be to re-run whole context init from sws_setColorspaceDetails, if the srcRange/dstRange change. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".