MythTV  master
mythvideotexture.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythlogging.h"
3 #include "mythvideotexture.h"
4 
5 #define LOC QString("MythVidTex: ")
6 
7 MythVideoTexture::MythVideoTexture(QOpenGLTexture* Texture)
8  : MythGLTexture(Texture)
9 {
10 }
11 
13  : MythGLTexture(Texture)
14 {
15 }
16 
18 {
19  if (!Context || !Texture)
20  return;
21 
22  OpenGLLocker locker(Context);
23  delete Texture->m_copyContext;
24  delete Texture->m_texture;
25  delete [] Texture->m_data;
26  delete Texture->m_vbo;
27 
28  delete Texture;
29 }
30 
31 void MythVideoTexture::DeleteTextures(MythRenderOpenGL *Context, vector<MythVideoTexture *> &Textures)
32 {
33  if (!Context || Textures.empty())
34  return;
35  for (auto & Texture : Textures)
36  DeleteTexture(Context, Texture);
37  Textures.clear();
38 }
39 
41  const vector<MythVideoTexture *> &Textures,
42  QOpenGLTexture::Filter Filter,
43  QOpenGLTexture::WrapMode Wrap)
44 {
45  for (uint i = 0; (i < Textures.size()) && Context; i++)
46  {
47  Textures[i]->m_filter = Filter;
48  Context->SetTextureFilters(reinterpret_cast<MythGLTexture*>(Textures[i]), Filter, Wrap);
49  }
50 }
51 
58  VideoFrameType Type,
60  vector<QSize> Sizes,
61  GLenum Target)
62 {
63  vector<MythVideoTexture*> result;
64  if (!Context || Sizes.empty())
65  return result;
66  if (Sizes[0].isEmpty())
67  return result;
68 
69  OpenGLLocker locker(Context);
70 
71  // Hardware frames
72  if (format_is_hw(Type))
73  return CreateHardwareTextures(Context, Type, Format, Sizes, Target);
74 
75  return CreateSoftwareTextures(Context, Type, Format, Sizes, Target);
76 }
77 
86  VideoFrameType Type,
88  vector<QSize> Sizes,
89  GLenum Target)
90 {
91  vector<MythVideoTexture*> result;
92 
93  uint count = planes(Format);
94  if (count < 1)
95  {
96  LOG(VB_GENERAL, LOG_ERR, LOC + "Invalid hardware frame format");
97  return result;
98  }
99 
100  if (count != Sizes.size())
101  {
102  LOG(VB_GENERAL, LOG_ERR, LOC + "Inconsistent plane count");
103  return result;
104  }
105 
106  for (uint plane = 0; plane < count; ++plane)
107  {
108  GLuint textureid = 0;
109  Context->glGenTextures(1, &textureid);
110  if (!textureid)
111  continue;
112 
113  auto* texture = new MythVideoTexture(textureid);
114  texture->m_frameType = Type;
115  texture->m_frameFormat = Format;
116  texture->m_plane = plane;
117  texture->m_planeCount = count;
118  texture->m_target = Target;
119  texture->m_size = Sizes[plane];
120  texture->m_totalSize = Context->GetTextureSize(Sizes[plane], texture->m_target != QOpenGLTexture::TargetRectangle);
121  texture->m_vbo = Context->CreateVBO(static_cast<int>(MythRenderOpenGL::kVertexSize));
122  result.push_back(texture);
123  }
124 
125  SetTextureFilters(Context, result, QOpenGLTexture::Linear);
126  return result;
127 }
128 
134  VideoFrameType Type,
136  vector<QSize> Sizes,
137  GLenum Target)
138 {
139  vector<MythVideoTexture*> result;
140 
141  uint count = planes(Format);
142  if (count < 1)
143  {
144  LOG(VB_GENERAL, LOG_ERR, LOC + "Invalid software frame format");
145  return result;
146  }
147 
148  // OpenGL ES 2.0 has very limited texture format support
149  bool legacy = (Context->GetExtraFeatures() & kGLLegacyTextures) != 0;
150  // GLES3 supports GL_RED etc and 16bit formats but there are no unsigned,
151  // normalised 16bit integer formats. So we must use unsigned integer formats
152  // for 10bit video textures which force:-
153  // - only nearest texture filtering - so we must use the resize stage
154  // - no GLSL mix method for uint/uvec4
155  // - must use unsigned samplers in the shaders - and convert uint to normalised float as necessary
156  // - need to use GLSL ES 3.00 - which means new/updated shaders
157  bool gles3 = Context->isOpenGLES() && Context->format().majorVersion() > 2;
158  QOpenGLTexture::PixelFormat r8pixelfmtnorm = QOpenGLTexture::Red;
159  QOpenGLTexture::PixelFormat r8pixelfmtuint = QOpenGLTexture::Red;
160  QOpenGLTexture::PixelFormat rg8pixelfmtnorm = QOpenGLTexture::RG;
161  QOpenGLTexture::PixelFormat rg8pixelfmtuint = QOpenGLTexture::RG;
162  QOpenGLTexture::TextureFormat r8internalfmt = QOpenGLTexture::R8_UNorm;
163  QOpenGLTexture::TextureFormat r16internalfmt = QOpenGLTexture::R16_UNorm;
164  QOpenGLTexture::TextureFormat rg8internalfmt = QOpenGLTexture::RG8_UNorm;
165  QOpenGLTexture::TextureFormat rg16internalfmt = QOpenGLTexture::RG16_UNorm;
166 
167  if (gles3)
168  {
169  r8pixelfmtuint = QOpenGLTexture::Red_Integer;
170  rg8pixelfmtuint = QOpenGLTexture::RG_Integer;
171  r16internalfmt = QOpenGLTexture::R16U;
172  rg16internalfmt = QOpenGLTexture::RG16U;
173  }
174  else if (legacy)
175  {
176  r8pixelfmtnorm = QOpenGLTexture::Luminance;
177  r8internalfmt = QOpenGLTexture::LuminanceFormat;
178  }
179 
180  for (uint plane = 0; plane < count; ++plane)
181  {
182  QSize size = Sizes[0];
183  MythVideoTexture* texture = nullptr;
184  switch (Format)
185  {
186  case FMT_YV12:
187  if (plane > 0)
188  size = QSize(size.width() >> 1, size.height() >> 1);
189  texture = CreateTexture(Context, size, Target,
190  QOpenGLTexture::UInt8, r8pixelfmtnorm, r8internalfmt);
191  break;
192  case FMT_YUV420P9:
193  case FMT_YUV420P10:
194  case FMT_YUV420P12:
195  case FMT_YUV420P14:
196  case FMT_YUV420P16:
197  if (plane > 0)
198  size = QSize(size.width() >> 1, size.height() >> 1);
199  texture = CreateTexture(Context, size, Target,
200  QOpenGLTexture::UInt16, r8pixelfmtuint, r16internalfmt);
201  break;
202  case FMT_YUY2:
203  size.setWidth(size.width() >> 1);
204  texture = CreateTexture(Context, size, Target);
205  break;
206  case FMT_NV12:
207  if (plane == 0)
208  {
209  texture = CreateTexture(Context, size, Target,
210  QOpenGLTexture::UInt8, r8pixelfmtnorm, r8internalfmt);
211  }
212  else
213  {
214  size = QSize(size.width() >> 1, size.height() >> 1);
215  texture = CreateTexture(Context, size, Target,
216  QOpenGLTexture::UInt8, rg8pixelfmtnorm, rg8internalfmt);
217  }
218  break;
219  case FMT_P010:
220  case FMT_P016:
221  if (plane == 0)
222  {
223  texture = CreateTexture(Context, size, Target,
224  QOpenGLTexture::UInt16, r8pixelfmtuint, r16internalfmt);
225  }
226  else
227  {
228  size = QSize(size.width() >> 1, size.height() >> 1);
229  texture = CreateTexture(Context, size, Target,
230  QOpenGLTexture::UInt16, rg8pixelfmtuint, rg16internalfmt);
231  }
232  break;
233  case FMT_YUV422P:
234  if (plane > 0)
235  size = QSize(size.width() >> 1, size.height());
236  texture = CreateTexture(Context, size, Target,
237  QOpenGLTexture::UInt8, r8pixelfmtnorm, r8internalfmt);
238  break;
239  case FMT_YUV422P9:
240  case FMT_YUV422P10:
241  case FMT_YUV422P12:
242  case FMT_YUV422P14:
243  case FMT_YUV422P16:
244  if (plane > 0)
245  size = QSize(size.width() >> 1, size.height());
246  texture = CreateTexture(Context, size, Target,
247  QOpenGLTexture::UInt16, r8pixelfmtuint, r16internalfmt);
248  break;
249  case FMT_YUV444P:
250  texture = CreateTexture(Context, size, Target,
251  QOpenGLTexture::UInt8, r8pixelfmtnorm, r8internalfmt);
252  break;
253  case FMT_YUV444P9:
254  case FMT_YUV444P10:
255  case FMT_YUV444P12:
256  case FMT_YUV444P14:
257  case FMT_YUV444P16:
258  texture = CreateTexture(Context, size, Target,
259  QOpenGLTexture::UInt16, r8pixelfmtuint, r16internalfmt);
260  break;
261  default: break;
262  }
263  if (texture)
264  {
265  texture->m_plane = plane;
266  texture->m_planeCount = count;
267  texture->m_frameType = Type;
268  texture->m_frameFormat = Format;
269  result.push_back(texture);
270  }
271  }
272 
273  if (result.size() != count)
274  LOG(VB_GENERAL, LOG_ERR, LOC + QString("Failed to create all textures: %1 < %2")
275  .arg(result.size()).arg(count));
276  return result;
277 }
278 
282  const VideoFrame *Frame,
283  const vector<MythVideoTexture*> &Textures)
284 {
285  if (!Context || !Frame || Textures.empty())
286  {
287  LOG(VB_GENERAL, LOG_ERR, LOC + "Error");
288  return;
289  }
290 
291  if (Frame->codec != Textures[0]->m_frameType)
292  {
293  LOG(VB_GENERAL, LOG_ERR, LOC + "Inconsistent video and texture frame types");
294  return;
295  }
296 
297  uint count = planes(Textures[0]->m_frameFormat);
298  if (!count || (count != Textures.size()))
299  {
300  LOG(VB_GENERAL, LOG_ERR, LOC + "Invalid software frame type");
301  return;
302  }
303 
304  OpenGLLocker locker(Context);
305 
306  for (uint i = 0; i < count; ++i)
307  {
308  MythVideoTexture *texture = Textures[i];
309  if (!texture)
310  continue;
311  if (!texture->m_texture)
312  continue;
313 
314  if (i != texture->m_plane)
315  {
316  LOG(VB_GENERAL, LOG_ERR, LOC + "Inconsistent plane numbering");
317  continue;
318  }
319 
320  switch (texture->m_frameType)
321  {
322  case FMT_YV12:
323  {
324  switch (texture->m_frameFormat)
325  {
326  case FMT_YV12: YV12ToYV12(Context, Frame, texture, i); break;
327  case FMT_YUY2: YV12ToYUYV(Frame, texture); break;
328  default: break;
329  }
330  break;
331  }
332  case FMT_YUV420P9:
333  case FMT_YUV420P10:
334  case FMT_YUV420P12:
335  case FMT_YUV420P14:
336  case FMT_YUV420P16:
337  {
338  switch (texture->m_frameFormat)
339  {
340  case FMT_YUV420P9:
341  case FMT_YUV420P10:
342  case FMT_YUV420P12:
343  case FMT_YUV420P14:
344  case FMT_YUV420P16: YV12ToYV12(Context, Frame, texture, i); break;
345  default: break;
346  }
347  break;
348  }
349  case FMT_NV12:
350  {
351  switch (texture->m_frameFormat)
352  {
353  case FMT_NV12: NV12ToNV12(Context, Frame, texture, i); break;
354  default: break;
355  }
356  break;
357  }
358  case FMT_P010:
359  case FMT_P016:
360  {
361  switch (texture->m_frameFormat)
362  {
363  case FMT_P010:
364  case FMT_P016: NV12ToNV12(Context, Frame, texture, i); break;
365  default: break;
366  }
367  break;
368  }
369  case FMT_YUV422P:
370  {
371  switch (texture->m_frameFormat)
372  {
373  case FMT_YUV422P: YV12ToYV12(Context, Frame, texture, i); break;
374  default: break;
375  }
376  break;
377  }
378  case FMT_YUV422P9:
379  case FMT_YUV422P10:
380  case FMT_YUV422P12:
381  case FMT_YUV422P14:
382  case FMT_YUV422P16:
383  {
384  switch (texture->m_frameFormat)
385  {
386  case FMT_YUV422P9:
387  case FMT_YUV422P10:
388  case FMT_YUV422P12:
389  case FMT_YUV422P14:
390  case FMT_YUV422P16: YV12ToYV12(Context, Frame, texture, i); break;
391  default: break;
392  }
393  break;
394  }
395  case FMT_YUV444P:
396  {
397  switch (texture->m_frameFormat)
398  {
399  case FMT_YUV444P: YV12ToYV12(Context, Frame, texture, i); break;
400  default: break;
401  }
402  break;
403  }
404  case FMT_YUV444P9:
405  case FMT_YUV444P10:
406  case FMT_YUV444P12:
407  case FMT_YUV444P14:
408  case FMT_YUV444P16:
409  {
410  switch (texture->m_frameFormat)
411  {
412  case FMT_YUV444P9:
413  case FMT_YUV444P10:
414  case FMT_YUV444P12:
415  case FMT_YUV444P14:
416  case FMT_YUV444P16: YV12ToYV12(Context, Frame, texture, i); break;
417  default: break;
418  }
419  break;
420  }
421  default: break;
422  }
423  }
424 }
425 
432  QSize Size,
433  GLenum Target,
434  QOpenGLTexture::PixelType PixelType,
435  QOpenGLTexture::PixelFormat PixelFormat,
436  QOpenGLTexture::TextureFormat Format,
437  QOpenGLTexture::Filter Filter,
438  QOpenGLTexture::WrapMode Wrap)
439 {
440  if (!Context)
441  return nullptr;
442 
443  OpenGLLocker locker(Context);
444 
445  int datasize = MythRenderOpenGL::GetBufferSize(Size, PixelFormat, PixelType);
446  if (!datasize)
447  return nullptr;
448 
449  auto *texture = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(Target));
450  texture->setAutoMipMapGenerationEnabled(false);
451  texture->setMipLevels(1);
452  texture->setSize(Size.width(), Size.height()); // this triggers creation
453  if (!texture->textureId())
454  {
455  LOG(VB_GENERAL, LOG_INFO, LOC + "Failed to create texture");
456  delete texture;
457  return nullptr;
458  }
459 
460  if (Format == QOpenGLTexture::NoFormat)
461  {
462  if (Context->GetExtraFeatures() & kGLLegacyTextures)
463  Format = QOpenGLTexture::RGBAFormat;
464  else
465  Format = QOpenGLTexture::RGBA8_UNorm;
466  }
467  texture->setFormat(Format);
468  texture->allocateStorage(PixelFormat, PixelType);
469  texture->setMinMagFilters(Filter, Filter);
470  texture->setWrapMode(Wrap);
471 
472  auto *result = new MythVideoTexture(texture);
473  result->m_target = Target;
474  result->m_pixelFormat = PixelFormat;
475  result->m_pixelType = PixelType;
476  result->m_vbo = Context->CreateVBO(static_cast<int>(MythRenderOpenGL::kVertexSize));
477  result->m_totalSize = Context->GetTextureSize(Size, result->m_target != QOpenGLTexture::TargetRectangle);
478  result->m_bufferSize = datasize;
479  result->m_size = Size;
480  return result;
481 }
482 
485  MythVideoTexture *Texture, uint Plane)
486 {
487  if (Context->GetExtraFeatures() & kGLExtSubimage)
488  {
489  int pitch = (Frame->codec == FMT_YV12 || Frame->codec == FMT_YUV422P || Frame->codec == FMT_YUV444P) ?
490  Frame->pitches[Plane] : Frame->pitches[Plane] >> 1;
491  Context->glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch);
492  Texture->m_texture->setData(Texture->m_pixelFormat, Texture->m_pixelType,
493  static_cast<uint8_t*>(Frame->buf) + Frame->offsets[Plane]);
494  Context->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
495  }
496  else
497  {
498  if (!Texture->m_data)
499  if (!CreateBuffer(Texture, Texture->m_bufferSize))
500  return;
501  int pitch = (Frame->codec == FMT_YV12 || Frame->codec == FMT_YUV422P || Frame->codec == FMT_YUV444P) ?
502  Texture->m_size.width() : Texture->m_size.width() << 1;
503  copyplane(Texture->m_data, pitch, Frame->buf + Frame->offsets[Plane],
504  Frame->pitches[Plane], pitch, Texture->m_size.height());
505  Texture->m_texture->setData(Texture->m_pixelFormat, Texture->m_pixelType, Texture->m_data);
506  }
507  Texture->m_valid = true;
508 }
509 
512 {
513  // Create a buffer
514  if (!Texture->m_data)
515  if (!CreateBuffer(Texture, Texture->m_bufferSize))
516  return;
517  void* buffer = Texture->m_data;
518 
519  // Create a copy context
520  if (!Texture->m_copyContext)
521  {
522  Texture->m_copyContext = new MythAVCopy();
523  if (!Texture->m_copyContext)
524  return;
525  }
526 
527  // Convert
528  AVFrame out;
529  Texture->m_copyContext->Copy(&out, Frame, static_cast<unsigned char*>(buffer), AV_PIX_FMT_UYVY422);
530 
531  // Update
532  Texture->m_texture->setData(Texture->m_pixelFormat, Texture->m_pixelType, buffer);
533  Texture->m_valid = true;
534 }
535 
538  MythVideoTexture *Texture, uint Plane)
539 {
540  if (Context->GetExtraFeatures() & kGLExtSubimage)
541  {
542  bool hdr = Texture->m_frameFormat != FMT_NV12;
543  Context->glPixelStorei(GL_UNPACK_ROW_LENGTH, Plane ? Frame->pitches[Plane] >> (hdr ? 2 : 1) :
544  Frame->pitches[Plane] >> (hdr ? 1 : 0));
545  Texture->m_texture->setData(Texture->m_pixelFormat, Texture->m_pixelType,
546  static_cast<uint8_t*>(Frame->buf) + Frame->offsets[Plane]);
547  Context->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
548  }
549  else
550  {
551  if (!Texture->m_data)
552  if (!CreateBuffer(Texture, Texture->m_bufferSize))
553  return;
554  copyplane(Texture->m_data, Frame->pitches[Plane], Frame->buf + Frame->offsets[Plane],
555  Frame->pitches[Plane], Frame->pitches[Plane], Texture->m_size.height());
556  Texture->m_texture->setData(Texture->m_pixelFormat, Texture->m_pixelType, Texture->m_data);
557  }
558  Texture->m_valid = true;
559 }
560 
562 inline bool MythVideoTexture::CreateBuffer(MythVideoTexture *Texture, int Size)
563 {
564  if (!Texture || Size < 1)
565  return false;
566 
567  unsigned char *scratch = GetAlignedBufferZero(static_cast<size_t>(Size));
568  if (scratch)
569  {
570  Texture->m_data = scratch;
571  return true;
572  }
573 
574  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to allocate texture buffer");
575  return false;
576 }
577 
579 {
580  if (!Context)
581  return nullptr;
582 
583  OpenGLLocker locker(Context);
584 
585  int width = Context->GetMaxTextureSize();
586  MythVideoTexture *texture = CreateTexture(Context, QSize(width, 1),
587  QOpenGLTexture::Target2D,
588  QOpenGLTexture::Float32,
589  QOpenGLTexture::RGBA,
590  QOpenGLTexture::RGBA16_UNorm,
591  QOpenGLTexture::Linear,
592  QOpenGLTexture::Repeat);
593 
594  float *buf = nullptr;
595  buf = new float[texture->m_bufferSize];
596  float *ref = buf;
597 
598  for (int i = 0; i < width; i++)
599  {
600  float x = (i + 0.5F) / static_cast<float>(width);
601  StoreBicubicWeights(x, ref);
602  ref += 4;
603  }
604  StoreBicubicWeights(0, buf);
605  StoreBicubicWeights(1, &buf[(width - 1) << 2]);
606 
607  texture->m_texture->bind();
608  texture->m_texture->setData(texture->m_pixelFormat, texture->m_pixelType, buf);
609  LOG(VB_PLAYBACK, LOG_INFO, LOC +
610  QString("Created bicubic helper texture (%1 samples)") .arg(width));
611  delete [] buf;
612  return texture;
613 }
614 
615 void MythVideoTexture::StoreBicubicWeights(float X, float *Dest)
616 {
617  float w0 = (((-1 * X + 3) * X - 3) * X + 1) / 6;
618  float w1 = ((( 3 * X - 6) * X + 0) * X + 4) / 6;
619  float w2 = (((-3 * X + 3) * X + 3) * X + 1) / 6;
620  float w3 = ((( 1 * X + 0) * X + 0) * X + 0) / 6;
621  *Dest++ = 1 + X - w1 / (w0 + w1);
622  *Dest++ = 1 - X + w3 / (w2 + w3);
623  *Dest++ = w0 + w1;
624  *Dest++ = 0;
625 }
MythGLTexture
Definition: mythrenderopengl.h:44
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:30
MythGLTexture::m_texture
QOpenGLTexture * m_texture
Definition: mythrenderopengl.h:54
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:33
MythVideoTexture::m_frameType
VideoFrameType m_frameType
Definition: mythvideotexture.h:49
MythVideoTexture::DeleteTexture
static void DeleteTexture(MythRenderOpenGL *Context, MythVideoTexture *Texture)
Definition: mythvideotexture.cpp:17
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:32
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:50
MythVideoTexture::CreateHardwareTextures
static vector< MythVideoTexture * > CreateHardwareTextures(MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, vector< QSize > Sizes, GLenum Target)
Create a set of hardware textures suitable for the given format.
Definition: mythvideotexture.cpp:85
MythVideoTexture::StoreBicubicWeights
static void StoreBicubicWeights(float X, float *Dest)
Definition: mythvideotexture.cpp:615
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:45
MythVideoTexture::CreateSoftwareTextures
static vector< MythVideoTexture * > CreateSoftwareTextures(MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, vector< QSize > Sizes, GLenum Target)
Create a set of OpenGL textures to represent the given Format.
Definition: mythvideotexture.cpp:133
Frame
Definition: zmdefines.h:93
MythGLTexture::m_pixelFormat
QOpenGLTexture::PixelFormat m_pixelFormat
Definition: mythrenderopengl.h:55
MythVideoTexture::NV12ToNV12
static void NV12ToNV12(MythRenderOpenGL *Context, const VideoFrame *Frame, MythVideoTexture *Texture, uint Plane)
Copy NV12 video frame data to 'NV12' textures.
Definition: mythvideotexture.cpp:537
MythVideoTexture::SetTextureFilters
static void SetTextureFilters(MythRenderOpenGL *Context, const vector< MythVideoTexture * > &Textures, QOpenGLTexture::Filter Filter, QOpenGLTexture::WrapMode Wrap=QOpenGLTexture::ClampToEdge)
Definition: mythvideotexture.cpp:40
FMT_P010
@ FMT_P010
Definition: mythframe.h:58
MythGLTexture::m_data
unsigned char * m_data
Definition: mythrenderopengl.h:51
MythVideoTexture::CreateTextures
static vector< MythVideoTexture * > CreateTextures(MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, vector< QSize > Sizes, GLenum Target=QOpenGLTexture::Target2D)
Create a set of textures suitable for the given Type and Format.
Definition: mythvideotexture.cpp:57
arg
arg(title).arg(filename).arg(doDelete))
MythVideoTexture::CreateBuffer
static bool CreateBuffer(MythVideoTexture *Texture, int Size)
Create a data buffer for holding CPU side texture data.
Definition: mythvideotexture.cpp:562
Context
QHash< QString, Action * > Context
Definition: action.h:77
GL_UNPACK_ROW_LENGTH
#define GL_UNPACK_ROW_LENGTH
Definition: mythrenderopengldefs.h:17
MythDate::Format
Format
Definition: mythdate.h:12
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:41
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
kGLLegacyTextures
@ kGLLegacyTextures
Definition: mythrenderopengl.h:36
mythvideotexture.h
VideoFrame
Definition: mythframe.h:137
MythVideoTexture::UpdateTextures
static void UpdateTextures(MythRenderOpenGL *Context, const VideoFrame *Frame, const vector< MythVideoTexture * > &Textures)
Update the contents of the given Textures for data held in Frame.
Definition: mythvideotexture.cpp:281
kGLExtSubimage
@ kGLExtSubimage
Definition: mythrenderopengl.h:34
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:52
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:48
MythGLTexture::m_pixelType
QOpenGLTexture::PixelType m_pixelType
Definition: mythrenderopengl.h:56
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
format_is_hw
static bool format_is_hw(VideoFrameType Type)
Definition: mythframe.h:73
mythlogging.h
MythRenderOpenGL::kVertexSize
static const GLuint kVertexSize
Definition: mythrenderopengl.h:119
MythGLTexture::m_vbo
QOpenGLBuffer * m_vbo
Definition: mythrenderopengl.h:57
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:49
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:28
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:43
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:53
MythVideoTexture::DeleteTextures
static void DeleteTextures(MythRenderOpenGL *Context, vector< MythVideoTexture * > &Textures)
Definition: mythvideotexture.cpp:31
copyplane
static void copyplane(uint8_t *dst, int dst_pitch, const uint8_t *src, int src_pitch, int width, int height)
Definition: mythframe.h:540
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:31
MythVideoTexture::CreateHelperTexture
static MythVideoTexture * CreateHelperTexture(MythRenderOpenGL *Context)
Definition: mythvideotexture.cpp:578
uint
unsigned int uint
Definition: compat.h:140
MythVideoTexture::CreateTexture
static MythVideoTexture * CreateTexture(MythRenderOpenGL *Context, QSize Size, GLenum Target=QOpenGLTexture::Target2D, QOpenGLTexture::PixelType PixelType=QOpenGLTexture::UInt8, QOpenGLTexture::PixelFormat PixelFormat=QOpenGLTexture::RGBA, QOpenGLTexture::TextureFormat Format=QOpenGLTexture::NoFormat, QOpenGLTexture::Filter Filter=QOpenGLTexture::Linear, QOpenGLTexture::WrapMode Wrap=QOpenGLTexture::ClampToEdge)
Create and initialise a MythVideoTexture that is backed by a QOpenGLTexture.
Definition: mythvideotexture.cpp:431
MythGLTexture::m_bufferSize
int m_bufferSize
Definition: mythrenderopengl.h:52
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:51
MythRenderOpenGL
Definition: mythrenderopengl.h:86
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:42
MythVideoTexture::MythVideoTexture
MythVideoTexture(GLuint Texture)
Definition: mythvideotexture.cpp:12
MythVideoTexture::m_frameFormat
VideoFrameType m_frameFormat
Definition: mythvideotexture.h:50
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:29
planes
static uint planes(VideoFrameType Type)
Definition: mythframe.h:570
LOC
#define LOC
Definition: mythvideotexture.cpp:5
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:46
FMT_YUY2
@ FMT_YUY2
Definition: mythframe.h:55
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:44
MythGLTexture::m_size
QSize m_size
Definition: mythrenderopengl.h:58
MythVideoTexture::YV12ToYUYV
static void YV12ToYUYV(const VideoFrame *Frame, MythVideoTexture *Texture)
Copy YV12 frame data to a YUYV texture.
Definition: mythvideotexture.cpp:511
MythVideoTexture::m_plane
uint m_plane
Definition: mythvideotexture.h:51
MythAVCopy
MythAVCopy Copy AVFrame<->frame, performing the required conversion if any.
Definition: mythavutil.h:107
MythVideoTexture::m_copyContext
MythAVCopy * m_copyContext
Definition: mythvideotexture.h:57
VideoFrameType
VideoFrameType
Definition: mythframe.h:24
MythAVCopy::Copy
int Copy(VideoFrame *dst, const VideoFrame *src)
Definition: mythavutil.cpp:331
MythVideoTexture::m_valid
bool m_valid
Definition: mythvideotexture.h:47
MythVideoTexture::m_planeCount
uint m_planeCount
Definition: mythvideotexture.h:52
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:57
MythVideoTexture
Definition: mythvideotexture.h:20
FMT_P016
@ FMT_P016
Definition: mythframe.h:59
GetAlignedBufferZero
static unsigned char * GetAlignedBufferZero(size_t Size)
Definition: mythframe.h:684
MythRenderOpenGL::GetBufferSize
static int GetBufferSize(QSize Size, QOpenGLTexture::PixelFormat Format, QOpenGLTexture::PixelType Type)
Definition: mythrenderopengl.cpp:1446
MythVideoTexture::YV12ToYV12
static void YV12ToYV12(MythRenderOpenGL *Context, const VideoFrame *Frame, MythVideoTexture *Texture, uint Plane)
Copy YV12 frame data to 'YV12' textures.
Definition: mythvideotexture.cpp:484
OpenGLLocker
Definition: mythrenderopengl.h:244