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