From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <git@haasn.dev>
Subject: [FFmpeg-devel] [PATCH v4 04/13] ffprobe: adapt to new AVFilmGrainParams
Date: Mon, 18 Mar 2024 17:54:12 +0100
Message-ID: <20240318165651.75520-5-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20240318165651.75520-1-ffmpeg@haasn.xyz>
From: Niklas Haas <git@haasn.dev>
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".
next prev parent reply other threads:[~2024-03-18 16:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 16:54 [FFmpeg-devel] [PATCH v4 00/13] AFGS1 film grain support Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 01/13] avutil/film_grain_params: add metadata to common struct Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 02/13] avutil/film_grain_params: initialize VCS to UNSPECIFIED Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 03/13] avfilter/vf_showinfo: adapt to new AVFilmGrainParams Niklas Haas
2024-03-18 16:54 ` Niklas Haas [this message]
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 05/13] avcodec/h2645_sei: signal new AVFilmGrainParams members Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 06/13] avcodec/av1dec: " Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 07/13] avcodec/libdavv1d: " Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 08/13] avutil/frame: clarify AV_FRAME_DATA_FILM_GRAIN_PARAMS usage Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 09/13] avutil/film_grain_params: add av_film_grain_params_select() Niklas Haas
2024-03-22 9:56 ` Anton Khirnov
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 10/13] avcodec/aom_film_grain: add AOM film grain synthesis Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 11/13] avcodec/aom_film_grain: implement AFGS1 parsing Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 12/13] avcodec/h2645_sei: decode AFGS1 T.35 SEI Niklas Haas
2024-03-18 16:54 ` [FFmpeg-devel] [PATCH v4 13/13] avcodec/hevcdec: apply AOM film grain synthesis Niklas Haas
2024-03-21 12:12 ` [FFmpeg-devel] [PATCH v4 00/13] AFGS1 film grain support Niklas Haas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240318165651.75520-5-ffmpeg@haasn.xyz \
--to=ffmpeg@haasn.xyz \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=git@haasn.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git