MythTV  master
mythvideocolourspace.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythcorecontext.h"
3 #include "mythlogging.h"
4 #include "mythdisplay.h"
5 #include "mythavutil.h"
6 #include "mythmainwindow.h"
7 #include "mythvideocolourspace.h"
8 
9 // libavutil
10 extern "C" {
11 #include "libavutil/pixfmt.h"
12 #include "libavutil/pixdesc.h"
13 }
14 
15 // Std
16 #include <cmath>
17 
18 #define LOC QString("ColourSpace: ")
19 
41  : ReferenceCounter("Colour")
42 {
47  m_dbSettings[kPictureAttribute_Range] = static_cast<int>(gCoreContext->GetBoolSetting("GUIRGBLevels", true));
48  m_primariesMode = toPrimariesMode(gCoreContext->GetSetting("ColourPrimariesMode", "auto"));
49 
55 
56  // This isn't working as intended (most notable on OSX internal display).
57  // Presumably the driver is expecting sRGB/Rec709 and handles any final
58  // conversion to the display's colourspace.
59  /*
60  if (HasMythMainWindow())
61  {
62  MythDisplay* display = MythDisplay::AcquireRelease();
63  MythEDID& edid = display->GetEDID();
64  // We assume sRGB/Rec709 by default
65  bool custom = edid.Valid() && !edid.IsSRGB();
66  bool likesrgb = custom && edid.IsLikeSRGB() && m_primariesMode != PrimariesExact;
67  if (custom)
68  {
69  // Use sRGB if we don't want exact matching (i.e. close is good enough)
70  // and the display primaries are similar to sRGB.
71  if (likesrgb && qFuzzyCompare(edid.Gamma() + 1.0F, 2.2F + 1.0F))
72  {
73  LOG(VB_PLAYBACK, LOG_INFO, LOC + "sRGB primaries preferred as close match to display primaries");
74  }
75  else
76  {
77  m_customDisplayGamma = edid.Gamma();
78  m_customDisplayPrimaries = new ColourPrimaries;
79  MythEDID::Primaries displayprimaries = edid.ColourPrimaries();
80  memcpy(m_customDisplayPrimaries, &displayprimaries, sizeof(ColourPrimaries));
81  }
82  }
83  MythDisplay::AcquireRelease(false);
84  }
85  */
86  m_updatesDisabled = false;
87  Update();
88 }
89 
91 {
93 }
94 
96 {
99 }
100 
102 {
103  return m_supportedAttributes;
104 }
105 
112 {
113  if (Supported == m_supportedAttributes)
114  return;
115  m_supportedAttributes = Supported;
116  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("PictureAttributes: %1").arg(toString(m_supportedAttributes)));
118 }
119 
121 {
122  if (auto found = m_dbSettings.find(Attribute); found != m_dbSettings.end())
123  return found->second;
124  return -1;
125 }
126 
134 {
135  if (m_updatesDisabled)
136  return;
137 
138  // build an RGB to YCbCr conversion matrix from first principles
139  // and then invert it for the YCbCr to RGB conversion
140  std::vector<float> rgb;
141  switch (static_cast<AVColorSpace>(m_colourSpace))
142  {
143  case AVCOL_SPC_RGB: rgb = { 1.0000F, 1.0000F, 1.0000F }; break;
144  case AVCOL_SPC_BT709: rgb = { 0.2126F, 0.7152F, 0.0722F }; break;
145  case AVCOL_SPC_FCC: rgb = { 0.30F, 0.59F, 0.11F }; break;
146  case AVCOL_SPC_BT470BG:
147  case AVCOL_SPC_SMPTE170M: rgb = { 0.299F, 0.587F, 0.114F }; break;
148  case AVCOL_SPC_SMPTE240M: rgb = { 0.212F, 0.701F, 0.087F }; break;
149  case AVCOL_SPC_YCOCG: rgb = { 0.25F, 0.5F, 0.25F }; break;
150  case AVCOL_SPC_BT2020_CL:
151  case AVCOL_SPC_BT2020_NCL: rgb = { 0.2627F, 0.6780F, 0.0593F }; break;
152  case AVCOL_SPC_UNSPECIFIED:
153  case AVCOL_SPC_RESERVED:
154  case AVCOL_SPC_SMPTE2085:
155  case AVCOL_SPC_CHROMA_DERIVED_CL:
156  case AVCOL_SPC_CHROMA_DERIVED_NCL:
157  case AVCOL_SPC_ICTCP:
158  default: rgb = { 0.2126F, 0.7152F, 0.0722F }; //Rec.709
159  }
160 
161  float bs = rgb[2] == 1.0F ? 0.0F : 0.5F / (rgb[2] - 1.0F);
162  float rs = rgb[0] == 1.0F ? 0.0F : 0.5F / (rgb[0] - 1.0F);
163  QMatrix4x4 rgb2yuv( rgb[0], rgb[1], rgb[2], 0.0F,
164  bs * rgb[0], bs * rgb[1], 0.5F, 0.0F,
165  0.5F, rs * rgb[1], rs * rgb[2], 0.0F,
166  0.0F, 0.0F, 0.0F, m_alpha);
167 
168  // TODO check AVCOL_SPC_RGB
169  if (m_colourSpace == AVCOL_SPC_YCOCG)
170  {
171  rgb2yuv = QMatrix4x4(0.25F, 0.50F, 0.25F, 0.0F,
172  -0.25F, 0.50F, -0.25F, 0.0F,
173  0.50F, 0.00F, -0.50F, 0.0F,
174  0.00F, 0.00F, 0.00F, m_alpha);
175  }
176  QMatrix4x4 yuv2rgb = rgb2yuv.inverted();
177 
178  // scale the chroma values for saturation
179  yuv2rgb.scale(1.0F, m_saturation, m_saturation);
180  // rotate the chroma for hue - this is a rotation around the 'Y' (luminance) axis
181  yuv2rgb.rotate(m_hue, 1.0F, 0.0F, 0.0F);
182  // denormalise chroma
183  yuv2rgb.translate(0.0F, -0.5F, -0.5F);
184  // Levels adjustment
185  // This is a no-op when using full range MJPEG sources and full range output
186  // or 'standard' limited range MPEG sources with limited range output.
187  // N.B all of the quantization parameters scale perfectly between the different
188  // standards and bitdepths (i.e. 709 8 and 10 bit, 2020 10 and 12bit).
189  // In the event that we are displaying a downsampled format, the following
190  // also effectively limits the precision in line with that loss in precision.
191  // For example, YUV420P10 is downsampled by removing the 2 lower bits of
192  // precision. We identify the resultant YUV420P frame as 8bit and calculate
193  // the quantization/range accordingly.
194  bool expand = (m_range == AVCOL_RANGE_MPEG) && m_fullRange;
195  bool contract = (m_range == AVCOL_RANGE_JPEG) && !m_fullRange;
196  bool noop = !expand && !contract;
197  float depth = (1 << m_colourSpaceDepth) - 1;
198  float blacklevel = 16 << (m_colourSpaceDepth - 8);
199  float lumapeak = 235 << (m_colourSpaceDepth - 8);
200  float chromapeak = 240 << (m_colourSpaceDepth - 8);
201  float luma_scale = noop ? 1.0F : (expand ? depth / (lumapeak - blacklevel) : (lumapeak - blacklevel) / depth);
202  float chroma_scale = noop ? 1.0F : (expand ? depth / (chromapeak - blacklevel) : (chromapeak - blacklevel) / depth);
203  float offset = noop ? 0.0F : (expand ? -blacklevel / depth : blacklevel / depth);
204 
205  setToIdentity();
207  scale(m_contrast);
208  this->operator *= (yuv2rgb);
209  scale(luma_scale, chroma_scale, chroma_scale);
210  translate(offset, offset, offset);
211 
212  // Scale when needed for 10/12/16bit fixed point data
213  // Raw 10bit video is represented as XXXXXXXX:XX000000
214  // Raw 12bit video is XXXXXXXX:XXXX0000
215  // Raw 16bit video is XXXXXXXX:XXXXXXXX
216  // and these formats are returned by FFmpeg when software decoding
217  // so we need to shift by the appropriate number of 'bits' (actually a float in the shader)
218  // Hardware decoders seem to return 'corrected' values
219  // i.e. 10bit as XXXXXXXXXX for both direct rendering and copy back.
220  // Works for NVDEC and VAAPI. VideoToolBox untested.
221  if ((m_colourSpaceDepth > 8) && !m_colourShifted)
222  {
223  float scaler = 65535.0F / ((1 << m_colourSpaceDepth) -1);
224  scale(scaler);
225  }
226  static_cast<QMatrix4x4*>(this)->operator = (this->transposed());
227 
228  // check for a change in primaries conversion. This will need a recompile
229  // of the shaders - not just a parameter update.
230  float tmpsrcgamma = m_colourGamma;
231  float tmpdspgamma = m_displayGamma;
232  QMatrix4x4 tmpmatrix = m_primaryMatrix;
234  bool primchanged = !qFuzzyCompare(tmpsrcgamma, m_colourGamma) ||
235  !qFuzzyCompare(tmpdspgamma, m_displayGamma) ||
236  !qFuzzyCompare(tmpmatrix, m_primaryMatrix);
237  Debug();
238  emit Updated(primchanged);
239 }
240 
242 {
243  bool primary = !m_primaryMatrix.isIdentity();
244 
245  LOG(VB_PLAYBACK, LOG_DEBUG, LOC +
246  QString("Brightness: %1 Contrast: %2 Saturation: %3 Hue: %4 Alpha: %5 Range: %6 Primary: %7")
247  .arg(static_cast<qreal>(m_brightness), 2, 'f', 4, QLatin1Char('0'))
248  .arg(static_cast<qreal>(m_contrast) , 2, 'f', 4, QLatin1Char('0'))
249  .arg(static_cast<qreal>(m_saturation), 2, 'f', 4, QLatin1Char('0'))
250  .arg(static_cast<qreal>(m_hue) , 2, 'f', 4, QLatin1Char('0'))
251  .arg(static_cast<qreal>(m_alpha) , 2, 'f', 4, QLatin1Char('0'))
252  .arg(m_fullRange ? "Full" : "Limited")
253  .arg(primary));
254 
255  if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_DEBUG))
256  {
257  QString stream;
258  QDebug debug(&stream);
259  debug << *this;
260  if (primary)
262  LOG(VB_PLAYBACK, LOG_DEBUG, stream);
263  }
264 }
265 
266 int MythVideoColourSpace::ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
267 {
268  if (!(m_supportedAttributes & toMask(Attribute)))
269  return -1;
270 
271  int current = GetPictureAttribute(Attribute);
272  if (current < 0)
273  return -1;
274 
275  int newvalue = Value;
276  if (Value < 0)
277  {
278  newvalue = current + ((Direction) ? +1 : -1);
279  if (kPictureAttribute_Hue == Attribute)
280  newvalue = newvalue % 100;
281  if ((kPictureAttribute_Range == Attribute) && newvalue > 1)
282  newvalue = 1;
283  }
284 
285  newvalue = std::min(std::max(newvalue, 0), 100);
286  if (newvalue != current)
287  {
288  switch (Attribute)
289  {
291  SetBrightness(newvalue);
292  break;
294  SetContrast(newvalue);
295  break;
297  SetSaturation(newvalue);
298  break;
300  SetHue(newvalue);
301  break;
302  default:
303  newvalue = -1;
304  }
305 
306  emit PictureAttributeChanged(Attribute, newvalue);
307 
308  if (newvalue >= 0)
309  SaveValue(Attribute, newvalue);
310  }
311 
312  return newvalue;
313 }
314 
322 {
323  if (!Frame)
324  return false;
325 
326  int csp = Frame->m_colorspace;
327  int primary = Frame->m_colorprimaries;
328  int transfer = Frame->m_colortransfer;
329  int chroma = Frame->m_chromalocation;
330  int raw = csp;
331  int rawchroma = chroma;
332  VideoFrameType frametype = Frame->m_type;
333  VideoFrameType softwaretype = MythAVUtil::PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->m_swPixFmt));
334 
335  // workaround for NVDEC. NVDEC defaults to a colorspace of 0 - which happens
336  // to equate to RGB. In testing, NVDEC reports the same colourspace as FFmpeg
337  // software decode for MPEG2, MPEG4, H.264, HEVC and VP8. VP9 seems to go wrong (with limited samples)
338  bool forced = false;
339  if (csp == AVCOL_SPC_RGB && (MythVideoFrame::YUVFormat(frametype) || frametype == FMT_NVDEC))
340  {
341  forced = true;
342  csp = AVCOL_SPC_UNSPECIFIED;
343  }
344  int range = Frame->m_colorrange;
345  if (range == AVCOL_RANGE_UNSPECIFIED)
346  range = AVCOL_RANGE_MPEG;
347  int depth = MythVideoFrame::ColorDepth(MythVideoFrame::HardwareFormat(frametype) ? softwaretype : frametype);
348  if (csp == AVCOL_SPC_UNSPECIFIED)
349  csp = (Frame->m_width < 1280) ? AVCOL_SPC_BT470BG : AVCOL_SPC_BT709;
350  if (primary == AVCOL_PRI_UNSPECIFIED)
351  primary = (Frame->m_width < 1280) ? AVCOL_PRI_BT470BG : AVCOL_PRI_BT709;
352  if (transfer == AVCOL_TRC_UNSPECIFIED)
353  transfer = (Frame->m_width < 1280) ? AVCOL_TRC_GAMMA28 : AVCOL_TRC_BT709;
354  if (chroma == AVCHROMA_LOC_UNSPECIFIED)
355  chroma = AVCHROMA_LOC_LEFT;
356 
357  if ((csp == m_colourSpace) && (m_colourSpaceDepth == depth) &&
358  (m_range == range) && (m_colourShifted == Frame->m_colorshifted) &&
359  (primary == m_colourPrimaries) && (chroma == m_chromaLocation))
360  {
361  return false;
362  }
363 
364  m_colourSpace = csp;
365  m_colourSpaceDepth = depth;
366  m_range = range;
367  m_colourShifted = Frame->m_colorshifted;
368  m_colourPrimaries = primary;
369  m_colourTransfer = transfer;
370  m_chromaLocation = chroma;
371 
372  if (forced)
373  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Forcing inconsistent colourspace - frame format %1")
375 
376  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Input : %1(%2) Depth:%3 %4Range:%5")
377  .arg(av_color_space_name(static_cast<AVColorSpace>(m_colourSpace)),
378  m_colourSpace == raw ? "Detected" : "Guessed",
379  QString::number(m_colourSpaceDepth),
380  (m_colourSpaceDepth > 8) ? (m_colourShifted ? "(Pre-scaled) " : "(Fixed point) ") : "",
381  (AVCOL_RANGE_JPEG == m_range) ? "Full" : "Limited"));
382  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Input : Primaries:%1 Transfer: %2")
383  .arg(av_color_primaries_name(static_cast<AVColorPrimaries>(m_colourPrimaries)),
384  av_color_transfer_name(static_cast<AVColorTransferCharacteristic>(m_colourTransfer))));
385  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Output: Range:%1 Primaries: %2")
386  .arg(m_fullRange ? "Full" : "Limited",
387  m_customDisplayPrimaries ? "Custom (screen)" :
388  av_color_primaries_name(static_cast<AVColorPrimaries>(m_displayPrimaries))));
389  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Chroma location: %1 %2")
390  .arg(av_chroma_location_name(static_cast<AVChromaLocation>(m_chromaLocation)),
391  rawchroma == m_chromaLocation ? "(Detected)" : "(Guessed)"));
392 
393  Update();
394 
395  if (!m_primaryMatrix.isIdentity())
396  {
397  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Enabled colourspace primaries conversion from %1 to %2")
398  .arg(av_color_primaries_name(static_cast<AVColorPrimaries>(m_colourPrimaries)),
400  ? "Custom (screen)"
401  : av_color_primaries_name(static_cast<AVColorPrimaries>(m_displayPrimaries))));
402  }
403  return true;
404 }
405 
407 {
408  m_fullRange = FullRange;
409  Update();
410 }
411 
413 {
414  m_brightness = (Value * 0.02F) - 1.0F;
415  Update();
416 }
417 
419 {
420  m_contrast = Value * 0.02F;
421  Update();
422 }
423 
425 {
426  m_hue = Value * -3.6F;
427  Update();
428 }
429 
431 {
432  m_saturation = Value * 0.02F;
433  Update();
434 }
435 
437 {
438  m_alpha = 100.0F / Value;
439  Update();
440 }
441 
443 {
444  QStringList result;
445 
446  // TODO extend this to handle all non-co-sited chroma locations. Left is the
447  // most common by far - otherwise topleft seems to be used by some 422 content (but
448  // subjectively looks better without adjusting vertically!)
449  if (m_chromaLocation == AVCHROMA_LOC_LEFT || m_chromaLocation == AVCHROMA_LOC_TOPLEFT ||
450  m_chromaLocation == AVCHROMA_LOC_BOTTOMLEFT)
451  {
452  result << "CHROMALEFT";
453  }
454 
455  if (!m_primaryMatrix.isIdentity())
456  result << "COLOURMAPPING";
457  return result;
458 }
459 
461 {
462  return m_primaryMatrix;
463 }
464 
466 {
467  return m_colourGamma;
468 }
469 
471 {
472  return m_displayGamma;
473 }
474 
476 {
477  return m_primariesMode;
478 }
479 
481 {
482  return m_range;
483 }
484 
486 {
487  return m_colourSpace;
488 }
489 
491 {
492  m_primariesMode = Mode;
493  Update();
494 }
495 
497 void MythVideoColourSpace::SaveValue(PictureAttribute AttributeType, int Value)
498 {
499  QString dbName;
500  if (kPictureAttribute_Brightness == AttributeType)
501  dbName = "PlaybackBrightness";
502  else if (kPictureAttribute_Contrast == AttributeType)
503  dbName = "PlaybackContrast";
504  else if (kPictureAttribute_Colour == AttributeType)
505  dbName = "PlaybackColour";
506  else if (kPictureAttribute_Hue == AttributeType)
507  dbName = "PlaybackHue";
508 
509  if (!dbName.isEmpty())
510  gCoreContext->SaveSetting(dbName, Value);
511 
512  m_dbSettings[AttributeType] = Value;
513 }
514 
516 {
517  // Default to identity
518  QMatrix4x4 result;
519 
520  // User isn't interested in quality
522  return result;
523 
524  auto source = static_cast<AVColorPrimaries>(Source);
525  auto dest = static_cast<AVColorPrimaries>(Dest);
526  auto custom = m_customDisplayPrimaries != nullptr;
527 
528  // No-op
529  if (!custom && (source == dest))
530  return result;
531 
532  auto srcprimaries = GetPrimaries(source, m_colourGamma);
533  auto dstprimaries = GetPrimaries(dest, m_displayGamma);
534  if (custom)
535  {
536  dstprimaries = *m_customDisplayPrimaries;
538  }
539 
540  // If 'exact' is not requested and the primaries and gamma are similar, then
541  // ignore. Note: 0.021F should cover any differences between Rec.709/sRGB and Rec.610
542  if ((m_primariesMode == PrimariesRelaxed) && qFuzzyCompare(m_colourGamma + 1.0F, m_displayGamma + 1.0F) &&
543  MythColourSpace::Alike(srcprimaries, dstprimaries, 0.021F))
544  {
545  return result;
546  }
547 
548  return (MythColourSpace::RGBtoXYZ(srcprimaries) *
549  MythColourSpace::RGBtoXYZ(dstprimaries).inverted());
550 }
551 
553 {
554  auto primary = static_cast<AVColorPrimaries>(Primary);
555  Gamma = 2.2F;
556  switch (primary)
557  {
558  case AVCOL_PRI_BT470BG:
559  case AVCOL_PRI_BT470M: return MythColourSpace::s_BT610_625;
560  case AVCOL_PRI_SMPTE170M:
561  case AVCOL_PRI_SMPTE240M: return MythColourSpace::s_BT610_525;
562  case AVCOL_PRI_BT2020: Gamma = 2.4F; return MythColourSpace::s_BT2020;
563  default: return MythColourSpace::s_BT709;
564  }
565 }
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:142
Source
static QString Source(const QNetworkRequest &request)
Definition: netstream.cpp:144
build_compdb.dest
dest
Definition: build_compdb.py:9
MythVideoColourSpace::PictureAttributeChanged
void PictureAttributeChanged(PictureAttribute Attribute, int Value)
PrimariesRelaxed
@ PrimariesRelaxed
Definition: videoouttypes.h:145
PictureAttributeSupported
PictureAttributeSupported
Definition: videoouttypes.h:116
MythColourSpace::s_BT610_625
static MythColourSpace s_BT610_625
Definition: mythcolourspace.h:25
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
rgb2yuv
static void rgb2yuv(eu8 r, eu8 g, eu8 b, eu8 *y, eu8 *cr, eu8 *cb)
Definition: pxsup2dast.c:213
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
kPictureAttribute_Contrast
@ kPictureAttribute_Contrast
Definition: videoouttypes.h:108
MythVideoColourSpace::m_updatesDisabled
bool m_updatesDisabled
Definition: mythvideocolourspace.h:78
MythVideoColourSpace::SetFullRange
void SetFullRange(bool FullRange)
Definition: mythvideocolourspace.cpp:406
MythColourSpace::Alike
static bool Alike(const MythColourSpace &First, const MythColourSpace &Second, float Fuzz)
Definition: mythcolourspace.cpp:27
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
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
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
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:425
MythColourSpace::s_BT610_525
static MythColourSpace s_BT610_525
Definition: mythcolourspace.h:24
MythVideoColourSpace::GetPrimaryConversion
QMatrix4x4 GetPrimaryConversion(int Source, int Dest)
Definition: mythvideocolourspace.cpp:515
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
MythVideoColourSpace::SupportedAttributesChanged
void SupportedAttributesChanged(PictureAttributeSupported Supported)
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
PrimariesDisabled
@ PrimariesDisabled
Definition: videoouttypes.h:144
MythVideoColourSpace::GetColourMappingDefines
QStringList GetColourMappingDefines(void)
Definition: mythvideocolourspace.cpp:442
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
MythVideoFrame::YUVFormat
static bool YUVFormat(VideoFrameType Type)
Definition: mythframe.h:466
MythVideoColourSpace::Debug
void Debug(void)
Definition: mythvideocolourspace.cpp:241
mythvideocolourspace.h
MythVideoColourSpace::GetPictureAttribute
int GetPictureAttribute(PictureAttribute Attribute)
Definition: mythvideocolourspace.cpp:120
MythVideoColourSpace::m_dbSettings
std::map< PictureAttribute, int > m_dbSettings
Definition: mythvideocolourspace.h:67
mythdisplay.h
MythColourSpace::s_BT2020
static MythColourSpace s_BT2020
Definition: mythcolourspace.h:26
mythlogging.h
Source
Definition: channelsettings.cpp:68
yuv2rgb
static void yuv2rgb(int y, int cr, int cb, eu8 *r, eu8 *g, eu8 *b)
Definition: pxsup2dast.c:200
MythColourSpace::RGBtoXYZ
static QMatrix4x4 RGBtoXYZ(const MythColourSpace &Primaries)
Create a conversion matrix for RGB to XYZ with the given primaries.
Definition: mythcolourspace.cpp:65
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
MythColourSpace::s_BT709
static MythColourSpace s_BT709
Definition: mythcolourspace.h:22
debug
VERBOSE_PREAMBLE Most debug(nodatabase, notimestamp, noextra)") VERBOSE_MAP(VB_GENERAL
MythVideoColourSpace::SaveValue
void SaveValue(PictureAttribute Attribute, int Value)
Save the PictureAttribute value to the database.
Definition: mythvideocolourspace.cpp:497
MythVideoFrame::ColorDepth
static int ColorDepth(int Format)
Definition: mythframe.h:399
kPictureAttribute_Brightness
@ kPictureAttribute_Brightness
Definition: videoouttypes.h:107
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
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
MythVideoColourSpace::m_displayPrimaries
int m_displayPrimaries
Definition: mythvideocolourspace.h:83
MythVideoColourSpace::m_primariesMode
PrimariesMode m_primariesMode
Definition: mythvideocolourspace.h:81
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:936
MythVideoColourSpace::m_colourSpaceDepth
int m_colourSpaceDepth
Definition: mythvideocolourspace.h:76
MythVideoColourSpace::m_alpha
float m_alpha
Definition: mythvideocolourspace.h:74
MythVideoColourSpace::m_colourPrimaries
int m_colourPrimaries
Definition: mythvideocolourspace.h:82
kPictureAttribute_Range
@ kPictureAttribute_Range
Definition: videoouttypes.h:111
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:70
MythVideoColourSpace::m_saturation
float m_saturation
Definition: mythvideocolourspace.h:72
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:930
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:63
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
VERBOSE_LEVEL_CHECK
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
Definition: mythlogging.h:14
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
MythVideoFrame::FormatDescription
static QString FormatDescription(VideoFrameType Type)
Definition: mythframe.cpp:368
MythVideoColourSpace::ChangePictureAttribute
int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
Definition: mythvideocolourspace.cpp:266
mythcorecontext.h
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
mythavutil.h
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
toMask
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
Definition: videoouttypes.h:334
VideoFrameType
VideoFrameType
Definition: mythframe.h:20
MythVideoColourSpace::SetBrightness
void SetBrightness(int Value)
Definition: mythvideocolourspace.cpp:412
MythVideoFrame
Definition: mythframe.h:88
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:905
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
mythmainwindow.h
LOC
#define LOC
Definition: mythvideocolourspace.cpp:18
kPictureAttribute_Hue
@ kPictureAttribute_Hue
Definition: videoouttypes.h:110
toPrimariesMode
PrimariesMode toPrimariesMode(const QString &Mode)
Definition: videoouttypes.h:163
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26
MythVideoColourSpace::SetSaturation
void SetSaturation(int Value)
Definition: mythvideocolourspace.cpp:430
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:922
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:109