avfilter/vf_zscale: make it possible to override input frame parameters
Mostly useful when there is no such parameters present at all. Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
a0174f6729
commit
df7b165e87
@ -12784,6 +12784,63 @@ Possible value are:
|
||||
@end table
|
||||
|
||||
Default is same as input.
|
||||
|
||||
@item rangein, rin
|
||||
Set the input color range.
|
||||
|
||||
Possible values are:
|
||||
@table @var
|
||||
@item input
|
||||
@item limited
|
||||
@item full
|
||||
@end table
|
||||
|
||||
Default is same as input.
|
||||
|
||||
@item primariesin, pin
|
||||
Set the input color primaries.
|
||||
|
||||
Possible values are:
|
||||
@table @var
|
||||
@item input
|
||||
@item 709
|
||||
@item unspecified
|
||||
@item 170m
|
||||
@item 240m
|
||||
@item 2020
|
||||
@end table
|
||||
|
||||
Default is same as input.
|
||||
|
||||
@item transferin, tin
|
||||
Set the input transfer characteristics.
|
||||
|
||||
Possible values are:
|
||||
@table @var
|
||||
@item input
|
||||
@item 709
|
||||
@item unspecified
|
||||
@item 601
|
||||
@item linear
|
||||
@item 2020_10
|
||||
@item 2020_12
|
||||
@end table
|
||||
|
||||
Default is same as input.
|
||||
|
||||
@item matrixin, min
|
||||
Set the input colorspace matrix.
|
||||
|
||||
Possible value are:
|
||||
@table @var
|
||||
@item input
|
||||
@item 709
|
||||
@item unspecified
|
||||
@item 470bg
|
||||
@item 170m
|
||||
@item 2020_ncl
|
||||
@item 2020_cl
|
||||
@end table
|
||||
@end table
|
||||
|
||||
The values of the @option{w} and @option{h} options are expressions
|
||||
|
@ -88,6 +88,10 @@ typedef struct ZScaleContext {
|
||||
int trc;
|
||||
int primaries;
|
||||
int range;
|
||||
int colorspace_in;
|
||||
int trc_in;
|
||||
int primaries_in;
|
||||
int range_in;
|
||||
char *size_str;
|
||||
|
||||
char *w_expr; ///< width expression string
|
||||
@ -448,10 +452,10 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
s->src_format.depth = desc->comp[0].depth;
|
||||
s->src_format.pixel_type = desc->comp[0].depth > 8 ? ZIMG_PIXEL_WORD : ZIMG_PIXEL_BYTE;
|
||||
s->src_format.color_family = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_COLOR_RGB : ZIMG_COLOR_YUV;
|
||||
s->src_format.matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_MATRIX_RGB : convert_matrix(in->colorspace);
|
||||
s->src_format.transfer_characteristics = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_TRANSFER_UNSPECIFIED : convert_trc(in->color_trc);
|
||||
s->src_format.color_primaries = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_PRIMARIES_UNSPECIFIED : convert_primaries(in->color_primaries);
|
||||
s->src_format.pixel_range = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_RANGE_FULL : convert_range(in->color_range);
|
||||
s->src_format.matrix_coefficients = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_MATRIX_RGB : s->colorspace_in == -1 ? convert_matrix(in->colorspace) : s->colorspace_in;
|
||||
s->src_format.transfer_characteristics = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_TRANSFER_UNSPECIFIED : s->trc_in == - 1 ? convert_trc(in->color_trc) : s->trc_in;
|
||||
s->src_format.color_primaries = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_PRIMARIES_UNSPECIFIED : s->primaries_in == -1 ? convert_primaries(in->color_primaries) : s->primaries_in;
|
||||
s->src_format.pixel_range = (desc->flags & AV_PIX_FMT_FLAG_RGB) ? ZIMG_RANGE_FULL : s->range_in == -1 ? convert_range(in->color_range) : s->range_in;
|
||||
|
||||
s->dst_format.width = out->width;
|
||||
s->dst_format.height = out->height;
|
||||
@ -693,6 +697,14 @@ static const AVOption zscale_options[] = {
|
||||
{ "ycgco", 0, 0, AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_YCGCO}, 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" },
|
||||
{ "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" },
|
||||
{ "primariesin", "set input color primaries", OFFSET(primaries_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_PRIMARIES_2020, FLAGS, "primaries" },
|
||||
{ "pin", "set input color primaries", OFFSET(primaries_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_PRIMARIES_2020, FLAGS, "primaries" },
|
||||
{ "transferin", "set input transfer characteristic", OFFSET(trc_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_TRANSFER_2020_12, FLAGS, "transfer" },
|
||||
{ "tin", "set input transfer characteristic", OFFSET(trc_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_TRANSFER_2020_12, FLAGS, "transfer" },
|
||||
{ "matrixin", "set input colorspace matrix", OFFSET(colorspace_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_MATRIX_2020_CL, FLAGS, "matrix" },
|
||||
{ "min", "set input colorspace matrix", OFFSET(colorspace_in), AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_MATRIX_2020_CL, FLAGS, "matrix" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user