47 #define ZIMG_ALIGNMENT 32
137 if (
s->size_str && (
s->w_expr ||
s->h_expr)) {
139 "Size and width/height expressions cannot be set at the same time.\n");
143 if (
s->w_expr && !
s->h_expr)
144 FFSWAP(
char *,
s->w_expr,
s->size_str);
150 "Invalid size '%s'\n",
s->size_str);
153 snprintf(buf,
sizeof(buf)-1,
"%d",
s->w);
155 snprintf(buf,
sizeof(buf)-1,
"%d",
s->h);
206 double var_values[
VARS_NB], res;
209 int factor_w, factor_h;
215 var_values[
VAR_A] = (double) inlink->
w / inlink->
h;
273 if (
s->force_original_aspect_ratio) {
277 if (
s->force_original_aspect_ratio == 1) {
286 if (
w > INT_MAX ||
h > INT_MAX ||
287 (
h * inlink->
w) > INT_MAX ||
288 (
w * inlink->
h) > INT_MAX)
294 if (inlink->
w == outlink->
w &&
295 inlink->
h == outlink->
h &&
315 "Error when evaluating the expression '%s'.\n"
316 "Maybe the expression for out_w:'%s' or for out_h:'%s' is self-referencing.\n",
317 expr,
s->w_expr,
s->h_expr);
324 int err_code = zimg_get_last_error(err_msg,
sizeof(err_msg));
333 switch (chroma_location) {
336 return ZIMG_CHROMA_LEFT;
338 return ZIMG_CHROMA_CENTER;
340 return ZIMG_CHROMA_TOP_LEFT;
342 return ZIMG_CHROMA_TOP;
344 return ZIMG_CHROMA_BOTTOM_LEFT;
346 return ZIMG_CHROMA_BOTTOM;
348 return ZIMG_CHROMA_LEFT;
353 switch (colorspace) {
355 return ZIMG_MATRIX_RGB;
357 return ZIMG_MATRIX_709;
359 return ZIMG_MATRIX_UNSPECIFIED;
361 return ZIMG_MATRIX_FCC;
363 return ZIMG_MATRIX_470BG;
365 return ZIMG_MATRIX_170M;
367 return ZIMG_MATRIX_240M;
369 return ZIMG_MATRIX_YCGCO;
371 return ZIMG_MATRIX_2020_NCL;
373 return ZIMG_MATRIX_2020_CL;
375 return ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL;
377 return ZIMG_MATRIX_CHROMATICITY_DERIVED_CL;
379 return ZIMG_MATRIX_ICTCP;
381 return ZIMG_MATRIX_UNSPECIFIED;
388 return ZIMG_TRANSFER_UNSPECIFIED;
390 return ZIMG_TRANSFER_709;
392 return ZIMG_TRANSFER_470_M;
394 return ZIMG_TRANSFER_470_BG;
396 return ZIMG_TRANSFER_601;
398 return ZIMG_TRANSFER_240M;
400 return ZIMG_TRANSFER_LINEAR;
402 return ZIMG_TRANSFER_LOG_100;
404 return ZIMG_TRANSFER_LOG_316;
406 return ZIMG_TRANSFER_IEC_61966_2_4;
408 return ZIMG_TRANSFER_2020_10;
410 return ZIMG_TRANSFER_2020_12;
412 return ZIMG_TRANSFER_ST2084;
414 return ZIMG_TRANSFER_ARIB_B67;
416 return ZIMG_TRANSFER_IEC_61966_2_1;
418 return ZIMG_TRANSFER_UNSPECIFIED;
425 return ZIMG_PRIMARIES_UNSPECIFIED;
427 return ZIMG_PRIMARIES_709;
429 return ZIMG_PRIMARIES_470_M;
431 return ZIMG_PRIMARIES_470_BG;
433 return ZIMG_PRIMARIES_170M;
435 return ZIMG_PRIMARIES_240M;
437 return ZIMG_PRIMARIES_FILM;
439 return ZIMG_PRIMARIES_2020;
441 return ZIMG_PRIMARIES_ST428;
443 return ZIMG_PRIMARIES_ST431_2;
445 return ZIMG_PRIMARIES_ST432_1;
447 return ZIMG_PRIMARIES_EBU3213_E;
449 return ZIMG_PRIMARIES_UNSPECIFIED;
457 return ZIMG_RANGE_LIMITED;
459 return ZIMG_RANGE_FULL;
461 return ZIMG_RANGE_LIMITED;
465 int colorspace,
int primaries,
int transfer,
int range,
int location)
481 static int graph_build(zimg_filter_graph **graph, zimg_graph_builder_params *params,
482 zimg_image_format *src_format, zimg_image_format *dst_format,
483 void **
tmp,
size_t *tmp_size)
488 zimg_filter_graph_free(*graph);
489 *graph = zimg_filter_graph_build(src_format, dst_format, params);
493 ret = zimg_filter_graph_get_tmp_size(*graph, &
size);
497 if (
size > *tmp_size) {
515 for (plane = 0; plane < 3; plane++) {
516 int p =
desc->comp[plane].plane;
523 aligned->format = (*frame)->format;
524 aligned->width = (*frame)->width;
525 aligned->height = (*frame)->height;
553 zimg_image_buffer_const src_buf = { ZIMG_API_VERSION };
554 zimg_image_buffer dst_buf = { ZIMG_API_VERSION };
568 out->width = outlink->
w;
569 out->height = outlink->
h;
571 if(
in->width != link->
w
572 ||
in->height != link->
h
574 ||
s->in_colorspace !=
in->colorspace
575 ||
s->in_trc !=
in->color_trc
576 ||
s->in_primaries !=
in->color_primaries
577 ||
s->in_range !=
in->color_range
578 ||
s->out_colorspace !=
out->colorspace
579 ||
s->out_trc !=
out->color_trc
580 ||
s->out_primaries !=
out->color_primaries
581 ||
s->out_range !=
out->color_range
582 ||
s->in_chromal !=
in->chroma_location
583 ||
s->out_chromal !=
out->chroma_location) {
584 snprintf(buf,
sizeof(buf)-1,
"%d", outlink->
w);
586 snprintf(buf,
sizeof(buf)-1,
"%d", outlink->
h);
596 zimg_image_format_default(&
s->src_format, ZIMG_API_VERSION);
597 zimg_image_format_default(&
s->dst_format, ZIMG_API_VERSION);
598 zimg_graph_builder_params_default(&
s->params, ZIMG_API_VERSION);
600 s->params.dither_type =
s->dither;
601 s->params.cpu_type = ZIMG_CPU_AUTO;
602 s->params.resample_filter =
s->filter;
603 s->params.resample_filter_uv =
s->filter;
604 s->params.nominal_peak_luminance =
s->nominal_peak_luminance;
605 s->params.allow_approximate_gamma =
s->approximate_gamma;
606 s->params.filter_param_a =
s->params.filter_param_a_uv =
s->param_a;
607 s->params.filter_param_b =
s->params.filter_param_b_uv =
s->param_b;
610 s->primaries_in,
s->trc_in,
s->range_in,
s->chromal_in);
612 s->primaries,
s->trc,
s->range,
s->chromal);
614 if (
s->colorspace != -1)
615 out->colorspace = (
int)
s->dst_format.matrix_coefficients;
617 if (
s->primaries != -1)
618 out->color_primaries = (
int)
s->dst_format.color_primaries;
621 out->color_range = (
int)
s->dst_format.pixel_range + 1;
624 out->color_trc = (
int)
s->dst_format.transfer_characteristics;
626 if (
s->chromal != -1)
627 out->chroma_location = (
int)
s->dst_format.chroma_location - 1;
629 ret =
graph_build(&
s->graph, &
s->params, &
s->src_format, &
s->dst_format,
630 &
s->tmp, &
s->tmp_size);
634 s->in_colorspace =
in->colorspace;
635 s->in_trc =
in->color_trc;
636 s->in_primaries =
in->color_primaries;
637 s->in_range =
in->color_range;
638 s->out_colorspace =
out->colorspace;
639 s->out_trc =
out->color_trc;
640 s->out_primaries =
out->color_primaries;
641 s->out_range =
out->color_range;
644 zimg_image_format_default(&
s->alpha_src_format, ZIMG_API_VERSION);
645 zimg_image_format_default(&
s->alpha_dst_format, ZIMG_API_VERSION);
646 zimg_graph_builder_params_default(&
s->alpha_params, ZIMG_API_VERSION);
648 s->alpha_params.dither_type =
s->dither;
649 s->alpha_params.cpu_type = ZIMG_CPU_AUTO;
650 s->alpha_params.resample_filter =
s->filter;
652 s->alpha_src_format.width =
in->width;
653 s->alpha_src_format.height =
in->height;
654 s->alpha_src_format.depth =
desc->comp[0].depth;
655 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;
656 s->alpha_src_format.color_family = ZIMG_COLOR_GREY;
658 s->alpha_dst_format.width =
out->width;
659 s->alpha_dst_format.height =
out->height;
660 s->alpha_dst_format.depth = odesc->
comp[0].
depth;
662 s->alpha_dst_format.color_family = ZIMG_COLOR_GREY;
664 zimg_filter_graph_free(
s->alpha_graph);
665 s->alpha_graph = zimg_filter_graph_build(&
s->alpha_src_format, &
s->alpha_dst_format, &
s->alpha_params);
666 if (!
s->alpha_graph) {
673 if (
s->colorspace != -1)
674 out->colorspace = (
int)
s->dst_format.matrix_coefficients;
676 if (
s->primaries != -1)
677 out->color_primaries = (
int)
s->dst_format.color_primaries;
680 out->color_range = (
int)
s->dst_format.pixel_range;
683 out->color_trc = (
int)
s->dst_format.transfer_characteristics;
685 av_reduce(&
out->sample_aspect_ratio.num, &
out->sample_aspect_ratio.den,
686 (int64_t)
in->sample_aspect_ratio.num * outlink->
h * link->
w,
687 (int64_t)
in->sample_aspect_ratio.den * outlink->
w * link->
h,
690 for (plane = 0; plane < 3; plane++) {
691 int p =
desc->comp[plane].plane;
692 src_buf.plane[plane].data =
in->data[p];
693 src_buf.plane[plane].stride =
in->linesize[p];
694 src_buf.plane[plane].mask = -1;
697 dst_buf.plane[plane].data =
out->data[p];
698 dst_buf.plane[plane].stride =
out->linesize[p];
699 dst_buf.plane[plane].mask = -1;
702 ret = zimg_filter_graph_process(
s->graph, &src_buf, &dst_buf,
s->tmp, 0, 0, 0, 0);
709 src_buf.plane[0].data =
in->data[3];
710 src_buf.plane[0].stride =
in->linesize[3];
711 src_buf.plane[0].mask = -1;
713 dst_buf.plane[0].data =
out->data[3];
714 dst_buf.plane[0].stride =
out->linesize[3];
715 dst_buf.plane[0].mask = -1;
717 ret = zimg_filter_graph_process(
s->alpha_graph, &src_buf, &dst_buf,
s->tmp, 0, 0, 0, 0);
726 for (y = 0; y <
out->height; y++) {
727 for (x = 0; x <
out->width; x++) {
733 for (y = 0; y < outlink->
h; y++)
734 memset(
out->data[3] + y *
out->linesize[3], 0xff, outlink->
w);
752 zimg_filter_graph_free(
s->graph);
753 zimg_filter_graph_free(
s->alpha_graph);
759 char *res,
int res_len,
int flags)
764 if ( !strcmp(cmd,
"width") || !strcmp(cmd,
"w")
765 || !strcmp(cmd,
"height") || !strcmp(cmd,
"h")) {
782 #define OFFSET(x) offsetof(ZScaleContext, x)
783 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
784 #define TFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
798 {
"error_diffusion", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_DITHER_ERROR_DIFFUSION}, 0, 0,
FLAGS,
"dither" },
820 {
"unspecified", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_PRIMARIES_UNSPECIFIED}, 0, 0,
FLAGS,
"primaries" },
857 {
"iec61966-2-4", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_4},0, 0,
FLAGS,
"transfer" },
858 {
"iec61966-2-1", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_TRANSFER_IEC_61966_2_1},0, 0,
FLAGS,
"transfer" },
879 {
"chroma-derived-nc",0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_NCL}, 0, 0,
FLAGS,
"matrix" },
880 {
"chroma-derived-c", 0, 0,
AV_OPT_TYPE_CONST, {.i64 = ZIMG_MATRIX_CHROMATICITY_DERIVED_CL}, 0, 0,
FLAGS,
"matrix" },
885 {
"primariesin",
"set input color primaries",
OFFSET(primaries_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS,
"primaries" },
887 {
"transferin",
"set input transfer characteristic",
OFFSET(trc_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS,
"transfer" },
889 {
"matrixin",
"set input colorspace matrix",
OFFSET(colorspace_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
FLAGS,
"matrix" },
891 {
"chromal",
"set output chroma location",
OFFSET(chromal),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS,
"chroma" },
892 {
"c",
"set output chroma location",
OFFSET(chromal),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS,
"chroma" },
900 {
"chromalin",
"set input chroma location",
OFFSET(chromal_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS,
"chroma" },
901 {
"cin",
"set input chroma location",
OFFSET(chromal_in),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, ZIMG_CHROMA_BOTTOM,
FLAGS,
"chroma" },
904 {
"param_a",
"parameter A, which is parameter \"b\" for bicubic, "
936 .priv_class = &zscale_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static const char *const format[]
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
simple assert() macros that are a bit more flexible than ISO C assert().
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
#define flags(name, subs,...)
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
#define FFSWAP(type, a, b)
static int aligned(int val)
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.
simple arithmetic expression evaluator
#define AVERROR_EXTERNAL
Generic error in an external library.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
static av_always_inline uint32_t av_float2int(float f)
Reinterpret a float as a 32-bit integer.
static const struct ColorPrimaries color_primaries[AVCOL_PRI_NB]
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
AVChromaLocation
Location of chroma samples.
@ AVCHROMA_LOC_TOPLEFT
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
@ AVCHROMA_LOC_LEFT
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
@ AVCHROMA_LOC_BOTTOMLEFT
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
@ AVCHROMA_LOC_UNSPECIFIED
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
AVColorRange
Visual content value range.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P16
AVColorPrimaries
Chromaticity coordinates of the source primaries.
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_PRI_FILM
colour filters using Illuminant C
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
@ AVCOL_PRI_SMPTE240M
functionally identical to above
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AVCOL_PRI_BT2020
ITU-R BT2020.
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVColorTransferCharacteristic
Color Transfer Characteristic.
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
@ AVCOL_TRC_BT709
also ITU-R BT1361
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_CHROMA_DERIVED_CL
Chromaticity-derived constant luminance system.
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
@ AVCOL_SPC_CHROMA_DERIVED_NCL
Chromaticity-derived non-constant luminance system.
@ AVCOL_SPC_SMPTE240M
functionally identical to above
@ AVCOL_SPC_YCGCO
Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16.
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Describe the class of an AVClass context structure.
int plane
Which of the 4 planes contains the component.
int step
Number of elements between 2 horizontally consecutive pixels.
int depth
Number of bits in the component.
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
enum AVChromaLocation chroma_location
enum AVColorPrimaries color_primaries
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
enum AVColorTransferCharacteristic color_trc
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Rational number (pair of numerator and denominator).
double nominal_peak_luminance
zimg_graph_builder_params params
enum AVColorTransferCharacteristic in_trc out_trc
enum AVColorPrimaries in_primaries out_primaries
zimg_image_format alpha_src_format
int force_original_aspect_ratio
enum AVColorSpace in_colorspace out_colorspace
zimg_graph_builder_params alpha_params
zimg_image_format dst_format
enum AVChromaLocation in_chromal out_chromal
zimg_filter_graph * graph
char * w_expr
width expression string
enum AVColorRange in_range out_range
zimg_filter_graph * alpha_graph
zimg_image_format src_format
zimg_image_format alpha_dst_format
char * h_expr
height expression string
static const uint8_t dither[8][8]
static int realign_frame(const AVPixFmtDescriptor *desc, AVFrame **frame)
static int config_props(AVFilterLink *outlink)
static int graph_build(zimg_filter_graph **graph, zimg_graph_builder_params *params, zimg_image_format *src_format, zimg_image_format *dst_format, void **tmp, size_t *tmp_size)
static int print_zimg_error(AVFilterContext *ctx)
static int convert_trc(enum AVColorTransferCharacteristic color_trc)
static int convert_range(enum AVColorRange color_range)
static int filter_frame(AVFilterLink *link, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
static void format_init(zimg_image_format *format, AVFrame *frame, const AVPixFmtDescriptor *desc, int colorspace, int primaries, int transfer, int range, int location)
static int convert_primaries(enum AVColorPrimaries color_primaries)
AVFILTER_DEFINE_CLASS(zscale)
static int convert_matrix(enum AVColorSpace colorspace)
static const char *const var_names[]
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static av_cold void uninit(AVFilterContext *ctx)
static int convert_chroma_location(enum AVChromaLocation chroma_location)
static const AVFilterPad avfilter_vf_zscale_outputs[]
static const AVOption zscale_options[]
static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts)
static const AVFilterPad avfilter_vf_zscale_inputs[]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.