MythTV  master
mythvideocolourspace.h
Go to the documentation of this file.
1 #ifndef VIDEOCOLOURSPACE_H
2 #define VIDEOCOLOURSPACE_H
3 
4 // Qt
5 #include <QMap>
6 #include <QObject>
7 #include <QMatrix4x4>
8 
9 // MythTV
10 #include "mythcolourspace.h"
11 #include "mythframe.h"
12 #include "videoouttypes.h"
13 #include "referencecounter.h"
14 
15 // FFmpeg
16 #include "libavutil/pixfmt.h" // For AVCOL_xxx defines
17 
18 class MythVideoColourSpace : public QObject, public QMatrix4x4, public ReferenceCounter
19 {
20  Q_OBJECT
21 
22  friend class MythVideoOutput;
23 
24  public slots:
25  int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value);
27  void RefreshState();
28 
29  signals:
30  void Updated(bool PrimariesChanged);
31  void PictureAttributeChanged(PictureAttribute Attribute, int Value);
33  void PictureAttributesUpdated(const std::map<PictureAttribute,int>& Values);
34 
35  public:
41  void SetAlpha(int Value);
42  QMatrix4x4 GetPrimaryMatrix(void);
43  QStringList GetColourMappingDefines(void);
44  float GetColourGamma(void) const;
45  float GetDisplayGamma(void) const;
47  int GetRange() const;
48  int GetColourSpace() const;
49 
50  protected:
51  ~MythVideoColourSpace() override;
52 
53  private:
54  void SetFullRange(bool FullRange);
55  void SetBrightness(int Value);
56  void SetContrast(int Value);
57  void SetHue(int Value);
58  void SetSaturation(int Value);
59  void SaveValue(PictureAttribute Attribute, int Value);
60  void Update(void);
61  void Debug(void);
62  QMatrix4x4 GetPrimaryConversion(int Source, int Dest);
63  static MythColourSpace GetPrimaries(int Primary, float &Gamma);
64 
65  private:
67  std::map<PictureAttribute,int> m_dbSettings;
68 
69  bool m_fullRange { true };
70  float m_brightness { 0.0F };
71  float m_contrast { 1.0F };
72  float m_saturation { 1.0F };
73  float m_hue { 0.0F };
74  float m_alpha { 1.0F };
75  int m_colourSpace { AVCOL_SPC_UNSPECIFIED };
76  int m_colourSpaceDepth { 8 };
77  int m_range { AVCOL_RANGE_MPEG };
78  bool m_updatesDisabled { true };
79  bool m_colourShifted { false };
80  int m_colourTransfer { AVCOL_TRC_BT709 };
82  int m_colourPrimaries { AVCOL_PRI_BT709 };
83  int m_displayPrimaries { AVCOL_PRI_BT709 };
84  int m_chromaLocation { AVCHROMA_LOC_LEFT };
85  float m_colourGamma { 2.2F };
86  float m_displayGamma { 2.2F };
87  QMatrix4x4 m_primaryMatrix { };
88  float m_customDisplayGamma { 0.0F };
90 };
91 
92 #endif
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:142
MythVideoColourSpace::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
PrimariesRelaxed
@ PrimariesRelaxed
Definition: videoouttypes.h:145
PictureAttributeSupported
PictureAttributeSupported
Definition: videoouttypes.h:116
MythVideoOutput
Definition: mythvideoout.h:35
MythVideoColourSpace::Update
void Update(void)
Update the matrix for the current settings and colourspace.
Definition: mythvideocolourspace.cpp:133
MythVideoColourSpace::m_customDisplayPrimaries
MythColourSpace * m_customDisplayPrimaries
Definition: mythvideocolourspace.h:89
MythVideoColourSpace::m_primaryMatrix
QMatrix4x4 m_primaryMatrix
Definition: mythvideocolourspace.h:87
MythVideoColourSpace::GetColourSpace
int GetColourSpace() const
Definition: mythvideocolourspace.cpp:485
Frame
Definition: zmdefines.h:93
MythVideoColourSpace::m_hue
float m_hue
Definition: mythvideocolourspace.h:73
MythVideoColourSpace::UpdateColourSpace
bool UpdateColourSpace(const MythVideoFrame *Frame)
Set the current colourspace to use.
Definition: mythvideocolourspace.cpp:321
MythVideoColourSpace::m_updatesDisabled
bool m_updatesDisabled
Definition: mythvideocolourspace.h:78
MythVideoColourSpace::SetFullRange
void SetFullRange(bool FullRange)
Definition: mythvideocolourspace.cpp:406
MythVideoColourSpace::m_displayGamma
float m_displayGamma
Definition: mythvideocolourspace.h:86
MythVideoColourSpace::SetSupportedAttributes
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
Definition: mythvideocolourspace.cpp:111
MythVideoColourSpace::SetContrast
void SetContrast(int Value)
Definition: mythvideocolourspace.cpp:418
MythVideoColourSpace::m_colourShifted
bool m_colourShifted
Definition: mythvideocolourspace.h:79
MythVideoColourSpace::m_fullRange
bool m_fullRange
Definition: mythvideocolourspace.h:69
mythframe.h
MythVideoColourSpace::GetPrimaryConversion
QMatrix4x4 GetPrimaryConversion(int Source, int Dest)
Definition: mythvideocolourspace.cpp:515
MythVideoColourSpace::SupportedAttributesChanged
void SupportedAttributesChanged(PictureAttributeSupported Supported)
kPictureAttributeSupported_None
@ kPictureAttributeSupported_None
Definition: videoouttypes.h:118
MythVideoColourSpace::SetPrimariesMode
void SetPrimariesMode(PrimariesMode Mode)
Definition: mythvideocolourspace.cpp:490
MythColourSpace
Definition: mythcolourspace.h:18
MythVideoColourSpace::m_colourTransfer
int m_colourTransfer
Definition: mythvideocolourspace.h:80
MythVideoColourSpace::GetRange
int GetRange() const
Definition: mythvideocolourspace.cpp:480
MythVideoColourSpace::GetColourMappingDefines
QStringList GetColourMappingDefines(void)
Definition: mythvideocolourspace.cpp:442
MythVideoColourSpace::Debug
void Debug(void)
Definition: mythvideocolourspace.cpp:241
MythVideoColourSpace::GetPictureAttribute
int GetPictureAttribute(PictureAttribute Attribute)
Definition: mythvideocolourspace.cpp:120
MythVideoColourSpace::m_dbSettings
std::map< PictureAttribute, int > m_dbSettings
Definition: mythvideocolourspace.h:67
Source
Definition: channelsettings.cpp:68
videoouttypes.h
MythVideoColourSpace::GetColourGamma
float GetColourGamma(void) const
Definition: mythvideocolourspace.cpp:465
MythVideoColourSpace::GetPrimaries
static MythColourSpace GetPrimaries(int Primary, float &Gamma)
Definition: mythvideocolourspace.cpp:552
MythVideoColourSpace::SetHue
void SetHue(int Value)
Definition: mythvideocolourspace.cpp:424
MythVideoColourSpace::SaveValue
void SaveValue(PictureAttribute Attribute, int Value)
Save the PictureAttribute value to the database.
Definition: mythvideocolourspace.cpp:497
MythVideoColourSpace::RefreshState
void RefreshState()
Definition: mythvideocolourspace.cpp:95
MythVideoColourSpace::GetDisplayGamma
float GetDisplayGamma(void) const
Definition: mythvideocolourspace.cpp:470
MythVideoColourSpace::GetPrimariesMode
PrimariesMode GetPrimariesMode(void)
Definition: mythvideocolourspace.cpp:475
MythVideoColourSpace::m_displayPrimaries
int m_displayPrimaries
Definition: mythvideocolourspace.h:83
MythVideoColourSpace::m_primariesMode
PrimariesMode m_primariesMode
Definition: mythvideocolourspace.h:81
mythcolourspace.h
MythVideoColourSpace::m_colourSpaceDepth
int m_colourSpaceDepth
Definition: mythvideocolourspace.h:76
referencecounter.h
MythVideoColourSpace::m_alpha
float m_alpha
Definition: mythvideocolourspace.h:74
MythVideoColourSpace::m_colourPrimaries
int m_colourPrimaries
Definition: mythvideocolourspace.h:82
MythVideoColourSpace::m_saturation
float m_saturation
Definition: mythvideocolourspace.h:72
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
MythVideoColourSpace::MythVideoColourSpace
MythVideoColourSpace()
Definition: mythvideocolourspace.cpp:40
MythVideoColourSpace::m_colourGamma
float m_colourGamma
Definition: mythvideocolourspace.h:85
MythVideoColourSpace::m_supportedAttributes
PictureAttributeSupported m_supportedAttributes
Definition: mythvideocolourspace.h:66
MythVideoColourSpace::PictureAttributesUpdated
void PictureAttributesUpdated(const std::map< PictureAttribute, int > &Values)
MythVideoColourSpace::~MythVideoColourSpace
~MythVideoColourSpace() override
Definition: mythvideocolourspace.cpp:90
MythVideoColourSpace::SetAlpha
void SetAlpha(int Value)
Definition: mythvideocolourspace.cpp:436
MythVideoColourSpace::ChangePictureAttribute
int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
Definition: mythvideocolourspace.cpp:266
MythVideoColourSpace::Updated
void Updated(bool PrimariesChanged)
MythVideoColourSpace::m_customDisplayGamma
float m_customDisplayGamma
Definition: mythvideocolourspace.h:88
MythVideoColourSpace::m_contrast
float m_contrast
Definition: mythvideocolourspace.h:71
MythVideoColourSpace::GetPrimaryMatrix
QMatrix4x4 GetPrimaryMatrix(void)
Definition: mythvideocolourspace.cpp:460
MythVideoColourSpace::m_brightness
float m_brightness
Definition: mythvideocolourspace.h:70
MythVideoColourSpace::m_chromaLocation
int m_chromaLocation
Definition: mythvideocolourspace.h:84
MythVideoColourSpace::SetBrightness
void SetBrightness(int Value)
Definition: mythvideocolourspace.cpp:412
MythVideoFrame
Definition: mythframe.h:88
MythVideoColourSpace::m_colourSpace
int m_colourSpace
Definition: mythvideocolourspace.h:75
MythVideoColourSpace::m_range
int m_range
Definition: mythvideocolourspace.h:77
MythVideoColourSpace::SupportedAttributes
PictureAttributeSupported SupportedAttributes(void) const
Definition: mythvideocolourspace.cpp:101
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:18
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26
MythVideoColourSpace::SetSaturation
void SetSaturation(int Value)
Definition: mythvideocolourspace.cpp:430