1 /*
2 * Copyright (c) 2015 Paul B Mahol
3 * Copyright (c) 2022 Victoria Zhislina, Intel
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * zscale video filter using z.lib library
25 */
26
28 #include <stdio.h>
29 #include <string.h>
30
31 #include <zimg.h>
32
46
47 #define ZIMG_ALIGNMENT 64
48 #define MIN_TILESIZE 64
49 #define MAX_THREADS 64
50
52 "in_w", "iw",
53 "in_h", "ih",
54 "out_w", "ow",
55 "out_h", "oh",
56 "a",
57 "sar",
58 "dar",
59 "hsub",
60 "vsub",
61 "ohsub",
62 "ovsub",
64 };
65
79 };
80
83
84 /**
85 * New dimensions. Special values are:
86 * 0 = original width/height
87 * -1 = keep original aspect
88 * -N = try to keep aspect but make sure it is divisible by N
89 */
108
109 char *
w_expr;
///< width expression string
110 char *
h_expr;
///< height expression string
111
116
119
127
136
141
143 {
146 zimg_image_format_default(&
s->src_format, ZIMG_API_VERSION);
147 zimg_image_format_default(&
s->dst_format, ZIMG_API_VERSION);
148 zimg_image_format_default(&
s->src_format_tmp, ZIMG_API_VERSION);
149 zimg_image_format_default(&
s->dst_format_tmp, ZIMG_API_VERSION);
150
151 zimg_image_format_default(&
s->alpha_src_format, ZIMG_API_VERSION);
152 zimg_image_format_default(&
s->alpha_dst_format, ZIMG_API_VERSION);
153 zimg_image_format_default(&
s->alpha_src_format_tmp, ZIMG_API_VERSION);
154 zimg_image_format_default(&
s->alpha_dst_format_tmp, ZIMG_API_VERSION);
155
156 zimg_graph_builder_params_default(&
s->params, ZIMG_API_VERSION);
157 zimg_graph_builder_params_default(&
s->params_tmp, ZIMG_API_VERSION);
158 zimg_graph_builder_params_default(&
s->alpha_params, ZIMG_API_VERSION);
159 zimg_graph_builder_params_default(&
s->alpha_params_tmp, ZIMG_API_VERSION);
160
161 if (
s->size_str && (
s->w_expr ||
s->h_expr)) {
163 "Size and width/height expressions cannot be set at the same time.\n");
165 }
166
167 if (
s->w_expr && !
s->h_expr)
168 FFSWAP(
char *,
s->w_expr,
s->size_str);
169
171 char buf[32];
174 "Invalid size '%s'\n",
s->size_str);
176 }
177 snprintf(buf,
sizeof(buf)-1,
"%d",
s->w);
179 snprintf(buf,
sizeof(buf)-1,
"%d",
s->h);
181 }
186
187 return 0;
188 }
189
191
193 {
218 };
220
227
231
232 formats =
s->colorspace != ZIMG_MATRIX_UNSPECIFIED &&
s->colorspace > 0
237
243
244 return 0;
245 }
246
248 {
249 s->out_slice_start[0] = 0;
250 for (
int i = 1;
i <
s->nb_threads;
i++) {
253 }
254 s->out_slice_end[
s->nb_threads - 1] = out_h;
255
256 for (
int i = 0;
i <
s->nb_threads;
i++) {
257 s->in_slice_start[
i] =
s->out_slice_start[
i] * in_h / (
double)out_h;
258 s->in_slice_end[
i] =
s->out_slice_end[
i] * in_h / (
double)out_h;
259 }
260 }
261
263 {
270 double var_values[
VARS_NB], res;
271 char *expr;
273 int factor_w, factor_h;
274
281 (
double)
inlink->sample_aspect_ratio.num /
inlink->sample_aspect_ratio.den : 1;
287
288 /* evaluate width and height */
298 /* evaluate again the width, as it may depend on the output height */
304
307
308 /* Check if it is requested that the result has to be divisible by a some
309 * factor (w or h = -n with n being the factor). */
310 factor_w = 1;
311 factor_h = 1;
314 }
317 }
318
321
326
327 /* Make sure that the result is divisible by the factor we determined
328 * earlier. If no factor was set, it is nothing will happen as the default
329 * factor is 1 */
334
335 /* Note that force_original_aspect_ratio may overwrite the previous set
336 * dimensions so that it is not divisible by the set factors anymore. */
337 if (
s->force_original_aspect_ratio) {
340
341 if (
s->force_original_aspect_ratio == 1) {
344 } else {
347 }
348 }
349
350 if (
w > INT_MAX ||
h > INT_MAX ||
354
357
359
360 if (
inlink->sample_aspect_ratio.num){
362 } else
364
367 inlink->sample_aspect_ratio.num,
inlink->sample_aspect_ratio.den,
370 return 0;
371
374 "Error when evaluating the expression '%s'.\n"
375 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
376 expr,
s->w_expr,
s->h_expr);
378 }
379
381 {
382 char err_msg[1024];
383 int err_code = zimg_get_last_error(err_msg, sizeof(err_msg));
384
386
388 }
389
391 {
392 switch (chroma_location) {
395 return ZIMG_CHROMA_LEFT;
397 return ZIMG_CHROMA_CENTER;
399 return ZIMG_CHROMA_TOP_LEFT;
401 return ZIMG_CHROMA_TOP;
403 return ZIMG_CHROMA_BOTTOM_LEFT;
405 return ZIMG_CHROMA_BOTTOM;
406 }
407 return ZIMG_CHROMA_LEFT;
408 }
409
411 {
412 switch (colorspace) {
414 return ZIMG_MATRIX_RGB;
416 return ZIMG_MATRIX_709;
418 return ZIMG_MATRIX_UNSPECIFIED;
420 return ZIMG_MATRIX_FCC;
422 return ZIMG_MATRIX_470BG;
424 return ZIMG_MATRIX_170M;
426 return ZIMG_MATRIX_240M;
428 return ZIMG_MATRIX_YCGCO;
430 return ZIMG_MATRIX_2020_NCL;
432 return ZIMG_MATRIX_2020_CL;
434 return ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL;
436 return ZIMG_MATRIX_CHROMATICITY_DERIVED_CL;
438 return ZIMG_MATRIX_ICTCP;
439 }
440 return ZIMG_MATRIX_UNSPECIFIED;
441 }
442
444 {
445 switch (color_trc) {
447 return ZIMG_TRANSFER_UNSPECIFIED;
449 return ZIMG_TRANSFER_709;
451 return ZIMG_TRANSFER_470_M;
453 return ZIMG_TRANSFER_470_BG;
455 return ZIMG_TRANSFER_601;
457 return ZIMG_TRANSFER_240M;
459 return ZIMG_TRANSFER_LINEAR;
461 return ZIMG_TRANSFER_LOG_100;
463 return ZIMG_TRANSFER_LOG_316;
465 return ZIMG_TRANSFER_IEC_61966_2_4;
467 return ZIMG_TRANSFER_2020_10;
469 return ZIMG_TRANSFER_2020_12;
471 return ZIMG_TRANSFER_ST2084;
473 return ZIMG_TRANSFER_ARIB_B67;
475 return ZIMG_TRANSFER_IEC_61966_2_1;
476 }
477 return ZIMG_TRANSFER_UNSPECIFIED;
478 }
479
481 {
484 return ZIMG_PRIMARIES_UNSPECIFIED;
486 return ZIMG_PRIMARIES_709;
488 return ZIMG_PRIMARIES_470_M;
490 return ZIMG_PRIMARIES_470_BG;
492 return ZIMG_PRIMARIES_170M;
494 return ZIMG_PRIMARIES_240M;
496 return ZIMG_PRIMARIES_FILM;
498 return ZIMG_PRIMARIES_2020;
500 return ZIMG_PRIMARIES_ST428;
502 return ZIMG_PRIMARIES_ST431_2;
504 return ZIMG_PRIMARIES_ST432_1;
506 return ZIMG_PRIMARIES_EBU3213_E;
507 }
508 return ZIMG_PRIMARIES_UNSPECIFIED;
509 }
510
512 {
516 return ZIMG_RANGE_LIMITED;
518 return ZIMG_RANGE_FULL;
519 }
520 return ZIMG_RANGE_LIMITED;
521 }
522
524 {
526 case ZIMG_RANGE_LIMITED:
528 case ZIMG_RANGE_FULL:
530 }
532 }
533
534 /* returns 0 if image formats are the same and 1 otherwise */
536 {
537 return ((img_fmt0->chroma_location != img_fmt1->chroma_location) ||
538 #if ZIMG_API_VERSION >= 0x204
539 (img_fmt0->alpha != img_fmt1->alpha) ||
540 #endif
541 (img_fmt0->color_family != img_fmt1->color_family) ||
542 (img_fmt0->color_primaries != img_fmt1->color_primaries) ||
543 (img_fmt0->depth != img_fmt1->depth) ||
544 (img_fmt0->field_parity != img_fmt1->field_parity) ||
545 (img_fmt0->height != img_fmt1->height) ||
546 (img_fmt0->matrix_coefficients != img_fmt1->matrix_coefficients) ||
547 (img_fmt0->pixel_range != img_fmt1->pixel_range) ||
548 (img_fmt0->pixel_type != img_fmt1->pixel_type) ||
549 (img_fmt0->subsample_h != img_fmt1->subsample_h) ||
550 (img_fmt0->subsample_w != img_fmt1->subsample_w) ||
551 (img_fmt0->transfer_characteristics != img_fmt1->transfer_characteristics) ||
552 (img_fmt0->width != img_fmt1->width));
553 }
554
555 /* returns 0 if graph builder parameters are the same and 1 otherwise */
557 {
558 /* the parameters that could be changed inside a single ffmpeg zscale invocation are checked only
559 and NaN values that are default for some params are treated properly*/
560 int ret = (parm0->allow_approximate_gamma != parm1->allow_approximate_gamma) ||
561 (parm0->dither_type != parm1->dither_type) ||
562 (parm0->resample_filter != parm1->resample_filter) ||
563 (parm0->resample_filter_uv != parm1->resample_filter_uv);
564
565 if ((
isnan(parm0->nominal_peak_luminance) == 0) || (
isnan(parm1->nominal_peak_luminance) == 0))
566 ret =
ret || (parm0->nominal_peak_luminance != parm1->nominal_peak_luminance);
567 if ((
isnan(parm0->filter_param_a) == 0) || (
isnan(parm1->filter_param_a) == 0))
568 ret =
ret || (parm0->filter_param_a != parm1->filter_param_a);
569 if ((
isnan(parm0->filter_param_a_uv) == 0) || (
isnan(parm1->filter_param_a_uv) == 0))
570 ret =
ret || (parm0->filter_param_a_uv != parm1->filter_param_a_uv);
571 if ((
isnan(parm0->filter_param_b) == 0) || (
isnan(parm1->filter_param_b) == 0))
572 ret =
ret || (parm0->filter_param_b != parm1->filter_param_b);
573 if ((
isnan(parm0->filter_param_b_uv) == 0) || (
isnan(parm1->filter_param_b_uv) == 0))
574 ret =
ret || (parm0->filter_param_b_uv != parm1->filter_param_b_uv);
575
577 }
578
581 {
594 }
595
598 {
602 zimg_image_format src_format;
603 zimg_image_format dst_format;
604 zimg_image_format alpha_src_format;
605 zimg_image_format alpha_dst_format;
606 const double in_slice_start =
s->in_slice_start[job_nr];
607 const double in_slice_end =
s->in_slice_end[job_nr];
608 const int out_slice_start =
s->out_slice_start[job_nr];
609 const int out_slice_end =
s->out_slice_end[job_nr];
610
611 src_format =
s->src_format;
612 dst_format =
s->dst_format;
613 /* The input slice is specified through the active_region field,
614 unlike the output slice.
615 according to zimg requirements input and output slices should have even dimensions */
616 src_format.active_region.width = in->
width;
617 src_format.active_region.height = in_slice_end - in_slice_start;
618 src_format.active_region.left = 0;
619 src_format.active_region.top = in_slice_start;
620 //dst now is the single tile only!!
621 dst_format.width =
out->width;
622 dst_format.height = out_slice_end - out_slice_start;
623
624 if (
s->graph[job_nr]) {
625 zimg_filter_graph_free(
s->graph[job_nr]);
626 }
627 s->graph[job_nr] = zimg_filter_graph_build(&src_format, &dst_format, &
s->params);
628 if (!
s->graph[job_nr])
630
631 ret = zimg_filter_graph_get_tmp_size(
s->graph[job_nr], &
size);
634
640
642 alpha_src_format =
s->alpha_src_format;
643 alpha_dst_format =
s->alpha_dst_format;
644 /* The input slice is specified through the active_region field, unlike the output slice.
645 according to zimg requirements input and output slices should have even dimentions */
646 alpha_src_format.active_region.width = in->
width;
647 alpha_src_format.active_region.height = in_slice_end - in_slice_start;
648 alpha_src_format.active_region.left = 0;
649 alpha_src_format.active_region.top = in_slice_start;
650 //dst now is the single tile only!!
651 alpha_dst_format.width =
out->width;
652 alpha_dst_format.height = out_slice_end - out_slice_start;
653
654 if (
s->alpha_graph[job_nr]) {
655 zimg_filter_graph_free(
s->alpha_graph[job_nr]);
656 }
657 s->alpha_graph[job_nr] = zimg_filter_graph_build(&alpha_src_format, &alpha_dst_format, &
s->alpha_params);
658 if (!
s->alpha_graph[job_nr])
660 }
661 return 0;
662 }
663
665 {
668
669 /* Realign any unaligned input frame. */
671 for (plane = 0; plane <
planes; plane++) {
672 int p =
desc->comp[plane].plane;
677 }
678
679 aligned->format = (*frame)->format;
680 aligned->width = (*frame)->width;
681 aligned->height = (*frame)->height;
682
685
688
691
694 return 0;
695 }
696 }
697
701 }
702
704 {
705 if (
s->primaries != -1)
707
710
711 if (
s->chromal != -1)
713 }
714
716 {
719 int p;
720 int need_gb;
722 zimg_image_buffer_const src_buf = { ZIMG_API_VERSION };
723 zimg_image_buffer dst_buf = { ZIMG_API_VERSION };
724 const int out_slice_start =
s->out_slice_start[job_nr];
725
726 /* create zimg filter graphs for each thread
727 only if not created earlier or there is some change in frame parameters */
735
736 if (need_gb){
740 }
741 for (
int i = 0;
i < 3;
i++) {
742 const int vsamp =
i >= 1 ?
td->odesc->log2_chroma_h : 0;
743
744 p =
td->desc->comp[
i].plane;
745
746 src_buf.plane[
i].data =
td->in->data[p];
747 src_buf.plane[
i].stride =
td->in->linesize[p];
748 src_buf.plane[
i].mask = -1;
749
750 p =
td->odesc->comp[
i].plane;
751 dst_buf.plane[
i].data =
td->out->data[p] +
td->out->linesize[p] * (out_slice_start >> vsamp);
752 dst_buf.plane[
i].stride =
td->out->linesize[p];
753 dst_buf.plane[
i].mask = -1;
754 }
755 if (!
s->graph[job_nr])
757 ret = zimg_filter_graph_process(
s->graph[job_nr], &src_buf, &dst_buf,
s->tmp[job_nr], 0, 0, 0, 0);
760
762 src_buf.plane[0].data =
td->in->data[3];
763 src_buf.plane[0].stride =
td->in->linesize[3];
764 src_buf.plane[0].mask = -1;
765
766 dst_buf.plane[0].data =
td->out->data[3] +
td->out->linesize[3] * out_slice_start;
767 dst_buf.plane[0].stride =
td->out->linesize[3];
768 dst_buf.plane[0].mask = -1;
769
770 if (!
s->alpha_graph[job_nr])
772 ret = zimg_filter_graph_process(
s->alpha_graph[job_nr], &src_buf, &dst_buf,
s->tmp[job_nr], 0, 0, 0, 0);
775 }
776 return 0;
777 }
778
780 {
786 char buf[32];
790
791 //we need to use this filter if something is different for an input and output only
792 //otherwise - just copy the input frame to the output
794 (
link->w != outlink->
w) ||
795 (
link->h != outlink->
h) ||
799 (
s->src_format.chroma_location !=
s->dst_format.chroma_location) ||
800 (
s->src_format.color_family !=
s->dst_format.color_family) ||
801 (
s->src_format.color_primaries !=
s->dst_format.color_primaries) ||
802 (
s->src_format.depth !=
s->dst_format.depth) ||
803 (
s->src_format.matrix_coefficients !=
s->dst_format.matrix_coefficients) ||
804 (
s->src_format.field_parity !=
s->dst_format.field_parity) ||
805 (
s->src_format.pixel_range !=
s->dst_format.pixel_range) ||
806 (
s->src_format.pixel_type !=
s->dst_format.pixel_type) ||
807 (
s->src_format.transfer_characteristics !=
s->dst_format.transfer_characteristics)
808 ){
813 }
814
817
821
824
825 snprintf(buf,
sizeof(buf)-1,
"%d", outlink->
w);
827 snprintf(buf,
sizeof(buf)-1,
"%d", outlink->
h);
829
835
838
839 zimg_image_format_default(&
s->src_format, ZIMG_API_VERSION);
840 zimg_image_format_default(&
s->dst_format, ZIMG_API_VERSION);
841 zimg_graph_builder_params_default(&
s->params, ZIMG_API_VERSION);
842
844 s->primaries_in,
s->trc_in,
s->range_in,
s->chromal_in);
846 s->primaries,
s->trc,
s->range,
s->chromal);
848
849 s->params.dither_type =
s->dither;
850 s->params.cpu_type = ZIMG_CPU_AUTO_64B;
851 s->params.resample_filter =
s->filter;
852 s->params.resample_filter_uv =
s->filter;
853 s->params.nominal_peak_luminance =
s->nominal_peak_luminance;
854 s->params.allow_approximate_gamma =
s->approximate_gamma;
855 s->params.filter_param_a =
s->params.filter_param_a_uv =
s->param_a;
856 s->params.filter_param_b =
s->params.filter_param_b_uv =
s->param_b;
857
859 zimg_image_format_default(&
s->alpha_src_format, ZIMG_API_VERSION);
860 zimg_image_format_default(&
s->alpha_dst_format, ZIMG_API_VERSION);
861 zimg_graph_builder_params_default(&
s->alpha_params, ZIMG_API_VERSION);
862
863 s->alpha_params.dither_type =
s->dither;
864 s->alpha_params.cpu_type = ZIMG_CPU_AUTO_64B;
865 s->alpha_params.resample_filter =
s->filter;
866
867 s->alpha_src_format.width = in->
width;
868 s->alpha_src_format.height = in->
height;
869 s->alpha_src_format.depth =
desc->comp[0].depth;
870 s->alpha_src_format.pixel_type = (
desc->flags &
AV_PIX_FMT_FLAG_FLOAT) ? ZIMG_PIXEL_FLOAT :
desc->comp[0].depth > 8 ? ZIMG_PIXEL_WORD : ZIMG_PIXEL_BYTE;
871 s->alpha_src_format.color_family = ZIMG_COLOR_GREY;
872
873 s->alpha_dst_format.depth = odesc->
comp[0].
depth;
875 s->alpha_dst_format.color_family = ZIMG_COLOR_GREY;
876 }
877
879 av_reduce(&
out->sample_aspect_ratio.num, &
out->sample_aspect_ratio.den,
882 INT_MAX);
883
888
889 memset(
s->jobs_ret, 0,
s->nb_threads *
sizeof(*
s->jobs_ret));
891 for (
int i = 0;
ret >= 0 &&
i <
s->nb_threads;
i++)
892 if (
s->jobs_ret[
i] < 0)
893 ret =
s->jobs_ret[
i];
898 }
899
900 s->src_format_tmp =
s->src_format;
901 s->dst_format_tmp =
s->dst_format;
902 s->params_tmp =
s->params;
904 s->alpha_src_format_tmp =
s->alpha_src_format;
905 s->alpha_dst_format_tmp =
s->alpha_dst_format;
906 s->alpha_params_tmp =
s->alpha_params;
907 }
908
910 int x, y;
912 for (y = 0; y <
out->height; y++) {
913 const ptrdiff_t row = y *
out->linesize[3];
914 for (x = 0; x <
out->width; x++) {
917 }
918 }
919 }
else if (
s->dst_format.depth == 8) {
920 for (y = 0; y < outlink->
h; y++)
921 memset(
out->data[3] + y *
out->linesize[3], 0xff, outlink->
w);
922 } else {
923 const uint16_t
max = (1 <<
s->dst_format.depth) - 1;
924 for (y = 0; y < outlink->
h; y++) {
925 const ptrdiff_t row = y *
out->linesize[3];
926 for (x = 0; x <
out->width; x++)
928 }
929 }
930 }
931 } else {
932 /*no need for any filtering */
934 }
940 }
941
943 }
944
946 {
948
949 for (
int i = 0;
i <
s->nb_threads;
i++) {
952 zimg_filter_graph_free(
s->graph[
i]);
954 }
955 if (
s->alpha_graph[
i]) {
956 zimg_filter_graph_free(
s->alpha_graph[
i]);
958 }
959 }
960 }
961
963 char *res,
int res_len,
int flags)
964 {
967
968 if ( !strcmp(cmd, "width") || !strcmp(cmd, "w")
969 || !strcmp(cmd, "height") || !strcmp(cmd, "h")) {
970
974
979 }
980 } else
982
984 }
985
986 #define OFFSET(x) offsetof(ZScaleContext, x)
987 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
988 #define TFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
989
1002 {
"error_diffusion", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_DITHER_ERROR_DIFFUSION}, 0, 0,
FLAGS, .unit =
"dither" },
1024 {
"unspecified", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_UNSPECIFIED}, 0, 0,
FLAGS, .unit =
"primaries" },
1028 {
"unknown", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_UNSPECIFIED}, 0, 0,
FLAGS, .unit =
"primaries" },
1031 {
"bt470bg", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_470_BG}, 0, 0,
FLAGS, .unit =
"primaries" },
1032 {
"smpte170m", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_170M}, 0, 0,
FLAGS, .unit =
"primaries" },
1033 {
"smpte240m", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_240M}, 0, 0,
FLAGS, .unit =
"primaries" },
1036 {
"smpte428", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST428}, 0, 0,
FLAGS, .unit =
"primaries" },
1037 {
"smpte431", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST431_2}, 0, 0,
FLAGS, .unit =
"primaries" },
1038 {
"smpte432", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_ST432_1}, 0, 0,
FLAGS, .unit =
"primaries" },
1039 {
"jedec-p22", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_EBU3213_E}, 0, 0,
FLAGS, .unit =
"primaries" },
1040 {
"ebu3213", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_EBU3213_E}, 0, 0,
FLAGS, .unit =
"primaries" },
1041 {
"transfer",
"set transfer characteristic",
OFFSET(trc),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"transfer" },
1045 {
"unspecified", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_UNSPECIFIED}, 0, 0,
FLAGS, .unit =
"transfer" },
1050 {
"unknown", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_UNSPECIFIED}, 0, 0,
FLAGS, .unit =
"transfer" },
1059 {
"bt2020-10", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_10}, 0, 0,
FLAGS, .unit =
"transfer" },
1060 {
"bt2020-12", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_2020_12}, 0, 0,
FLAGS, .unit =
"transfer" },
1061 {
"smpte2084", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_ST2084}, 0, 0,
FLAGS, .unit =
"transfer" },
1062 {
"iec61966-2-4", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_4},0, 0,
FLAGS, .unit =
"transfer" },
1063 {
"iec61966-2-1", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_1},0, 0,
FLAGS, .unit =
"transfer" },
1064 {
"arib-std-b67", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_ARIB_B67}, 0, 0,
FLAGS, .unit =
"transfer" },
1065 {
"matrix",
"set colorspace matrix",
OFFSET(colorspace),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"matrix" },
1069 {
"unspecified", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_UNSPECIFIED}, 0, 0,
FLAGS, .unit =
"matrix" },
1084 {
"chroma-derived-nc",0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL}, 0, 0,
FLAGS, .unit =
"matrix" },
1085 {
"chroma-derived-c", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_CL}, 0, 0,
FLAGS, .unit =
"matrix" },
1087 {
"in_range",
"set input color range",
OFFSET(range_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL,
FLAGS, .unit =
"range" },
1088 {
"rangein",
"set input color range",
OFFSET(range_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL,
FLAGS, .unit =
"range" },
1089 {
"rin",
"set input color range",
OFFSET(range_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_RANGE_FULL,
FLAGS, .unit =
"range" },
1090 {
"primariesin",
"set input color primaries",
OFFSET(primaries_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"primaries" },
1091 {
"pin",
"set input color primaries",
OFFSET(primaries_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"primaries" },
1092 {
"transferin",
"set input transfer characteristic",
OFFSET(trc_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"transfer" },
1093 {
"tin",
"set input transfer characteristic",
OFFSET(trc_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"transfer" },
1094 {
"matrixin",
"set input colorspace matrix",
OFFSET(colorspace_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"matrix" },
1095 {
"min",
"set input colorspace matrix",
OFFSET(colorspace_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS, .unit =
"matrix" },
1096 {
"chromal",
"set output chroma location",
OFFSET(chromal),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS, .unit =
"chroma" },
1097 {
"c",
"set output chroma location",
OFFSET(chromal),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS, .unit =
"chroma" },
1103 {
"bottomleft",0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_CHROMA_BOTTOM_LEFT}, 0, 0,
FLAGS, .unit =
"chroma" },
1105 {
"chromalin",
"set input chroma location",
OFFSET(chromal_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS, .unit =
"chroma" },
1106 {
"cin",
"set input chroma location",
OFFSET(chromal_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS, .unit =
"chroma" },
1109 { "param_a", "parameter A, which is parameter \"b\" for bicubic, "
1113 };
1114
1116
1118 {
1122 },
1123 };
1124
1126 {
1130 },
1131 };
1132
1138 .priv_class = &zscale_class,
1145 };