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 
19  {{{{0.640F, 0.330F}, {0.300F, 0.600F}, {0.150F, 0.060F}}}, {0.3127F, 0.3290F}};
21  {{{{0.630F, 0.340F}, {0.310F, 0.595F}, {0.155F, 0.070F}}}, {0.3127F, 0.3290F}};
23  {{{{0.640F, 0.330F}, {0.290F, 0.600F}, {0.150F, 0.060F}}}, {0.3127F, 0.3290F}};
25  {{{{0.708F, 0.292F}, {0.170F, 0.797F}, {0.131F, 0.046F}}}, {0.3127F, 0.3290F}};
26 
27 #define LOC QString("ColourSpace: ")
28 
58  : ReferenceCounter("Colour")
59 {
64  m_dbSettings[kPictureAttribute_Range] = static_cast<int>(gCoreContext->GetBoolSetting("GUIRGBLevels", true));
65  m_primariesMode = toPrimariesMode(gCoreContext->GetSetting("ColourPrimariesMode", "auto"));
66 
72 
73  // This isn't working as intended (most notable on OSX internal display).
74  // Presumably the driver is expecting sRGB/Rec709 and handles any final
75  // conversion to the display's colourspace.
76  /*
77  if (HasMythMainWindow())
78  {
79  MythDisplay* display = MythDisplay::AcquireRelease();
80  MythEDID& edid = display->GetEDID();
81  // We assume sRGB/Rec709 by default
82  bool custom = edid.Valid() && !edid.IsSRGB();
83  bool likesrgb = custom && edid.IsLikeSRGB() && m_primariesMode != PrimariesExact;
84  if (custom)
85  {
86  // Use sRGB if we don't want exact matching (i.e. close is good enough)
87  // and the display primaries are similar to sRGB.
88  if (likesrgb && qFuzzyCompare(edid.Gamma() + 1.0F, 2.2F + 1.0F))
89  {
90  LOG(VB_PLAYBACK, LOG_INFO, LOC + "sRGB primaries preferred as close match to display primaries");
91  }
92  else
93  {
94  m_customDisplayGamma = edid.Gamma();
95  m_customDisplayPrimaries = new ColourPrimaries;
96  MythEDID::Primaries displayprimaries = edid.ColourPrimaries();
97  memcpy(m_customDisplayPrimaries, &displayprimaries, sizeof(ColourPrimaries));
98  }
99  }
100  MythDisplay::AcquireRelease(false);
101  }
102  */
103  m_updatesDisabled = false;
104  Update();
105 }
106 
108 {
110 }
111 
113 {
114  return m_supportedAttributes;
115 }
116 
123 {
124  m_supportedAttributes = Supported;
125  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("PictureAttributes: %1").arg(toString(m_supportedAttributes)));
126 }
127 
129 {
130  if (m_dbSettings.contains(Attribute))
131  return m_dbSettings.value(Attribute);
132  return -1;
133 }
134 
142 {
143  if (m_updatesDisabled)
144  return;
145 
146  // build an RGB to YCbCr conversion matrix from first principles
147  // and then invert it for the YCbCr to RGB conversion
148  std::vector<float> rgb;
149  switch (static_cast<AVColorSpace>(m_colourSpace))
150  {
151  case AVCOL_SPC_RGB: rgb = { 1.0000F, 1.0000F, 1.0000F }; break;
152  case AVCOL_SPC_BT709: rgb = { 0.2126F, 0.7152F, 0.0722F }; break;
153  case AVCOL_SPC_FCC: rgb = { 0.30F, 0.59F, 0.11F }; break;
154  case AVCOL_SPC_BT470BG:
155  case AVCOL_SPC_SMPTE170M: rgb = { 0.299F, 0.587F, 0.114F }; break;
156  case AVCOL_SPC_SMPTE240M: rgb = { 0.212F, 0.701F, 0.087F }; break;
157  case AVCOL_SPC_YCOCG: rgb = { 0.25F, 0.5F, 0.25F }; break;
158  case AVCOL_SPC_BT2020_CL:
159  case AVCOL_SPC_BT2020_NCL: rgb = { 0.2627F, 0.6780F, 0.0593F }; break;
160  case AVCOL_SPC_UNSPECIFIED:
161  case AVCOL_SPC_RESERVED:
162  case AVCOL_SPC_SMPTE2085:
163  case AVCOL_SPC_CHROMA_DERIVED_CL:
164  case AVCOL_SPC_CHROMA_DERIVED_NCL:
165  case AVCOL_SPC_ICTCP:
166  default: rgb = { 0.2126F, 0.7152F, 0.0722F }; //Rec.709
167  }
168 
169  float bs = rgb[2] == 1.0F ? 0.0F : 0.5F / (rgb[2] - 1.0F);
170  float rs = rgb[0] == 1.0F ? 0.0F : 0.5F / (rgb[0] - 1.0F);
171  QMatrix4x4 rgb2yuv( rgb[0], rgb[1], rgb[2], 0.0F,
172  bs * rgb[0], bs * rgb[1], 0.5F, 0.0F,
173  0.5F, rs * rgb[1], rs * rgb[2], 0.0F,
174  0.0F, 0.0F, 0.0F, m_alpha);
175 
176  // TODO check AVCOL_SPC_RGB
177  if (m_colourSpace == AVCOL_SPC_YCOCG)
178  {
179  rgb2yuv = QMatrix4x4(0.25F, 0.50F, 0.25F, 0.0F,
180  -0.25F, 0.50F, -0.25F, 0.0F,
181  0.50F, 0.00F, -0.50F, 0.0F,
182  0.00F, 0.00F, 0.00F, m_alpha);
183  }
184  QMatrix4x4 yuv2rgb = rgb2yuv.inverted();
185 
186  // scale the chroma values for saturation
187  yuv2rgb.scale(1.0F, m_saturation, m_saturation);
188  // rotate the chroma for hue - this is a rotation around the 'Y' (luminance) axis
189  yuv2rgb.rotate(m_hue, 1.0F, 0.0F, 0.0F);
190  // denormalise chroma
191  yuv2rgb.translate(0.0F, -0.5F, -0.5F);
192  // Levels adjustment
193  // This is a no-op when using full range MJPEG sources and full range output
194  // or 'standard' limited range MPEG sources with limited range output.
195  // N.B all of the quantization parameters scale perfectly between the different
196  // standards and bitdepths (i.e. 709 8 and 10 bit, 2020 10 and 12bit).
197  // In the event that we are displaying a downsampled format, the following
198  // also effectively limits the precision in line with that loss in precision.
199  // For example, YUV420P10 is downsampled by removing the 2 lower bits of
200  // precision. We identify the resultant YUV420P frame as 8bit and calculate
201  // the quantization/range accordingly.
202  bool expand = (m_range == AVCOL_RANGE_MPEG) && m_fullRange;
203  bool contract = (m_range == AVCOL_RANGE_JPEG) && !m_fullRange;
204  bool noop = !expand && !contract;
205  float depth = (1 << m_colourSpaceDepth) - 1;
206  float blacklevel = 16 << (m_colourSpaceDepth - 8);
207  float lumapeak = 235 << (m_colourSpaceDepth - 8);
208  float chromapeak = 240 << (m_colourSpaceDepth - 8);
209  float luma_scale = noop ? 1.0F : (expand ? depth / (lumapeak - blacklevel) : (lumapeak - blacklevel) / depth);
210  float chroma_scale = noop ? 1.0F : (expand ? depth / (chromapeak - blacklevel) : (chromapeak - blacklevel) / depth);
211  float offset = noop ? 0.0F : (expand ? -blacklevel / depth : blacklevel / depth);
212 
213  setToIdentity();
215  scale(m_contrast);
216  this->operator *= (yuv2rgb);
217  scale(luma_scale, chroma_scale, chroma_scale);
218  translate(offset, offset, offset);
219 
220  // Scale when needed for 10/12/16bit fixed point data
221  // Raw 10bit video is represented as XXXXXXXX:XX000000
222  // Raw 12bit video is XXXXXXXX:XXXX0000
223  // Raw 16bit video is XXXXXXXX:XXXXXXXX
224  // and these formats are returned by FFmpeg when software decoding
225  // so we need to shift by the appropriate number of 'bits' (actually a float in the shader)
226  // Hardware decoders seem to return 'corrected' values
227  // i.e. 10bit as XXXXXXXXXX for both direct rendering and copy back.
228  // Works for NVDEC and VAAPI. VideoToolBox untested.
229  if ((m_colourSpaceDepth > 8) && !m_colourShifted)
230  {
231  float scaler = 65535.0F / ((1 << m_colourSpaceDepth) -1);
232  scale(scaler);
233  }
234  static_cast<QMatrix4x4*>(this)->operator = (this->transposed());
235 
236  // check for a change in primaries conversion. This will need a recompile
237  // of the shaders - not just a parameter update.
238  float tmpsrcgamma = m_colourGamma;
239  float tmpdspgamma = m_displayGamma;
240  QMatrix4x4 tmpmatrix = m_primaryMatrix;
242  bool primchanged = !qFuzzyCompare(tmpsrcgamma, m_colourGamma) ||
243  !qFuzzyCompare(tmpdspgamma, m_displayGamma) ||
244  !qFuzzyCompare(tmpmatrix, m_primaryMatrix);
245  Debug();
246  emit Updated(primchanged);
247 }
248 
250 {
251  bool primary = !m_primaryMatrix.isIdentity();
252 
253  LOG(VB_PLAYBACK, LOG_DEBUG, LOC +
254  QString("Brightness: %1 Contrast: %2 Saturation: %3 Hue: %4 Alpha: %5 Range: %6 Primary: %7")
255  .arg(static_cast<qreal>(m_brightness), 2, 'f', 4, QLatin1Char('0'))
256  .arg(static_cast<qreal>(m_contrast) , 2, 'f', 4, QLatin1Char('0'))
257  .arg(static_cast<qreal>(m_saturation), 2, 'f', 4, QLatin1Char('0'))
258  .arg(static_cast<qreal>(m_hue) , 2, 'f', 4, QLatin1Char('0'))
259  .arg(static_cast<qreal>(m_alpha) , 2, 'f', 4, QLatin1Char('0'))
260  .arg(m_fullRange ? "Full" : "Limited")
261  .arg(primary));
262 
263  if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_DEBUG))
264  {
265  QString stream;
266  QDebug debug(&stream);
267  debug << *this;
268  if (primary)
270  LOG(VB_PLAYBACK, LOG_DEBUG, stream);
271  }
272 }
273 
274 int MythVideoColourSpace::ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
275 {
276  if (!(m_supportedAttributes & toMask(Attribute)))
277  return -1;
278 
279  int current = GetPictureAttribute(Attribute);
280  if (current < 0)
281  return -1;
282 
283  int newvalue = Value;
284  if (Value < 0)
285  {
286  newvalue = current + ((Direction) ? +1 : -1);
287  if (kPictureAttribute_Hue == Attribute)
288  newvalue = newvalue % 100;
289  if ((kPictureAttribute_Range == Attribute) && newvalue > 1)
290  newvalue = 1;
291  }
292 
293  newvalue = std::min(std::max(newvalue, 0), 100);
294  if (newvalue != current)
295  {
296  switch (Attribute)
297  {
299  SetBrightness(newvalue);
300  break;
302  SetContrast(newvalue);
303  break;
305  SetSaturation(newvalue);
306  break;
308  SetHue(newvalue);
309  break;
310  default:
311  newvalue = -1;
312  }
313 
314  emit PictureAttributeChanged(Attribute, newvalue);
315 
316  if (newvalue >= 0)
317  SaveValue(Attribute, newvalue);
318  }
319 
320  return newvalue;
321 }
322 
330 {
331  if (!Frame)
332  return false;
333 
334  int csp = Frame->m_colorspace;
335  int primary = Frame->m_colorprimaries;
336  int transfer = Frame->m_colortransfer;
337  int chroma = Frame->m_chromalocation;
338  int raw = csp;
339  int rawchroma = chroma;
340  VideoFrameType frametype = Frame->m_type;
341  VideoFrameType softwaretype = MythAVUtil::PixelFormatToFrameType(static_cast<AVPixelFormat>(Frame->m_swPixFmt));
342 
343  // workaround for NVDEC. NVDEC defaults to a colorspace of 0 - which happens
344  // to equate to RGB. In testing, NVDEC reports the same colourspace as FFmpeg
345  // software decode for MPEG2, MPEG4, H.264, HEVC and VP8. VP9 seems to go wrong (with limited samples)
346  bool forced = false;
347  if (csp == AVCOL_SPC_RGB && (MythVideoFrame::YUVFormat(frametype) || frametype == FMT_NVDEC))
348  {
349  forced = true;
350  csp = AVCOL_SPC_UNSPECIFIED;
351  }
352  int range = Frame->m_colorrange;
353  if (range == AVCOL_RANGE_UNSPECIFIED)
354  range = AVCOL_RANGE_MPEG;
355  int depth = MythVideoFrame::ColorDepth(MythVideoFrame::HardwareFormat(frametype) ? softwaretype : frametype);
356  if (csp == AVCOL_SPC_UNSPECIFIED)
357  csp = (Frame->m_width < 1280) ? AVCOL_SPC_BT470BG : AVCOL_SPC_BT709;
358  if (primary == AVCOL_PRI_UNSPECIFIED)
359  primary = (Frame->m_width < 1280) ? AVCOL_PRI_BT470BG : AVCOL_PRI_BT709;
360  if (transfer == AVCOL_TRC_UNSPECIFIED)
361  transfer = (Frame->m_width < 1280) ? AVCOL_TRC_GAMMA28 : AVCOL_TRC_BT709;
362  if (chroma == AVCHROMA_LOC_UNSPECIFIED)
363  chroma = AVCHROMA_LOC_LEFT;
364 
365  if ((csp == m_colourSpace) && (m_colourSpaceDepth == depth) &&
366  (m_range == range) && (m_colourShifted == Frame->m_colorshifted) &&
367  (primary == m_colourPrimaries) && (chroma == m_chromaLocation))
368  {
369  return false;
370  }
371 
372  m_colourSpace = csp;
373  m_colourSpaceDepth = depth;
374  m_range = range;
375  m_colourShifted = Frame->m_colorshifted;
376  m_colourPrimaries = primary;
377  m_colourTransfer = transfer;
378  m_chromaLocation = chroma;
379 
380  if (forced)
381  LOG(VB_GENERAL, LOG_WARNING, LOC + QString("Forcing inconsistent colourspace - frame format %1")
383 
384  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Input : %1(%2) Depth:%3 %4Range:%5")
385  .arg(av_color_space_name(static_cast<AVColorSpace>(m_colourSpace)))
386  .arg(m_colourSpace == raw ? "Detected" : "Guessed")
388  .arg((m_colourSpaceDepth > 8) ? (m_colourShifted ? "(Pre-scaled) " : "(Fixed point) ") : "")
389  .arg((AVCOL_RANGE_JPEG == m_range) ? "Full" : "Limited"));
390  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Input : Primaries:%1 Transfer: %2")
391  .arg(av_color_primaries_name(static_cast<AVColorPrimaries>(m_colourPrimaries)))
392  .arg(av_color_transfer_name(static_cast<AVColorTransferCharacteristic>(m_colourTransfer))));
393  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Output: Range:%1 Primaries: %2")
394  .arg(m_fullRange ? "Full" : "Limited")
395  .arg(m_customDisplayPrimaries ? "Custom (screen)" :
396  av_color_primaries_name(static_cast<AVColorPrimaries>(m_displayPrimaries))));
397  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Chroma location: %1 %2")
398  .arg(av_chroma_location_name(static_cast<AVChromaLocation>(m_chromaLocation)))
399  .arg(rawchroma == m_chromaLocation ? "(Detected)" : "(Guessed)"));
400 
401  Update();
402 
403  if (!m_primaryMatrix.isIdentity())
404  {
405  LOG(VB_GENERAL, LOG_INFO, LOC + QString("Enabled colourspace primaries conversion from %1 to %2")
406  .arg(av_color_primaries_name(static_cast<AVColorPrimaries>(m_colourPrimaries)))
407  .arg(m_customDisplayPrimaries ? "Custom (screen)" :
408  av_color_primaries_name(static_cast<AVColorPrimaries>(m_displayPrimaries))));
409  }
410  return true;
411 }
412 
414 {
415  m_fullRange = FullRange;
416  Update();
417 }
418 
420 {
421  m_brightness = (Value * 0.02F) - 1.0F;
422  Update();
423 }
424 
426 {
427  m_contrast = Value * 0.02F;
428  Update();
429 }
430 
432 {
433  m_hue = Value * -3.6F;
434  Update();
435 }
436 
438 {
439  m_saturation = Value * 0.02F;
440  Update();
441 }
442 
444 {
445  m_alpha = 100.0F / Value;
446  Update();
447 }
448 
450 {
451  QStringList result;
452 
453  // TODO extend this to handle all non-co-sited chroma locations. Left is the
454  // most common by far - otherwise topleft seems to be used by some 422 content (but
455  // subjectively looks better without adjusting vertically!)
456  if (m_chromaLocation == AVCHROMA_LOC_LEFT || m_chromaLocation == AVCHROMA_LOC_TOPLEFT ||
457  m_chromaLocation == AVCHROMA_LOC_BOTTOMLEFT)
458  {
459  result << "CHROMALEFT";
460  }
461 
462  if (m_primaryMatrix.isIdentity())
463  return result;
464 
465  result << "COLOURMAPPING";
466  return result;
467 }
468 
470 {
471  return m_primaryMatrix;
472 }
473 
475 {
476  return m_colourGamma;
477 }
478 
480 {
481  return m_displayGamma;
482 }
483 
485 {
486  return m_primariesMode;
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  ColourPrimaries srcprimaries = GetPrimaries(source, m_colourGamma);
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  Similar(srcprimaries, dstprimaries, 0.021F))
543  {
544  return result;
545  }
546 
547  return (RGBtoXYZ(srcprimaries) * RGBtoXYZ(dstprimaries).inverted());
548 }
549 
551 {
552  auto primary = static_cast<AVColorPrimaries>(Primary);
553  Gamma = 2.2F;
554  switch (primary)
555  {
556  case AVCOL_PRI_BT470BG:
557  case AVCOL_PRI_BT470M: return kBT610_625;
558  case AVCOL_PRI_SMPTE170M:
559  case AVCOL_PRI_SMPTE240M: return kBT610_525;
560  case AVCOL_PRI_BT2020: Gamma = 2.4F; return kBT2020;
561  default: return kBT709;
562  }
563 }
564 
565 bool MythVideoColourSpace::Similar(const ColourPrimaries &First, const ColourPrimaries &Second, float Fuzz)
566 {
567  auto cmp = [=](float One, float Two) { return (abs(One - Two) < Fuzz); };
568  return cmp(First.primaries[0][0], Second.primaries[0][0]) &&
569  cmp(First.primaries[0][1], Second.primaries[0][1]) &&
570  cmp(First.primaries[1][0], Second.primaries[1][0]) &&
571  cmp(First.primaries[1][1], Second.primaries[1][1]) &&
572  cmp(First.primaries[2][0], Second.primaries[2][0]) &&
573  cmp(First.primaries[2][1], Second.primaries[2][1]) &&
574  cmp(First.whitepoint[0], Second.whitepoint[0]) &&
575  cmp(First.whitepoint[1], Second.whitepoint[1]);
576 }
577 
578 inline float CalcBy(const PrimarySpace& p, const WhiteSpace w)
579 {
580  float val = ((1-w[0])/w[1] - (1-p[0][0])/p[0][1]) * (p[1][0]/p[1][1] - p[0][0]/p[0][1]) -
581  (w[0]/w[1] - p[0][0]/p[0][1]) * ((1-p[1][0])/p[1][1] - (1-p[0][0])/p[0][1]);
582  val /= ((1-p[2][0])/p[2][1] - (1-p[0][0])/p[0][1]) * (p[1][0]/p[1][1] - p[0][0]/p[0][1]) -
583  (p[2][0]/p[2][1] - p[0][0]/p[0][1]) * ((1-p[1][0])/p[1][1] - (1-p[0][0])/p[0][1]);
584  return val;
585 }
586 
587 inline float CalcGy(const PrimarySpace& p, const WhiteSpace w, const float By)
588 {
589  float val = w[0]/w[1] - p[0][0]/p[0][1] - By * (p[2][0]/p[2][1] - p[0][0]/p[0][1]);
590  val /= p[1][0]/p[1][1] - p[0][0]/p[0][1];
591  return val;
592 }
593 
594 inline float CalcRy(const float By, const float Gy)
595 {
596  return 1.0F - Gy - By;
597 }
598 
607 {
608  float By = CalcBy(Primaries.primaries, Primaries.whitepoint);
609  float Gy = CalcGy(Primaries.primaries, Primaries.whitepoint, By);
610  float Ry = CalcRy(By, Gy);
611 
612  return {
613  // Row 0
614  Ry * Primaries.primaries[0][0] / Primaries.primaries[0][1],
615  Gy * Primaries.primaries[1][0] / Primaries.primaries[1][1],
616  By * Primaries.primaries[2][0] / Primaries.primaries[2][1],
617  0.0F,
618  // Row 1
619  Ry, Gy, By, 0.0F,
620  // Row 2
621  Ry / Primaries.primaries[0][1] * (1- Primaries.primaries[0][0] - Primaries.primaries[0][1]),
622  Gy / Primaries.primaries[1][1] * (1- Primaries.primaries[1][0] - Primaries.primaries[1][1]),
623  By / Primaries.primaries[2][1] * (1- Primaries.primaries[2][0] - Primaries.primaries[2][1]),
624  0.0F,
625  // Row 3
626  0.0F, 0.0F, 0.0F, 1.0F };
627 }
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:143
CalcRy
float CalcRy(const float By, const float Gy)
Definition: mythvideocolourspace.cpp:594
Source
static QString Source(const QNetworkRequest &request)
Definition: netstream.cpp:143
PrimarySpace
std::array< std::array< float, 2 >, 3 > PrimarySpace
Definition: mythvideocolourspace.h:17
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:117
MythVideoColourSpace::Update
void Update(void)
Update the matrix for the current settings and colourspace.
Definition: mythvideocolourspace.cpp:141
MythVideoColourSpace::m_primaryMatrix
QMatrix4x4 m_primaryMatrix
Definition: mythvideocolourspace.h:98
rgb2yuv
static void rgb2yuv(eu8 r, eu8 g, eu8 b, eu8 *y, eu8 *cr, eu8 *cb)
Definition: pxsup2dast.c:213
Frame
Definition: zmdefines.h:94
MythVideoColourSpace::ColourPrimaries
Definition: mythvideocolourspace.h:48
MythVideoColourSpace::m_hue
float m_hue
Definition: mythvideocolourspace.h:84
MythVideoColourSpace::UpdateColourSpace
bool UpdateColourSpace(const MythVideoFrame *Frame)
Set the current colourspace to use.
Definition: mythvideocolourspace.cpp:329
arg
arg(title).arg(filename).arg(doDelete))
kPictureAttribute_Contrast
@ kPictureAttribute_Contrast
Definition: videoouttypes.h:108
MythVideoColourSpace::m_updatesDisabled
bool m_updatesDisabled
Definition: mythvideocolourspace.h:89
MythVideoColourSpace::SetFullRange
void SetFullRange(bool FullRange)
Definition: mythvideocolourspace.cpp:413
MythVideoColourSpace::m_displayGamma
float m_displayGamma
Definition: mythvideocolourspace.h:97
MythVideoColourSpace::SetSupportedAttributes
void SetSupportedAttributes(PictureAttributeSupported Supported)
Enable the given set of picture attributes.
Definition: mythvideocolourspace.cpp:122
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVideoColourSpace::SetContrast
void SetContrast(int Value)
Definition: mythvideocolourspace.cpp:425
MythVideoColourSpace::m_colourShifted
bool m_colourShifted
Definition: mythvideocolourspace.h:90
MythVideoColourSpace::m_fullRange
bool m_fullRange
Definition: mythvideocolourspace.h:80
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:408
MythVideoColourSpace::m_customDisplayPrimaries
ColourPrimaries * m_customDisplayPrimaries
Definition: mythvideocolourspace.h:100
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::SetPrimariesMode
void SetPrimariesMode(PrimariesMode Mode)
Definition: mythvideocolourspace.cpp:489
MythVideoColourSpace::m_colourTransfer
int m_colourTransfer
Definition: mythvideocolourspace.h:91
PrimariesDisabled
@ PrimariesDisabled
Definition: videoouttypes.h:144
MythVideoColourSpace::GetColourMappingDefines
QStringList GetColourMappingDefines(void)
Definition: mythvideocolourspace.cpp:449
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
MythVideoFrame::YUVFormat
static bool YUVFormat(VideoFrameType Type)
Definition: mythframe.h:449
MythVideoColourSpace::Debug
void Debug(void)
Definition: mythvideocolourspace.cpp:249
WhiteSpace
std::array< float, 2 > WhiteSpace
Definition: mythvideocolourspace.h:18
mythvideocolourspace.h
MythVideoColourSpace::GetPictureAttribute
int GetPictureAttribute(PictureAttribute Attribute)
Definition: mythvideocolourspace.cpp:128
mythdisplay.h
mythlogging.h
Source
Definition: channelsettings.cpp:69
yuv2rgb
static void yuv2rgb(int y, int cr, int cb, eu8 *r, eu8 *g, eu8 *b)
Definition: pxsup2dast.c:200
hardwareprofile.config.p
p
Definition: config.py:33
MythVideoColourSpace::ColourPrimaries::whitepoint
WhiteSpace whitepoint
Definition: mythvideocolourspace.h:50
MythVideoColourSpace::Similar
static bool Similar(const ColourPrimaries &First, const ColourPrimaries &Second, float Fuzz)
Definition: mythvideocolourspace.cpp:565
MythVideoColourSpace::kBT709
static const ColourPrimaries kBT709
Definition: mythvideocolourspace.h:53
MythVideoColourSpace::GetColourGamma
float GetColourGamma(void) const
Definition: mythvideocolourspace.cpp:474
MythVideoColourSpace::SetHue
void SetHue(int Value)
Definition: mythvideocolourspace.cpp:431
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:382
kPictureAttribute_Brightness
@ kPictureAttribute_Brightness
Definition: videoouttypes.h:107
MythVideoColourSpace::ColourPrimaries::primaries
PrimarySpace primaries
Definition: mythvideocolourspace.h:49
MythVideoColourSpace::m_dbSettings
QMap< PictureAttribute, int > m_dbSettings
Definition: mythvideocolourspace.h:78
MythVideoColourSpace::GetDisplayGamma
float GetDisplayGamma(void) const
Definition: mythvideocolourspace.cpp:479
MythVideoColourSpace::GetPrimariesMode
PrimariesMode GetPrimariesMode(void)
Definition: mythvideocolourspace.cpp:484
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
MythVideoColourSpace::kBT610_525
static const ColourPrimaries kBT610_525
Definition: mythvideocolourspace.h:54
MythVideoColourSpace::m_displayPrimaries
int m_displayPrimaries
Definition: mythvideocolourspace.h:94
MythVideoColourSpace::m_primariesMode
PrimariesMode m_primariesMode
Definition: mythvideocolourspace.h:92
MythCoreContext::GetNumSetting
int GetNumSetting(const QString &key, int defaultval=0)
Definition: mythcorecontext.cpp:933
MythVideoColourSpace::m_colourSpaceDepth
int m_colourSpaceDepth
Definition: mythvideocolourspace.h:87
MythVideoColourSpace::m_alpha
float m_alpha
Definition: mythvideocolourspace.h:85
MythVideoColourSpace::m_colourPrimaries
int m_colourPrimaries
Definition: mythvideocolourspace.h:93
kPictureAttribute_Range
@ kPictureAttribute_Range
Definition: videoouttypes.h:111
MythAVUtil::PixelFormatToFrameType
static VideoFrameType PixelFormatToFrameType(AVPixelFormat Fmt)
Definition: mythavutil.cpp:74
MythVideoColourSpace::m_saturation
float m_saturation
Definition: mythvideocolourspace.h:83
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:104
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:927
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:58
CalcGy
float CalcGy(const PrimarySpace &p, const WhiteSpace w, const float By)
Definition: mythvideocolourspace.cpp:587
MythVideoColourSpace::MythVideoColourSpace
MythVideoColourSpace()
Definition: mythvideocolourspace.cpp:57
MythVideoColourSpace::m_colourGamma
float m_colourGamma
Definition: mythvideocolourspace.h:96
MythVideoColourSpace::m_supportedAttributes
PictureAttributeSupported m_supportedAttributes
Definition: mythvideocolourspace.h:77
VERBOSE_LEVEL_CHECK
#define VERBOSE_LEVEL_CHECK(_MASK_, _LEVEL_)
Definition: mythlogging.h:14
MythVideoColourSpace::~MythVideoColourSpace
~MythVideoColourSpace() override
Definition: mythvideocolourspace.cpp:107
MythVideoColourSpace::kBT2020
static const ColourPrimaries kBT2020
Definition: mythvideocolourspace.h:56
MythVideoColourSpace::SetAlpha
void SetAlpha(int Value)
Definition: mythvideocolourspace.cpp:443
MythVideoFrame::FormatDescription
static QString FormatDescription(VideoFrameType Type)
Definition: mythframe.cpp:363
MythVideoColourSpace::ChangePictureAttribute
int ChangePictureAttribute(PictureAttribute Attribute, bool Direction, int Value)
Definition: mythvideocolourspace.cpp:274
mythcorecontext.h
MythVideoColourSpace::Updated
void Updated(bool PrimariesChanged)
MythVideoColourSpace::m_customDisplayGamma
float m_customDisplayGamma
Definition: mythvideocolourspace.h:99
MythVideoColourSpace::GetPrimaries
static ColourPrimaries GetPrimaries(int Primary, float &Gamma)
Definition: mythvideocolourspace.cpp:550
MythVideoColourSpace::m_contrast
float m_contrast
Definition: mythvideocolourspace.h:82
MythVideoColourSpace::kBT610_625
static const ColourPrimaries kBT610_625
Definition: mythvideocolourspace.h:55
mythavutil.h
MythVideoColourSpace::GetPrimaryMatrix
QMatrix4x4 GetPrimaryMatrix(void)
Definition: mythvideocolourspace.cpp:469
MythVideoColourSpace::m_brightness
float m_brightness
Definition: mythvideocolourspace.h:81
MythVideoColourSpace::m_chromaLocation
int m_chromaLocation
Definition: mythvideocolourspace.h:95
toMask
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
Definition: videoouttypes.h:334
VideoFrameType
VideoFrameType
Definition: mythframe.h:16
MythVideoColourSpace::SetBrightness
void SetBrightness(int Value)
Definition: mythvideocolourspace.cpp:419
MythVideoFrame
Definition: mythframe.h:83
CalcBy
float CalcBy(const PrimarySpace &p, const WhiteSpace w)
Definition: mythvideocolourspace.cpp:578
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:902
MythVideoColourSpace::m_colourSpace
int m_colourSpace
Definition: mythvideocolourspace.h:86
MythVideoColourSpace::RGBtoXYZ
static QMatrix4x4 RGBtoXYZ(const ColourPrimaries &Primaries)
Create a conversion matrix for RGB to XYZ with the given primaries.
Definition: mythvideocolourspace.cpp:606
MythVideoColourSpace::m_range
int m_range
Definition: mythvideocolourspace.h:88
MythVideoColourSpace::SupportedAttributes
PictureAttributeSupported SupportedAttributes(void) const
Definition: mythvideocolourspace.cpp:112
mythmainwindow.h
LOC
#define LOC
Definition: mythvideocolourspace.cpp:27
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:27
MythVideoColourSpace::SetSaturation
void SetSaturation(int Value)
Definition: mythvideocolourspace.cpp:437
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:919
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:109