[FFmpeg-devel] [PATCH 3/3] vf_colorspace: Allow overriding input color properties

Ronald S. Bultje rsbultje at gmail.com
Fri Aug 26 07:59:14 EEST 2016


Hi Vittorio,

On Thu, Aug 25, 2016 at 7:14 PM, Vittorio Giovara <
vittorio.giovara at gmail.com> wrote:

> The filter needs input frames with color properties filled out by
> the decoder. Since this is not always possible, add input options to
> the filter so that user may override color space, color primaries,
> transfer characteristics, and color range.
>
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> ---
> Please keep me in CC.
> Vittorio
>
[..]

> @@ -1014,6 +1022,9 @@ static const AVOption colorspace_options[] = {
>      { "space",      "Output colorspace",
>        OFFSET(user_csp),   AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED
> },
>        AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
> +    { "ispace",     "Input colorspace",
> +      OFFSET(user_icsp),  AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED
> },
> +      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
>      ENUM("bt709",       AVCOL_SPC_BT709,       "csp"),
>      ENUM("fcc",         AVCOL_SPC_FCC,         "csp"),
>      ENUM("bt470bg",     AVCOL_SPC_BT470BG,     "csp"),
> @@ -1024,12 +1035,18 @@ static const AVOption colorspace_options[] = {
>      { "range",      "Output color range",
>        OFFSET(user_rng),   AV_OPT_TYPE_INT, { .i64 =
> AVCOL_RANGE_UNSPECIFIED },
>        AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
> +    { "irange",     "Input color range",
> +      OFFSET(user_irng),  AV_OPT_TYPE_INT, { .i64 =
> AVCOL_RANGE_UNSPECIFIED },
> +      AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_NB - 1, FLAGS, "rng" },
>      ENUM("mpeg",        AVCOL_RANGE_MPEG,      "rng"),
>      ENUM("jpeg",        AVCOL_RANGE_JPEG,      "rng"),
>
>      { "primaries",  "Output color primaries",
>        OFFSET(user_prm),   AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED
> },
>        AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
> +    { "iprimaries", "Input color primaries",
> +      OFFSET(user_iprm),  AV_OPT_TYPE_INT, { .i64 = AVCOL_PRI_UNSPECIFIED
> },
> +      AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "prm" },
>      ENUM("bt709",        AVCOL_PRI_BT709,      "prm"),
>      ENUM("bt470m",       AVCOL_PRI_BT470M,     "prm"),
>      ENUM("bt470bg",      AVCOL_PRI_BT470BG,    "prm"),
> @@ -1040,6 +1057,9 @@ static const AVOption colorspace_options[] = {
>      { "trc",        "Output transfer characteristics",
>        OFFSET(user_trc),   AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED
> },
>        AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
> +    { "itrc",       "Input transfer characteristics",
> +      OFFSET(user_itrc),  AV_OPT_TYPE_INT, { .i64 = AVCOL_TRC_UNSPECIFIED
> },
> +      AVCOL_TRC_RESERVED0, AVCOL_TRC_NB - 1, FLAGS, "trc" },
>      ENUM("bt709",        AVCOL_TRC_BT709,        "trc"),
>      ENUM("gamma22",      AVCOL_TRC_GAMMA22,      "trc"),
>      ENUM("gamma28",      AVCOL_TRC_GAMMA28,      "trc"),


Do you think it makes sense to have a "iall" property, similar to "all"?
iprm/irange/itr/iprimeries would take precedence over iall, but iall could
be used to set all 4 at once in the (common) case where they are consistent.

Ronald


More information about the ffmpeg-devel mailing list