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  .arg(m_colourSpace == raw ? "Detected" : "Guessed")
380  .arg((m_colourSpaceDepth > 8) ? (m_colourShifted ? "(Pre-scaled) " : "(Fixed point) ") : "")
381  .arg((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  .arg(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  .arg(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  .arg(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)))
399  .arg(m_customDisplayPrimaries ? "Custom (screen)" :
400  av_color_primaries_name(static_cast<AVColorPrimaries>(m_displayPrimaries))));
401  }
402  return true;
403 }
404 
406 {
407  m_fullRange = FullRange;
408  Update();
409 }
410 
412 {
413  m_brightness = (Value * 0.02F) - 1.0F;
414  Update();
415 }
416 
418 {
419  m_contrast = Value * 0.02F;
420  Update();
421 }
422 
424 {
425  m_hue = Value * -3.6F;
426  Update();
427 }
428 
430 {
431  m_saturation = Value * 0.02F;
432  Update();
433 }
434 
436 {
437  m_alpha = 100.0F / Value;
438  Update();
439 }
440 
442 {
443  QStringList result;
444 
445  // TODO extend this to handle all non-co-sited chroma locations. Left is the
446  // most common by far - otherwise topleft seems to be used by some 422 content (but
447  // subjectively looks better without adjusting vertically!)
448  if (m_chromaLocation == AVCHROMA_LOC_LEFT || m_chromaLocation == AVCHROMA_LOC_TOPLEFT ||
449  m_chromaLocation == AVCHROMA_LOC_BOTTOMLEFT)
450  {
451  result << "CHROMALEFT";
452  }
453 
454  if (!m_primaryMatrix.isIdentity())
455  result << "COLOURMAPPING";
456  return result;
457 }
458 
460 {
461  return m_primaryMatrix;
462 }
463 
465 {
466  return m_colourGamma;
467 }
468 
470 {
471  return m_displayGamma;
472 }
473 
475 {
476  return m_primariesMode;
477 }
478 
480 {
481  return m_range;
482 }
483 
485 {
486  return m_colourSpace;
487 }
488 
490 {
491  m_primariesMode = Mode;
492  Update();
493 }
494 
496 void MythVideoColourSpace::SaveValue(PictureAttribute AttributeType, int Value)
497 {
498  QString dbName;
499  if (kPictureAttribute_Brightness == AttributeType)
500  dbName = "PlaybackBrightness";
501  else if (kPictureAttribute_Contrast == AttributeType)
502  dbName = "PlaybackContrast";
503  else if (kPictureAttribute_Colour == AttributeType)
504  dbName = "PlaybackColour";
505  else if (kPictureAttribute_Hue == AttributeType)
506  dbName = "PlaybackHue";
507 
508  if (!dbName.isEmpty())
509  gCoreContext->SaveSetting(dbName, Value);
510 
511  m_dbSettings[AttributeType] = Value;
512 }
513 
515 {
516  // Default to identity
517  QMatrix4x4 result;
518 
519  // User isn't interested in quality
521  return result;
522 
523  auto source = static_cast<AVColorPrimaries>(Source);
524  auto dest = static_cast<AVColorPrimaries>(Dest);
525  auto custom = m_customDisplayPrimaries != nullptr;
526 
527  // No-op
528  if (!custom && (source == dest))
529  return result;
530 
531  auto srcprimaries = GetPrimaries(source, m_colourGamma);
532  auto dstprimaries = GetPrimaries(dest, m_displayGamma);
533  if (custom)
534  {
535  dstprimaries = *m_customDisplayPrimaries;
537  }
538 
539  // If 'exact' is not requested and the primaries and gamma are similar, then
540  // ignore. Note: 0.021F should cover any differences between Rec.709/sRGB and Rec.610
541  if ((m_primariesMode == PrimariesRelaxed) && qFuzzyCompare(m_colourGamma + 1.0F, m_displayGamma + 1.0F) &&
542  MythColourSpace::Alike(srcprimaries, dstprimaries, 0.021F))
543  {
544  return result;
545  }
546 
547  return (MythColourSpace::RGBtoXYZ(srcprimaries) *
548  MythColourSpace::RGBtoXYZ(dstprimaries).inverted());
549 }
550 
552 {
553  auto primary = static_cast<AVColorPrimaries>(Primary);
554  Gamma = 2.2F;
555  switch (primary)
556  {
557  case AVCOL_PRI_BT470BG:
558  case AVCOL_PRI_BT470M: return MythColourSpace::s_BT610_625;
559  case AVCOL_PRI_SMPTE170M:
560  case AVCOL_PRI_SMPTE240M: return MythColourSpace::s_BT610_525;
561  case AVCOL_PRI_BT2020: Gamma = 2.4F; return MythColourSpace::s_BT2020;
562  default: return MythColourSpace::s_BT709;
563  }
564 }
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:142
Source
static QString Source(const QNetworkRequest &request)
Definition: netstream.cpp:143
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:484
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
arg
arg(title).arg(filename).arg(doDelete))
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:405
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:417
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:514
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:489
MythColourSpace
Definition: mythcolourspace.h:18
MythVideoColourSpace::m_colourTransfer
int m_colourTransfer
Definition: mythvideocolourspace.h:80
MythVideoColourSpace::GetRange
int GetRange() const
Definition: mythvideocolourspace.cpp:479
PrimariesDisabled
@ PrimariesDisabled
Definition: videoouttypes.h:144
MythVideoColourSpace::GetColourMappingDefines
QStringList GetColourMappingDefines(void)
Definition: mythvideocolourspace.cpp:441
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:464
MythVideoColourSpace::GetPrimaries
static MythColourSpace GetPrimaries(int Primary, float &Gamma)
Definition: mythvideocolourspace.cpp:551
MythVideoColourSpace::SetHue
void SetHue(int Value)
Definition: mythvideocolourspace.cpp:423
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:496
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:469
MythVideoColourSpace::GetPrimariesMode
PrimariesMode GetPrimariesMode(void)
Definition: mythvideocolourspace.cpp:474
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:932
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:926
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:435
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:459
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:411
MythVideoFrame
Definition: mythframe.h:88
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:901
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:429
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:918
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:109