Shockingly, there isn't currently _any_ filter for overriding this.
Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -41,6 +41,7 @@ typedef struct SetParamsContext { · 40 unmodified lines | |||
| 41 | int color_primaries; | 41 | int color_primaries; |
| 42 | int color_trc; | 42 | int color_trc; |
| 43 | int colorspace; | 43 | int colorspace; |
| 44 | int chroma_location; | ||
| 44 | } SetParamsContext; | 45 | } SetParamsContext; |
| 45 | 46 | ||
| 46 | #define OFFSET(x) offsetof(SetParamsContext, x) | 47 | #define OFFSET(x) offsetof(SetParamsContext, x) |
| @@ -119,6 +120,17 @@ static const AVOption setparams_options[] = { · 72 unmodified lines | |||
| 119 | {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | 120 | {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, |
| 120 | {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | 121 | {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, |
| 121 | {"ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, | 122 | {"ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, |
| 123 | |||
| 124 | {"chroma_location", "select chroma sample location", OFFSET(chroma_location), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCHROMA_LOC_NB-1, FLAGS, .unit = "chroma_location"}, | ||
| 125 | {"auto", "keep the same chroma location", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 126 | {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 127 | {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 128 | {"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_LEFT}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 129 | {"center", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_CENTER}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 130 | {"topleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOPLEFT}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 131 | {"top", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOP}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 132 | {"bottomleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOMLEFT}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 133 | {"bottom", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOM}, 0, 0, FLAGS, .unit = "chroma_location"}, | ||
| 122 | {NULL} | 134 | {NULL} |
| 123 | }; | 135 | }; |
| 124 | 136 | ||
| @@ -174,17 +186,18 @@ FF_ENABLE_DEPRECATION_WARNINGS · 49 unmodified lines | |||
| 174 | frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; | 186 | frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; |
| 175 | } | 187 | } |
| 176 | 188 | ||
| 177 | /* set range */ | 189 | /* set straightforward parameters */ |
| 178 | if (s->color_range >= 0) | 190 | if (s->color_range >= 0) |
| 179 | frame->color_range = s->color_range; | 191 | frame->color_range = s->color_range; |
| 180 | |||
| 181 | /* set color prim, trc, space */ | ||
| 182 | if (s->color_primaries >= 0) | 192 | if (s->color_primaries >= 0) |
| 183 | frame->color_primaries = s->color_primaries; | 193 | frame->color_primaries = s->color_primaries; |
| 184 | if (s->color_trc >= 0) | 194 | if (s->color_trc >= 0) |
| 185 | frame->color_trc = s->color_trc; | 195 | frame->color_trc = s->color_trc; |
| 186 | if (s->colorspace >= 0) | 196 | if (s->colorspace >= 0) |
| 187 | frame->colorspace = s->colorspace; | 197 | frame->colorspace = s->colorspace; |
| 198 | if (s->chroma_location >= 0) | ||
| 199 | frame->chroma_location = s->chroma_location; | ||
| 200 | |||
| 188 | return ff_filter_frame(ctx->outputs[0], frame); | 201 | return ff_filter_frame(ctx->outputs[0], frame); |
| 189 | } | 202 | } |
| 190 | 203 | ||