208 double in_alpha =
s->in_txchr->alpha, in_beta =
s->in_txchr->beta;
209 double in_gamma =
s->in_txchr->gamma, in_delta =
s->in_txchr->delta;
210 double in_ialpha = 1.0 / in_alpha, in_igamma = 1.0 / in_gamma, in_idelta = 1.0 / in_delta;
211 double out_alpha =
s->out_txchr->alpha, out_beta =
s->out_txchr->beta;
212 double out_gamma =
s->out_txchr->gamma, out_delta =
s->out_txchr->delta;
215 s->lin_lut =
av_malloc(
sizeof(*
s->lin_lut) * 32768 * 2);
218 s->delin_lut = &
s->lin_lut[32768];
219 for (n = 0; n < 32768; n++) {
220 double v = (n - 2048.0) / 28672.0, d, l;
223 if (v <= -out_beta) {
224 d = -out_alpha * pow(-v, out_gamma) + (out_alpha - 1.0);
225 }
else if (v < out_beta) {
228 d = out_alpha * pow(v, out_gamma) - (out_alpha - 1.0);
230 int d_rounded =
lrint(d * 28672.0);
231 s->delin_lut[n] = clip_gamut ?
av_clip(d_rounded, 0, 28672)
235 if (v <= -in_beta * in_delta) {
236 l = -pow((1.0 - in_alpha - v) * in_ialpha, in_igamma);
237 }
else if (v < in_beta * in_delta) {
240 l = pow((v + in_alpha - 1.0) * in_ialpha, in_igamma);
242 int l_rounded =
lrint(l * 28672.0);
243 s->lin_lut[n] = clip_gamut ?
av_clip(l_rounded, 0, 28672)
260 { 0.8951, 0.2664, -0.1614 },
261 { -0.7502, 1.7135, 0.0367 },
262 { 0.0389, -0.0685, 1.0296 },
264 { 0.40024, 0.70760, -0.08081 },
265 { -0.22630, 1.16532, 0.04570 },
266 { 0.00000, 0.00000, 0.91822 },
269 const double (*
ma)[3] = ma_tbl[wp_adapt];
272 double zw_src = 1.0 - xw_src - yw_src;
273 double zw_dst = 1.0 - xw_dst - yw_dst;
274 double mai[3][3], fac[3][3],
tmp[3][3];
275 double rs, gs, bs, rd, gd, bd;
278 rs =
ma[0][0] * xw_src +
ma[0][1] * yw_src +
ma[0][2] * zw_src;
279 gs =
ma[1][0] * xw_src +
ma[1][1] * yw_src +
ma[1][2] * zw_src;
280 bs =
ma[2][0] * xw_src +
ma[2][1] * yw_src +
ma[2][2] * zw_src;
281 rd =
ma[0][0] * xw_dst +
ma[0][1] * yw_dst +
ma[0][2] * zw_dst;
282 gd =
ma[1][0] * xw_dst +
ma[1][1] * yw_dst +
ma[1][2] * zw_dst;
283 bd =
ma[2][0] * xw_dst +
ma[2][1] * yw_dst +
ma[2][2] * zw_dst;
287 fac[0][1] = fac[0][2] = fac[1][0] = fac[1][2] = fac[2][0] = fac[2][1] = 0.0;
293 int w,
int h,
const int16_t *lut)
297 for (n = 0; n < 3; n++) {
298 int16_t *
data = buf[n];
300 for (y = 0; y <
h; y++) {
301 for (x = 0; x <
w; x++)
319 uint8_t *in_data[3], *out_data[3];
321 int h_in = (td->
in->
height + 1) >> 1;
322 int h1 = 2 * (job_nr * h_in / n_jobs), h2 = 2 * ((job_nr + 1) * h_in / n_jobs);
331 rgb[0] =
s->rgb[0] +
s->rgb_stride * h1;
332 rgb[1] =
s->rgb[1] +
s->rgb_stride * h1;
333 rgb[2] =
s->rgb[2] +
s->rgb_stride * h1;
339 if (
s->yuv2yuv_fastmode) {
344 s->yuv2yuv_coeffs,
s->yuv_offset);
366 s->yuv2rgb_coeffs,
s->yuv_offset[0]);
367 if (!
s->rgb2rgb_passthrough) {
369 if (!
s->lrgb2lrgb_passthrough)
370 s->dsp.multiply3x3(
rgb,
s->rgb_stride,
w,
h,
s->lrgb2lrgb_coeffs);
375 s->rgb2yuv_coeffs,
s->yuv_offset[1],
s->dither_scratch);
378 s->rgb2yuv_coeffs,
s->yuv_offset[1]);
386 int *y_rng,
int *uv_rng,
393 if (!
s->did_warn_range) {
395 s->did_warn_range = 1;
400 *off = 16 << (depth - 8);
401 *y_rng = 219 << (depth - 8);
402 *uv_rng = 224 << (depth - 8);
406 *y_rng = *uv_rng = (256 << (depth - 8)) - 1;
421 int m, n, o, res, fmt_identical, redo_yuv2rgb = 0, redo_rgb2yuv = 0;
423#define supported_depth(d) ((d) == 8 || (d) == 10 || (d) == 12)
424#define supported_subsampling(lcw, lch) \
425 (((lcw) == 0 && (lch) == 0) || ((lcw) == 1 && (lch) == 0) || ((lcw) == 1 && (lch) == 1))
426#define supported_format(d) \
427 ((d) != NULL && (d)->nb_components == 3 && \
428 !((d)->flags & AV_PIX_FMT_FLAG_RGB) && \
429 supported_depth((d)->comp[0].depth) && \
430 supported_subsampling((d)->log2_chroma_w, (d)->log2_chroma_h))
434 "Unsupported input format %d (%s) or bitdepth (%d)\n",
441 "Unsupported output format %d (%s) or bitdepth (%d)\n",
443 out_desc ? out_desc->
comp[0].
depth : -1);
448 if (
out->color_primaries !=
s->out_prm)
s->out_primaries =
NULL;
450 if (
out->color_trc !=
s->out_trc)
s->out_txchr =
NULL;
453 if (
out->color_range !=
s->out_rng)
s->rgb2yuv =
NULL;
455 if (!
s->out_primaries || !
s->in_primaries) {
460 s->in_prm =
s->user_iprm;
462 if (!
s->in_primaries) {
464 "Unsupported input primaries %d (%s)\n",
468 s->out_prm =
out->color_primaries;
470 if (!
s->out_primaries) {
476 "Unsupported output color property %d\n",
s->user_all);
480 "Unsupported output primaries %d (%s)\n",
485 s->lrgb2lrgb_passthrough = !memcmp(
s->in_primaries,
s->out_primaries,
486 sizeof(*
s->in_primaries));
487 if (!
s->lrgb2lrgb_passthrough && !
s->fast_mode) {
488 double rgb2xyz[3][3],
xyz2rgb[3][3], rgb2rgb[3][3];
491 wp_out = &
s->out_primaries->wp;
492 wp_in = &
s->in_primaries->wp;
496 if (memcmp(wp_in, wp_out,
sizeof(*wp_in)) != 0 &&
498 double wpconv[3][3],
tmp[3][3];
501 &
s->out_primaries->wp);
507 for (m = 0; m < 3; m++)
508 for (n = 0; n < 3; n++) {
509 long coeff =
lrint(16384.0 * rgb2rgb[m][n]);
510 if (coeff < INT16_MIN || coeff > INT16_MAX) {
512 "Conversion from %s to %s primaries does not fit "
513 "the fixed point range of the filter\n",
516 s->in_primaries =
NULL;
517 s->out_primaries =
NULL;
520 s->lrgb2lrgb_coeffs[m][n][0] = coeff;
521 for (o = 1; o < 8; o++)
522 s->lrgb2lrgb_coeffs[m][n][o] =
s->lrgb2lrgb_coeffs[m][n][0];
534 s->in_trc =
s->user_itrc;
538 "Unsupported input transfer characteristics %d (%s)\n",
546 s->out_trc =
out->color_trc;
552 "Please specify output transfer characteristics\n");
555 "Unsupported output color property %d\n",
s->user_all);
559 "Unsupported output transfer characteristics %d (%s)\n",
566 s->rgb2rgb_passthrough =
s->fast_mode || (
s->lrgb2lrgb_passthrough &&
567 !memcmp(
s->in_txchr,
s->out_txchr,
sizeof(*
s->in_txchr)));
568 if (!
s->rgb2rgb_passthrough && !
s->lin_lut) {
574 if (!
s->in_lumacoef) {
579 s->in_csp =
s->user_icsp;
582 s->in_rng =
s->user_irng;
584 if (!
s->in_lumacoef) {
586 "Unsupported input colorspace %d (%s)\n",
594 s->out_rng =
out->color_range;
600 s->yuv2yuv_fastmode =
s->rgb2rgb_passthrough && fmt_identical;
601 s->yuv2yuv_passthrough =
s->yuv2yuv_fastmode &&
s->in_rng ==
s->out_rng &&
602 !memcmp(
s->in_lumacoef,
s->out_lumacoef,
603 sizeof(*
s->in_lumacoef)) &&
605 if (!
s->yuv2yuv_passthrough) {
607 double rgb2yuv[3][3], (*yuv2rgb)[3] =
s->yuv2rgb_dbl_coeffs;
608 int off,
bits, in_rng;
614 "Unsupported input color range %d (%s)\n",
618 for (n = 0; n < 8; n++)
619 s->yuv_offset[0][n] = off;
623 for (n = 0; n < 3; n++) {
624 for (in_rng =
s->in_y_rng, m = 0; m < 3; m++, in_rng = s->in_uv_rng) {
626 for (o = 1; o < 8; o++)
627 s->yuv2rgb_coeffs[n][m][o] =
s->yuv2rgb_coeffs[n][m][0];
632 av_assert2(
s->yuv2rgb_coeffs[0][0][0] ==
s->yuv2rgb_coeffs[1][0][0]);
633 av_assert2(
s->yuv2rgb_coeffs[0][0][0] ==
s->yuv2rgb_coeffs[2][0][0]);
634 s->yuv2rgb =
s->dsp.yuv2rgb[(in_desc->
comp[0].
depth - 8) >> 1]
640 int off, out_rng,
bits;
646 "Unsupported output color range %d (%s)\n",
650 for (n = 0; n < 8; n++)
651 s->yuv_offset[1][n] = off;
654 for (out_rng =
s->out_y_rng, n = 0; n < 3; n++, out_rng = s->out_uv_rng) {
655 for (m = 0; m < 3; m++) {
657 for (o = 1; o < 8; o++)
658 s->rgb2yuv_coeffs[n][m][o] =
s->rgb2yuv_coeffs[n][m][0];
661 av_assert2(
s->rgb2yuv_coeffs[1][2][0] ==
s->rgb2yuv_coeffs[2][0][0]);
662 s->rgb2yuv =
s->dsp.rgb2yuv[(out_desc->
comp[0].
depth - 8) >> 1]
664 s->rgb2yuv_fsb =
s->dsp.rgb2yuv_fsb[(out_desc->
comp[0].
depth - 8) >> 1]
668 if (
s->yuv2yuv_fastmode && (redo_yuv2rgb || redo_rgb2yuv)) {
676 for (out_rng =
s->out_y_rng, m = 0; m < 3; m++, out_rng = s->out_uv_rng) {
677 for (in_rng =
s->in_y_rng, n = 0; n < 3; n++, in_rng = s->in_uv_rng) {
678 s->yuv2yuv_coeffs[m][n][0] =
680 (in_rng * (1 << odepth)));
681 for (o = 1; o < 8; o++)
682 s->yuv2yuv_coeffs[m][n][o] =
s->yuv2yuv_coeffs[m][n][0];
687 s->yuv2yuv =
s->dsp.yuv2yuv[(idepth - 8) >> 1][(odepth - 8) >> 1]
702 if (!
s->out_lumacoef) {
706 "Please specify output colorspace\n");
709 "Unsupported output color property %d\n",
s->user_all);
713 "Unsupported output colorspace %d (%s)\n",
s->out_csp,
752 ptrdiff_t rgb_stride =
FFALIGN(in->
width *
sizeof(int16_t), 32);
753 unsigned rgb_sz = rgb_stride * in->
height;
767 out->colorspace =
s->out_csp;
779 out->color_trc =
s->user_trc;
787 if (rgb_sz !=
s->rgb_sz) {
789 int uvw = in->
width >>
desc->log2_chroma_w;
805 s->dither_scratch_base[0][0] =
807 s->dither_scratch_base[0][1] =
809 s->dither_scratch_base[1][0] =
810 av_malloc(
sizeof(*
s->dither_scratch_base[1][0]) * (uvw + 4));
811 s->dither_scratch_base[1][1] =
812 av_malloc(
sizeof(*
s->dither_scratch_base[1][1]) * (uvw + 4));
813 s->dither_scratch_base[2][0] =
814 av_malloc(
sizeof(*
s->dither_scratch_base[2][0]) * (uvw + 4));
815 s->dither_scratch_base[2][1] =
816 av_malloc(
sizeof(*
s->dither_scratch_base[2][1]) * (uvw + 4));
817 s->dither_scratch[0][0] = &
s->dither_scratch_base[0][0][1];
818 s->dither_scratch[0][1] = &
s->dither_scratch_base[0][1][1];
819 s->dither_scratch[1][0] = &
s->dither_scratch_base[1][0][1];
820 s->dither_scratch[1][1] = &
s->dither_scratch_base[1][1][1];
821 s->dither_scratch[2][0] = &
s->dither_scratch_base[2][0][1];
822 s->dither_scratch[2][1] = &
s->dither_scratch_base[2][1][1];
823 if (!
s->rgb[0] || !
s->rgb[1] || !
s->rgb[2] ||
824 !
s->dither_scratch_base[0][0] || !
s->dither_scratch_base[0][1] ||
825 !
s->dither_scratch_base[1][0] || !
s->dither_scratch_base[1][1] ||
826 !
s->dither_scratch_base[2][0] || !
s->dither_scratch_base[2][1]) {
840 s->rgb_stride = rgb_stride /
sizeof(int16_t);
851 if (
s->yuv2yuv_passthrough) {
914 if (inlink->
w % 2 || inlink->
h % 2) {
916 inlink->
w, inlink->
h);
920 outlink->
w = inlink->
w;
921 outlink->
h = inlink->
h;
928#define OFFSET(x) offsetof(ColorSpaceContext, x)
929#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
930#define ENUM(x, y, z) { x, "", 0, AV_OPT_TYPE_CONST, { .i64 = y }, INT_MIN, INT_MAX, FLAGS, .unit = z }
933 {
"all",
"Set all color properties together",
945 {
"space",
"Output colorspace",
958 {
"range",
"Output color range",
966 {
"primaries",
"Output color primaries",
983 {
"trc",
"Output transfer characteristics",
1002 {
"format",
"Output pixel format",
1015 {
"fast",
"Ignore primary chromaticity and gamma correction",
1019 {
"dither",
"Dithering mode",
1025 {
"wpadapt",
"Whitepoint adaptation method",
1033 "Controls how to clip out-of-gamut colors that arise as a result of colorspace conversion.",
1039 {
"iall",
"Set all input color properties together",
1042 {
"ispace",
"Input colorspace",
1045 {
"irange",
"Input color range",
1048 {
"iprimaries",
"Input color primaries",
1051 {
"itrc",
"Input transfer characteristics",
1077 .p.name =
"colorspace",
1079 .p.priv_class = &colorspace_class,
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
const FFFilter ff_vf_colorspace
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
void ff_colorspacedsp_init(ColorSpaceDSPContext *dsp)
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])
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])
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])
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])
static void fn rgb2yuv(uint8_t *_yuv[3], const ptrdiff_t yuv_stride[3], int16_t *rgb[3], ptrdiff_t s, int w, int h, const int16_t rgb2yuv_coeffs[3][3][8], const int16_t yuv_offset[8])
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])
Colorspace value utility functions for libavutil.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int(* init)(AVBSFContext *ctx)
static void convert(float y, float u, float v, float *b, float *g, float *r)
static const uint8_t bits[8]
reference-counted frame API
static void yuv2rgb(uint8_t *out, int ridx, int Y, int U, int V)
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, int props)
Remove and free all side data instances that match any of the given side data properties.
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.
int av_frame_copy(AVFrame *dst, const AVFrame *src)
Copy the frame data from src to dst.
@ AV_SIDE_DATA_PROP_COLOR_DEPENDENT
Side data depends on the video color space.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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...
AVCIExy AVWhitepointCoefficients
Struct defining white point location in terms of CIE 1931 chromaticity x and y.
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
void ff_matrix_mul_3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
void ff_fill_rgb2xyz_table(const AVPrimaryCoefficients *coeffs, const AVWhitepointCoefficients *wp, double rgb2xyz[3][3])
void ff_matrix_invert_3x3(const double in[3][3], double out[3][3])
void ff_fill_rgb2yuv_table(const AVLumaCoefficients *coeffs, double rgb2yuv[3][3])
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define FILTER_QUERY_FUNC2(func)
static int fill_gamma_table(ColorSpaceContext *s)
static int config_props(AVFilterLink *outlink)
#define supported_format(d)
static int filter_frame(AVFilterLink *link, AVFrame *in)
static int convert(AVFilterContext *ctx, void *data, int job_nr, int n_jobs)
static int create_filtergraph(AVFilterContext *ctx, const AVFrame *in, const AVFrame *out)
static void uninit(AVFilterContext *ctx)
static enum AVColorTransferCharacteristic default_trc[CS_NB+1]
static int get_range_off(AVFilterContext *ctx, int *off, int *y_rng, int *uv_rng, enum AVColorRange rng, int depth)
static const AVOption colorspace_options[]
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static const struct TransferCharacteristics * get_transfer_characteristics(enum AVColorTransferCharacteristic trc)
@ NB_WP_ADAPT_NON_IDENTITY
static enum AVColorPrimaries default_prm[CS_NB+1]
static void apply_lut(int16_t *buf[3], ptrdiff_t stride, int w, int h, const int16_t *lut)
static const struct TransferCharacteristics transfer_characteristics[]
static void fill_whitepoint_conv_table(double out[3][3], enum WhitepointAdaptation wp_adapt, const AVWhitepointCoefficients *wp_src, const AVWhitepointCoefficients *wp_dst)
static enum AVColorSpace default_csp[CS_NB+1]
Macro definitions for various function/variable attributes.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
const char * av_color_space_name(enum AVColorSpace space)
const char * av_color_range_name(enum AVColorRange range)
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 char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV420P10
AVColorRange
Visual content value range.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_NB
Not part of ABI.
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
@ 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_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...
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_NB
Not part of ABI.
@ 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 RP 177 Annex B
@ AVCOL_PRI_EXT_NB
Not part of ABI.
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
@ AVCOL_PRI_EBU3213
EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors.
@ 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_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
@ 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_EXT_NB
Not part of ABI.
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
@ AVCOL_TRC_BT709
also ITU-R BT1361
#define AV_PIX_FMT_YUV444P10
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 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_NB
Not part of ABI.
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
@ 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 / functionally identical to above
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
#define FF_ARRAY_ELEMS(a)
static int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
Struct that contains both white point location and primaries location, providing the complete descrip...
int depth
Number of bits in the component.
AVFilterLink ** inputs
array of pointers to input links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
enum AVColorPrimaries color_primaries
enum AVColorRange color_range
MPEG vs JPEG YUV range.
enum AVColorSpace colorspace
YUV colorspace type.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
enum AVColorTransferCharacteristic color_trc
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
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.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
enum AVColorPrimaries in_prm out_prm user_prm user_iprm
const struct TransferCharacteristics * in_txchr
int * dither_scratch_base[3][2]
int16_t yuv2rgb_coeffs[3][3][8]
enum AVPixelFormat in_format user_format
int16_t yuv2yuv_coeffs[3][3][8]
const AVLumaCoefficients * in_lumacoef
int * dither_scratch[3][2]
rgb2yuv_fsb_fn rgb2yuv_fsb
int16_t rgb2yuv_coeffs[3][3][8]
enum Colorspace user_all user_iall
enum AVColorRange in_rng out_rng user_rng user_irng
double rgb2yuv_dbl_coeffs[3][3]
const AVColorPrimariesDesc * out_primaries
const AVColorPrimariesDesc * in_primaries
const struct TransferCharacteristics * out_txchr
int16_t lrgb2lrgb_coeffs[3][3][8]
enum AVColorSpace in_csp out_csp user_csp user_icsp
int lrgb2lrgb_passthrough
const AVLumaCoefficients * out_lumacoef
enum AVColorTransferCharacteristic in_trc out_trc user_trc user_itrc
double yuv2rgb_dbl_coeffs[3][3]
Used for passing data between threads.
ptrdiff_t out_linesize[3]
static const float xyz2rgb[3][3]
static const uint16_t dither[8][8]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.