va: Fix vapostproc navigation event co-ordinate mapping

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
This commit is contained in:
Colin Kinloch 2022-09-23 19:29:31 +01:00 committed by GStreamer Marge Bot
parent e1d71aedbc
commit 841f50f0d9

View file

@ -1897,10 +1897,10 @@ static void
_get_scale_factor (GstVaVpp * self, gdouble * w_factor, gdouble * h_factor) _get_scale_factor (GstVaVpp * self, gdouble * w_factor, gdouble * h_factor)
{ {
GstVaBaseTransform *btrans = GST_VA_BASE_TRANSFORM (self); GstVaBaseTransform *btrans = GST_VA_BASE_TRANSFORM (self);
gdouble w = GST_VIDEO_INFO_WIDTH (&btrans->in_info); gdouble w = GST_VIDEO_INFO_WIDTH (&btrans->out_info);
gdouble h = GST_VIDEO_INFO_HEIGHT (&btrans->in_info); gdouble h = GST_VIDEO_INFO_HEIGHT (&btrans->out_info);
switch (self->direction) { switch (gst_va_filter_get_orientation (btrans->filter)) {
case GST_VIDEO_ORIENTATION_90R: case GST_VIDEO_ORIENTATION_90R:
case GST_VIDEO_ORIENTATION_90L: case GST_VIDEO_ORIENTATION_90L:
case GST_VIDEO_ORIENTATION_UR_LL: case GST_VIDEO_ORIENTATION_UR_LL:
@ -1914,10 +1914,10 @@ _get_scale_factor (GstVaVpp * self, gdouble * w_factor, gdouble * h_factor)
break; break;
} }
*w_factor = GST_VIDEO_INFO_WIDTH (&btrans->out_info); *w_factor = GST_VIDEO_INFO_WIDTH (&btrans->in_info);
*w_factor /= w; *w_factor /= w;
*h_factor = GST_VIDEO_INFO_HEIGHT (&btrans->out_info); *h_factor = GST_VIDEO_INFO_HEIGHT (&btrans->in_info);
*h_factor /= h; *h_factor /= h;
} }
@ -1945,35 +1945,35 @@ gst_va_vpp_src_event (GstBaseTransform * trans, GstEvent * event)
break; break;
/* video-direction compensation */ /* video-direction compensation */
switch (self->direction) { switch (gst_va_filter_get_orientation (btrans->filter)) {
case GST_VIDEO_ORIENTATION_90R: case GST_VIDEO_ORIENTATION_90R:
new_x = y; new_x = y;
new_y = GST_VIDEO_INFO_WIDTH (in_info) - 1 - x; new_y = GST_VIDEO_INFO_WIDTH (out_info) - 1 - x;
break; break;
case GST_VIDEO_ORIENTATION_90L: case GST_VIDEO_ORIENTATION_90L:
new_x = GST_VIDEO_INFO_HEIGHT (in_info) - 1 - y; new_x = GST_VIDEO_INFO_HEIGHT (out_info) - 1 - y;
new_y = x; new_y = x;
break; break;
case GST_VIDEO_ORIENTATION_UL_LR: case GST_VIDEO_ORIENTATION_UL_LR:
new_x = GST_VIDEO_INFO_HEIGHT (in_info) - 1 - y;
new_y = GST_VIDEO_INFO_WIDTH (in_info) - 1 - x;
break;
case GST_VIDEO_ORIENTATION_UR_LL:
new_x = y; new_x = y;
new_y = x; new_y = x;
break; break;
case GST_VIDEO_ORIENTATION_UR_LL:
new_x = GST_VIDEO_INFO_HEIGHT (out_info) - 1 - y;
new_y = GST_VIDEO_INFO_WIDTH (out_info) - 1 - x;
break;
case GST_VIDEO_ORIENTATION_180: case GST_VIDEO_ORIENTATION_180:
/* FIXME: is this correct? */ /* FIXME: is this correct? */
new_x = GST_VIDEO_INFO_WIDTH (in_info) - 1 - x; new_x = GST_VIDEO_INFO_WIDTH (out_info) - 1 - x;
new_y = GST_VIDEO_INFO_HEIGHT (in_info) - 1 - y; new_y = GST_VIDEO_INFO_HEIGHT (out_info) - 1 - y;
break; break;
case GST_VIDEO_ORIENTATION_HORIZ: case GST_VIDEO_ORIENTATION_HORIZ:
new_x = GST_VIDEO_INFO_WIDTH (in_info) - 1 - x; new_x = GST_VIDEO_INFO_WIDTH (out_info) - 1 - x;
new_y = y; new_y = y;
break; break;
case GST_VIDEO_ORIENTATION_VERT: case GST_VIDEO_ORIENTATION_VERT:
new_x = x; new_x = x;
new_y = GST_VIDEO_INFO_HEIGHT (in_info) - 1 - y; new_y = GST_VIDEO_INFO_HEIGHT (out_info) - 1 - y;
break; break;
default: default:
new_x = x; new_x = x;