From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 462574E652 for ; Fri, 11 Jul 2025 14:01:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 33E1068FFF6; Fri, 11 Jul 2025 17:01:46 +0300 (EEST) Received: from vidala.pars.ee (vidala.pars.ee [116.203.72.101]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 7B55E68FFC9 for ; Fri, 11 Jul 2025 17:01:39 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; s=202405r; d=lynne.ee; c=relaxed/relaxed; h=From:To:Subject:Date:Message-ID; t=1752242499; bh=jCXwDnu0Pqojrn7Spkqbkaz XKV7porJng/nhFrQtC5I=; b=V9isO7V05ivfL0NWBvr/aDHNLmgdp3tvbEhpybKbEyuHadm6KN MD5A54Q1Q4VBsm/k46WSVsvILr2vm0SnpI5bU73o+EqySL5CJrSY4HWFlI3vgBpBjeSMWsskAjC 7YUu9XzZ1voewQrkzfXrC+OqeTip4ilaVcnYpXjXsxQ/HnNmpsk9ZQJRZFvbd5e0Zui6O5CBa4t aQrP/yl2fhPrY22K7DlefkDWgXsZeIwvjHPLjhV7Iqhlc2dptsGNLsHjXAf8pAaY8OeVzRlOxCR dUM3qzDY/c4MN1IsTHyiuRkwAh7CPk73E+VY1FSuC2fKf2X+iyOELidxnzQmdKpDNRA==; DKIM-Signature: v=1; a=ed25519-sha256; s=202405e; d=lynne.ee; c=relaxed/relaxed; h=From:To:Subject:Date:Message-ID; t=1752242499; bh=jCXwDnu0Pqojrn7Spkqbkaz XKV7porJng/nhFrQtC5I=; b=QsEamdf76YKqXvYVQq5W0pTzJTkAhgQpoR5EEf8/UG41zXuHs9 YC6k0gXrQyy3uQsT3yuHezuPH53hnwYP3SDg==; Message-ID: <95c00e3d-2ec3-4b20-97dc-7a1804618be4@lynne.ee> Date: Fri, 11 Jul 2025 23:01:36 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Niklas Haas , ffmpeg-devel@ffmpeg.org References: <20250710151349.1157547-1-dev@lynne.ee> <20250711123911.GB5499@haasn.xyz> Content-Language: en-US From: Lynne In-Reply-To: <20250711123911.GB5499@haasn.xyz> Subject: Re: [FFmpeg-devel] [PATCH 1/7] vf_libplacebo: add support for specifying a LUT for the input 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 11/07/2025 19:39, Niklas Haas wrote: > On Fri, 11 Jul 2025 00:13:29 +0900 Lynne wrote: >> This makes it possible to apply Adobe .cube files to inputs. >> --- >> libavfilter/vf_libplacebo.c | 28 ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c >> index 475030c80d..d74a6e1bf7 100644 >> --- a/libavfilter/vf_libplacebo.c >> +++ b/libavfilter/vf_libplacebo.c >> @@ -159,6 +159,7 @@ typedef struct LibplaceboContext { >> pl_vulkan vulkan; >> pl_gpu gpu; >> pl_tex tex[4]; >> + struct pl_custom_lut *lut; >> >> /* input state */ >> LibplaceboInput *inputs; >> @@ -184,6 +185,7 @@ typedef struct LibplaceboContext { >> AVExpr *pos_x_pexpr, *pos_y_pexpr, *pos_w_pexpr, *pos_h_pexpr; >> float pad_crop_ratio; >> float corner_rounding; >> + char *lut_filename; >> int force_original_aspect_ratio; >> int force_divisible_by; >> int reset_sar; >> @@ -371,6 +373,28 @@ static int find_scaler(AVFilterContext *avctx, >> return AVERROR(EINVAL); >> } >> >> +static int update_lut(LibplaceboContext *s) >> +{ >> + int ret; >> + uint8_t *lutbuf; >> + size_t lutbuf_size; >> + >> + pl_lut_free(&s->lut); >> + >> + if ((ret = av_file_map(s->lut_filename, &lutbuf, &lutbuf_size, 0, s)) < 0) { >> + av_log(s, AV_LOG_ERROR, >> + "The LUT file '%s' could not be read: %s\n", >> + s->lut_filename, av_err2str(ret)); >> + return ret; >> + } >> + >> + s->lut = pl_lut_parse_cube(s->log, lutbuf, lutbuf_size); > > It would be a good idea to at least warn or ideally error out if parsing > the file fails (in which case, this function returns NULL). Doesn't pl_lut_parse_cube do that already (its given a log context)? >> + >> + av_file_unmap(lutbuf, lutbuf_size); >> + >> + return 0; >> +} >> + >> static int update_settings(AVFilterContext *ctx) >> { >> int err = 0; >> @@ -468,6 +492,7 @@ static int update_settings(AVFilterContext *ctx) >> RET(find_scaler(ctx, &opts->params.upscaler, s->upscaler, 0)); >> RET(find_scaler(ctx, &opts->params.downscaler, s->downscaler, 0)); >> RET(find_scaler(ctx, &opts->params.frame_mixer, s->frame_mixer, 1)); >> + RET(update_lut(s)); > > Putting this function here will cause it to get called every time any of > the settings change, which could in principle be very frequent. > > I would either embed a lightweight check to see if the filename matches the > currently loaded filename, or else move this to the init() section and change > it from DYNAMIC to STATIC, like how the custom shaders are handled. Is parsing really that heavy? _______________________________________________ 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".