mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
58a512b7c5
commit
40bcefcb3b
1 changed files with 8 additions and 8 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue