From patchwork Mon Mar 18 16:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 47183 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp1139771pzb; Mon, 18 Mar 2024 09:57:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVajHLjl1YGWn6OzEav2ksgmasaxq+c9rXXTbS9PWKeyW+4kSQX83TTQMAL4GzNB6S7F9/hoDikJ+IADp8LPX7eOL3unc3QdSFwEg== X-Google-Smtp-Source: AGHT+IEtKQopHXhRsCr1XqqruV9VmlaPp3bc+xoZtqzyDscu2RtLIA1XuRlyAZrHF159+K2QY2h6 X-Received: by 2002:a17:906:bc95:b0:a46:1fa:fc12 with SMTP id lv21-20020a170906bc9500b00a4601fafc12mr7447397ejb.18.1710781067024; Mon, 18 Mar 2024 09:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710781067; cv=none; d=google.com; s=arc-20160816; b=IiOzkY5E7AtQnppCN9tOn+PrJndpXA7fVQGQ9vgQfCQdvKDcgs2uKetB8PIypsrqId Kn8JNIjFqHV/d2NsTYsgjTnhoDY+Ccy7MnXLp8MoM3riWAPhj/KFtavkpDh+Jqt9wDD9 4ilZcLRmqnP2j9VpqeD9WplM1p2Z/ubjXJPwXxfuWXNSRf3VZ81gWhCLb3Nl77Q6rJ82 +5JEGFmIzFw1d3BcyxdMVhA9zsA8xVHWT5p9MOyUMGtGmRjdd8MKomwRcSr+DVfypzs5 zgSKJMJWLsiFcIdFJN1o4qrpARlDGrtXh3Aj/3iOnREgfImB/W2lMfsOAqest3PqxI2/ DB3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=TNQbm6AnT8Zatg6+lHFdwHEp2BmN+d8Nfe60Izruqn8=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=zUqbEhn1EXFOnG2sM+3xbDb+Xf50xmueT6PoWr5a7NAY6/N6FCH/FPklTXspp/pNIE pLZsR/L2RaS2vxJCOlqvL72/JsshmfuGwXnzf3X51ffOuH39KjiaNPLn1VEnBlmFxRnD IpboBCZ66WVeT2QkDOEPEUs7LxFuOmEdFrFW9DEB9LD98RukaBihJbnuoVr9xucXKVlR 2tW6+04eFISDG+OJdELYMMLoXPGLKfFIYDkMI2nFge1CEvwmYZ3X260NIqI5SIeh+EF2 7UwJpAm8WRl8+QLTTiS/1X5XNxRNJZ3DcOiTf5T7e4fd/sO/5EkcRdF9cSHYqXMrRhzH egsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=KvvpmRiL; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g14-20020a170906538e00b00a449027ce94si4572504ejo.682.2024.03.18.09.57.46; Mon, 18 Mar 2024 09:57:47 -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=@haasn.xyz header.s=mail header.b=KvvpmRiL; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3FC768D34A; Mon, 18 Mar 2024 18:57:08 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1F55468D2DC for ; Mon, 18 Mar 2024 18:56:58 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1710781017; bh=WQ2n86Z401VqMeFy2pFufWmQ/wynwTV9Id+4JPWp/yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KvvpmRiLaSvrUfJmNbuJoyJxi+WpY/OsJMgsQzh/Ti789oGBr+l439p3OKxMmeRXN 09X9YwJ8BC1My3zQPNy9rJnL1uoBtoKhwgY6Dw93e73ItzXFEOk2LNPdCB3VHuSTJU NP6vRhVw89jR2O3O7nizMJYeR9pbyjVBRakAT2NM= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id C8E78434A2; Mon, 18 Mar 2024 17:56:57 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 18 Mar 2024 17:54:12 +0100 Message-ID: <20240318165651.75520-5-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318165651.75520-1-ffmpeg@haasn.xyz> References: <20240318165651.75520-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 04/13] ffprobe: adapt to new AVFilmGrainParams 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 Cc: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +3Oxm9V3lX1A From: Niklas Haas Follow the establish convention of printing the bit depth metadata per-component. --- fftools/ffprobe.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index fe2da82e24c..7d9998b428b 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -2402,22 +2402,41 @@ static void print_ambient_viewing_environment(WriterContext *w, static void print_film_grain_params(WriterContext *w, const AVFilmGrainParams *fgp) { + const char *color_range, *color_primaries, *color_trc, *color_space; + const char *const film_grain_type_names[] = { + [AV_FILM_GRAIN_PARAMS_NONE] = "none", + [AV_FILM_GRAIN_PARAMS_AV1] = "av1", + [AV_FILM_GRAIN_PARAMS_H274] = "h274", + }; + AVBPrint pbuf; - if (!fgp) + if (!fgp || fgp->type >= FF_ARRAY_ELEMS(film_grain_type_names)) return; + color_range = av_color_range_name(fgp->color_range); + color_primaries = av_color_primaries_name(fgp->color_primaries); + color_trc = av_color_transfer_name(fgp->color_trc); + color_space = av_color_space_name(fgp->color_space); + av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED); + print_str("type", film_grain_type_names[fgp->type]); + print_fmt("seed", "%"PRIu64, fgp->seed); + print_int("width", fgp->width); + print_int("height", fgp->height); + print_int("subsampling_x", fgp->subsampling_x); + print_int("subsampling_y", fgp->subsampling_y); + print_str("color_range", color_range ? color_range : "unknown"); + print_str("color_primaries", color_primaries ? color_primaries : "unknown"); + print_str("color_trc", color_trc ? color_trc : "unknown"); + print_str("color_space", color_space ? color_space : "unknown"); switch (fgp->type) { case AV_FILM_GRAIN_PARAMS_NONE: - print_str("type", "none"); break; case AV_FILM_GRAIN_PARAMS_AV1: { const AVFilmGrainAOMParams *aom = &fgp->codec.aom; const int num_ar_coeffs_y = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1); const int num_ar_coeffs_uv = num_ar_coeffs_y + !!aom->num_y_points; - print_str("type", "av1"); - print_fmt("seed", "%"PRIu64, fgp->seed); print_int("chroma_scaling_from_luma", aom->chroma_scaling_from_luma); print_int("scaling_shift", aom->scaling_shift); print_int("ar_coeff_lag", aom->ar_coeff_lag); @@ -2431,6 +2450,7 @@ static void print_film_grain_params(WriterContext *w, if (aom->num_y_points) { writer_print_section_header(w, NULL, SECTION_ID_FRAME_SIDE_DATA_COMPONENT); + print_int("bit_depth_luma", fgp->bit_depth_luma); print_list_fmt("y_points_value", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][0]); print_list_fmt("y_points_scaling", "%"PRIu8, aom->num_y_points, 1, aom->y_points[idx][1]); print_list_fmt("ar_coeffs_y", "%"PRId8, num_ar_coeffs_y, 1, aom->ar_coeffs_y[idx]); @@ -2445,6 +2465,7 @@ static void print_film_grain_params(WriterContext *w, writer_print_section_header(w, NULL, SECTION_ID_FRAME_SIDE_DATA_COMPONENT); + print_int("bit_depth_chroma", fgp->bit_depth_chroma); print_list_fmt("uv_points_value", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][0]); print_list_fmt("uv_points_scaling", "%"PRIu8, aom->num_uv_points[uv], 1, aom->uv_points[uv][idx][1]); print_list_fmt("ar_coeffs_uv", "%"PRId8, num_ar_coeffs_uv, 1, aom->ar_coeffs_uv[uv][idx]); @@ -2462,17 +2483,7 @@ static void print_film_grain_params(WriterContext *w, } case AV_FILM_GRAIN_PARAMS_H274: { const AVFilmGrainH274Params *h274 = &fgp->codec.h274; - const char *color_range_str = av_color_range_name(h274->color_range); - const char *color_primaries_str = av_color_primaries_name(h274->color_primaries); - const char *color_trc_str = av_color_transfer_name(h274->color_trc); - const char *color_space_str = av_color_space_name(h274->color_space); - print_str("type", "h274"); - print_fmt("seed", "%"PRIu64, fgp->seed); print_int("model_id", h274->model_id); - print_str("color_range", color_range_str ? color_range_str : "unknown"); - print_str("color_primaries", color_primaries_str ? color_primaries_str : "unknown"); - print_str("color_trc", color_trc_str ? color_trc_str : "unknown"); - print_str("color_space", color_space_str ? color_space_str : "unknown"); print_int("blending_mode_id", h274->blending_mode_id); print_int("log2_scale_factor", h274->log2_scale_factor); @@ -2483,7 +2494,7 @@ static void print_film_grain_params(WriterContext *w, continue; writer_print_section_header(w, NULL, SECTION_ID_FRAME_SIDE_DATA_COMPONENT); - print_int(c ? "bit_depth_chroma" : "bit_depth_luma", c ? h274->bit_depth_chroma : h274->bit_depth_luma); + print_int(c ? "bit_depth_chroma" : "bit_depth_luma", c ? fgp->bit_depth_chroma : fgp->bit_depth_luma); writer_print_section_header(w, NULL, SECTION_ID_FRAME_SIDE_DATA_PIECE_LIST); for (int i = 0; i < h274->num_intensity_intervals[c]; i++) {