sysprog21 / vcam

Virtual camera device driver for Linux
MIT License
105 stars 45 forks source link

Improve cropping operaions #30

Closed kevinshieh0225 closed 2 years ago

kevinshieh0225 commented 2 years ago

In the original version, by setting different size between resolution and bytesperline, vcam can simulate cropping function on the screen. However there is three main drawbacks:

  1. vcam crop left-top partition of the screen, which in most cases users would expect for the middle region.
  2. The origin implementation is lack of expansibility to offer user to choose their region of interest.
  3. vcam doesn't make good use of the var information in fb device.

By speculate how FFmpeg operate in fbdev_enc.c, I rewrite the cropping mechanism by using fbdev information including x/yres, x/yres_virtual, x/yoffset. Instead of copy all the information sended from users, only select those we want to display to copy_from_user.

Current version obtains the following improvement:

  1. vcam is able to crop the middle region of the picture.
  2. This version has the potential to offer user to choose their region of interest, and will be my future work.
  3. This version can finally pass all the v4l2-compliance when we allow cropping and scaling together.
jserv commented 2 years ago

Thank @kevinshieh0225 for contributing!

kevinshieh0225 commented 2 years ago

Thankyou!