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 C5F5E4A047 for ; Mon, 18 Mar 2024 16:57:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A2AA468D344; Mon, 18 Mar 2024 18:57:08 +0200 (EET) 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 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: 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++) { -- 2.44.0 _______________________________________________ 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".