VideoMode.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * TI Voxel Lib component.
  3. *
  4. * Copyright (c) 2014 Texas Instruments Inc.
  5. */
  6. #ifndef VOXEL_VIDEO_MODE_H
  7. #define VOXEL_VIDEO_MODE_H
  8. #include <stdint.h>
  9. namespace Voxel
  10. {
  11. /**
  12. * \addtogroup Frm
  13. * @{
  14. */
  15. class FrameSize
  16. {
  17. public:
  18. uint32_t width, height;
  19. inline bool operator ==(const FrameSize &other) const
  20. {
  21. return width == other.width && height == other.height;
  22. }
  23. inline bool operator !=(const FrameSize &other) const
  24. {
  25. return !operator==(other);
  26. }
  27. };
  28. class RegionOfInterest: public FrameSize
  29. {
  30. public:
  31. uint32_t x, y;
  32. inline bool operator ==(const RegionOfInterest &other) const
  33. {
  34. return width == other.width && height == other.height && x == other.x && y == other.y;
  35. }
  36. inline bool operator !=(const RegionOfInterest &other) const
  37. {
  38. return !operator==(other);
  39. }
  40. };
  41. class FrameRate
  42. {
  43. public:
  44. uint32_t numerator, denominator;
  45. inline float getFrameRate() const { return (denominator == 0)?0:(((float)numerator)/denominator); }
  46. };
  47. class VideoMode
  48. {
  49. public:
  50. FrameSize frameSize;
  51. FrameRate frameRate;
  52. inline float getFrameRate() const { return frameRate.getFrameRate(); }
  53. };
  54. class SupportedVideoMode: public VideoMode
  55. {
  56. public:
  57. uint8_t bytesPerPixel;
  58. SupportedVideoMode(): bytesPerPixel(0)
  59. {
  60. frameSize.width = frameSize.height = 0;
  61. frameRate.numerator = 0;
  62. frameRate.denominator = 1;
  63. }
  64. SupportedVideoMode(uint32_t width, uint32_t height, uint32_t rateNumerator, uint32_t rateDenominator, uint8_t bytesPerPixel)
  65. {
  66. frameSize.width = width;
  67. frameSize.height = height;
  68. frameRate.numerator = rateNumerator;
  69. frameRate.denominator = rateDenominator;
  70. this->bytesPerPixel = bytesPerPixel;
  71. }
  72. };
  73. /**
  74. * @}
  75. */
  76. }
  77. #endif // VOXEL_POINT_H