Add control for video subsampling
Add '-s' to assign jpeg subsampling.
0: 444, 1: 420
Using 420 will make video lack of detail compared to 444, but cut
amount of video data by half. This could be useful for some cases.
Change-Id: I48836a7117f7e3b9986e3f5c6a92974c9268525e
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
diff --git a/ikvm_video.hpp b/ikvm_video.hpp
index fb8c5da..23c58a7 100644
--- a/ikvm_video.hpp
+++ b/ikvm_video.hpp
@@ -23,7 +23,7 @@
* @param[in] input - Reference to the Input object
* @param[in] fr - desired frame rate of the video
*/
- Video(const std::string& p, Input& input, int fr = 30);
+ Video(const std::string& p, Input& input, int fr = 30, int sub = 0);
~Video();
Video(const Video&) = default;
Video& operator=(const Video&) = default;
@@ -93,6 +93,24 @@
{
return width;
}
+ /*
+ * @brief Gets the subsampling of the video frame
+ *
+ * @return Value of the subsampling of video frame, 1:420/0:444
+ */
+ inline int getSubsampling() const
+ {
+ return subSampling;
+ }
+ /*
+ * @brief Sets the subsampling of the video frame
+ *
+ * @return Value of the subsampling of video frame, 1:420/0:444
+ */
+ inline void setSubsampling(int _sub)
+ {
+ subSampling = _sub;
+ }
/* @brief Number of bits per component of a pixel */
static const int bitsPerSample;
@@ -141,6 +159,8 @@
size_t height;
/* @brief Width in pixels of the video frame */
size_t width;
+ /* @brief jpeg's subsampling, 1:420/0:444 */
+ int subSampling;
/* @brief Reference to the Input object */
Input& input;
/* @brief Path to the V4L2 video device */