Shockingly, there isn't currently _any_ filter for overriding this.
Unified · Split
| @@ -22073,6 +22073,23 @@ Keep the same colorspace property (default). · 22072 unmodified lines | ||
| 22073 | 22073 | @item chroma-derived-c |
| 22074 | 22074 | @item ictcp |
| 22075 | 22075 | @end table |
| 22076 | + | |
| 22077 | +@item chroma_location | |
| 22078 | +Set the chroma sample location. | |
| 22079 | +Available values are: | |
| 22080 | + | |
| 22081 | +@table @samp | |
| 22082 | +@item auto | |
| 22083 | +Keep the same chroma location (default). | |
| 22084 | + | |
| 22085 | +@item unspecified, unknown | |
| 22086 | +@item left | |
| 22087 | +@item center | |
| 22088 | +@item topleft | |
| 22089 | +@item top | |
| 22090 | +@item bottomleft | |
| 22091 | +@item bottom | |
| 22092 | +@end table | |
| 22076 | 22093 | @end table |
| 22077 | 22094 | |
| 22078 | 22095 | @section sharpen_npp |
| @@ -41,6 +41,7 @@ typedef struct SetParamsContext { · 40 unmodified lines | ||
| 41 | 41 | int color_primaries; |
| 42 | 42 | int color_trc; |
| 43 | 43 | int colorspace; |
| 44 | + int chroma_location; | |
| 44 | 45 | } SetParamsContext; |
| 45 | 46 | |
| 46 | 47 | #define OFFSET(x) offsetof(SetParamsContext, x) |
| @@ -119,6 +120,17 @@ static const AVOption setparams_options[] = { · 72 unmodified lines | ||
| 119 | 120 | {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, |
| 120 | 121 | {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, |
| 121 | 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 | 134 | {NULL} |
| 123 | 135 | }; |
| 124 | 136 | |
| @@ -174,17 +186,18 @@ FF_ENABLE_DEPRECATION_WARNINGS · 49 unmodified lines | ||
| 174 | 186 | frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; |
| 175 | 187 | } |
| 176 | 188 | |
| 177 | − /* set range */ | |
| 189 | + /* set straightforward parameters */ | |
| 178 | 190 | if (s->color_range >= 0) |
| 179 | 191 | frame->color_range = s->color_range; |
| 180 | − | |
| 181 | − /* set color prim, trc, space */ | |
| 182 | 192 | if (s->color_primaries >= 0) |
| 183 | 193 | frame->color_primaries = s->color_primaries; |
| 184 | 194 | if (s->color_trc >= 0) |
| 185 | 195 | frame->color_trc = s->color_trc; |
| 186 | 196 | if (s->colorspace >= 0) |
| 187 | 197 | frame->colorspace = s->colorspace; |
| 198 | + if (s->chroma_location >= 0) | |
| 199 | + frame->chroma_location = s->chroma_location; | |
| 200 | + | |
| 188 | 201 | return ff_filter_frame(ctx->outputs[0], frame); |
| 189 | 202 | } |
| 190 | 203 | |