Go to the documentation of this file.
195 double in_alpha =
s->in_txchr->alpha, in_beta =
s->in_txchr->beta;
196 double in_gamma =
s->in_txchr->gamma, in_delta =
s->in_txchr->delta;
197 double in_ialpha = 1.0 / in_alpha, in_igamma = 1.0 / in_gamma, in_idelta = 1.0 / in_delta;
198 double out_alpha =
s->out_txchr->alpha, out_beta =
s->out_txchr->beta;
199 double out_gamma =
s->out_txchr->gamma, out_delta =
s->out_txchr->delta;
201 s->lin_lut =
av_malloc(
sizeof(*
s->lin_lut) * 32768 * 2);
204 s->delin_lut = &
s->lin_lut[32768];
205 for (n = 0; n < 32768; n++) {
206 double v = (n - 2048.0) / 28672.0,
d, l;
209 if (v <= -out_beta) {
210 d = -out_alpha * pow(-v, out_gamma) + (out_alpha - 1.0);
211 }
else if (v < out_beta) {
214 d = out_alpha * pow(v, out_gamma) - (out_alpha - 1.0);
219 if (v <= -in_beta * in_delta) {
220 l = -pow((1.0 - in_alpha - v) * in_ialpha, in_igamma);
221 }
else if (v < in_beta * in_delta) {
224 l = pow((v + in_alpha - 1.0) * in_ialpha, in_igamma);
242 { 0.8951, 0.2664, -0.1614 },
243 { -0.7502, 1.7135, 0.0367 },
244 { 0.0389, -0.0685, 1.0296 },
246 { 0.40024, 0.70760, -0.08081 },
247 { -0.22630, 1.16532, 0.04570 },
248 { 0.00000, 0.00000, 0.91822 },
251 const double (*
ma)[3] = ma_tbl[wp_adapt];
254 double zw_src = 1.0 - xw_src - yw_src;
255 double zw_dst = 1.0 - xw_dst - yw_dst;
256 double mai[3][3], fac[3][3],
tmp[3][3];
257 double rs, gs, bs, rd, gd, bd;
260 rs =
ma[0][0] * xw_src +
ma[0][1] * yw_src +
ma[0][2] * zw_src;
261 gs =
ma[1][0] * xw_src +
ma[1][1] * yw_src +
ma[1][2] * zw_src;
262 bs =
ma[2][0] * xw_src +
ma[2][1] * yw_src +
ma[2][2] * zw_src;
263 rd =
ma[0][0] * xw_dst +
ma[0][1] * yw_dst +
ma[0][2] * zw_dst;
264 gd =
ma[1][0] * xw_dst +
ma[1][1] * yw_dst +
ma[1][2] * zw_dst;
265 bd =
ma[2][0] * xw_dst +
ma[2][1] * yw_dst +
ma[2][2] * zw_dst;
269 fac[0][1] = fac[0][2] = fac[1][0] = fac[1][2] = fac[2][0] = fac[2][1] = 0.0;
275 int w,
int h,
const int16_t *lut)
279 for (n = 0; n < 3; n++) {
280 int16_t *
data = buf[n];
282 for (y = 0; y <
h; y++) {
283 for (x = 0; x <
w; x++)
301 uint8_t *in_data[3], *out_data[3];
303 int h_in = (
td->in->height + 1) >> 1;
304 int h1 = 2 * (job_nr * h_in / n_jobs), h2 = 2 * ((job_nr + 1) * h_in / n_jobs);
305 int w =
td->in->width,
h = h2 - h1;
307 in_data[0] =
td->in->data[0] +
td->in_linesize[0] * h1;
308 in_data[1] =
td->in->data[1] +
td->in_linesize[1] * (h1 >>
td->in_ss_h);
309 in_data[2] =
td->in->data[2] +
td->in_linesize[2] * (h1 >>
td->in_ss_h);
310 out_data[0] =
td->out->data[0] +
td->out_linesize[0] * h1;
311 out_data[1] =
td->out->data[1] +
td->out_linesize[1] * (h1 >>
td->out_ss_h);
312 out_data[2] =
td->out->data[2] +
td->out_linesize[2] * (h1 >>
td->out_ss_h);
313 rgb[0] =
s->rgb[0] +
s->rgb_stride * h1;
314 rgb[1] =
s->rgb[1] +
s->rgb_stride * h1;
315 rgb[2] =
s->rgb[2] +
s->rgb_stride * h1;
321 if (
s->yuv2yuv_fastmode) {
325 s->yuv2yuv(out_data,
td->out_linesize, in_data,
td->in_linesize,
w,
h,
326 s->yuv2yuv_coeffs,
s->yuv_offset);
347 s->yuv2rgb(
rgb,
s->rgb_stride, in_data,
td->in_linesize,
w,
h,
348 s->yuv2rgb_coeffs,
s->yuv_offset[0]);
349 if (!
s->rgb2rgb_passthrough) {
351 if (!
s->lrgb2lrgb_passthrough)
352 s->dsp.multiply3x3(
rgb,
s->rgb_stride,
w,
h,
s->lrgb2lrgb_coeffs);
356 s->rgb2yuv_fsb(out_data,
td->out_linesize,
rgb,
s->rgb_stride,
w,
h,
357 s->rgb2yuv_coeffs,
s->yuv_offset[1],
s->dither_scratch);
359 s->rgb2yuv(out_data,
td->out_linesize,
rgb,
s->rgb_stride,
w,
h,
360 s->rgb2yuv_coeffs,
s->yuv_offset[1]);
368 int *y_rng,
int *uv_rng,
375 if (!
s->did_warn_range) {
377 s->did_warn_range = 1;
382 *off = 16 << (depth - 8);
383 *y_rng = 219 << (depth - 8);
384 *uv_rng = 224 << (depth - 8);
388 *y_rng = *uv_rng = (256 << (depth - 8)) - 1;
403 int m, n, o, res, fmt_identical, redo_yuv2rgb = 0, redo_rgb2yuv = 0;
405 #define supported_depth(d) ((d) == 8 || (d) == 10 || (d) == 12)
406 #define supported_subsampling(lcw, lch) \
407 (((lcw) == 0 && (lch) == 0) || ((lcw) == 1 && (lch) == 0) || ((lcw) == 1 && (lch) == 1))
408 #define supported_format(d) \
409 ((d) != NULL && (d)->nb_components == 3 && \
410 !((d)->flags & AV_PIX_FMT_FLAG_RGB) && \
411 supported_depth((d)->comp[0].depth) && \
412 supported_subsampling((d)->log2_chroma_w, (d)->log2_chroma_h))
416 "Unsupported input format %d (%s) or bitdepth (%d)\n",
423 "Unsupported output format %d (%s) or bitdepth (%d)\n",
425 out_desc ? out_desc->
comp[0].
depth : -1);
430 if (
out->color_primaries !=
s->out_prm)
s->out_primaries =
NULL;
432 if (
out->color_trc !=
s->out_trc)
s->out_txchr =
NULL;
435 if (
out->colorspace !=
s->out_csp ||
436 out->color_range !=
s->out_rng)
s->out_lumacoef =
NULL;
438 if (!
s->out_primaries || !
s->in_primaries) {
443 s->in_prm =
s->user_iprm;
445 if (!
s->in_primaries) {
447 "Unsupported input primaries %d (%s)\n",
451 s->out_prm =
out->color_primaries;
453 if (!
s->out_primaries) {
459 "Unsupported output color property %d\n",
s->user_all);
463 "Unsupported output primaries %d (%s)\n",
468 s->lrgb2lrgb_passthrough = !memcmp(
s->in_primaries,
s->out_primaries,
469 sizeof(*
s->in_primaries));
470 if (!
s->lrgb2lrgb_passthrough) {
471 double rgb2xyz[3][3],
xyz2rgb[3][3], rgb2rgb[3][3];
474 wp_out = &
s->out_primaries->wp;
475 wp_in = &
s->in_primaries->wp;
479 if (memcmp(wp_in, wp_out,
sizeof(*wp_in)) != 0 &&
481 double wpconv[3][3],
tmp[3][3];
484 &
s->out_primaries->wp);
490 for (m = 0; m < 3; m++)
491 for (n = 0; n < 3; n++) {
492 s->lrgb2lrgb_coeffs[m][n][0] =
lrint(16384.0 * rgb2rgb[m][n]);
493 for (o = 1; o < 8; o++)
494 s->lrgb2lrgb_coeffs[m][n][o] =
s->lrgb2lrgb_coeffs[m][n][0];
506 s->in_trc =
s->user_itrc;
510 "Unsupported input transfer characteristics %d (%s)\n",
518 s->out_trc =
out->color_trc;
524 "Please specify output transfer characteristics\n");
527 "Unsupported output color property %d\n",
s->user_all);
531 "Unsupported output transfer characteristics %d (%s)\n",
538 s->rgb2rgb_passthrough =
s->fast_mode || (
s->lrgb2lrgb_passthrough &&
539 !memcmp(
s->in_txchr,
s->out_txchr,
sizeof(*
s->in_txchr)));
540 if (!
s->rgb2rgb_passthrough && !
s->lin_lut) {
546 if (!
s->in_lumacoef) {
551 s->in_csp =
s->user_icsp;
554 s->in_rng =
s->user_irng;
556 if (!
s->in_lumacoef) {
558 "Unsupported input colorspace %d (%s)\n",
565 if (!
s->out_lumacoef) {
566 s->out_csp =
out->colorspace;
567 s->out_rng =
out->color_range;
569 if (!
s->out_lumacoef) {
573 "Please specify output colorspace\n");
576 "Unsupported output color property %d\n",
s->user_all);
580 "Unsupported output colorspace %d (%s)\n",
s->out_csp,
590 s->yuv2yuv_fastmode =
s->rgb2rgb_passthrough && fmt_identical;
591 s->yuv2yuv_passthrough =
s->yuv2yuv_fastmode &&
s->in_rng ==
s->out_rng &&
592 !memcmp(
s->in_lumacoef,
s->out_lumacoef,
593 sizeof(*
s->in_lumacoef)) &&
595 if (!
s->yuv2yuv_passthrough) {
597 double rgb2yuv[3][3], (*yuv2rgb)[3] =
s->yuv2rgb_dbl_coeffs;
598 int off,
bits, in_rng;
604 "Unsupported input color range %d (%s)\n",
608 for (n = 0; n < 8; n++)
609 s->yuv_offset[0][n] = off;
613 for (n = 0; n < 3; n++) {
614 for (in_rng =
s->in_y_rng, m = 0; m < 3; m++, in_rng = s->in_uv_rng) {
616 for (o = 1; o < 8; o++)
617 s->yuv2rgb_coeffs[n][m][o] =
s->yuv2rgb_coeffs[n][m][0];
622 av_assert2(
s->yuv2rgb_coeffs[0][0][0] ==
s->yuv2rgb_coeffs[1][0][0]);
623 av_assert2(
s->yuv2rgb_coeffs[0][0][0] ==
s->yuv2rgb_coeffs[2][0][0]);
624 s->yuv2rgb =
s->dsp.yuv2rgb[(in_desc->
comp[0].
depth - 8) >> 1]
630 int off, out_rng,
bits;
636 "Unsupported output color range %d (%s)\n",
640 for (n = 0; n < 8; n++)
641 s->yuv_offset[1][n] = off;
644 for (out_rng =
s->out_y_rng, n = 0; n < 3; n++, out_rng = s->out_uv_rng) {
645 for (m = 0; m < 3; m++) {
647 for (o = 1; o < 8; o++)
648 s->rgb2yuv_coeffs[n][m][o] =
s->rgb2yuv_coeffs[n][m][0];
651 av_assert2(
s->rgb2yuv_coeffs[1][2][0] ==
s->rgb2yuv_coeffs[2][0][0]);
652 s->rgb2yuv =
s->dsp.rgb2yuv[(out_desc->
comp[0].
depth - 8) >> 1]
654 s->rgb2yuv_fsb =
s->dsp.rgb2yuv_fsb[(out_desc->
comp[0].
depth - 8) >> 1]
658 if (
s->yuv2yuv_fastmode && (redo_yuv2rgb || redo_rgb2yuv)) {
666 for (out_rng =
s->out_y_rng, m = 0; m < 3; m++, out_rng = s->out_uv_rng) {
667 for (in_rng =
s->in_y_rng, n = 0; n < 3; n++, in_rng = s->in_uv_rng) {
668 s->yuv2yuv_coeffs[m][n][0] =
670 (in_rng * (1 << odepth)));
671 for (o = 1; o < 8; o++)
672 s->yuv2yuv_coeffs[m][n][o] =
s->yuv2yuv_coeffs[m][n][0];
677 s->yuv2yuv =
s->dsp.yuv2yuv[(idepth - 8) >> 1][(odepth - 8) >> 1]
722 ptrdiff_t rgb_stride =
FFALIGN(in->
width *
sizeof(int16_t), 32);
723 unsigned rgb_sz = rgb_stride * in->
height;
746 out->color_trc =
s->user_trc;
752 if (rgb_sz !=
s->rgb_sz) {
754 int uvw = in->
width >>
desc->log2_chroma_w;
770 s->dither_scratch_base[0][0] =
772 s->dither_scratch_base[0][1] =
774 s->dither_scratch_base[1][0] =
775 av_malloc(
sizeof(*
s->dither_scratch_base[1][0]) * (uvw + 4));
776 s->dither_scratch_base[1][1] =
777 av_malloc(
sizeof(*
s->dither_scratch_base[1][1]) * (uvw + 4));
778 s->dither_scratch_base[2][0] =
779 av_malloc(
sizeof(*
s->dither_scratch_base[2][0]) * (uvw + 4));
780 s->dither_scratch_base[2][1] =
781 av_malloc(
sizeof(*
s->dither_scratch_base[2][1]) * (uvw + 4));
782 s->dither_scratch[0][0] = &
s->dither_scratch_base[0][0][1];
783 s->dither_scratch[0][1] = &
s->dither_scratch_base[0][1][1];
784 s->dither_scratch[1][0] = &
s->dither_scratch_base[1][0][1];
785 s->dither_scratch[1][1] = &
s->dither_scratch_base[1][1][1];
786 s->dither_scratch[2][0] = &
s->dither_scratch_base[2][0][1];
787 s->dither_scratch[2][1] = &
s->dither_scratch_base[2][1][1];
788 if (!
s->rgb[0] || !
s->rgb[1] || !
s->rgb[2] ||
789 !
s->dither_scratch_base[0][0] || !
s->dither_scratch_base[0][1] ||
790 !
s->dither_scratch_base[1][0] || !
s->dither_scratch_base[1][1] ||
791 !
s->dither_scratch_base[2][0] || !
s->dither_scratch_base[2][1]) {
805 s->rgb_stride = rgb_stride /
sizeof(int16_t);
811 td.out_linesize[0] =
out->linesize[0];
812 td.out_linesize[1] =
out->linesize[1];
813 td.out_linesize[2] =
out->linesize[2];
816 if (
s->yuv2yuv_passthrough) {
879 #define OFFSET(x) offsetof(ColorSpaceContext, x)
880 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
881 #define ENUM(x, y, z) { x, "", 0, AV_OPT_TYPE_CONST, { .i64 = y }, INT_MIN, INT_MAX, FLAGS, z }
884 {
"all",
"Set all color properties together",
896 {
"space",
"Output colorspace",
909 {
"range",
"Output color range",
917 {
"primaries",
"Output color primaries",
933 {
"trc",
"Output transfer characteristics",
951 {
"format",
"Output pixel format",
964 {
"fast",
"Ignore primary chromaticity and gamma correction",
968 {
"dither",
"Dithering mode",
974 {
"wpadapt",
"Whitepoint adaptation method",
981 {
"iall",
"Set all input color properties together",
984 {
"ispace",
"Input colorspace",
987 {
"irange",
"Input color range",
990 {
"iprimaries",
"Input color primaries",
993 {
"itrc",
"Input transfer characteristics",
1019 .
name =
"colorspace",
1024 .priv_class = &colorspace_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
enum AVColorTransferCharacteristic color_trc
#define AV_LOG_WARNING
Something somehow does not look correct.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
AVPixelFormat
Pixel format.
@ AVCOL_PRI_EBU3213
EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
rgb2yuv_fsb_fn rgb2yuv_fsb
enum AVPixelFormat in_format user_format
AVColorTransferCharacteristic
Color Transfer Characteristic.
Struct that contains both white point location and primaries location, providing the complete descrip...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int * dither_scratch_base[3][2]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
void ff_matrix_invert_3x3(const double in[3][3], double out[3][3])
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
const struct TransferCharacteristics * out_txchr
enum AVColorPrimaries color_primaries
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
enum AVColorSpace colorspace
YUV colorspace type.
This structure describes decoded (raw) audio or video data.
AVFILTER_DEFINE_CLASS(colorspace)
static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptation wp_adapt, const AVWhitepointCoefficients *wp_src, const AVWhitepointCoefficients *wp_dst)
@ AVCOL_TRC_NB
Not part of ABI.
@ AVCOL_RANGE_JPEG
Full range content.
const struct AVLumaCoefficients * av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp)
Retrieves the Luma coefficients necessary to construct a conversion matrix from an enum constant desc...
int depth
Number of bits in the component.
@ AVCOL_SPC_NB
Not part of ABI.
#define FILTER_QUERY_FUNC(func)
static const char rgb2yuv[]
double rgb2yuv_dbl_coeffs[3][3]
#define AV_PIX_FMT_YUV420P10
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
int16_t lrgb2lrgb_coeffs[3][3][8]
AVColorPrimaries
Chromaticity coordinates of the source primaries.
const char * name
Filter name.
static const struct TransferCharacteristics * get_transfer_characteristics(enum AVColorTransferCharacteristic trc)
A link between two filters.
enum WhitepointAdaptation wp_adapt
static const AVOption colorspace_options[]
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
@ 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_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
const char * av_color_space_name(enum AVColorSpace space)
ptrdiff_t out_linesize[3]
@ AVCOL_RANGE_NB
Not part of ABI.
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
A filter pad used for either input or output.
#define AV_PIX_FMT_YUV444P10
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AVCOL_PRI_NB
Not part of ABI.
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
int16_t yuv2rgb_coeffs[3][3][8]
static int get_range_off(AVFilterContext *ctx, int *off, int *y_rng, int *uv_rng, enum AVColorRange rng, int depth)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static int filter_frame(AVFilterLink *link, AVFrame *in)
static enum AVPixelFormat pix_fmts[]
static enum AVColorTransferCharacteristic default_trc[CS_NB+1]
@ AVCOL_PRI_SMPTE428
SMPTE ST 428-1 (CIE 1931 XYZ)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
#define FILTER_INPUTS(array)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
int16_t rgb2yuv_coeffs[3][3][8]
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
enum AVColorRange in_rng out_rng user_rng user_irng
static av_cold int init(AVFilterContext *ctx)
const char * av_color_range_name(enum AVColorRange range)
int16_t yuv2yuv_coeffs[3][3][8]
void ff_matrix_mul_3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
static int config_props(AVFilterLink *outlink)
Describe the class of an AVClass context structure.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
enum AVColorTransferCharacteristic in_trc out_trc user_trc user_itrc
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
AVFilterLink ** inputs
array of pointers to input links
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
static int fill_gamma_table(ColorSpaceContext *s)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
#define AV_PIX_FMT_YUV422P10
const struct TransferCharacteristics * in_txchr
Struct containing chromaticity x and y values for the standard CIE 1931 chromaticity definition.
enum Colorspace user_all user_iall
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_PRI_BT2020
ITU-R BT2020.
static void uninit(AVFilterContext *ctx)
int lrgb2lrgb_passthrough
@ AVCOL_PRI_SMPTE431
SMPTE ST 431-2 (2011) / DCI P3.
void(* yuv2yuv_fn)(uint8_t *yuv_out[3], const ptrdiff_t yuv_out_stride[3], uint8_t *yuv_in[3], const ptrdiff_t yuv_in_stride[3], int w, int h, const int16_t yuv2yuv_coeffs[3][3][8], const int16_t yuv_offset[2][8])
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AVCOL_PRI_FILM
colour filters using Illuminant C
#define DECLARE_ALIGNED(n, t, v)
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
#define AV_PIX_FMT_YUV422P12
static const float xyz2rgb[3][3]
#define AV_PIX_FMT_YUV444P12
AVFilterContext * dst
dest filter
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
AVFilterContext * src
source filter
double yuv2rgb_dbl_coeffs[3][3]
@ AVCOL_TRC_BT709
also ITU-R BT1361
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
static int convert(AVFilterContext *ctx, void *data, int job_nr, int n_jobs)
static void fn() yuv2yuv(uint8_t *_dst[3], const ptrdiff_t dst_stride[3], uint8_t *_src[3], const ptrdiff_t src_stride[3], int w, int h, const int16_t c[3][3][8], const int16_t yuv_offset[2][8])
static int query_formats(AVFilterContext *ctx)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
void ff_fill_rgb2yuv_table(const AVLumaCoefficients *coeffs, double rgb2yuv[3][3])
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
int * dither_scratch[3][2]
const AVColorPrimariesDesc * in_primaries
int w
agreed upon image width
AVColorSpace
YUV colorspace type.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
const AVLumaCoefficients * in_lumacoef
Used for passing data between threads.
const AVColorPrimariesDesc * out_primaries
const char * name
Pad name.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ NB_WP_ADAPT_NON_IDENTITY
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
static const AVFilterPad outputs[]
const AVLumaCoefficients * out_lumacoef
void ff_fill_rgb2xyz_table(const AVPrimaryCoefficients *coeffs, const AVWhitepointCoefficients *wp, double rgb2xyz[3][3])
#define AV_PIX_FMT_YUV420P12
void(* yuv2rgb_fn)(int16_t *rgb[3], ptrdiff_t rgb_stride, uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int w, int h, const int16_t yuv2rgb_coeffs[3][3][8], const int16_t yuv_offset[8])
enum AVColorSpace in_csp out_csp user_csp user_icsp
static enum AVColorSpace default_csp[CS_NB+1]
int h
agreed upon image height
static enum AVColorPrimaries default_prm[CS_NB+1]
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void(* rgb2yuv_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t rgb_stride, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
static const AVFilterPad inputs[]
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
enum AVColorPrimaries in_prm out_prm user_prm user_iprm
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void(* rgb2yuv_fsb_fn)(uint8_t *yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t rgb_stride, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8], int *rnd[3][2])
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
@ AVCOL_PRI_SMPTE432
SMPTE ST 432-1 (2010) / P3 D65 / Display P3.
const AVFilter ff_vf_colorspace
#define FILTER_OUTPUTS(array)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define supported_format(d)
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
AVColorRange
Visual content value range.
static int create_filtergraph(AVFilterContext *ctx, const AVFrame *in, const AVFrame *out)
static void yuv2rgb(uint8_t *out, int ridx, int Y, int U, int V)
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static void apply_lut(int16_t *buf[3], ptrdiff_t stride, int w, int h, const int16_t *lut)
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.
static const uint8_t dither[8][8]