MythTV  master
mythframe.cpp
Go to the documentation of this file.
1 // MythTV
3 #include "mythframe.h"
4 #include "mythvideoprofile.h"
5 
6 // FFmpeg - for av_malloc/av_free
7 extern "C" {
8 #include "libavcodec/avcodec.h"
9 }
10 
11 #define LOC QString("VideoFrame: ")
12 
23 {
25  LOG(VB_GENERAL, LOG_ERR, LOC + "Frame still contains a hardware buffer!");
26  else if (m_buffer)
27  av_freep(reinterpret_cast<void*>(&m_buffer));
28 }
29 
30 MythVideoFrame::MythVideoFrame(VideoFrameType Type, int Width, int Height, const VideoFrameTypes* RenderFormats)
31 {
32  Init(Type, Width, Height, (RenderFormats == nullptr) ? &kDefaultRenderFormats : RenderFormats);
33 }
34 
35 MythVideoFrame::MythVideoFrame(VideoFrameType Type, uint8_t* Buffer, size_t BufferSize,
36  int Width, int Height, const VideoFrameTypes* RenderFormats, int Alignment)
37 {
38  const VideoFrameTypes* formats = (RenderFormats == nullptr) ? &kDefaultRenderFormats : RenderFormats;
39  Init(Type, Buffer, BufferSize, Width, Height, formats, Alignment);
40 }
41 
42 void MythVideoFrame::Init(VideoFrameType Type, int Width, int Height, const VideoFrameTypes* RenderFormats)
43 {
44  size_t newsize = 0;
45  uint8_t* newbuffer = nullptr;
46  if ((Width > 0 && Height > 0) && (Type != FMT_NONE) && !HardwareFormat(Type))
47  {
48  newsize = GetBufferSize(Type, Width, Height);
49  bool reallocate = (Width != m_width) || (Height != m_height) || (newsize != m_bufferSize) || (Type != m_type);
50  newbuffer = reallocate ? GetAlignedBuffer(newsize) : m_buffer;
51  newsize = reallocate ? newsize : m_bufferSize;
52  }
53  Init(Type, newbuffer, newsize, Width, Height, (RenderFormats == nullptr) ? &kDefaultRenderFormats : RenderFormats);
54 }
55 
56 void MythVideoFrame::Init(VideoFrameType Type, uint8_t *Buffer, size_t BufferSize,
57  int Width, int Height, const VideoFrameTypes* RenderFormats, int Alignment)
58 {
60  {
61  LOG(VB_GENERAL, LOG_ERR, LOC + "Trying to reinitialise a hardware frame. Ignoring");
62  return;
63  }
64 
65  if (std::any_of(m_priv.cbegin(), m_priv.cend(), [](const uint8_t* P) { return P != nullptr; }))
66  {
67  LOG(VB_GENERAL, LOG_ERR, LOC + "Priv buffers are set (hardware frame?). Ignoring Init");
68  return;
69  }
70 
71  if ((Buffer && !BufferSize) || (!Buffer && BufferSize))
72  {
73  LOG(VB_GENERAL, LOG_ERR, LOC + "Inconsistent frame buffer data");
74  return;
75  }
76 
77  if (m_buffer && (m_buffer != Buffer))
78  {
79  LOG(VB_GENERAL, LOG_DEBUG, LOC + "Deleting old frame buffer");
80  av_freep(reinterpret_cast<void*>(&m_buffer));
81  }
82 
83  m_type = Type;
85  m_buffer = Buffer;
86  m_bufferSize = BufferSize;
87  m_width = Width;
88  m_height = Height;
89  m_renderFormats = (RenderFormats == nullptr) ? &kDefaultRenderFormats : RenderFormats;
90 
91  ClearMetadata();
92 
94  return;
95 
96  int alignedwidth = Alignment > 0 ? (m_width + Alignment - 1) & ~(Alignment - 1) : m_width;
97  int alignedheight = (m_height + MYTH_HEIGHT_ALIGNMENT - 1) & ~(MYTH_HEIGHT_ALIGNMENT -1);
98 
99  for (uint i = 0; i < 3; ++i)
100  m_pitches[i] = GetPitchForPlane(m_type, alignedwidth, i);
101 
102  m_offsets[0] = 0;
103  if (FMT_YV12 == m_type)
104  {
105  m_offsets[1] = alignedwidth * alignedheight;
106  m_offsets[2] = m_offsets[1] + ((alignedwidth + 1) >> 1) * ((alignedheight+1) >> 1);
107  }
108  else if (FormatIs420(m_type))
109  {
110  m_offsets[1] = (alignedwidth << 1) * alignedheight;
111  m_offsets[2] = m_offsets[1] + (alignedwidth * (alignedheight >> 1));
112  }
113  else if (FMT_YUV422P == m_type)
114  {
115  m_offsets[1] = alignedwidth * alignedheight;
116  m_offsets[2] = m_offsets[1] + ((alignedwidth + 1) >> 1) * alignedheight;
117  }
118  else if (FormatIs422(m_type))
119  {
120  m_offsets[1] = (alignedwidth << 1) * alignedheight;
121  m_offsets[2] = m_offsets[1] + (alignedwidth * alignedheight);
122  }
123  else if (FMT_YUV444P == m_type)
124  {
125  m_offsets[1] = alignedwidth * alignedheight;
126  m_offsets[2] = m_offsets[1] + (alignedwidth * alignedheight);
127  }
128  else if (FormatIs444(m_type))
129  {
130  m_offsets[1] = (alignedwidth << 1) * alignedheight;
131  m_offsets[2] = m_offsets[1] + ((alignedwidth << 1) * alignedheight);
132  }
133  else if (FMT_NV12 == m_type)
134  {
135  m_offsets[1] = alignedwidth * alignedheight;
136  m_offsets[2] = 0;
137  }
138  else if (FormatIsNV12(m_type))
139  {
140  m_offsets[1] = (alignedwidth << 1) * alignedheight;
141  m_offsets[2] = 0;
142  }
143  else
144  {
145  m_offsets[1] = m_offsets[2] = 0;
146  }
147 }
148 
150 {
151  m_aspect = -1.0F;
152  m_frameRate = -1.0 ;
153  m_frameNumber = 0;
154  m_frameCounter = 0;
155  m_timecode = 0ms;
156  m_displayTimecode = 0ms;
157  m_priv = { nullptr };
158  m_interlaced = 0;
159  m_topFieldFirst = true;
160  m_interlacedReverse = false;
161  m_newGOP = false;
162  m_repeatPic = false;
163  m_forceKey = false;
164  m_dummy = false;
165  m_pauseFrame = false;
166  m_pitches = { 0 };
167  m_offsets = { 0 };
168  m_pixFmt = 0;
169  m_swPixFmt = 0;
170  m_directRendering = true;
171  m_colorspace = 1;
172  m_colorrange = 1;
173  m_colorprimaries = 1;
174  m_colortransfer = 1;
175  m_chromalocation = 1;
176  m_colorshifted = false;
177  m_alreadyDeinterlaced = false;
178  m_rotation = 0;
179  m_stereo3D = 0;
180  m_hdrMetadata = nullptr;
185  m_deinterlaceInuse2x = false;
186 }
187 
188 void MythVideoFrame::CopyPlane(uint8_t *To, int ToPitch, const uint8_t *From, int FromPitch,
189  int PlaneWidth, int PlaneHeight)
190 {
191  if ((ToPitch == PlaneWidth) && (FromPitch == PlaneWidth))
192  {
193  memcpy(To, From, static_cast<size_t>(PlaneWidth) * PlaneHeight);
194  return;
195  }
196 
197  for (int y = 0; y < PlaneHeight; y++)
198  {
199  memcpy(To, From, static_cast<size_t>(PlaneWidth));
200  From += FromPitch;
201  To += ToPitch;
202  }
203 }
204 
206 {
207  if (!m_buffer)
208  return;
209 
210  if (HardwareFormat(m_type))
211  {
212  LOG(VB_GENERAL, LOG_ERR, LOC + "Cannot clear a hardware frame");
213  return;
214  }
215 
216  // luma (or RGBA)
217  int uv_height = GetHeightForPlane(m_type, m_height, 1);
218  int uv = (1 << (ColorDepth(m_type) - 1)) - 1;
219  if (FMT_YV12 == m_type || FMT_YUV422P == m_type || FMT_YUV444P == m_type)
220  {
221  memset(m_buffer + m_offsets[0], 0, static_cast<size_t>(m_pitches[0]) * m_height);
222  memset(m_buffer + m_offsets[1], uv & 0xff, static_cast<size_t>(m_pitches[1]) * uv_height);
223  memset(m_buffer + m_offsets[2], uv & 0xff, static_cast<size_t>(m_pitches[2]) * uv_height);
224  }
225  else if ((FormatIs420(m_type) || FormatIs422(m_type) || FormatIs444(m_type)) &&
226  (m_pitches[1] == m_pitches[2]))
227  {
228  memset(m_buffer + m_offsets[0], 0, static_cast<size_t>(m_pitches[0]) * m_height);
229  unsigned char uv1 = (uv & 0xff00) >> 8;
230  unsigned char uv2 = (uv & 0x00ff);
231  unsigned char* buf1 = m_buffer + m_offsets[1];
232  unsigned char* buf2 = m_buffer + m_offsets[2];
233  for (int row = 0; row < uv_height; ++row)
234  {
235  for (int col = 0; col < m_pitches[1]; col += 2)
236  {
237  buf1[col] = buf2[col] = uv1;
238  buf1[col + 1] = buf2[col + 1] = uv2;
239  }
240  buf1 += m_pitches[1];
241  buf2 += m_pitches[2];
242  }
243  }
244  else if (FMT_NV12 == m_type)
245  {
246  memset(m_buffer + m_offsets[0], 0, static_cast<size_t>(m_pitches[0]) * m_height);
247  memset(m_buffer + m_offsets[1], uv & 0xff, static_cast<size_t>(m_pitches[1]) * uv_height);
248  }
249  else if (FormatIsNV12(m_type))
250  {
251  memset(m_buffer + m_offsets[0], 0, static_cast<size_t>(m_pitches[0]) * m_height);
252  unsigned char uv1 = (uv & 0xff00) >> 8;
253  unsigned char uv2 = (uv & 0x00ff);
254  unsigned char* buf3 = m_buffer + m_offsets[1];
255  for (int row = 0; row < uv_height; ++row)
256  {
257  for (int col = 0; col < m_pitches[1]; col += 4)
258  {
259  buf3[col] = buf3[col + 2] = uv1;
260  buf3[col + 1] = buf3[col + 3] = uv2;
261  }
262  buf3 += m_pitches[1];
263  }
264  }
265  else if (PackedFormat(m_type))
266  {
267  // TODO
268  }
269  else
270  {
271  memset(m_buffer, 0, m_bufferSize);
272  }
273 }
274 
276 {
277  // Sanity checks
278  if (!From || (this == From))
279  return false;
280 
281  if (m_type != From->m_type)
282  {
283  LOG(VB_GENERAL, LOG_ERR, "Cannot copy frames of differing types");
284  return false;
285  }
286 
287  if (From->m_type == FMT_NONE || HardwareFormat(From->m_type))
288  {
289  LOG(VB_GENERAL, LOG_ERR, "Invalid frame format");
290  return false;
291  }
292 
293  if ((m_width <= 0) || (m_height <= 0) ||
294  (m_width != From->m_width) || (m_height != From->m_height))
295  {
296  LOG(VB_GENERAL, LOG_ERR, "Invalid frame sizes");
297  return false;
298  }
299 
300  if (!m_buffer || !From->m_buffer || (m_buffer == From->m_buffer))
301  {
302  LOG(VB_GENERAL, LOG_ERR, "Invalid frames for copying");
303  return false;
304  }
305 
306  // N.B. Minimum based on zero width alignment but will apply height alignment
307  size_t minsize = GetBufferSize(m_type, m_width, m_height, 0);
308  if ((m_bufferSize < minsize) || (From->m_bufferSize < minsize))
309  {
310  LOG(VB_GENERAL, LOG_ERR, "Invalid buffer size");
311  return false;
312  }
313 
314  // We have 2 frames of the same valid size and format, they are not hardware frames
315  // and both have buffers reported to satisfy a minimal size.
316 
317  // Copy data
318  uint count = GetNumPlanes(From->m_type);
319  for (uint plane = 0; plane < count; plane++)
320  {
321  CopyPlane(m_buffer + m_offsets[plane], m_pitches[plane],
322  From->m_buffer + From->m_offsets[plane], From->m_pitches[plane],
323  GetPitchForPlane(From->m_type, From->m_width, plane),
324  GetHeightForPlane(From->m_type, From->m_height, plane));
325  }
326 
327  // Copy metadata
328  // Not copied: codec, width, height - should already be the same
329  // Not copied: buf, size, pitches, offsets - should/could be different
330  // Not copied: priv - hardware frames only
331  m_aspect = From->m_aspect;
332  m_frameRate = From->m_frameRate;
336  m_timecode = From->m_timecode;
338  m_interlaced = From->m_interlaced;
341  m_newGOP = From->m_newGOP;
342  m_repeatPic = From->m_repeatPic;
343  m_forceKey = From->m_forceKey;
344  m_dummy = From->m_dummy;
345  m_pauseFrame = From->m_pauseFrame;
346  m_pixFmt = From->m_pixFmt;
347  m_swPixFmt = From->m_swPixFmt;
349  m_colorspace = From->m_colorspace;
350  m_colorrange = From->m_colorrange;
356  m_rotation = From->m_rotation;
357  m_stereo3D = From->m_stereo3D;
364 
365  return true;
366 }
367 
369 {
370  switch (Type)
371  {
372  case FMT_NONE: return "None";
373  case FMT_RGB24: return "RGB24";
374  case FMT_YV12: return "YUV420P";
375  case FMT_RGB32: return "RGB32";
376  case FMT_ARGB32: return "ARGB32";
377  case FMT_RGBA32: return "RGBA32";
378  case FMT_YUV422P: return "YUV422P";
379  case FMT_BGRA: return "BGRA";
380  case FMT_YUY2: return "YUY2";
381  case FMT_NV12: return "NV12";
382  case FMT_P010: return "P010";
383  case FMT_P016: return "P016";
384  case FMT_YUV420P9: return "YUV420P9";
385  case FMT_YUV420P10: return "YUV420P10";
386  case FMT_YUV420P12: return "YUV420P12";
387  case FMT_YUV420P14: return "YUV420P14";
388  case FMT_YUV420P16: return "YUV420P16";
389  case FMT_YUV422P9: return "YUV422P9";
390  case FMT_YUV422P10: return "YUV422P10";
391  case FMT_YUV422P12: return "YUV422P12";
392  case FMT_YUV422P14: return "YUV422P14";
393  case FMT_YUV422P16: return "YUV422P16";
394  case FMT_YUV444P: return "YUV444P";
395  case FMT_YUV444P9: return "YUV444P9";
396  case FMT_YUV444P10: return "YUV444P10";
397  case FMT_YUV444P12: return "YUV444P12";
398  case FMT_YUV444P14: return "YUV444P14";
399  case FMT_YUV444P16: return "YUV444P16";
400  case FMT_VDPAU: return "VDPAU";
401  case FMT_VAAPI: return "VAAPI";
402  case FMT_DXVA2: return "DXVA2";
403  case FMT_MMAL: return "MMAL";
404  case FMT_MEDIACODEC: return "MediaCodec";
405  case FMT_VTB: return "VideoToolBox";
406  case FMT_NVDEC: return "NVDec";
407  case FMT_DRMPRIME: return "DRM-PRIME";
408  }
409  return "?";
410 }
411 
412 size_t MythVideoFrame::GetBufferSize(VideoFrameType Type, int Width, int Height, int Aligned)
413 {
414  // bits per pixel div common factor
415  int bpp = BitsPerPixel(Type) / 4;
416  // bits per byte div common factor
417  int bpb = 8 / 4;
418 
419  // Align height and width. We always align height to 16 rows and the *default*
420  // width alignment is 64bytes, which allows SIMD operations on subsampled
421  // planes (i.e. 32byte alignment)
422  int adj_w = Aligned ? ((Width + Aligned - 1) & ~(Aligned - 1)) : Width;
423  int adj_h = (Height + MYTH_HEIGHT_ALIGNMENT - 1) & ~(MYTH_HEIGHT_ALIGNMENT - 1);
424 
425  // Calculate rounding as necessary.
426  int remainder = (adj_w * adj_h * bpp) % bpb;
427  return static_cast<uint>(((adj_w * adj_h * bpp) / bpb) + (remainder ? 1 : 0));
428 }
429 
430 uint8_t *MythVideoFrame::GetAlignedBuffer(size_t Size)
431 {
432  return static_cast<uint8_t*>(av_malloc(Size + 64));
433 }
434 
435 uint8_t *MythVideoFrame::CreateBuffer(VideoFrameType Type, int Width, int Height)
436 {
437  size_t size = GetBufferSize(Type, Width, Height);
438  return GetAlignedBuffer(size);
439 }
440 
442 {
444  if (options & Type)
445  return GetDeinterlacer(options);
446  return DEINT_NONE;
447 }
448 
450 {
452  if (options & Type)
453  return GetDeinterlacer(options);
454  return DEINT_NONE;
455 }
456 
458 {
459  return Option & (DEINT_BASIC | DEINT_MEDIUM | DEINT_HIGH);
460 }
461 
463 {
464  MythDeintType deint = GetDeinterlacer(Deint);
465  QString result = DoubleRate ? "2x " : "";
466  if (Deint & DEINT_CPU)
467  {
468  result += "CPU ";
469  switch (deint)
470  {
471  case DEINT_HIGH: return result + "Yadif";
472  case DEINT_MEDIUM: return result + "Linearblend";
473  case DEINT_BASIC: return result + "Onefield";
474  default: break;
475  }
476  }
477  else if (Deint & DEINT_SHADER)
478  {
479  result += "GLSL ";
480  switch (deint)
481  {
482  case DEINT_HIGH: return result + "Kernel";
483  case DEINT_MEDIUM: return result + "Linearblend";
484  case DEINT_BASIC: return result + "Onefield";
485  default: break;
486  }
487  }
488  else if (Deint & DEINT_DRIVER)
489  {
490  switch (Format)
491  {
492  case FMT_MEDIACODEC: return "MediaCodec";
493  case FMT_DRMPRIME: return result + "EGL Onefield";
494  case FMT_VDPAU:
495  result += "VDPAU ";
496  switch (deint)
497  {
498  case DEINT_HIGH: return result + "Advanced";
499  case DEINT_MEDIUM: return result + "Temporal";
500  case DEINT_BASIC: return result + "Basic";
501  default: break;
502  }
503  break;
504  case FMT_NVDEC:
505  result += "NVDec ";
506  switch (deint)
507  {
508  case DEINT_HIGH:
509  case DEINT_MEDIUM: return result + "Adaptive";
510  case DEINT_BASIC: return result + "Basic";
511  default: break;
512  }
513  break;
514  case FMT_VAAPI:
515  result += "VAAPI ";
516  switch (deint)
517  {
518  case DEINT_HIGH: return result + "Compensated";
519  case DEINT_MEDIUM: return result + "Adaptive";
520  case DEINT_BASIC: return result + "Basic";
521  default: break;
522  }
523  break;
524  default: break;
525  }
526  }
527  return "None";
528 }
529 
531 {
532  if (DEINT_NONE == Deint)
533  return {"None"};
534  QString result;
535  if (Deint & DEINT_BASIC) result = "Basic";
536  else if (Deint & DEINT_MEDIUM) result = "Medium";
537  else if (Deint & DEINT_HIGH) result = "High";
538  if (Deint & DEINT_CPU) result += "|CPU";
539  if (Deint & DEINT_SHADER) result += "|GLSL";
540  if (Deint & DEINT_DRIVER) result += "|DRIVER";
541  return result;
542 }
543 
545 {
546  MythDeintType result = DEINT_NONE;
547 
548  if (Deinterlacer.contains(DEINT_QUALITY_HIGH))
549  result = DEINT_HIGH;
550  else if (Deinterlacer.contains(DEINT_QUALITY_MEDIUM))
551  result = DEINT_MEDIUM;
552  else if (Deinterlacer.contains(DEINT_QUALITY_LOW))
553  result = DEINT_BASIC;
554 
555  if (result != DEINT_NONE)
556  {
557  result = result | DEINT_CPU; // NB always assumed
558  if (Deinterlacer.contains(DEINT_QUALITY_SHADER))
559  result = result | DEINT_SHADER;
560  if (Deinterlacer.contains(DEINT_QUALITY_DRIVER))
561  result = result | DEINT_DRIVER;
562  }
563 
564  return result;
565 }
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:62
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:49
FMT_ARGB32
@ FMT_ARGB32
Definition: mythframe.h:34
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:57
MythVideoFrame::m_colorspace
int m_colorspace
Definition: mythframe.h:148
MythVideoFrame::GetDoubleRateOption
MythDeintType GetDoubleRateOption(MythDeintType Type, MythDeintType Override=DEINT_NONE) const
Definition: mythframe.cpp:449
MythVideoFrame::m_colortransfer
int m_colortransfer
Definition: mythframe.h:151
MythVideoFrame::GetPitchForPlane
static int GetPitchForPlane(VideoFrameType Type, int Width, uint Plane)
Definition: mythframe.h:304
MythVideoFrame::m_interlaced
int m_interlaced
Definition: mythframe.h:134
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:28
MythVideoFrame::m_newGOP
bool m_newGOP
Definition: mythframe.h:137
MythVideoFrame::ParseDeinterlacer
static MythDeintType ParseDeinterlacer(const QString &Deinterlacer)
Definition: mythframe.cpp:544
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:46
MythVideoFrame::PackedFormat
static bool PackedFormat(VideoFrameType Type)
Definition: mythframe.h:461
MythVideoFrame::m_deinterlaceAllowed
MythDeintType m_deinterlaceAllowed
Definition: mythframe.h:160
DEINT_QUALITY_MEDIUM
static constexpr const char * DEINT_QUALITY_MEDIUM
Definition: mythvideoprofile.h:19
MythVideoFrame::ClearBufferToBlank
void ClearBufferToBlank()
Definition: mythframe.cpp:205
MythVideoFrame::m_chromalocation
int m_chromalocation
Definition: mythframe.h:152
MythVideoFrame::m_frameCounter
uint64_t m_frameCounter
Definition: mythframe.h:130
DEINT_QUALITY_HIGH
static constexpr const char * DEINT_QUALITY_HIGH
Definition: mythvideoprofile.h:20
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:63
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:29
MythDate::Format
Format
Definition: mythdate.h:15
MythVideoFrame::m_width
int m_width
Definition: mythframe.h:121
FMT_P016
@ FMT_P016
Definition: mythframe.h:55
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythVideoFrame::Init
void Init(VideoFrameType Type, int Width, int Height, const VideoFrameTypes *RenderFormats=nullptr)
Definition: mythframe.cpp:42
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:22
MythVideoFrame::HardwareFormat
static bool HardwareFormat(VideoFrameType Type)
Definition: mythframe.h:425
mythframe.h
MythVideoFrame::FormatIs422
static bool FormatIs422(VideoFrameType Type)
Definition: mythframe.h:444
MythVideoFrame::m_forceKey
bool m_forceKey
Definition: mythframe.h:139
MythVideoFrame::m_offsets
FrameOffsets m_offsets
Definition: mythframe.h:143
MythVideoFrame::m_displayTimecode
std::chrono::milliseconds m_displayTimecode
Definition: mythframe.h:132
MythVideoFrame::m_interlacedReverse
bool m_interlacedReverse
Definition: mythframe.h:136
FMT_RGB24
@ FMT_RGB24
Definition: mythframe.h:31
MythDeintType
MythDeintType
Definition: mythframe.h:67
MythVideoFrame::m_dummy
bool m_dummy
Definition: mythframe.h:140
MythVideoFrame::m_rotation
int m_rotation
Definition: mythframe.h:155
MythVideoFrame::BitsPerPixel
static int BitsPerPixel(VideoFrameType Type)
Definition: mythframe.h:170
MythVideoFrame::m_colorrange
int m_colorrange
Definition: mythframe.h:149
MythVideoFrame::m_deinterlaceDouble
MythDeintType m_deinterlaceDouble
Definition: mythframe.h:159
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:58
MythVideoFrame::GetBufferSize
static size_t GetBufferSize(VideoFrameType Type, int Width, int Height, int Aligned=MYTH_WIDTH_ALIGNMENT)
Definition: mythframe.cpp:412
mythlogging.h
FMT_P010
@ FMT_P010
Definition: mythframe.h:54
MythVideoFrame::m_colorshifted
bool m_colorshifted
Definition: mythframe.h:153
FMT_YUY2
@ FMT_YUY2
Definition: mythframe.h:51
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:40
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:37
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:47
MythVideoFrame::CopyPlane
static void CopyPlane(uint8_t *To, int ToPitch, const uint8_t *From, int FromPitch, int PlaneWidth, int PlaneHeight)
Definition: mythframe.cpp:188
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:53
MythVideoFrame::m_pixFmt
int m_pixFmt
Definition: mythframe.h:144
MythVideoFrame::m_alreadyDeinterlaced
bool m_alreadyDeinterlaced
Definition: mythframe.h:154
MythVideoFrame::m_timecode
std::chrono::milliseconds m_timecode
Definition: mythframe.h:131
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:83
DEINT_DRIVER
@ DEINT_DRIVER
Definition: mythframe.h:75
DEINT_SHADER
@ DEINT_SHADER
Definition: mythframe.h:74
formats
const std::array< const std::string, 8 > formats
Definition: vbilut.cpp:189
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:25
DEINT_QUALITY_DRIVER
static constexpr const char * DEINT_QUALITY_DRIVER
Definition: mythvideoprofile.h:22
MythVideoFrame::m_frameNumber
long long m_frameNumber
Definition: mythframe.h:129
VideoFrameType
VideoFrameType
Definition: mythframe.h:20
DEINT_BASIC
@ DEINT_BASIC
Definition: mythframe.h:70
MythVideoFrame::CreateBuffer
static uint8_t * CreateBuffer(VideoFrameType Type, int Width, int Height)
Definition: mythframe.cpp:435
MythVideoFrame::m_bufferSize
size_t m_bufferSize
Definition: mythframe.h:124
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:48
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:24
MythVideoFrame::ColorDepth
static int ColorDepth(int Format)
Definition: mythframe.h:399
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:64
FMT_RGBA32
@ FMT_RGBA32
Definition: mythframe.h:35
MythVideoFrame::m_colorprimaries
int m_colorprimaries
Definition: mythframe.h:150
MythVideoFrame::m_pauseFrame
bool m_pauseFrame
Definition: mythframe.h:141
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:38
MythVideoFrame::m_directRendering
bool m_directRendering
Definition: mythframe.h:146
mythvideoprofile.h
uint
unsigned int uint
Definition: compat.h:81
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:69
DEINT_HIGH
@ DEINT_HIGH
Definition: mythframe.h:72
MythVideoFrame::GetDeinterlacer
static MythDeintType GetDeinterlacer(MythDeintType Option)
Definition: mythframe.cpp:457
MythVideoFrame::m_renderFormats
const VideoFrameTypes * m_renderFormats
Definition: mythframe.h:147
DEINT_CPU
@ DEINT_CPU
Definition: mythframe.h:73
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:42
DEINT_QUALITY_LOW
static constexpr const char * DEINT_QUALITY_LOW
Definition: mythvideoprofile.h:18
MythVideoFrame::FormatIs444
static bool FormatIs444(VideoFrameType Type)
Definition: mythframe.h:450
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:26
MythVideoFrame::DeinterlacerPref
static QString DeinterlacerPref(MythDeintType Deint)
Definition: mythframe.cpp:530
MythVideoFrame::m_pitches
FramePitches m_pitches
Definition: mythframe.h:142
MythVideoFrame::m_topFieldFirst
bool m_topFieldFirst
Definition: mythframe.h:135
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:44
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:45
DEINT_MEDIUM
@ DEINT_MEDIUM
Definition: mythframe.h:71
MythVideoFrame::FormatIs420
static bool FormatIs420(VideoFrameType Type)
Definition: mythframe.h:438
MythVideoFrame::GetSingleRateOption
MythDeintType GetSingleRateOption(MythDeintType Type, MythDeintType Override=DEINT_NONE) const
Definition: mythframe.cpp:441
MythVideoFrame::GetHeightForPlane
static int GetHeightForPlane(VideoFrameType Type, int Height, uint Plane)
Definition: mythframe.h:258
DEINT_QUALITY_SHADER
static constexpr const char * DEINT_QUALITY_SHADER
Definition: mythvideoprofile.h:21
MythVideoFrame::m_stereo3D
uint m_stereo3D
Definition: mythframe.h:156
Buffer
Definition: MythExternControl.h:36
MythVideoFrame::m_repeatPic
bool m_repeatPic
Definition: mythframe.h:138
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:60
MythVideoFrame::FormatDescription
static QString FormatDescription(VideoFrameType Type)
Definition: mythframe.cpp:368
MythVideoFrame::kDefaultRenderFormats
static const VideoFrameTypes kDefaultRenderFormats
Definition: mythframe.h:91
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:119
MythVideoFrame::DeinterlacerName
static QString DeinterlacerName(MythDeintType Deint, bool DoubleRate, VideoFrameType Format=FMT_NONE)
Definition: mythframe.cpp:462
MythVideoFrame::m_swPixFmt
int m_swPixFmt
Definition: mythframe.h:145
MythVideoFrame::MythVideoFrame
MythVideoFrame()=default
FMT_BGRA
@ FMT_BGRA
Definition: mythframe.h:32
MythVideoFrame::GetNumPlanes
static uint GetNumPlanes(VideoFrameType Type)
Definition: mythframe.h:214
MythVideoFrame::m_height
int m_height
Definition: mythframe.h:122
MythVideoFrame::m_bitsPerPixel
int m_bitsPerPixel
Definition: mythframe.h:123
MythVideoFrame::ClearMetadata
void ClearMetadata()
Definition: mythframe.cpp:149
FMT_DXVA2
@ FMT_DXVA2
Definition: mythframe.h:59
MYTH_HEIGHT_ALIGNMENT
static constexpr uint8_t MYTH_HEIGHT_ALIGNMENT
Definition: mythframe.h:18
MythVideoFrame::GetAlignedBuffer
static uint8_t * GetAlignedBuffer(size_t Size)
Definition: mythframe.cpp:430
MythVideoFrame::~MythVideoFrame
~MythVideoFrame()
Definition: mythframe.cpp:22
FMT_RGB32
@ FMT_RGB32
endian dependent format, ARGB or BGRA
Definition: mythframe.h:33
LOC
#define LOC
Definition: mythframe.cpp:11
MythVideoFrame
Definition: mythframe.h:88
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:41
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:61
MythVideoFrame::m_deinterlaceInuse
MythDeintType m_deinterlaceInuse
Definition: mythframe.h:161
MythVideoFrame::m_hdrMetadata
MythHDRVideoPtr m_hdrMetadata
Definition: mythframe.h:157
MythVideoFrame::CopyFrame
bool CopyFrame(MythVideoFrame *From)
Definition: mythframe.cpp:275
build_compdb.options
options
Definition: build_compdb.py:11
MythVideoFrame::FormatIsNV12
static bool FormatIsNV12(VideoFrameType Type)
Definition: mythframe.h:456
MythVideoFrame::m_frameRate
double m_frameRate
Definition: mythframe.h:128
MythVideoFrame::m_deinterlaceSingle
MythDeintType m_deinterlaceSingle
Definition: mythframe.h:158
MythVideoFrame::m_deinterlaceInuse2x
bool m_deinterlaceInuse2x
Definition: mythframe.h:162
MythVideoFrame::m_aspect
float m_aspect
Definition: mythframe.h:127
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:39
MythVideoFrame::m_priv
std::array< uint8_t *, 4 > m_priv
Definition: mythframe.h:133
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:27
MythVideoFrame::m_buffer
uint8_t * m_buffer
Definition: mythframe.h:120