From patchwork Fri Sep 1 20:38:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 34984 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1a81:b0:149:dfde:5c0a with SMTP id ci1csp578491pzb; Fri, 1 Sep 2023 13:38:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEhJELyyelgyGMALhrZb5BFSr22bgcj0UJvjyKdhU25WyL/llLxl36wtE1xS9+5udNfCyQ X-Received: by 2002:a17:906:101a:b0:9a2:24f9:fabd with SMTP id 26-20020a170906101a00b009a224f9fabdmr2336411ejm.73.1693600733117; Fri, 01 Sep 2023 13:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693600733; cv=none; d=google.com; s=arc-20160816; b=bu4Qu8tVldrgQDURAuzDjg1F49uMwg4PqounMmvmYYhtIsU3xxQun76oylUY2dy+7A aI8RV46Bc0XM+4s7tp/vsiZ9Y4/sDelbN2W+vyIP86CMuI7NxI4armV6GLB4Cja2y8Af zGJnVIlxHCTGJoQVKpgoNHXqC1angvotLGRpcAQvg9AvEIw3ocvF3wZhiwNGWL9udC17 jiFgHU8JQyU43/X4j/M7TJLu/5n+g1IzspixMIjB6t3TyNZuk8rOuuL7gJbXBvtBQFoG qutIohDib3oCajK1kzl/73m51IjaNrTQXGSqwwnLxv9v2Q+NzeTCR0mfP77qz19UX9VS RQEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=4s+1gcq+F1bKty/bF3ulnTLmnVb8RRjKa3dVyPNp41M=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jPUJo0dakrfl7YOHgAXmEnCPVbWosAsb5krl0GyCu9N0ntmQHrCn2Hh+O0lgL6Lo7X tpKi+yrY8mlXUC12CQ8DRQ7pDr0BTj+UsJ9f4/tZEaNebgprDSYQkU5fTu3c9uuJKYUN zlQ+lhqh2Ajo7N2cJcNIU6AZgd0jMfciU0ZeGLf/ibj7SBgHpuh2lRF80PAiQqxG9jbl neVvU4mMqyyNUtsVagpTcoD81NeLx74m7Q1LCVtymALmE3wQLNES0e6R92cp6+WrEsm+ TP/X3kpn9NK3FgH8+6NS/USCDRMXD1QZXVr7NwFB9QSgwhBOn6I/1V5riN6GYAlwBNqT W1LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b="iYeR6/Ug"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q10-20020a170906b28a00b00992ca771e3asi2869391ejz.48.2023.09.01.13.38.52; Fri, 01 Sep 2023 13:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b="iYeR6/Ug"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BCCD268C743; Fri, 1 Sep 2023 23:38:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5509068C6B7 for ; Fri, 1 Sep 2023 23:38:31 +0300 (EEST) Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2bcfdadd149so43540121fa.0 for ; Fri, 01 Sep 2023 13:38:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693600710; x=1694205510; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=i80uBTypGWDRHPt3mbWmalH4AZfUUl5MoeFDtP+gwAI=; b=iYeR6/UgmM8RW5HrCutPu8GgeVD3uv/AIgXenRV9ZwaYpkMfgeS1VlbJ2JEBEVDyZ+ H9obwqPKgs3U3RsK55UGdLrvpn+NtgfQ/jUs217ATS4jn/rEAZq+0IfJKOJaFqoXa8Ly xQls4Fl/iIN9Rd76CZHWXxiSB4p5ydX2Pi/xDND/7Tap6OnU7awTGVZy1EGLEGQKOkkD PblXgZpxTyCeekBBm5M2CK+/BlzAY8c22VFTiL6WYhcp/hAyStoWmOEdHCXkiZ8z7KAu 0ZprvHQvuGNniVYbt/AkuteAPPEPeGQUGb50NBSkkvGEU//LhmSEC0BupF+BIwSLKeI1 oWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693600710; x=1694205510; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i80uBTypGWDRHPt3mbWmalH4AZfUUl5MoeFDtP+gwAI=; b=Tr3Bf7/W7xt4Lr2hx97cy8v+IuePGyy5F12WQU9cVBtML5x7igGdNIfvNCKePJNgcw wjY6yf4fzqOKV+MqWNG3o0od4nV3jQnwj3CODEJ8qKmhNRQItcOghMrA+17bPIJf0Cbt DBF5ENd30FHcgekJ9+lZ0L9AFKo8jHmCftFWNgAGQmDmuJulRbWNxpWivhuP8t07wlo7 0Ki0+I7c7MLswjPD/pgJ/6bIGS80meU1k3RGl6s/GkMI+rsFq410HXa8qFjyinKmfUFn IHp2RvSQ1jApXn+B17xM5laie7UW/cBUy6JF8WfQh5H53WhHegfMPYXXj237g/YQt7qU XSrg== X-Gm-Message-State: AOJu0YzmhHc/aR1KjOBAfs2u7YCNR1a34wtvuiknKizatmn24q9Mddu+ XdRk1lc2ZHmmHDCT1XwILUx7X58lD49g4A== X-Received: by 2002:a2e:3c0f:0:b0:2bc:ffcd:8556 with SMTP id j15-20020a2e3c0f000000b002bcffcd8556mr2518679lja.12.1693600709708; Fri, 01 Sep 2023 13:38:29 -0700 (PDT) Received: from hifumi.mshome.net (91-153-198-187.elisa-laajakaista.fi. [91.153.198.187]) by smtp.gmail.com with ESMTPSA id k17-20020a2e9211000000b002b9a1e9ba68sm907954ljg.136.2023.09.01.13.38.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 13:38:29 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 1 Sep 2023 23:38:10 +0300 Message-ID: <20230901203828.275197-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 00/13] encoder AVCodecContext configuration side data 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eCWvPCEmXmR5 Differences to v3: 1. rebased on top of current master 2. limited libx264 HDR10 metadata FATE test to BUILD >=163 3. renamed the set variable to `frame_sd_set` as per request from James on IRC 4. adopted various things noted by Andreas in reviews for various patches 5. extended side data set FATE test to also test av_frame_side_data_set_extend Comparison URL (mostly configure and wrappers, avutil/frame.c): https://github.com/jeeb/ffmpeg/compare/avcodec_cll_mdcv_side_data_v3..avcodec_cll_mdcv_side_data_v4 This patch set I've now been working for a while since I felt like it was weird we couldn't pass through information such as static HDR metadata to encoders from decoded input. This initial version adds the necessary framework, as well as adds static HDR metadata support for libsvtav1, libx264 as well as libx265 wrappers. An alternative to this would be to make encoders only properly initialize when they receive the first AVFrame, but that seems to be a bigger, nastier change than introducing an AVFrameSideDataSet in avctx as everything seems to presume that extradata etc are available after opening the encoder. Note: Any opinions on whether FFCodec or AVCodec should have handled_side_data list, so that if format specific generic logic is added, it could be checked whether the codec itself handles this side data? This could also be utilized to list handled side data from f.ex. `ffmpeg -h encoder=libsvtav1`. Jan Jan Ekström (13): avutil/frame: add AVFrameSideDataSet for passing sets of side data avutil/frame: split side data list wiping out to non-AVFrame function avutil/frame: add helper for uninitializing side data sets avutil/frame: split side_data_from_buf to base and AVFrame func avutil/frame: split side data removal out to non-AVFrame function avutil/frame: add helper for adding side data to set avutil/frame: add helper for getting side data from set avutil/frame: add helper for extending a set of side data avcodec: add side data set to AVCodecContext ffmpeg: pass first video AVFrame's side data to encoder avcodec/libsvtav1: add support for writing out CLL and MDCV avcodec/libx264: add support for writing out CLL and MDCV avcodec/libx265: add support for writing out CLL and MDCV configure | 2 + fftools/ffmpeg_enc.c | 13 +++ libavcodec/avcodec.h | 7 ++ libavcodec/libsvtav1.c | 67 ++++++++++++++ libavcodec/libx264.c | 78 ++++++++++++++++ libavcodec/libx265.c | 87 ++++++++++++++++++ libavcodec/options.c | 1 + libavutil/Makefile | 1 + libavutil/frame.c | 155 +++++++++++++++++++++++++------- libavutil/frame.h | 63 +++++++++++++ libavutil/tests/side_data_set.c | 113 +++++++++++++++++++++++ tests/fate/enc_external.mak | 15 ++++ tests/fate/libavutil.mak | 4 + tests/ref/fate/libsvtav1-hdr10 | 14 +++ tests/ref/fate/libx264-hdr10 | 15 ++++ tests/ref/fate/libx265-hdr10 | 16 ++++ tests/ref/fate/side_data_set | 21 +++++ 17 files changed, 642 insertions(+), 30 deletions(-) create mode 100644 libavutil/tests/side_data_set.c create mode 100644 tests/ref/fate/libsvtav1-hdr10 create mode 100644 tests/ref/fate/libx264-hdr10 create mode 100644 tests/ref/fate/libx265-hdr10 create mode 100644 tests/ref/fate/side_data_set