summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2019-10-10 15:26:36 -0700
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-10-11 16:37:31 +0000
commit40bcefcb3ba4c250ac26a4f504cd17b427bc1802 (patch)
tree8c3a7982d81600b134ca23daab7b6d5beee382c7
parent58a512b7c5aa671fd264146d3660633bd8cde47e (diff)
vaapipostproc: fix off-by-one coord translations
When translating navigation x,y coordinates for video-direction, it is necessary to subtract 1 when using the video dimensions to compute the new x,y coordinates. That is, a 100x200 image should map coordinates in x=[0-99],y=[0-199]. This issue was found with unit tests provided in !182.
-rw-r--r--gst/vaapi/gstvaapipostproc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c
index 51df13b6..0c899d5b 100644
--- a/gst/vaapi/gstvaapipostproc.c
+++ b/gst/vaapi/gstvaapipostproc.c
@@ -1801,31 +1801,31 @@ gst_vaapipostproc_src_event (GstBaseTransform * trans, GstEvent * event)
switch (gst_vaapi_filter_get_video_direction (postproc->filter)) {
case GST_VIDEO_ORIENTATION_90R:
new_x = y;
- new_y = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - x;
+ new_y = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - 1 - x;
break;
case GST_VIDEO_ORIENTATION_90L:
- new_x = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - y;
+ new_x = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - 1 - y;
new_y = x;
break;
case GST_VIDEO_ORIENTATION_UR_LL:
- new_x = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - y;
- new_y = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - x;
+ new_x = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - 1 - y;
+ new_y = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - 1 - x;
break;
case GST_VIDEO_ORIENTATION_UL_LR:
new_x = y;
new_y = x;
break;
case GST_VIDEO_ORIENTATION_180:
- new_x = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - x;
- new_y = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - y;
+ new_x = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - 1 - x;
+ new_y = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - 1 - y;
break;
case GST_VIDEO_ORIENTATION_HORIZ:
- new_x = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - x;
+ new_x = GST_VIDEO_INFO_WIDTH (&postproc->srcpad_info) - 1 - x;
new_y = y;
break;
case GST_VIDEO_ORIENTATION_VERT:
new_x = x;
- new_y = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - y;
+ new_y = GST_VIDEO_INFO_HEIGHT (&postproc->srcpad_info) - 1 - y;
break;
default:
new_x = x;