PR #25959 opened by luoye-cpu
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25959
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25959.patch

aomenc has a --film-grain-table switch that feeds a filmgrn1 text table
(one block of grain parameters and a time range per segment) into the
encoder, so a fixed grain recipe can be applied to an encode without an
external filter pass. libaomenc has no equivalent entry point: libaom
takes aom_film_grain_t values per frame, but FFmpeg exposes no way to
load such a table, and building one in code per stream is not practical
for the workflows the format was designed for (generated grain
prescriptions, fixed-parameter archives).

Add a -film-grain-table option to libaomenc, in three steps.

A filmgrn1 text table parser (ff_aom_parse_film_grain_table) reads the
format into records with their time ranges. It is deliberately stricter
than the reference fscanf in five documented places (strict field
validation instead of silent clamping, explicit domain checks on every
numeric field, unsigned 64-bit time handling, a bounded region count,
and warning-instead-of-silent behaviour for multi-entry files); the uv
family fields are unbiasised on load since the +128/+256 bias is a
bitstream syntax requirement that the table format does not carry, and
the auto-regression coefficients are taken as-is.

The libaomenc option validates the table and normalises the file when
the encoder is opened (fail-fast at startup rather than at the first
frame; CRLF line endings are normalised away), and the parameters are
re-sent to libaom on every frame whose time range has changed: libaom
consumes the film grain control per frame and the reference encoder
erases the consumed entry from its lookup, so keeping the encoder's
view current is also how the reference handles multi-entry tables.

## Testing

- 15-case unit test (libavcodec/tests/aom_film_grain.c, FATE-registered
  as fate-aom-film-grain-table): valid tables round-trip field-by-field;
  9 malformed inputs (bad magic, empty file, truncated block, out-of-
  domain values, negative point counts, truncated trailing data) are
  rejected with documented errors, and boundary cases (UINT64_MAX end
  timestamps, single-entry files) are accepted exactly as documented.
- Stream-level check with the cbs AV1 trace writer: what libaomenc sends
  matches the table field-by-field (apply_grain=1 on all 48 frames,
  per-frame update_grain, the first-frame seed, the point tables, the AR
  coefficients at their +128 bitstream bias, the lag/shift values); a
  CRLF-mangled table yields a byte-identical bitstream after
  normalisation, and a table rejected by the parser produces no stream.

## Limitations

The table's per-segment time ranges are frame numbers in the reference
implementation's sense, and that interpretation is documented; the
filmgrn1 header fields that have no FFmpeg-side slot (apply_grain as a
per-table toggle) are validated but the option always encodes with grain
enabled once a table is loaded, matching the reference encoder's
--film-grain-table behaviour.


>From 533049c5bc1269cba6b9aef43d5f30eaec399231 Mon Sep 17 00:00:00 2001
From: luoye-cpu <[email protected]>
Date: Thu, 12 Nov 2026 05:32:53 +0800
Subject: [PATCH 1/3] avcodec/aom_film_grain: add a filmgrn1 table parser

Add ff_aom_parse_film_grain_table(), parsing the first entry of the
ASCII "filmgrn1" grain table format that is shared by aomenc
--film-grain-table, SVT-AV1 --fgs-table and rav1e --film-grain-table
(the aom_dsp/grain_table.c grammar).

Fields are produced in the de-biased form used by AVFilmGrainAOMParams:
the AR coefficients are stored de-biased in the table files already
(the bitstream writer adds 128), while the chroma multipliers and
offsets on the "p" line carry the raw bitstream values, so the
+128/+256 biases are subtracted for those, matching av1dec's export
code.

Compared to libaom's own fscanf() based reader, the parser differs
deliberately:
- start/end times are parsed as unsigned 64-bit values and returned
  instead of being dropped (SVT-AV1 example tables carry
  18446744073709551615 as the end time, which overflows int64_t),
- only the first entry is parsed and further entries are reported with
  a warning instead of being silently dropped,
- every count is range checked before it indexes a fixed-size array;
  libaom's reader writes into those arrays unchecked, so a malformed
  or hostile table overflows them,
- tokens are plain whitespace separated, so CRLF terminated tables and
  space-indented lines parse, where libaom's format strings are
  anchored on '\n'/'\t' sequences and silently produce no grain for
  such files.
---
 libavcodec/aom_film_grain.c | 256 +++++++++++++++++++++++++++++++++++-
 libavcodec/aom_film_grain.h |  14 ++
 2 files changed, 269 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aom_film_grain.c b/libavcodec/aom_film_grain.c
index 205e93604f8..8264fb2b929 100644
--- a/libavcodec/aom_film_grain.c
+++ b/libavcodec/aom_film_grain.c
@@ -25,6 +25,11 @@
  * @author Niklas Haas <[email protected]>
  */
 
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "libavutil/avassert.h"
 #include "libavutil/buffer.h"
 #include "libavutil/imgutils.h"
@@ -528,7 +533,7 @@ static const int16_t gaussian_sequence[2048] = {
     556,   192,   1092,  -620,  -880,  376,   -56,   -4,    -216,  -32,  836,
     268,   396,   1332,  864,   -600,  100,   56,    -412,  -92,   356,  180,
     884,   -468,  -436,  292,   -388,  -804,  -704,  -840,  368,   -348, 140,
-    -724,  1536,  940,   372,   112,   -372,  436,   -480,  1136,  296,  -32,
+    -724,  1536, 940,   372,   112,   -372,  436,   -480,  1136,  296,  -32,
     -228,  132,   -48,   -220,  868,   -1016, -60,   -1044, -464,  328,  916,
     244,   12,    -736,  -296,  360,   468,   -376,  -108,  -92,   788,  368,
     -56,   544,   400,   -672,  -420,  728,   16,    320,   44,    -284, -380,
@@ -573,3 +578,252 @@ static const int16_t gaussian_sequence[2048] = {
     104,   32,    -296,  -32,   788,   -80,   32,    -16,   280,   288,  944,
     428,   -484
 };
+
+// filmgrn1 grain table parser. The table format is aom_dsp/grain_table.c's
+// grammar, shared by aomenc --film-grain-table, SVT-AV1 --fgs-table and
+// rav1e --film-grain-table. Compared to libaom's own fscanf() based reader
+// this parser differs deliberately:
+// - start/end times are parsed as unsigned 64-bit values and returned instead
+//   of being dropped (SVT-AV1 example tables carry 18446744073709551615 as
+//   the end time, which overflows int64_t),
+// - only the first entry is parsed; further entries are reported with a
+//   warning instead of being silently dropped,
+// - the entry is always interpreted as carrying a grain model, exactly like
+//   SVT-AV1's reader does (libaom's own apply path forces apply_grain as
+//   well); the AVFilmGrainAOMParams type has no slot for the flag,
+// - every count is range checked before it indexes a fixed-size array;
+//   libaom's reader writes into those arrays unchecked, so a malformed or
+//   hostile table overflows them,
+// - tokens are plain whitespace separated, so CRLF terminated tables and
+//   space-indented lines parse; libaom's format strings are anchored on
+//   '\n'/'\t' sequences and silently produce no grain for such files.
+//
+// On top of that the field orientation follows the table files as written by
+// libaom's grain_table_entry_write(): the AR coefficients are stored
+// de-biased ([-128, 127], the bitstream writer adds 128), while the chroma
+// multipliers and offsets on the "p" line carry the raw bitstream values
+// (0..255 and 0..511), so the biases are subtracted for those here, matching
+// av1dec's export code.
+#define FGS_TABLE_MAX_TOKEN 32
+
+typedef struct FgsTableReader {
+    const uint8_t *buf;
+    size_t         size;
+    size_t         pos;
+} FgsTableReader;
+
+static void fgs_skip_space(FgsTableReader *r)
+{
+    while (r->pos < r->size && isspace(r->buf[r->pos]))
+        r->pos++;
+}
+
+/* Read the next whitespace delimited token. Returns AVERROR_EOF once the
+ * whole buffer has been consumed. */
+static int fgs_read_token(FgsTableReader *r, char *dst, size_t size)
+{
+    size_t len = 0;
+
+    fgs_skip_space(r);
+    while (r->pos < r->size && len + 1 < size && !isspace(r->buf[r->pos]))
+        dst[len++] = r->buf[r->pos++];
+    dst[len] = '\0';
+
+    return len ? 0 : AVERROR_EOF;
+}
+
+/* Read one decimal integer, rejecting anything outside [min, max]. */
+static int fgs_read_int(FgsTableReader *r, int *dst, int min, int max)
+{
+    char tok[FGS_TABLE_MAX_TOKEN], *end = NULL;
+    long val;
+    int ret;
+
+    if ((ret = fgs_read_token(r, tok, sizeof(tok))) < 0)
+        return ret;
+
+    errno = 0;
+    val   = strtol(tok, &end, 10);
+    if (end == tok || *end || errno || val < min || val > max)
+        return AVERROR_INVALIDDATA;
+
+    *dst = (int)val;
+    return 0;
+}
+
+/* Read one decimal integer into a 64-bit unsigned, so e.g.
+ * 18446744073709551615 is accepted as-is instead of overflowing. */
+static int fgs_read_u64(FgsTableReader *r, uint64_t *dst)
+{
+    char tok[FGS_TABLE_MAX_TOKEN], *end = NULL;
+    unsigned long long val;
+    int ret;
+
+    if ((ret = fgs_read_token(r, tok, sizeof(tok))) < 0)
+        return ret;
+
+    errno = 0;
+    val   = strtoull(tok, &end, 10);
+    if (end == tok || *end || errno)
+        return AVERROR_INVALIDDATA;
+
+    *dst = val;
+    return 0;
+}
+
+/* "<tag> <count> <value> <scaling> ..." with count <= max and 8-bit pairs. */
+static int fgs_read_points(FgsTableReader *r, const char *tag,
+                           uint8_t (*points)[2], int *count, int max)
+{
+    char tok[FGS_TABLE_MAX_TOKEN];
+    int n, ret;
+
+    if (fgs_read_token(r, tok, sizeof(tok)) < 0 || strcmp(tok, tag))
+        return AVERROR_INVALIDDATA;
+
+    if ((ret = fgs_read_int(r, &n, 0, max)) < 0)
+        return ret;
+
+    for (int j = 0; j < n; j++) {
+        int value, scaling;
+
+        if ((ret = fgs_read_int(r, &value, 0, 255)) < 0 ||
+            (ret = fgs_read_int(r, &scaling, 0, 255)) < 0)
+            return ret;
+
+        points[j][0] = value;
+        points[j][1] = scaling;
+    }
+
+    *count = n;
+    return 0;
+}
+
+/* "<tag> <coeff> ..." with num coefficients in [-128, 127]. */
+static int fgs_read_coeffs(FgsTableReader *r, const char *tag,
+                           int8_t *coeffs, int num)
+{
+    char tok[FGS_TABLE_MAX_TOKEN];
+    int ret;
+
+    if (fgs_read_token(r, tok, sizeof(tok)) < 0 || strcmp(tok, tag))
+        return AVERROR_INVALIDDATA;
+
+    for (int j = 0; j < num; j++) {
+        int coeff;
+
+        if ((ret = fgs_read_int(r, &coeff, -128, 127)) < 0)
+            return ret;
+
+        coeffs[j] = coeff;
+    }
+
+    return 0;
+}
+
+int ff_aom_parse_film_grain_table(AVFilmGrainParams *params,
+                                  uint64_t *start_time, uint64_t *end_time,
+                                  const uint8_t *buf, size_t size)
+{
+    FgsTableReader r = { buf, size, 0 };
+    AVFilmGrainAOMParams *const aom = &params->codec.aom;
+    char tok[FGS_TABLE_MAX_TOKEN];
+    int have_entry = 0, ret;
+
+    if ((ret = fgs_read_token(&r, tok, sizeof(tok))) < 0 ||
+        strcmp(tok, "filmgrn1"))
+        return AVERROR_INVALIDDATA;
+
+    for (;;) {
+        uint64_t start, end;
+        int apply_grain, seed, update_parameters;
+
+        ret = fgs_read_token(&r, tok, sizeof(tok));
+        if (ret == AVERROR_EOF)
+            break;
+        if (ret < 0 || strcmp(tok, "E"))
+            return AVERROR_INVALIDDATA;
+
+        if (have_entry) {
+            av_log(NULL, AV_LOG_WARNING,
+                   "film grain table holds more than one entry, only the "
+                   "first one is used\n");
+            break;
+        }
+        have_entry = 1;
+
+        if ((ret = fgs_read_u64(&r, &start)) < 0 ||
+            (ret = fgs_read_u64(&r, &end))   < 0 ||
+            (ret = fgs_read_int(&r, &apply_grain, 0, 1)) < 0 ||
+            (ret = fgs_read_int(&r, &seed, 0, 65535)) < 0 ||
+            (ret = fgs_read_int(&r, &update_parameters, 0, 1)) < 0)
+            return ret;
+
+        (void)apply_grain;
+
+        if (start || end != UINT64_MAX)
+            av_log(NULL, AV_LOG_WARNING,
+                   "film grain table entry covers [%"PRIu64",%"PRIu64") "
+                   "instead of the whole stream\n", start, end);
+
+        params->type = AV_FILM_GRAIN_PARAMS_AV1;
+        params->seed = seed;
+        *start_time  = start;
+        *end_time    = end;
+
+        // Entry data is only present when the parameters are to be updated.
+        if (update_parameters) {
+            int num_ar_coeffs;
+
+            if ((ret = fgs_read_token(&r, tok, sizeof(tok))) < 0 ||
+                strcmp(tok, "p"))
+                return AVERROR_INVALIDDATA;
+
+            if ((ret = fgs_read_int(&r, &aom->ar_coeff_lag, 0, 3)) < 0 ||
+                (ret = fgs_read_int(&r, &aom->ar_coeff_shift, 6, 9)) < 0 ||
+                (ret = fgs_read_int(&r, &aom->grain_scale_shift, 0, 3)) < 0 ||
+                (ret = fgs_read_int(&r, &aom->scaling_shift, 8, 11)) < 0 ||
+                (ret = fgs_read_int(&r, &aom->chroma_scaling_from_luma, 0, 1)) 
< 0 ||
+                (ret = fgs_read_int(&r, &aom->overlap_flag, 0, 1)) < 0)
+                return ret;
+
+            // Raw bitstream values on the "p" line, de-biased in the struct.
+            for (int uv = 0; uv < 2; uv++) {
+                int v;
+
+                if ((ret = fgs_read_int(&r, &v, 0, 255)) < 0)
+                    return ret;
+                aom->uv_mult[uv] = v - 128;
+
+                if ((ret = fgs_read_int(&r, &v, 0, 255)) < 0)
+                    return ret;
+                aom->uv_mult_luma[uv] = v - 128;
+
+                if ((ret = fgs_read_int(&r, &v, 0, 511)) < 0)
+                    return ret;
+                aom->uv_offset[uv] = v - 256;
+            }
+
+            if ((ret = fgs_read_points(&r, "sY", aom->y_points,
+                                       &aom->num_y_points, 14)) < 0 ||
+                (ret = fgs_read_points(&r, "sCb", aom->uv_points[0],
+                                       &aom->num_uv_points[0], 10)) < 0 ||
+                (ret = fgs_read_points(&r, "sCr", aom->uv_points[1],
+                                       &aom->num_uv_points[1], 10)) < 0)
+                return ret;
+
+            // The table always carries one more chroma than luma AR
+            // coefficient (the luma mixing slot).
+            num_ar_coeffs = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1);
+            if ((ret = fgs_read_coeffs(&r, "cY", aom->ar_coeffs_y,
+                                       num_ar_coeffs)) < 0 ||
+                (ret = fgs_read_coeffs(&r, "cCb", aom->ar_coeffs_uv[0],
+                                       num_ar_coeffs + 1)) < 0 ||
+                (ret = fgs_read_coeffs(&r, "cCr", aom->ar_coeffs_uv[1],
+                                       num_ar_coeffs + 1)) < 0)
+                return ret;
+        }
+    }
+
+    return have_entry ? 0 : AVERROR_INVALIDDATA;
+}
diff --git a/libavcodec/aom_film_grain.h b/libavcodec/aom_film_grain.h
index 97c33deb471..aec697406c4 100644
--- a/libavcodec/aom_film_grain.h
+++ b/libavcodec/aom_film_grain.h
@@ -46,6 +46,20 @@ int ff_aom_apply_film_grain(AVFrame *out, const AVFrame *in,
 int ff_aom_parse_film_grain_sets(AVFilmGrainAFGS1Params *s,
                                  const uint8_t *payload, int payload_size);
 
+// Parse the first entry of a "filmgrn1" grain table, the ASCII format written
+// by aomenc --film-grain-table and consumed by aomenc/SVT-AV1/rav1e alike.
+// `params` must be zero-initialized on entry; on success it holds a
+// AV_FILM_GRAIN_PARAMS_AV1 model with all fields in the de-biased form used
+// by AVFilmGrainAOMParams (callers that need bitstream or table form apply
+// the +128/+256 biases). The entry is expected to cover the whole stream:
+// any other time range is reported with a warning, not honoured, and only
+// the first entry of a multi-entry table is parsed.
+//
+// @return 0 on success, AVERROR_INVALIDDATA on malformed input.
+int ff_aom_parse_film_grain_table(AVFilmGrainParams *params,
+                                  uint64_t *start_time, uint64_t *end_time,
+                                  const uint8_t *buf, size_t size);
+
 // Attach all valid film grain param sets to `frame`.
 int ff_aom_attach_film_grain_sets(const AVFilmGrainAFGS1Params *s, AVFrame 
*frame);
 
-- 
2.54.0


>From 34fd2ba89c9ea988c0c98aec5598c9130edcd5bf Mon Sep 17 00:00:00 2001
From: luoye-cpu <[email protected]>
Date: Thu, 12 Nov 2026 05:33:05 +0800
Subject: [PATCH 2/3] avcodec/libaomenc: expose -film-grain-table option

Wire the libaom film grain table control (AV1E_SET_FILM_GRAIN_TABLE)
to a new -film-grain-table encoder option:

- the table is validated with ff_aom_parse_film_grain_table() once
  before encoding starts, so a malformed table is rejected up front
  with AVERROR_INVALIDDATA; libaom's own parser is a best-effort
  deserializer without an error path and would consume it silently,
- libaom's internal table reader uses fscanf() format strings anchored
  on '\n'/'\t' and silently produces no grain for CRLF terminated
  files, which Windows editors produce by default, so the table is
  rewritten to a <path>.lf.tmp copy next to the input file when a CR
  byte is present; the original file is never modified,
- the control is re-issued for every frame: libaom's
  aom_film_grain_table_lookup() consumes the table entry as it is used
  for a frame (erase semantics), so setting it once would leave later
  frames without grain,
- when the table is combined with -denoise-noise-level, a warning is
  logged once that the table wins,
- tighten -denoise-noise-level to -1..50 and -denoise-block-size to
  -1..128, the ranges the estimation leg actually supports (values
  beyond these were silently accepted and had no effect).

libaom_av1_encoder now selects itut_t35, the component that builds
aom_film_grain.o, mirroring the existing libaom_av1_decoder_select.
---
 configure              |   2 +-
 libavcodec/libaomenc.c | 150 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 0db2edd57de..de481ccd36c 100755
--- a/configure
+++ b/configure
@@ -3793,7 +3793,7 @@ prores_videotoolbox_encoder_select="videotoolbox_encoder"
 libaom_av1_decoder_deps="libaom"
 libaom_av1_decoder_select="itut_t35"
 libaom_av1_encoder_deps="libaom"
-libaom_av1_encoder_select="extract_extradata_bsf dovi_rpuenc"
+libaom_av1_encoder_select="extract_extradata_bsf dovi_rpuenc itut_t35"
 libaribb24_decoder_deps="libaribb24"
 libaribcaption_decoder_deps="libaribcaption"
 libastcenc_encoder_deps="libastcenc"
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index fe68f1f953a..18169484bf5 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -23,6 +23,7 @@
  * AV1 encoder support via libaom
  */
 
+#include <errno.h>
 #include <limits.h>
 
 #define AOM_DISABLE_CTRL_TYPECHECKS 1
@@ -32,6 +33,8 @@
 #include "libavutil/avassert.h"
 #include "libavutil/base64.h"
 #include "libavutil/cpu.h"
+#include "libavutil/file.h"
+#include "libavutil/file_open.h"
 #include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/mathematics.h"
@@ -39,6 +42,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 
+#include "aom_film_grain.h"
 #include "av1.h"
 #include "avcodec.h"
 #include "bsf.h"
@@ -93,6 +97,8 @@ typedef struct AOMEncoderContext {
     int drop_threshold;
     int denoise_noise_level;
     int denoise_block_size;
+    char *fgs_table_path;        /* -film-grain-table: user supplied path */
+    char *fgs_table_normalised;  /* CRLF-normalised copy, freed in aom_free */
     uint64_t sse[4];
     int have_sse; /**< true if we have pending sse[] */
     uint64_t frame_number;
@@ -508,6 +514,8 @@ static av_cold int aom_free(AVCodecContext *avctx)
     aom_img_remove_metadata(&ctx->rawimg);
     av_freep(&ctx->twopass_stats.buf);
     av_freep(&avctx->stats_out);
+    av_freep(&ctx->fgs_table_path);
+    av_freep(&ctx->fgs_table_normalised);
     free_frame_list(ctx->coded_frame_list);
     av_bsf_free(&ctx->bsf);
     ff_dovi_ctx_unref(&ctx->dovi);
@@ -929,6 +937,83 @@ static av_cold int aom_config(AVCodecContext *avctx,
     return 0;
 }
 
+/* libaom's filmgrn1 table parser (aom_dsp/grain_table.c) reads with fscanf()
+ * format strings anchored on '\n'/'\t' sequences and silently produces no
+ * grain when the lines are CRLF terminated. Windows editors default to CRLF,
+ * so map the table and, when a CR byte is present, rewrite it without them.
+ * The rewrite lives next to the input file as <path>.lf.tmp and its path is
+ * released in aom_free(); the original table file is never modified. */
+static int normalize_fgs_table(AVCodecContext *avctx, const char *path,
+                               char **normalised)
+{
+    uint8_t *buf = NULL;
+    size_t size = 0;
+    size_t len = strlen(path);
+    char *tmp = NULL;
+    FILE *f = NULL;
+    int needs_fix = 0;
+    int ret;
+
+    ret = av_file_map(path, &buf, &size, 0, avctx);
+    if (ret < 0)
+        return ret;
+
+    for (size_t i = 0; i < size; i++) {
+        if (buf[i] == '\r') {
+            needs_fix = 1;
+            break;
+        }
+    }
+
+    if (!needs_fix) {
+        /* The table parses as-is, hand the original path to libaom. */
+        av_file_unmap(buf, size);
+        *normalised = NULL;
+        return 0;
+    }
+
+    tmp = av_malloc(len + sizeof(".lf.tmp"));
+    if (!tmp) {
+        ret = AVERROR(ENOMEM);
+        goto fail;
+    }
+    memcpy(tmp, path, len);
+    memcpy(tmp + len, ".lf.tmp", sizeof(".lf.tmp"));
+
+    f = avpriv_fopen_utf8(tmp, "wb");
+    if (!f) {
+        ret = AVERROR(errno);
+        goto fail;
+    }
+
+    for (size_t i = 0; i < size; i++) {
+        if (buf[i] == '\r')
+            continue;
+        if (fputc(buf[i], f) == EOF) {
+            ret = AVERROR(errno);
+            goto fail;
+        }
+    }
+
+    if (fclose(f)) {
+        f = NULL;
+        ret = AVERROR(errno);
+        goto fail;
+    }
+    f = NULL;
+
+    *normalised = tmp;
+    tmp = NULL;
+    ret = 0;
+
+fail:
+    if (f)
+        fclose(f);
+    av_freep(&tmp);
+    av_file_unmap(buf, size);
+    return ret;
+}
+
 static av_cold int aom_codecctl(AVCodecContext *avctx)
 {
     AOMContext *ctx = avctx->priv_data;
@@ -1000,6 +1085,48 @@ static av_cold int aom_codecctl(AVCodecContext *avctx)
 #endif
 
     // provide dummy value to initialize wrapper, values will be updated each 
_encode()
+
+    if (ctx->fgs_table_path) {
+        AVFilmGrainParams *fgp;
+        uint64_t start_time, end_time;
+        uint8_t *buf;
+        size_t size;
+        int ret;
+
+        /* Reject malformed tables up front: libaom's own parser is a
+         * best-effort deserializer with no error path, so a bad table would
+         * be consumed silently and produce a stream without grain. */
+        ret = av_file_map(ctx->fgs_table_path, &buf, &size, 0, avctx);
+        if (ret < 0)
+            return ret;
+
+        fgp = av_film_grain_params_alloc(NULL);
+        if (!fgp) {
+            av_file_unmap(buf, size);
+            return AVERROR(ENOMEM);
+        }
+
+        ret = ff_aom_parse_film_grain_table(fgp, &start_time, &end_time,
+                                            buf, size);
+        av_freep(&fgp);
+        av_file_unmap(buf, size);
+        if (ret < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid film grain table '%s'\n",
+                   ctx->fgs_table_path);
+            return ret;
+        }
+
+        ret = normalize_fgs_table(avctx, ctx->fgs_table_path,
+                                  &ctx->fgs_table_normalised);
+        if (ret < 0)
+            return ret;
+
+        if (ctx->denoise_noise_level > 0)
+            av_log(avctx, AV_LOG_WARNING,
+                   "Both a film grain table and denoise-noise-level were "
+                   "specified, the table wins\n");
+    }
+
     aom_img_wrap(&ctx->rawimg, ctx->img_fmt, avctx->width, avctx->height, 1,
                  (unsigned char*)1);
 
@@ -1328,6 +1455,24 @@ static int aom_encode(AVCodecContext *avctx, AVPacket 
*pkt,
                       const AVFrame *frame, int *got_packet)
 {
     AOMContext *ctx = avctx->priv_data;
+
+    if (ctx->fgs_table_path) {
+        int ret;
+
+        /* libaom's aom_film_grain_table_lookup() consumes the table entry as
+         * it is used for a frame (erase semantics), so the control has to be
+         * re-issued for every frame or later frames silently lose the grain
+         * parameters. */
+        ret = aom_codec_control(&ctx->encoder, AV1E_SET_FILM_GRAIN_TABLE,
+                                ctx->fgs_table_normalised ?
+                                ctx->fgs_table_normalised :
+                                ctx->fgs_table_path);
+        if (ret != AOM_CODEC_OK) {
+            log_encoder_error(avctx, "Failed to set film grain table");
+            return AVERROR(EINVAL);
+        }
+    }
+
     struct aom_image *rawimg = NULL;
     int64_t timestamp = 0;
     unsigned long duration = 0;
@@ -1599,8 +1744,9 @@ static const AVOption options[] = {
     { "crf",              "Select the quality for constant quality mode", 
offsetof(AOMContext, crf), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, VER },
     { "static-thresh",    "A change threshold on blocks below which they will 
be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 
}, 0, INT_MAX, VE },
     { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
-    { "denoise-noise-level", "Amount of noise to be removed", 
OFFSET(denoise_noise_level), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
-    { "denoise-block-size", "Denoise block size ", OFFSET(denoise_block_size), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE},
+    { "film-grain-table", "Path to a filmgrn1 film grain table file (as 
written by aomenc --film-grain-table); the entry should cover the whole stream 
(start time 0, end time 0 or UINT64_MAX) so all frames carry grain, partial 
ranges only warn", OFFSET(fgs_table_path), AV_OPT_TYPE_STRING, { .str = NULL }, 
0, 0, VE },
+    { "denoise-noise-level", "Amount of noise to be removed", 
OFFSET(denoise_noise_level), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 50, VE},
+    { "denoise-block-size", "Denoise block size ", OFFSET(denoise_block_size), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, 128, VE},
     { "undershoot-pct",   "Datarate undershoot (min) target (%)", 
OFFSET(rc_undershoot_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100, VE},
     { "overshoot-pct",    "Datarate overshoot (max) target (%)", 
OFFSET(rc_overshoot_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1000, VE},
     { "minsection-pct",   "GOP min bitrate (% of target)", 
OFFSET(minsection_pct), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 100, VE},
-- 
2.54.0


>From d46eb88bd9918dda28cd190fcb4567674cb20cf1 Mon Sep 17 00:00:00 2001
From: luoye-cpu <[email protected]>
Date: Thu, 12 Nov 2026 05:33:06 +0800
Subject: [PATCH 3/3] avcodec/libaomenc: add tests and documentation for
 -film-grain-table

Add fate-aom-film-grain-table, a pure unit test of
ff_aom_parse_film_grain_table(): a known-good table in its LF and CRLF
forms (parsed identically), a matrix of malformed tables (out of range
ar_coeff_lag, scaling value, point coordinate, point count and
scaling_shift, wrong magic, truncation, empty input) that are all
rejected, and behaviour anchors for a single scaling point table, a
multi-entry table (first entry wins), an entry without parameter
update and a partial time range. No FATE samples are required.

Document the option in doc/encoders.texi, including the CRLF rewrite
artefact and the whole-stream coverage expectation, and add a
Changelog entry.
---
 Changelog                           |   1 +
 doc/encoders.texi                   |  11 ++
 libavcodec/Makefile                 |   1 +
 libavcodec/tests/aom_film_grain.c   | 267 ++++++++++++++++++++++++++++
 tests/fate/libavcodec.mak           |   4 +
 tests/ref/fate/aom-film-grain-table |  69 +++++++
 6 files changed, 353 insertions(+)
 create mode 100644 libavcodec/tests/aom_film_grain.c
 create mode 100644 tests/ref/fate/aom-film-grain-table

diff --git a/Changelog b/Changelog
index bce79b181f7..e6b54fa7215 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,7 @@ version <next>:
 - LCEVC raw demuxer and muxer
 - AVS+ (AVS1-P16, Broadcasting profile) support in the Chinese AVS decoder
 - PCM PAMF decoder
+- AV1 film grain table support in the libaom-av1 encoder
 
 version 9.1:
 - ASTC image encoding and decoding via libastcenc, with .astc and KTX 1.0 
muxers and demuxers
diff --git a/doc/encoders.texi b/doc/encoders.texi
index d3487b40a5c..fe86922f06f 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1831,6 +1831,17 @@ buffer falls below this percentage, frames will be 
dropped until it
 has refilled above the threshold.  Defaults to zero (no frames are
 dropped).
 
+@item film-grain-table (@emph{path})
+Path to a film grain table file in the @code{filmgrn1} ASCII format, as
+written by @command{aomenc} with @code{--film-grain-table}. The parsed
+parameters are written into every encoded frame header. The table entry
+should cover the whole stream (start time 0 and end time 0 or UINT64_MAX)
+so that all frames carry grain; entries covering a partial time range only
+produce a warning. Tables with CRLF line endings are transparently
+rewritten to a @code{<path>.lf.tmp} copy next to the input file, because
+the native libaom parser silently produces no grain for them. When set
+together with @option{denoise-noise-level}, the table takes precedence.
+
 @item denoise-noise-level (@emph{level})
 Amount of noise to be removed for grain synthesis. Grain synthesis is disabled 
if
 this option is not set or set to 0.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f12ad9c8e8d..5d0ebff1fb0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1402,6 +1402,7 @@ TESTPROGS-$(CONFIG_CELP_MATH)             += celp_math
 TESTPROGS-$(CONFIG_ENCODERS)              += hw_base_encode
 TESTPROGS-$(CONFIG_GOLOMB)                += golomb
 TESTPROGS-$(CONFIG_IDCTDSP)               += dct
+TESTPROGS-$(CONFIG_ITUT_T35)              += aom_film_grain
 TESTPROGS-$(CONFIG_DXV_ENCODER)           += hashtable
 TESTPROGS-$(CONFIG_MJPEG_ENCODER)         += mjpegenc_huffman
 TESTPROGS-$(CONFIG_MPEGAUDIOHEADER)       += mpegaudiodecheader
diff --git a/libavcodec/tests/aom_film_grain.c 
b/libavcodec/tests/aom_film_grain.c
new file mode 100644
index 00000000000..7c369e8a137
--- /dev/null
+++ b/libavcodec/tests/aom_film_grain.c
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2026
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/*
+ * filmgrn1 grain table parser test: feeds ff_aom_parse_film_grain_table()
+ * with an embedded known-good table in its LF and CRLF forms, a matrix of
+ * malformed tables and a set of behaviour-anchoring tables (single scaling
+ * point, multiple entries, no parameter update, partial time range), and
+ * prints what it parsed; the FATE reference file captures the output.
+ * Unexpected parse results are reported on stderr and exit non-zero.
+ */
+
+#include <inttypes.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "libavutil/film_grain_params.h"
+#include "libavutil/mem.h"
+
+#include "libavcodec/aom_film_grain.h"
+
+static int fails;
+
+/* Known-good table in the tbl_ar2 shape: 14 luma scaling points, lag 2,
+ * neutral chroma multipliers/offsets. */
+static const char good_table[] =
+    "filmgrn1\n"
+    "E 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 14  0 7 20 9 39 10 59 12 78 13 98 14 118 14 137 14 157 14 177 14"
+    " 196 14 216 13 235 12 255 10\n"
+    "\tsCb 0\n"
+    "\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n";
+
+static const char * const bad_tables[] = {
+    /* ar_coeff_lag out of range */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 9 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 2 0 7 255 9\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* scaling value out of range */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 2 0 7 255 300\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* negative point coordinate */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 2 0 -5 255 9\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* too many luma points */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 15 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7\n"
+    "\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* scaling_shift below the legal range */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 4 0 1 128 128 256 128 128 256\n"
+    "\tsY 2 0 7 255 9\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* scaling_shift above the legal range */
+    "filmgrn1\nE 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 13 0 1 128 128 256 128 128 256\n"
+    "\tsY 2 0 7 255 9\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
+    /* wrong magic */
+    "filmgrn2\nE 0 9223372036854775807 1 10956 1\n",
+};
+
+/* A single luma scaling point: legal per the range checks, kept as an
+ * accepted-input regression anchor (it is one of the historical
+ * malformed-table assets that every involved parser silently accepted,
+ * because none of its values is actually out of range). */
+static const char single_point_table[] =
+    "filmgrn1\n"
+    "E 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 1 0 99\n"
+    "\tsCb 0\n"
+    "\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n";
+
+/* Two full entries: only the first one is parsed, the rest is reported. */
+static const char multi_entry_table[] =
+    "filmgrn1\n"
+    "E 0 500 1 1000 1\n"
+    "\tp 0 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 0\n\tsCb 0\n\tsCr 0\n"
+    "\tcY\n\tcCb 0\n\tcCr 0\n"
+    "E 500 1000 1 2000 1\n"
+    "\tp 0 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 0\n\tsCb 0\n\tsCr 0\n"
+    "\tcY\n\tcCb 0\n\tcCr 0\n";
+
+/* update_parameters = 0: the entry carries no parameter data. */
+static const char no_update_table[] =
+    "filmgrn1\n"
+    "E 0 18446744073709551615 1 4242 0\n";
+
+/* A partial time range: parsed, but reported as a warning. */
+static const char partial_range_table[] =
+    "filmgrn1\n"
+    "E 0 500 1 10956 1\n"
+    "\tp 2 6 0 8 0 1 128 128 256 128 128 256\n"
+    "\tsY 0\n\tsCb 0\n\tsCr 0\n"
+    "\tcY 0 0 0 0 0 0 15 25 15 0 0 30\n"
+    "\tcCb 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
+    "\tcCr 0 0 0 0 0 0 0 0 0 0 0 0 0\n";
+
+/* Truncated in the middle of the parameters line. */
+static const char truncated_table[] =
+    "filmgrn1\n"
+    "E 0 9223372036854775807 1 10956 1\n"
+    "\tp 2 6 0 8";
+
+static void print_params(const AVFilmGrainParams *p, uint64_t start,
+                         uint64_t end)
+{
+    const AVFilmGrainAOMParams *const aom = &p->codec.aom;
+    int num_ar_coeffs = 2 * aom->ar_coeff_lag * (aom->ar_coeff_lag + 1);
+
+    printf("  type %d seed %"PRIu64" time [%"PRIu64",%"PRIu64")\n",
+           p->type, p->seed, start, end);
+    printf("  lag %d coeff_shift %d scale_shift %d scaling_shift %d"
+           " csfl %d overlap %d\n",
+           aom->ar_coeff_lag, aom->ar_coeff_shift, aom->grain_scale_shift,
+           aom->scaling_shift, aom->chroma_scaling_from_luma,
+           aom->overlap_flag);
+    printf("  uv_mult %d/%d uv_mult_luma %d/%d uv_offset %d/%d\n",
+           aom->uv_mult[0], aom->uv_mult[1],
+           aom->uv_mult_luma[0], aom->uv_mult_luma[1],
+           aom->uv_offset[0], aom->uv_offset[1]);
+
+    printf("  y_points %d:", aom->num_y_points);
+    for (int i = 0; i < aom->num_y_points; i++)
+        printf(" %d/%d", aom->y_points[i][0], aom->y_points[i][1]);
+    printf("\n");
+    for (int uv = 0; uv < 2; uv++) {
+        printf("  uv_points[%d] %d:", uv, aom->num_uv_points[uv]);
+        for (int i = 0; i < aom->num_uv_points[uv]; i++)
+            printf(" %d/%d", aom->uv_points[uv][i][0],
+                   aom->uv_points[uv][i][1]);
+        printf("\n");
+    }
+
+    printf("  ar_coeffs_y %d:", num_ar_coeffs);
+    for (int i = 0; i < num_ar_coeffs; i++)
+        printf(" %d", aom->ar_coeffs_y[i]);
+    printf("\n");
+    for (int uv = 0; uv < 2; uv++) {
+        printf("  ar_coeffs_uv[%d] %d:", uv, num_ar_coeffs + 1);
+        for (int i = 0; i < num_ar_coeffs + 1; i++)
+            printf(" %d", aom->ar_coeffs_uv[uv][i]);
+        printf("\n");
+    }
+}
+
+static void run_case(const char *label, const char *table, size_t size,
+                     int expect_ok)
+{
+    AVFilmGrainParams *fgp = av_film_grain_params_alloc(NULL);
+    uint64_t start = 0, end = 0;
+    int ret;
+
+    if (!fgp) {
+        fprintf(stderr, "%s: out of memory\n", label);
+        fails++;
+        return;
+    }
+
+    ret = ff_aom_parse_film_grain_table(fgp, &start, &end,
+                                        (const uint8_t *)table, size);
+    printf("%s: ret %d\n", label, ret);
+    if (ret == 0)
+        print_params(fgp, start, end);
+
+    if ((ret == 0) != expect_ok) {
+        fprintf(stderr, "%s: unexpected parse result %d\n", label, ret);
+        fails++;
+    }
+
+    av_freep(&fgp);
+}
+
+static char *crlfify(const char *src)
+{
+    size_t len = strlen(src);
+    char *dst = av_malloc(2 * len + 1), *p = dst;
+
+    if (!dst)
+        return NULL;
+    for (const char *s = src; *s; s++) {
+        if (*s == '\n')
+            *p++ = '\r';
+        *p++ = *s;
+    }
+    *p = '\0';
+    return dst;
+}
+
+int main(void)
+{
+    char *crlf = crlfify(good_table);
+
+    run_case("good", good_table, sizeof(good_table) - 1, 1);
+    if (crlf)
+        run_case("good-crlf", crlf, strlen(crlf), 1);
+    else {
+        fprintf(stderr, "out of memory\n");
+        fails++;
+    }
+    av_freep(&crlf);
+
+    for (size_t i = 0; i < sizeof(bad_tables) / sizeof(bad_tables[0]); i++) {
+        char label[16];
+        snprintf(label, sizeof(label), "bad%zu", i);
+        run_case(label, bad_tables[i], strlen(bad_tables[i]), 0);
+    }
+
+    run_case("single-point", single_point_table,
+             sizeof(single_point_table) - 1, 1);
+    run_case("multi-entry", multi_entry_table,
+             sizeof(multi_entry_table) - 1, 1);
+    run_case("no-update", no_update_table, sizeof(no_update_table) - 1, 1);
+    run_case("partial-range", partial_range_table,
+             sizeof(partial_range_table) - 1, 1);
+    run_case("empty", "", 0, 0);
+    run_case("truncated", truncated_table, sizeof(truncated_table) - 1, 0);
+
+    return fails ? 1 : 0;
+}
\ No newline at end of file
diff --git a/tests/fate/libavcodec.mak b/tests/fate/libavcodec.mak
index 2e2dabcd148..aeeb3ccee8c 100644
--- a/tests/fate/libavcodec.mak
+++ b/tests/fate/libavcodec.mak
@@ -7,6 +7,10 @@ fate-av1-levels: libavcodec/tests/av1_levels$(EXESUF)
 fate-av1-levels: CMD = run libavcodec/tests/av1_levels$(EXESUF)
 fate-av1-levels: REF = /dev/null
 
+FATE_LIBAVCODEC-$(CONFIG_ITUT_T35) += fate-aom-film-grain-table
+fate-aom-film-grain-table: libavcodec/tests/aom_film_grain$(EXESUF)
+fate-aom-film-grain-table: CMD = run libavcodec/tests/aom_film_grain$(EXESUF)
+
 FATE_LIBAVCODEC-$(CONFIG_APV_DECODER) += fate-apv-entropy
 fate-apv-entropy: libavcodec/tests/apv$(EXESUF)
 fate-apv-entropy: CMD = run libavcodec/tests/apv$(EXESUF)
diff --git a/tests/ref/fate/aom-film-grain-table 
b/tests/ref/fate/aom-film-grain-table
new file mode 100644
index 00000000000..c7f457ce191
--- /dev/null
+++ b/tests/ref/fate/aom-film-grain-table
@@ -0,0 +1,69 @@
+good: ret 0
+  type 1 seed 10956 time [0,9223372036854775807)
+  lag 2 coeff_shift 6 scale_shift 0 scaling_shift 8 csfl 0 overlap 1
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 14: 0/7 20/9 39/10 59/12 78/13 98/14 118/14 137/14 157/14 177/14 
196/14 216/13 235/12 255/10
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 12: 0 0 0 0 0 0 15 25 15 0 0 30
+  ar_coeffs_uv[0] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+  ar_coeffs_uv[1] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+good-crlf: ret 0
+  type 1 seed 10956 time [0,9223372036854775807)
+  lag 2 coeff_shift 6 scale_shift 0 scaling_shift 8 csfl 0 overlap 1
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 14: 0/7 20/9 39/10 59/12 78/13 98/14 118/14 137/14 157/14 177/14 
196/14 216/13 235/12 255/10
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 12: 0 0 0 0 0 0 15 25 15 0 0 30
+  ar_coeffs_uv[0] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+  ar_coeffs_uv[1] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+bad0: ret -1094995529
+bad1: ret -1094995529
+bad2: ret -1094995529
+bad3: ret -1094995529
+bad4: ret -1094995529
+bad5: ret -1094995529
+bad6: ret -1094995529
+single-point: ret 0
+  type 1 seed 10956 time [0,9223372036854775807)
+  lag 2 coeff_shift 6 scale_shift 0 scaling_shift 8 csfl 0 overlap 1
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 1: 0/99
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 12: 0 0 0 0 0 0 15 25 15 0 0 30
+  ar_coeffs_uv[0] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+  ar_coeffs_uv[1] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+multi-entry: ret 0
+  type 1 seed 1000 time [0,500)
+  lag 0 coeff_shift 6 scale_shift 0 scaling_shift 8 csfl 0 overlap 1
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 0:
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 0:
+  ar_coeffs_uv[0] 1: 0
+  ar_coeffs_uv[1] 1: 0
+no-update: ret 0
+  type 1 seed 4242 time [0,18446744073709551615)
+  lag 0 coeff_shift 0 scale_shift 0 scaling_shift 0 csfl 0 overlap 0
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 0:
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 0:
+  ar_coeffs_uv[0] 1: 0
+  ar_coeffs_uv[1] 1: 0
+partial-range: ret 0
+  type 1 seed 10956 time [0,500)
+  lag 2 coeff_shift 6 scale_shift 0 scaling_shift 8 csfl 0 overlap 1
+  uv_mult 0/0 uv_mult_luma 0/0 uv_offset 0/0
+  y_points 0:
+  uv_points[0] 0:
+  uv_points[1] 0:
+  ar_coeffs_y 12: 0 0 0 0 0 0 15 25 15 0 0 30
+  ar_coeffs_uv[0] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+  ar_coeffs_uv[1] 13: 0 0 0 0 0 0 0 0 0 0 0 0 0
+empty: ret -1094995529
+truncated: ret -541478725
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to