[FFmpeg-devel] [PATCH] avfilter: add zscale filter

wm4 nfxjfg at googlemail.com
Wed Sep 30 12:38:46 CEST 2015


On Wed, 30 Sep 2015 11:09:28 +0100
Kevin Wheatley <kevin.j.wheatley at gmail.com> wrote:

> On Wed, Sep 30, 2015 at 9:49 AM, Paul B Mahol <onemda at gmail.com> wrote:
> > +    { "range", "set color range",      OFFSET(range),     AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL, FLAGS, "range" },
> > +    { "r",     "set color range",      OFFSET(range),     AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL, FLAGS, "range" },
> > +    {     "input",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = -1},                 0, 0, FLAGS, "range" },
> > +    {     "limited",          0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_RANGE_LIMITED}, 0, 0, FLAGS, "range" },
> > +    {     "full",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_RANGE_FULL},    0, 0, FLAGS, "range" },
> > +    { "primaries", "set color primaries", OFFSET(primaries), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_PRIMARIES_2020, FLAGS, "primaries" },
> > +    { "p",         "set color primaries", OFFSET(primaries), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_PRIMARIES_2020, FLAGS, "primaries" },
> > +    {     "input",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = -1},                         0, 0, FLAGS, "primaries" },
> > +    {     "709",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_709},         0, 0, FLAGS, "primaries" },
> > +    {     "unspecified",      0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_UNSPECIFIED}, 0, 0, FLAGS, "primaries" },
> > +    {     "170m",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_170M},        0, 0, FLAGS, "primaries" },
> > +    {     "240m",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_240M},        0, 0, FLAGS, "primaries" },
> > +    {     "2020",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_2020},        0, 0, FLAGS, "primaries" },
> > +    { "transfer", "set transfer characteristic", OFFSET(trc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_TRANSFER_2020_12, FLAGS, "transfer" },
> > +    { "t",        "set transfer characteristic", OFFSET(trc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_TRANSFER_2020_12, FLAGS, "transfer" },
> > +    {     "input",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = -1},                         0, 0, FLAGS, "transfer" },
> > +    {     "709",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_709},         0, 0, FLAGS, "transfer" },
> > +    {     "unspecified",      0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_UNSPECIFIED}, 0, 0, FLAGS, "transfer" },
> > +    {     "601",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_601},         0, 0, FLAGS, "transfer" },
> > +    {     "linear",           0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_LINEAR},      0, 0, FLAGS, "transfer" },
> > +    {     "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" },
> > +    { "matrix", "set colorspace matrix", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_MATRIX_2020_CL, FLAGS, "matrix" },
> > +    { "m",      "set colorspace matrix", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_MATRIX_2020_CL, FLAGS, "matrix" },
> > +    {     "input",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = -1},                     0, 0, FLAGS, "matrix" },
> > +    {     "709",              0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_709},        0, 0, FLAGS, "matrix" },
> > +    {     "unspecified",      0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_UNSPECIFIED},0, 0, FLAGS, "matrix" },
> > +    {     "470bg",            0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_470BG},      0, 0, FLAGS, "matrix" },
> > +    {     "170m",             0,       0,                 AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_170M},       0, 0, FLAGS, "matrix" },
> > +    {     "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" },
> 
> 
> As a casual developer/observer, I wonder about the consistency of the
> options here with other parts of ffmpeg, in the general case it uses:
> 
>   -color_primaries
>      bt709
>      unspecified
>      bt470m
>      bt470bg
>      smpte170m
>      smpte240m
>      film
>      bt2020
>   -color_trc
>      bt709
>      unspecified
>      gamma22
>      gamma28
>      smpte170m
>      smpte240m
>      linear
>      log
>      log_sqrt
>      iec61966_2_4
>      bt1361
>      iec61966_2_1
>      bt2020_10bit
>      bt2020_12bit
>   -colorspace
>      rgb
>      bt709
>      unspecified
>      fcc
>      bt470bg
>      smpte170m
>      smpte240m
>      ycocg
>      bt2020_ncl
>      bt2020_cl
> 
> For the colour range it has
> 
>   -color_range
>      unspecified
>      mpeg
>      jpeg
> 
> The scale filter also has 'tv' and 'pc', it would be nice if there was
> a  canonical set to pull from, certainly from the command line user's
> point of view. I had a hand in making some of those and I know I
> didn't find a single source to use,
> 

In my opinion, these should be configured via the filter pads (just
like width/height etc.). Then the user could control these from a
separate filter, which influences the configuration. This would get
rid of the duplication, and allow libavfilter as a whole to handle
colorspace issues correctly.


More information about the ffmpeg-devel mailing list