vaapipostproc: handle size and direction together in src events
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 4 Sep 2019 17:52:51 +0000 (10:52 -0700)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 4 Sep 2019 23:03:24 +0000 (16:03 -0700)
commit9fd020a1177160f5368e62e58daf8194a936eb3a
tree78ebc4918199fefdd327896490e8bd17a4f4ad01
parent6700f642fc3ee7b20bc69c18f160bed60e881691
vaapipostproc: handle size and direction together in src events

Mapping a pointer event needs to consider both size and
video-direction operations together, not just one or the other.

This fixes an issue where x,y were not being mapped correctly
for 90r, 90l, ur-ll and ul-lr video-direction. In these directions,
the WxH are swapped and GST_VAAPI_POSTPROC_FLAG_SIZE is set.  Thus,
the first condition in the pointer event handling was entered and
x,y scale factor were incorrectly computed due to srcpad WxH
swap.

This also fixes all cases where both video-direction and scaling
are enabled at the same time.

Test that all pointer events map appropriately:

for i in `seq 0 7`
do
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} width=300 height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} height=200 \
  ! vaapisink
 GST_DEBUG=vaapipostproc:5 gst-launch-1.0 -vf videotestsrc \
  ! vaapipostproc video-direction=${i} \
  ! vaapisink
done
gst/vaapi/gstvaapipostproc.c