[FFmpeg-devel] [PATCH 2/2] vf_zscale: Add more supported input properties

James Almer jamrial at gmail.com
Wed Dec 20 01:03:25 EET 2017


On 11/28/2017 3:57 PM, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> ---
> This version should be more complete.
> Regarding configure changes, this library is not packaged by any distribution
> that I could find, so users will just need to use zimg HEAD or any stable
> snapshot (2.6.2).
> Vittorio

Most if not all of the new enum values are not in the actual 2.6.2
release, nor in 2.6.3 which is the latest. They are in git master only,
where the version number is no different than the stable release branch.

This should probably be reverted, or an extra configure check added to
make sure these are available until 2.7.x is tagged and the current
check can be updated.

> 
>  libavfilter/vf_zscale.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 51 insertions(+)
> 
> diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c
> index 972f720ee6..865910bd87 100644
> --- a/libavfilter/vf_zscale.c
> +++ b/libavfilter/vf_zscale.c
> @@ -353,16 +353,26 @@ static int convert_matrix(enum AVColorSpace colorspace)
>          return ZIMG_MATRIX_709;
>      case AVCOL_SPC_UNSPECIFIED:
>          return ZIMG_MATRIX_UNSPECIFIED;
> +    case AVCOL_SPC_FCC:
> +        return ZIMG_MATRIX_FCC;
>      case AVCOL_SPC_BT470BG:
>          return ZIMG_MATRIX_470BG;
>      case AVCOL_SPC_SMPTE170M:
>          return ZIMG_MATRIX_170M;
> +    case AVCOL_SPC_SMPTE240M:
> +        return ZIMG_MATRIX_240M;
>      case AVCOL_SPC_YCGCO:
>          return ZIMG_MATRIX_YCGCO;
>      case AVCOL_SPC_BT2020_NCL:
>          return ZIMG_MATRIX_2020_NCL;
>      case AVCOL_SPC_BT2020_CL:
>          return ZIMG_MATRIX_2020_CL;
> +    case AVCOL_SPC_CHROMA_DERIVED_NCL:
> +        return ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL;
> +    case AVCOL_SPC_CHROMA_DERIVED_CL:
> +        return ZIMG_MATRIX_CHROMATICITY_DERIVED_CL;
> +    case AVCOL_SPC_ICTCP:
> +        return ZIMG_MATRIX_ICTCP;
>      }
>      return ZIMG_MATRIX_UNSPECIFIED;
>  }
> @@ -374,10 +384,22 @@ static int convert_trc(enum AVColorTransferCharacteristic color_trc)
>          return ZIMG_TRANSFER_UNSPECIFIED;
>      case AVCOL_TRC_BT709:
>          return ZIMG_TRANSFER_709;
> +    case AVCOL_TRC_GAMMA22:
> +        return ZIMG_TRANSFER_470_M;
> +    case AVCOL_TRC_GAMMA28:
> +        return ZIMG_TRANSFER_470_BG;
>      case AVCOL_TRC_SMPTE170M:
>          return ZIMG_TRANSFER_601;
> +    case AVCOL_TRC_SMPTE240M:
> +        return ZIMG_TRANSFER_240M;
>      case AVCOL_TRC_LINEAR:
>          return ZIMG_TRANSFER_LINEAR;
> +    case AVCOL_TRC_LOG:
> +        return ZIMG_TRANSFER_LOG_100;
> +    case AVCOL_TRC_LOG_SQRT:
> +        return ZIMG_TRANSFER_LOG_316;
> +    case AVCOL_TRC_IEC61966_2_4:
> +        return ZIMG_TRANSFER_IEC_61966_2_4;
>      case AVCOL_TRC_BT2020_10:
>          return ZIMG_TRANSFER_2020_10;
>      case AVCOL_TRC_BT2020_12:
> @@ -399,14 +421,26 @@ static int convert_primaries(enum AVColorPrimaries color_primaries)
>          return ZIMG_PRIMARIES_UNSPECIFIED;
>      case AVCOL_PRI_BT709:
>          return ZIMG_PRIMARIES_709;
> +    case AVCOL_PRI_BT470M:
> +        return ZIMG_PRIMARIES_470_M;
> +    case AVCOL_PRI_BT470BG:
> +        return ZIMG_PRIMARIES_470_BG;
>      case AVCOL_PRI_SMPTE170M:
>          return ZIMG_PRIMARIES_170M;
>      case AVCOL_PRI_SMPTE240M:
>          return ZIMG_PRIMARIES_240M;
> +    case AVCOL_PRI_FILM:
> +        return ZIMG_PRIMARIES_FILM;
>      case AVCOL_PRI_BT2020:
>          return ZIMG_PRIMARIES_2020;
> +    case AVCOL_PRI_SMPTE428:
> +        return ZIMG_PRIMARIES_ST428;
> +    case AVCOL_PRI_SMPTE431:
> +        return ZIMG_PRIMARIES_ST431_2;
>      case AVCOL_PRI_SMPTE432:
>          return ZIMG_PRIMARIES_ST432_1;
> +    case AVCOL_PRI_JEDEC_P22:
> +        return ZIMG_PRIMARIES_EBU3213_E;
>      }
>      return ZIMG_PRIMARIES_UNSPECIFIED;
>  }
> @@ -745,10 +779,16 @@ static const AVOption zscale_options[] = {
>      {     "2020",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_2020},        0, 0, FLAGS, "primaries" },
>      {     "unknown",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_UNSPECIFIED}, 0, 0, FLAGS, "primaries" },
>      {     "bt709",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_709},         0, 0, FLAGS, "primaries" },
> +    {     "bt470m",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_470_M},       0, 0, FLAGS, "primaries" },
> +    {     "bt470bg",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_470_BG},      0, 0, FLAGS, "primaries" },
>      {     "smpte170m",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_170M},        0, 0, FLAGS, "primaries" },
>      {     "smpte240m",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_240M},        0, 0, FLAGS, "primaries" },
> +    {     "film",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_FILM},        0, 0, FLAGS, "primaries" },
>      {     "bt2020",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_2020},        0, 0, FLAGS, "primaries" },
> +    {     "smpte428",         0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST428},       0, 0, FLAGS, "primaries" },
> +    {     "smpte431",         0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST431_2},     0, 0, FLAGS, "primaries" },
>      {     "smpte432",         0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST432_1},     0, 0, FLAGS, "primaries" },
> +    {     "jedec-p22",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_EBU3213_E},   0, 0, FLAGS, "primaries" },
>      { "transfer", "set transfer characteristic", OFFSET(trc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, FLAGS, "transfer" },
>      { "t",        "set transfer characteristic", OFFSET(trc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, FLAGS, "transfer" },
>      {     "input",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = -1},                         0, 0, FLAGS, "transfer" },
> @@ -759,12 +799,17 @@ static const AVOption zscale_options[] = {
>      {     "2020_10",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_10},     0, 0, FLAGS, "transfer" },
>      {     "2020_12",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_12},     0, 0, FLAGS, "transfer" },
>      {     "unknown",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_UNSPECIFIED}, 0, 0, FLAGS, "transfer" },
> +    {     "bt470m",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_470_M},       0, 0, FLAGS, "transfer" },
> +    {     "bt470bg",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_470_BG},      0, 0, FLAGS, "transfer" },
>      {     "smpte170m",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_601},         0, 0, FLAGS, "transfer" },
>      {     "bt709",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_709},         0, 0, FLAGS, "transfer" },
>      {     "linear",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_LINEAR},      0, 0, FLAGS, "transfer" },
> +    {     "log100",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_LOG_100},     0, 0, FLAGS, "transfer" },
> +    {     "log316",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_LOG_316},     0, 0, FLAGS, "transfer" },
>      {     "bt2020-10",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_10},     0, 0, FLAGS, "transfer" },
>      {     "bt2020-12",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_12},     0, 0, FLAGS, "transfer" },
>      {     "smpte2084",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_ST2084},      0, 0, FLAGS, "transfer" },
> +    {     "iec61966-2-4",     0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_4},0, 0, FLAGS, "transfer" },
>      {     "iec61966-2-1",     0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_1},0, 0, FLAGS, "transfer" },
>      {     "arib-std-b67",     0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_ARIB_B67},    0, 0, FLAGS, "transfer" },
>      { "matrix", "set colorspace matrix", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, FLAGS, "matrix" },
> @@ -777,12 +822,18 @@ static const AVOption zscale_options[] = {
>      {     "2020_ncl",         0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_2020_NCL},    0, 0, FLAGS, "matrix" },
>      {     "2020_cl",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_2020_CL},     0, 0, FLAGS, "matrix" },
>      {     "unknown",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_UNSPECIFIED}, 0, 0, FLAGS, "matrix" },
> +    {     "gbr",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_RGB},         0, 0, FLAGS, "matrix" },
>      {     "bt709",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_709},         0, 0, FLAGS, "matrix" },
> +    {     "fcc",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_FCC},         0, 0, FLAGS, "matrix" },
>      {     "bt470bg",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_470BG},       0, 0, FLAGS, "matrix" },
>      {     "smpte170m",        0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_170M},        0, 0, FLAGS, "matrix" },
> +    {     "smpte2400m",       0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_240M},        0, 0, FLAGS, "matrix" },
>      {     "ycgco",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_YCGCO},       0, 0, FLAGS, "matrix" },
>      {     "bt2020nc",         0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_2020_NCL},    0, 0, FLAGS, "matrix" },
>      {     "bt2020c",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_2020_CL},     0, 0, FLAGS, "matrix" },
> +    {     "chroma-derived-nc",0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL}, 0, 0, FLAGS, "matrix" },
> +    {     "chroma-derived-c", 0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_CL}, 0, 0, FLAGS, "matrix" },
> +    {     "ictcp",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_ICTCP},       0, 0, FLAGS, "matrix" },
>      { "in_range", "set input color range", OFFSET(range_in),    AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL, FLAGS, "range" },
>      { "rangein", "set input color range", OFFSET(range_in),     AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL, FLAGS, "range" },
>      { "rin",     "set input color range", OFFSET(range_in),     AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL, FLAGS, "range" },
> 



More information about the ffmpeg-devel mailing list