|
@@ -193,6 +193,7 @@ typedef struct LibplaceboContext {
|
|
|
int color_range;
|
|
int color_range;
|
|
|
int color_primaries;
|
|
int color_primaries;
|
|
|
int color_trc;
|
|
int color_trc;
|
|
|
|
|
+ int rotation;
|
|
|
AVDictionary *extra_opts;
|
|
AVDictionary *extra_opts;
|
|
|
|
|
|
|
|
int have_hwdevice;
|
|
int have_hwdevice;
|
|
@@ -802,6 +803,13 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
|
|
|
image->crop.y0 = av_expr_eval(s->crop_y_pexpr, s->var_values, NULL);
|
|
image->crop.y0 = av_expr_eval(s->crop_y_pexpr, s->var_values, NULL);
|
|
|
image->crop.x1 = image->crop.x0 + s->var_values[VAR_CROP_W];
|
|
image->crop.x1 = image->crop.x0 + s->var_values[VAR_CROP_W];
|
|
|
image->crop.y1 = image->crop.y0 + s->var_values[VAR_CROP_H];
|
|
image->crop.y1 = image->crop.y0 + s->var_values[VAR_CROP_H];
|
|
|
|
|
+ image->rotation = s->rotation;
|
|
|
|
|
+ if (s->rotation % PL_ROTATION_180 == PL_ROTATION_90) {
|
|
|
|
|
+ /* Libplacebo expects the input crop relative to the actual frame
|
|
|
|
|
+ * dimensions, so un-transpose them here */
|
|
|
|
|
+ FFSWAP(float, image->crop.x0, image->crop.y0);
|
|
|
|
|
+ FFSWAP(float, image->crop.x1, image->crop.y1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (src == ref) {
|
|
if (src == ref) {
|
|
|
/* Only update the target crop once, for the 'reference' frame */
|
|
/* Only update the target crop once, for the 'reference' frame */
|
|
@@ -1198,6 +1206,14 @@ static int libplacebo_config_input(AVFilterLink *inlink)
|
|
|
AVFilterContext *avctx = inlink->dst;
|
|
AVFilterContext *avctx = inlink->dst;
|
|
|
LibplaceboContext *s = avctx->priv;
|
|
LibplaceboContext *s = avctx->priv;
|
|
|
|
|
|
|
|
|
|
+ if (s->rotation % PL_ROTATION_180 == PL_ROTATION_90) {
|
|
|
|
|
+ /* Swap width and height for 90 degree rotations to make the size and
|
|
|
|
|
+ * scaling calculations work out correctly */
|
|
|
|
|
+ FFSWAP(int, inlink->w, inlink->h);
|
|
|
|
|
+ if (inlink->sample_aspect_ratio.num)
|
|
|
|
|
+ inlink->sample_aspect_ratio = av_inv_q(inlink->sample_aspect_ratio);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (inlink->format == AV_PIX_FMT_VULKAN)
|
|
if (inlink->format == AV_PIX_FMT_VULKAN)
|
|
|
return ff_vk_filter_config_input(inlink);
|
|
return ff_vk_filter_config_input(inlink);
|
|
|
|
|
|
|
@@ -1386,6 +1402,13 @@ static const AVOption libplacebo_options[] = {
|
|
|
{"smpte2084", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE2084}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
|
|
{"smpte2084", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_SMPTE2084}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
|
|
|
{"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
|
|
{"arib-std-b67", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_TRC_ARIB_STD_B67}, INT_MIN, INT_MAX, STATIC, .unit = "color_trc"},
|
|
|
|
|
|
|
|
|
|
+ {"rotate", "rotate the input clockwise", OFFSET(rotation), AV_OPT_TYPE_INT, {.i64=PL_ROTATION_0}, PL_ROTATION_0, PL_ROTATION_360, DYNAMIC, .unit = "rotation"},
|
|
|
|
|
+ {"0", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PL_ROTATION_0}, .flags = STATIC, .unit = "rotation"},
|
|
|
|
|
+ {"90", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PL_ROTATION_90}, .flags = STATIC, .unit = "rotation"},
|
|
|
|
|
+ {"180", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PL_ROTATION_180}, .flags = STATIC, .unit = "rotation"},
|
|
|
|
|
+ {"270", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PL_ROTATION_270}, .flags = STATIC, .unit = "rotation"},
|
|
|
|
|
+ {"360", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PL_ROTATION_360}, .flags = STATIC, .unit = "rotation"},
|
|
|
|
|
+
|
|
|
{ "upscaler", "Upscaler function", OFFSET(upscaler), AV_OPT_TYPE_STRING, {.str = "spline36"}, .flags = DYNAMIC },
|
|
{ "upscaler", "Upscaler function", OFFSET(upscaler), AV_OPT_TYPE_STRING, {.str = "spline36"}, .flags = DYNAMIC },
|
|
|
{ "downscaler", "Downscaler function", OFFSET(downscaler), AV_OPT_TYPE_STRING, {.str = "mitchell"}, .flags = DYNAMIC },
|
|
{ "downscaler", "Downscaler function", OFFSET(downscaler), AV_OPT_TYPE_STRING, {.str = "mitchell"}, .flags = DYNAMIC },
|
|
|
{ "frame_mixer", "Frame mixing function", OFFSET(frame_mixer), AV_OPT_TYPE_STRING, {.str = "none"}, .flags = DYNAMIC },
|
|
{ "frame_mixer", "Frame mixing function", OFFSET(frame_mixer), AV_OPT_TYPE_STRING, {.str = "none"}, .flags = DYNAMIC },
|