MythTV  master
mythvideogpu.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythcorecontext.h"
3 #include "mythvideobounds.h"
4 #include "mythvideoprofile.h"
5 #include "mythvideogpu.h"
6 
7 #define LOC QString("VideoGPU: ")
8 
10  MythVideoBounds* Bounds, const MythVideoProfilePtr &VideoProfile,
11  QString Profile)
12  : m_render(Render),
13  m_profile(std::move(Profile)),
14  m_videoDispDim(Bounds->GetVideoDispDim()),
15  m_videoDim(Bounds->GetVideoDim()),
16  m_masterViewportSize(Bounds->GetDisplayVisibleRect().size()),
17  m_displayVideoRect(Bounds->GetDisplayVideoRect()),
18  m_videoRect(Bounds->GetVideoRect()),
19  m_videoColourSpace(ColourSpace),
20  m_inputTextureSize(Bounds->GetVideoDim())
21 {
22  if (m_render)
23  m_render->IncrRef();
24 
26  {
29  }
30 
31  m_stereoMode = gCoreContext->GetBoolSetting("DiscardStereo3D", true) ?
33  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Discard stereoscopic fields: %1")
34  .arg(m_stereoMode == kStereoscopicModeIgnore3D ? "No" : "Yes"));
35 
40 
41  if (VideoProfile)
42  {
43  UpscalerChanged(VideoProfile->GetUpscaler());
44  connect(VideoProfile.get(), &MythVideoProfile::UpscalerChanged, this, &MythVideoGPU::UpscalerChanged);
45  }
46 }
47 
49 {
50  if (m_render)
51  m_render->DecrRef();
54 }
55 
58 void MythVideoGPU::UpdateColourSpace(bool PrimariesChanged)
59 {
60  ColourSpaceUpdate(PrimariesChanged);
61 }
62 
63 void MythVideoGPU::UpscalerChanged(const QString& Upscaler)
64 {
65  auto oldbicubic = m_bicubicUpsize;
66  m_bicubicUpsize = Upscaler == UPSCALE_HQ1;
67  if (m_bicubicUpsize != oldbicubic)
68  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("New upscaler preference: '%1'").arg(Upscaler));
69 }
70 
72 {
73  return m_valid;
74 }
75 
76 void MythVideoGPU::SetProfile(const QString& Profile)
77 {
78  m_profile = Profile;
79 }
80 
81 QString MythVideoGPU::GetProfile() const
82 {
83  return m_profile;
84 }
85 
87 {
88  m_masterViewportSize = Size;
89 }
90 
92 {
93  return m_videoDim;
94 }
95 
97 {
100  m_inputTextureSize = QSize();
102  // textures are created with Linear filtering - which matches no resize
103  m_resizing = None;
104 }
105 
106 QString MythVideoGPU::VideoResizeToString(VideoResizing Resize)
107 {
108  QStringList reasons;
109  if ((Resize & Deinterlacer) == Deinterlacer) reasons << "Deinterlacer";
110  if ((Resize & Sampling) == Sampling) reasons << "Sampling";
111  if ((Resize & Performance) == Performance) reasons << "Performance";
112  if ((Resize & Framebuffer) == Framebuffer) reasons << "Framebuffer";
113  if ((Resize & ToneMap) == ToneMap) reasons << "Tonemapping";
114  if ((Resize & Bicubic) == Bicubic) reasons << "Bicubic";
115  return reasons.join(",");
116 }
117 
118 void MythVideoGPU::SetVideoDimensions(QSize VideoDim, QSize VideoDispDim)
119 {
120  m_videoDim = VideoDim;
121  m_videoDispDim = VideoDispDim;
122 }
123 
124 void MythVideoGPU::SetVideoRects(QRect DisplayVideoRect, QRect VideoRect)
125 {
126  m_displayVideoRect = DisplayVideoRect;
127  m_videoRect = VideoRect;
128 }
129 
130 void MythVideoGPU::SetViewportRect(QRect DisplayVisibleRect)
131 {
132  SetMasterViewport(DisplayVisibleRect.size());
133 }
MythVideoGPU::MythVideoGPU
MythVideoGPU(MythRender *Render, MythVideoColourSpace *ColourSpace, MythVideoBounds *Bounds, const MythVideoProfilePtr &VideoProfile, QString Profile)
Definition: mythvideogpu.cpp:9
MythVideoGPU::m_inputTextureSize
QSize m_inputTextureSize
Definition: mythvideogpu.h:82
MythVideoGPU::Sampling
@ Sampling
Definition: mythvideogpu.h:29
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
MythVideoGPU::~MythVideoGPU
~MythVideoGPU() override
Definition: mythvideogpu.cpp:48
MythVideoGPU::m_resizing
VideoResizing m_resizing
Definition: mythvideogpu.h:83
MythVideoGPU::IsValid
bool IsValid() const
Definition: mythvideogpu.cpp:71
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:69
MythVideoGPU::m_videoColourSpace
MythVideoColourSpace * m_videoColourSpace
Definition: mythvideogpu.h:81
MythVideoGPU::m_bicubicUpsize
bool m_bicubicUpsize
Definition: mythvideogpu.h:91
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MythVideoBounds::VideoRectsChanged
void VideoRectsChanged(const QRect &DisplayVideoRect, const QRect &VideoRect)
MythVideoGPU::ToneMap
@ ToneMap
Definition: mythvideogpu.h:32
MythVideoGPU::m_videoDim
QSize m_videoDim
Definition: mythvideogpu.h:77
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:22
MythVideoGPU::ColourSpaceUpdate
virtual void ColourSpaceUpdate(bool PrimariesChanged)=0
MythVideoGPU::m_profile
QString m_profile
Definition: mythvideogpu.h:73
MythVideoGPU::Bicubic
@ Bicubic
Definition: mythvideogpu.h:33
MythVideoBounds::SourceChanged
void SourceChanged(QSize VideoDim, QSize VideoDispDim, float Aspect)
Update for new source video dimensions and aspect ratio.
Definition: mythvideobounds.cpp:524
MythVideoGPU::m_videoDispDim
QSize m_videoDispDim
Definition: mythvideogpu.h:76
MythVideoGPU::SetVideoRects
void SetVideoRects(QRect DisplayVideoRect, QRect VideoRect)
Definition: mythvideogpu.cpp:124
kStereoscopicModeIgnore3D
@ kStereoscopicModeIgnore3D
Definition: videoouttypes.h:137
MythVideoGPU::SetViewportRect
void SetViewportRect(QRect DisplayVisibleRect)
Definition: mythvideogpu.cpp:130
MythVideoGPU::SetMasterViewport
void SetMasterViewport(QSize Size)
Definition: mythvideogpu.cpp:86
MythVideoGPU::VideoResizeToString
static QString VideoResizeToString(VideoResizing Resize)
Definition: mythvideogpu.cpp:106
MythVideoGPU::m_deinterlacer
MythDeintType m_deinterlacer
Definition: mythvideogpu.h:85
MythVideoGPU::m_outputType
VideoFrameType m_outputType
Definition: mythvideogpu.h:75
mythvideoprofile.h
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
MythVideoGPU::m_videoRect
QRect m_videoRect
Definition: mythvideogpu.h:80
MythVideoBounds::VideoSizeChanged
void VideoSizeChanged(const QSize &VideoDim, const QSize &VideoDispDim)
MythVideoGPU::Deinterlacer
@ Deinterlacer
Definition: mythvideogpu.h:28
MythVideoGPU::OutputChanged
void OutputChanged(QSize VideoDim, QSize VideoDispDim, float)
mythvideogpu.h
LOC
#define LOC
Definition: mythvideogpu.cpp:7
MythVideoGPU::m_stereoMode
StereoscopicMode m_stereoMode
Definition: mythvideogpu.h:90
MythVideoBounds
Definition: mythvideobounds.h:23
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:930
MythVideoGPU::m_displayVideoRect
QRect m_displayVideoRect
Definition: mythvideogpu.h:79
MythVideoGPU::m_render
MythRender * m_render
Definition: mythvideogpu.h:71
MythVideoGPU::GetProfile
virtual QString GetProfile() const
Definition: mythvideogpu.cpp:81
UPSCALE_HQ1
#define UPSCALE_HQ1
Definition: mythvideoprofile.h:28
mythcorecontext.h
MythVideoColourSpace::Updated
void Updated(bool PrimariesChanged)
MythRender
Definition: mythrender_base.h:23
std
Definition: mythchrono.h:23
MythVideoGPU::UpscalerChanged
void UpscalerChanged(const QString &Upscaler)
Definition: mythvideogpu.cpp:63
MythVideoGPU::SetProfile
void SetProfile(const QString &Profile)
Definition: mythvideogpu.cpp:76
MythVideoGPU::m_valid
bool m_valid
Definition: mythvideogpu.h:87
MythVideoGPU::ResetFrameFormat
virtual void ResetFrameFormat()
Definition: mythvideogpu.cpp:96
MythVideoGPU::UpdateColourSpace
void UpdateColourSpace(bool PrimariesChanged)
Definition: mythvideogpu.cpp:58
MythVideoProfilePtr
std::shared_ptr< MythVideoProfile > MythVideoProfilePtr
Definition: mythvideogpu.h:18
MythVideoBounds::WindowRectChanged
void WindowRectChanged(const QRect &WindowRect)
MythVideoGPU::None
@ None
Definition: mythvideogpu.h:27
MythVideoGPU::SetVideoDimensions
void SetVideoDimensions(QSize VideoDim, QSize VideoDispDim)
Definition: mythvideogpu.cpp:118
MythVideoProfile::UpscalerChanged
void UpscalerChanged(const QString &Upscaler)
MythVideoGPU::m_masterViewportSize
QSize m_masterViewportSize
Definition: mythvideogpu.h:78
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
mythvideobounds.h
kStereoscopicModeSideBySideDiscard
@ kStereoscopicModeSideBySideDiscard
Definition: videoouttypes.h:138
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:18
MythVideoGPU::m_inputType
VideoFrameType m_inputType
Definition: mythvideogpu.h:74
MythVideoGPU::Performance
@ Performance
Definition: mythvideogpu.h:30
MythVideoGPU::GetVideoDim
QSize GetVideoDim() const
Definition: mythvideogpu.cpp:91
MythVideoGPU::Framebuffer
@ Framebuffer
Definition: mythvideogpu.h:31