MythTV  master
mythframe.h
Go to the documentation of this file.
1 #ifndef MYTHFRAME_H
2 #define MYTHFRAME_H
3 
4 #include <array>
5 #include <cstdint>
6 #include <cstring>
7 #include <vector>
8 
9 #include "mythtvexp.h" // for MTV_PUBLIC
10 #include "mythaverror.h"
11 
12 extern "C" {
13 #include "libavcodec/avcodec.h"
14 }
15 
16 #define MYTH_WIDTH_ALIGNMENT 64
17 #define MYTH_HEIGHT_ALIGNMENT 16
19 {
20  FMT_NONE = -1,
21  // YV12 and variants
22  FMT_YV12 = 0,
28  // RGB variants
34  // YUV422P and variants
41  // YUV444P and variants
48  // Packed YUV
50  // NV12 and variants
54  // hardware formats
63 };
64 
65 const char* format_description(VideoFrameType Type);
66 
67 static inline bool format_is_hw(VideoFrameType Type)
68 {
69  return (Type == FMT_VDPAU) || (Type == FMT_VAAPI) ||
70  (Type == FMT_DXVA2) || (Type == FMT_MMAL) ||
71  (Type == FMT_MEDIACODEC) || (Type == FMT_VTB) ||
72  (Type == FMT_NVDEC) || (Type == FMT_DRMPRIME);
73 }
74 
75 static inline bool format_is_hwframes(VideoFrameType Type)
76 {
77  return (Type == FMT_VDPAU) || (Type == FMT_VAAPI) || (Type == FMT_NVDEC);
78 }
79 
80 static inline bool format_is_420(VideoFrameType Type)
81 {
82  return (Type == FMT_YV12) || (Type == FMT_YUV420P9) || (Type == FMT_YUV420P10) ||
83  (Type == FMT_YUV420P12) || (Type == FMT_YUV420P14) || (Type == FMT_YUV420P16);
84 }
85 
86 static inline bool format_is_422(VideoFrameType Type)
87 {
88  return (Type == FMT_YUV422P) || (Type == FMT_YUV422P9) || (Type == FMT_YUV422P10) ||
89  (Type == FMT_YUV422P12) || (Type == FMT_YUV422P14) || (Type == FMT_YUV422P16);
90 }
91 
92 static inline bool format_is_444(VideoFrameType Type)
93 {
94  return (Type == FMT_YUV444P) || (Type == FMT_YUV444P9) || (Type == FMT_YUV444P10) ||
95  (Type == FMT_YUV444P12) || (Type == FMT_YUV444P14) || (Type == FMT_YUV444P16);
96 
97 }
98 
99 static inline bool format_is_nv12(VideoFrameType Type)
100 {
101  return (Type == FMT_NV12) || (Type == FMT_P010) || (Type == FMT_P016);
102 }
103 
104 static inline bool format_is_packed(VideoFrameType Type)
105 {
106  return Type == FMT_YUY2;
107 }
108 
109 static inline bool format_is_yuv(VideoFrameType Type)
110 {
111  return format_is_420(Type) || format_is_422(Type) || format_is_444(Type) ||
112  format_is_nv12(Type) || format_is_packed(Type);
113 }
114 
116 {
117  DEINT_NONE = 0x0000,
118  DEINT_BASIC = 0x0001,
119  DEINT_MEDIUM = 0x0002,
120  DEINT_HIGH = 0x0004,
121  DEINT_CPU = 0x0010,
122  DEINT_SHADER = 0x0020,
123  DEINT_DRIVER = 0x0040,
124  DEINT_ALL = 0x0077
125 };
126 
127 inline MythDeintType operator| (MythDeintType a, MythDeintType b) { return static_cast<MythDeintType>(static_cast<int>(a) | static_cast<int>(b)); }
128 inline MythDeintType operator& (MythDeintType a, MythDeintType b) { return static_cast<MythDeintType>(static_cast<int>(a) & static_cast<int>(b)); }
129 inline MythDeintType operator~ (MythDeintType a) { return static_cast<MythDeintType>(~(static_cast<int>(a))); }
130 
131 using FramePitches = std::array<int,3>;
132 using FrameOffsets = std::array<int,3>;
133 
135 {
137  unsigned char *buf;
138 
139  int width;
140  int height;
141  float aspect;
142  double frame_rate;
143  int bpp;
144  int size;
145  long long frameNumber;
146  long long frameCounter;
147  long long timecode;
148  int64_t disp_timecode;
149  std::array<uint8_t*,4> priv;
153  bool new_gop;
155  bool forcekey;
156  bool dummy;
160  int pix_fmt;
170  int rotation;
177 };
178 
179 using VideoFrameTypeVec = std::vector<VideoFrameType>;
180 
181 int MTV_PUBLIC ColorDepth(int Format);
182 
186 
187 enum class uswcState {
188  Detect,
189  Use_SSE,
190  Use_SW
191 };
192 
194 {
195 public:
196  explicit MythUSWCCopy(int width, bool nocache = false);
197  virtual ~MythUSWCCopy();
198 
199  void copy(VideoFrame *dst, const VideoFrame *src);
200  void reset(int width);
201  void resetUSWCDetection(void);
202  void setUSWC(bool uswc);
203 
204 private:
205  void allocateCache(int width);
206 
207  uint8_t* m_cache {nullptr};
208  int m_size {0};
210 };
211 
212 void MTV_PUBLIC framecopy(VideoFrame *dst, const VideoFrame *src,
213  bool useSSE = true);
214 
215 static inline int bitsperpixel(VideoFrameType type);
216 static inline int pitch_for_plane(VideoFrameType Type, int Width, uint Plane);
217 static inline int height_for_plane(VideoFrameType Type, int Height, uint Plane);
218 
219 using mavtriplet = std::array<int,3>;
220 using mavtripletptr = mavtriplet::const_pointer;
221 
222 static inline void init(VideoFrame *vf, VideoFrameType _codec,
223  unsigned char *_buf, int _width, int _height,
224  int _size,
225  const FramePitches p,
226  const FrameOffsets o,
227  bool arrays_valid = true,
228  float _aspect = -1.0F, double _rate = -1.0F,
229  int _aligned = MYTH_WIDTH_ALIGNMENT)
230 {
231  vf->bpp = bitsperpixel(_codec);
232  vf->codec = _codec;
233  vf->buf = _buf;
234  vf->width = _width;
235  vf->height = _height;
236  vf->aspect = _aspect;
237  vf->frame_rate = _rate;
238  vf->size = _size;
239  vf->frameNumber = 0;
240  vf->frameCounter = 0;
241  vf->timecode = 0;
242  vf->interlaced_frame = 1;
243  vf->interlaced_reversed = false;
244  vf->new_gop = false;
245  vf->top_field_first = true;
246  vf->repeat_pict = false;
247  vf->forcekey = false;
248  vf->dummy = false;
249  vf->pause_frame = false;
250  vf->pix_fmt = 0;
251  vf->sw_pix_fmt = -1; // AV_PIX_FMT_NONE
252  vf->directrendering = true;
253  vf->colorspace = 1; // BT.709
254  vf->colorrange = 1; // normal/mpeg
255  vf->colorprimaries = 1; // BT.709
256  vf->colortransfer = 1; // BT.709
257  vf->chromalocation = 1; // default 4:2:0
258  vf->colorshifted = false;
259  vf->already_deinterlaced = false;
260  vf->rotation = 0;
261  vf->stereo3D = 0;
266  vf->deinterlace_inuse2x = false;
267  vf->priv.fill(nullptr);
268 
269  int width_aligned = 0;
270  int height_aligned = (_height + MYTH_HEIGHT_ALIGNMENT - 1) & ~(MYTH_HEIGHT_ALIGNMENT -1);
271  if (!_aligned)
272  width_aligned = _width;
273  else
274  width_aligned = (_width + _aligned - 1) & ~(_aligned - 1);
275 
276  if (arrays_valid)
277  {
278  vf->pitches = p;
279  }
280  else
281  {
282  for (uint i = 0; i < 3; ++i)
283  vf->pitches[i] = pitch_for_plane(_codec, width_aligned, i);
284  }
285 
286  if (arrays_valid)
287  {
288  vf->offsets = o;
289  }
290  else
291  {
292  vf->offsets[0] = 0;
293  if (FMT_YV12 == _codec)
294  {
295  vf->offsets[1] = width_aligned * height_aligned;
296  vf->offsets[2] = vf->offsets[1] + ((width_aligned + 1) >> 1) * ((height_aligned+1) >> 1);
297  }
298  else if (format_is_420(_codec))
299  {
300  vf->offsets[1] = (width_aligned << 1) * height_aligned;
301  vf->offsets[2] = vf->offsets[1] + (width_aligned * (height_aligned >> 1));
302  }
303  else if (FMT_YUV422P == _codec)
304  {
305  vf->offsets[1] = width_aligned * height_aligned;
306  vf->offsets[2] = vf->offsets[1] + ((width_aligned + 1) >> 1) * height_aligned;
307  }
308  else if (format_is_422(_codec))
309  {
310  vf->offsets[1] = (width_aligned << 1) * height_aligned;
311  vf->offsets[2] = vf->offsets[1] + (width_aligned * height_aligned);
312  }
313  else if (FMT_YUV444P == _codec)
314  {
315  vf->offsets[1] = width_aligned * height_aligned;
316  vf->offsets[2] = vf->offsets[1] + (width_aligned * height_aligned);
317  }
318  else if (format_is_444(_codec))
319  {
320  vf->offsets[1] = (width_aligned << 1) * height_aligned;
321  vf->offsets[2] = vf->offsets[1] + ((width_aligned << 1) * height_aligned);
322  }
323  else if (FMT_NV12 == _codec)
324  {
325  vf->offsets[1] = width_aligned * height_aligned;
326  vf->offsets[2] = 0;
327  }
328  else if (format_is_nv12(_codec))
329  {
330  vf->offsets[1] = (width_aligned << 1) * height_aligned;
331  vf->offsets[2] = 0;
332  }
333  else
334  {
335  vf->offsets[1] = vf->offsets[2] = 0;
336  }
337  }
338 }
339 
340 static inline void init(VideoFrame *vf, VideoFrameType _codec,
341  unsigned char *_buf, int _width, int _height, int _size,
342  float _aspect = -1.0F, double _rate = -1.0F,
343  int _aligned = MYTH_WIDTH_ALIGNMENT)
344 {
345  init(vf, _codec, _buf, _width, _height, _size, {}, {}, false,
346  _aspect, _rate, _aligned);
347 }
348 
349 static inline int pitch_for_plane(VideoFrameType Type, int Width, uint Plane)
350 {
351  switch (Type)
352  {
353  case FMT_YV12:
354  case FMT_YUV422P:
355  if (Plane == 0) return Width;
356  if (Plane < 3) return (Width + 1) >> 1;
357  break;
358  case FMT_YUV420P9:
359  case FMT_YUV420P10:
360  case FMT_YUV420P12:
361  case FMT_YUV420P14:
362  case FMT_YUV420P16:
363  case FMT_YUV422P9:
364  case FMT_YUV422P10:
365  case FMT_YUV422P12:
366  case FMT_YUV422P14:
367  case FMT_YUV422P16:
368  if (Plane == 0) return Width << 1;
369  if (Plane < 3) return Width;
370  break;
371  case FMT_YUV444P:
372  case FMT_YUV444P9:
373  case FMT_YUV444P10:
374  case FMT_YUV444P12:
375  case FMT_YUV444P14:
376  case FMT_YUV444P16:
377  if (Plane < 3) return Width;
378  break;
379  case FMT_NV12:
380  if (Plane < 2) return Width;
381  break;
382  case FMT_P010:
383  case FMT_P016:
384  if (Plane < 2) return Width << 1;
385  break;
386  case FMT_YUY2:
387  case FMT_RGB24:
388  case FMT_ARGB32:
389  case FMT_RGBA32:
390  case FMT_BGRA:
391  case FMT_RGB32:
392  if (Plane == 0) return (bitsperpixel(Type) * Width) >> 3;
393  break;
394  default: break; // None and hardware formats
395  }
396  return 0;
397 }
398 
399 static inline int width_for_plane(VideoFrameType Type, int Width, uint Plane)
400 {
401  switch (Type)
402  {
403  case FMT_YV12:
404  case FMT_YUV420P9:
405  case FMT_YUV420P10:
406  case FMT_YUV420P12:
407  case FMT_YUV420P14:
408  case FMT_YUV420P16:
409  case FMT_YUV422P:
410  case FMT_YUV422P9:
411  case FMT_YUV422P10:
412  case FMT_YUV422P12:
413  case FMT_YUV422P14:
414  case FMT_YUV422P16:
415  if (Plane == 0) return Width;
416  if (Plane < 3) return (Width + 1) >> 1;
417  break;
418  case FMT_YUV444P:
419  case FMT_YUV444P9:
420  case FMT_YUV444P10:
421  case FMT_YUV444P12:
422  case FMT_YUV444P14:
423  case FMT_YUV444P16:
424  if (Plane < 3) return Width;
425  break;
426  case FMT_NV12:
427  case FMT_P010:
428  case FMT_P016:
429  if (Plane < 2) return Width;
430  break;
431  case FMT_YUY2:
432  case FMT_RGB24:
433  case FMT_ARGB32:
434  case FMT_RGBA32:
435  case FMT_BGRA:
436  case FMT_RGB32:
437  if (Plane == 0) return Width;
438  break;
439  default: break; // None and hardware formats
440  }
441  return 0;
442 }
443 
444 static inline int height_for_plane(VideoFrameType Type, int Height, uint Plane)
445 {
446  switch (Type)
447  {
448  case FMT_YV12:
449  case FMT_YUV420P9:
450  case FMT_YUV420P10:
451  case FMT_YUV420P12:
452  case FMT_YUV420P14:
453  case FMT_YUV420P16:
454  if (Plane == 0) return Height;
455  if (Plane < 3) return Height >> 1;
456  break;
457  case FMT_YUV422P:
458  case FMT_YUV422P9:
459  case FMT_YUV422P10:
460  case FMT_YUV422P12:
461  case FMT_YUV422P14:
462  case FMT_YUV422P16:
463  case FMT_YUV444P:
464  case FMT_YUV444P9:
465  case FMT_YUV444P10:
466  case FMT_YUV444P12:
467  case FMT_YUV444P14:
468  case FMT_YUV444P16:
469  if (Plane < 3) return Height;
470  break;
471  case FMT_NV12:
472  case FMT_P010:
473  case FMT_P016:
474  if (Plane == 0) return Height;
475  if (Plane < 2) return Height >> 1;
476  break;
477  case FMT_YUY2:
478  case FMT_RGB24:
479  case FMT_ARGB32:
480  case FMT_RGBA32:
481  case FMT_BGRA:
482  case FMT_RGB32:
483  if (Plane == 0) return Height;
484  break;
485  default: break; // None and hardware formats
486  }
487  return 0;
488 }
489 static inline void clear(VideoFrame *vf)
490 {
491  if (!vf || (vf && !vf->buf))
492  return;
493 
494  // luma (or RGBA)
495  int uv_height = height_for_plane(vf->codec, vf->height, 1);
496  int uv = (1 << (ColorDepth(vf->codec) - 1)) - 1;
497  if (FMT_YV12 == vf->codec || FMT_YUV422P == vf->codec || FMT_YUV444P == vf->codec)
498  {
499  memset(vf->buf + vf->offsets[0], 0, static_cast<size_t>(vf->pitches[0] * vf->height));
500  memset(vf->buf + vf->offsets[1], uv & 0xff, static_cast<size_t>(vf->pitches[1] * uv_height));
501  memset(vf->buf + vf->offsets[2], uv & 0xff, static_cast<size_t>(vf->pitches[2] * uv_height));
502  }
503  else if ((format_is_420(vf->codec) || format_is_422(vf->codec) || format_is_444(vf->codec)) && (vf->pitches[1] == vf->pitches[2]))
504  {
505  memset(vf->buf + vf->offsets[0], 0, static_cast<size_t>(vf->pitches[0] * vf->height));
506  unsigned char uv1 = (uv & 0xff00) >> 8;
507  unsigned char uv2 = (uv & 0x00ff);
508  unsigned char* buf1 = vf->buf + vf->offsets[1];
509  unsigned char* buf2 = vf->buf + vf->offsets[2];
510  for (int row = 0; row < uv_height; ++row)
511  {
512  for (int col = 0; col < vf->pitches[1]; col += 2)
513  {
514  buf1[col] = buf2[col] = uv1;
515  buf1[col + 1] = buf2[col + 1] = uv2;
516  }
517  buf1 += vf->pitches[1];
518  buf2 += vf->pitches[2];
519  }
520  }
521  else if (FMT_NV12 == vf->codec)
522  {
523  memset(vf->buf + vf->offsets[0], 0, static_cast<size_t>(vf->pitches[0] * vf->height));
524  memset(vf->buf + vf->offsets[1], uv & 0xff, vf->pitches[1] * uv_height);
525  }
526  else if (format_is_nv12(vf->codec))
527  {
528  memset(vf->buf + vf->offsets[0], 0, static_cast<size_t>(vf->pitches[0] * vf->height));
529  unsigned char uv1 = (uv & 0xff00) >> 8;
530  unsigned char uv2 = (uv & 0x00ff);
531  unsigned char* buf = vf->buf + vf->offsets[1];
532  for (int row = 0; row < uv_height; ++row)
533  {
534  for (int col = 0; col < vf->pitches[1]; col += 4)
535  {
536  buf[col] = buf[col + 2] = uv1;
537  buf[col + 1] = buf[col + 3] = uv2;
538  }
539  buf += vf->pitches[1];
540  }
541  }
542 }
543 
544 static inline void copyplane(uint8_t* dst, int dst_pitch,
545  const uint8_t* src, int src_pitch,
546  int width, int height)
547 {
548  if ((dst_pitch == width) && (src_pitch == width))
549  {
550  memcpy(dst, src, static_cast<size_t>(width * height));
551  return;
552  }
553 
554  for (int y = 0; y < height; y++)
555  {
556  memcpy(dst, src, static_cast<size_t>(width));
557  src += src_pitch;
558  dst += dst_pitch;
559  }
560 }
561 
569 static inline void copy(VideoFrame *dst, const VideoFrame *src)
570 {
571  framecopy(dst, src, true);
572 }
573 
574 static inline uint planes(VideoFrameType Type)
575 {
576  switch (Type)
577  {
578  case FMT_YV12:
579  case FMT_YUV420P9:
580  case FMT_YUV420P10:
581  case FMT_YUV420P12:
582  case FMT_YUV420P14:
583  case FMT_YUV420P16:
584  case FMT_YUV422P:
585  case FMT_YUV422P9:
586  case FMT_YUV422P10:
587  case FMT_YUV422P12:
588  case FMT_YUV422P14:
589  case FMT_YUV422P16:
590  case FMT_YUV444P:
591  case FMT_YUV444P9:
592  case FMT_YUV444P10:
593  case FMT_YUV444P12:
594  case FMT_YUV444P14:
595  case FMT_YUV444P16: return 3;
596  case FMT_P010:
597  case FMT_P016:
598  case FMT_NV12: return 2;
599  case FMT_YUY2:
600  case FMT_BGRA:
601  case FMT_ARGB32:
602  case FMT_RGB24:
603  case FMT_RGB32:
604  case FMT_RGBA32: return 1;
605  case FMT_NONE:
606  case FMT_VDPAU:
607  case FMT_VAAPI:
608  case FMT_DXVA2:
609  case FMT_MEDIACODEC:
610  case FMT_NVDEC:
611  case FMT_MMAL:
612  case FMT_DRMPRIME:
613  case FMT_VTB: return 0;
614  }
615  return 0;
616 }
617 
618 static inline int bitsperpixel(VideoFrameType Type)
619 {
620  switch (Type)
621  {
622  case FMT_BGRA:
623  case FMT_RGBA32:
624  case FMT_ARGB32:
625  case FMT_RGB32:
626  case FMT_YUV422P9:
627  case FMT_YUV422P10:
628  case FMT_YUV422P12:
629  case FMT_YUV422P14:
630  case FMT_YUV422P16: return 32;
631  case FMT_RGB24: return 24;
632  case FMT_YUV422P:
633  case FMT_YUY2: return 16;
634  case FMT_YV12:
635  case FMT_NV12: return 12;
636  case FMT_YUV444P:
637  case FMT_P010:
638  case FMT_P016:
639  case FMT_YUV420P9:
640  case FMT_YUV420P10:
641  case FMT_YUV420P12:
642  case FMT_YUV420P14:
643  case FMT_YUV420P16: return 24;
644  case FMT_YUV444P9:
645  case FMT_YUV444P10:
646  case FMT_YUV444P12:
647  case FMT_YUV444P14:
648  case FMT_YUV444P16: return 48;
649  case FMT_NONE:
650  case FMT_VDPAU:
651  case FMT_VAAPI:
652  case FMT_DXVA2:
653  case FMT_MMAL:
654  case FMT_MEDIACODEC:
655  case FMT_NVDEC:
656  case FMT_DRMPRIME:
657  case FMT_VTB: break;
658  }
659  return 8;
660 }
661 
662 static inline size_t GetBufferSize(VideoFrameType Type, int Width, int Height,
663  int Aligned = MYTH_WIDTH_ALIGNMENT)
664 {
665  int type_bpp = bitsperpixel(Type);
666  int bpp = type_bpp / 4; /* bits per pixel div common factor */
667  int bpb = 8 / 4; /* bits per byte div common factor */
668 
669  // make sure all our pitches are a multiple of 16 bytes
670  // as U and V channels are half the size of Y channel
671  // This allow for SSE/HW accelerated code on all planes
672  // If the buffer sizes are not 32 bytes aligned, adjust.
673  // old versions of MythTV allowed people to set invalid
674  // dimensions for MPEG-4 capture, no need to segfault..
675  int adj_w = Aligned ? ((Width + Aligned - 1) & ~(Aligned - 1)) : Width;
676  int adj_h = (Height + MYTH_HEIGHT_ALIGNMENT - 1) & ~(MYTH_HEIGHT_ALIGNMENT - 1);
677 
678  // Calculate rounding as necessary.
679  int remainder = (adj_w * adj_h * bpp) % bpb;
680  return static_cast<uint>((adj_w * adj_h * bpp) / bpb + (remainder ? 1 : 0));
681 }
682 
683 static inline unsigned char* GetAlignedBuffer(size_t Size)
684 {
685  return static_cast<unsigned char*>(av_malloc(Size + 64));
686 }
687 
688 static inline unsigned char* GetAlignedBufferZero(size_t Size)
689 {
690  return static_cast<unsigned char*>(av_mallocz(Size + 64));
691 }
692 
693 static inline unsigned char* CreateBuffer(VideoFrameType Type, int Width, int Height)
694 {
695  size_t size = GetBufferSize(Type, Width, Height);
696  return GetAlignedBuffer(size);
697 }
698 
699 static inline unsigned char* CreateBufferZero(VideoFrameType Type, int Width, int Height)
700 {
701  size_t size = GetBufferSize(Type, Width, Height);
702  return GetAlignedBufferZero(size);
703 }
704 #endif /* MYTHFRAME_H */
FMT_MEDIACODEC
@ FMT_MEDIACODEC
Definition: mythframe.h:59
DEINT_DRIVER
@ DEINT_DRIVER
Definition: mythframe.h:123
VideoFrame::bpp
int bpp
Definition: mythframe.h:143
CreateBufferZero
static unsigned char * CreateBufferZero(VideoFrameType Type, int Width, int Height)
Definition: mythframe.h:699
DEINT_MEDIUM
@ DEINT_MEDIUM
Definition: mythframe.h:119
VideoFrame::forcekey
bool forcekey
hardware encoded .nuv
Definition: mythframe.h:155
format_is_444
static bool format_is_444(VideoFrameType Type)
Definition: mythframe.h:92
FMT_YUV420P10
@ FMT_YUV420P10
Definition: mythframe.h:24
mavtriplet
std::array< int, 3 > mavtriplet
Definition: mythframe.h:219
GetSingleRateOption
MythDeintType MTV_PUBLIC GetSingleRateOption(const VideoFrame *Frame, MythDeintType Type, MythDeintType Override=DEINT_NONE)
Definition: mythframe.cpp:842
GetBufferSize
static size_t GetBufferSize(VideoFrameType Type, int Width, int Height, int Aligned=MYTH_WIDTH_ALIGNMENT)
Definition: mythframe.h:662
FMT_YUV420P16
@ FMT_YUV420P16
Definition: mythframe.h:27
FMT_VTB
@ FMT_VTB
Definition: mythframe.h:60
DEINT_SHADER
@ DEINT_SHADER
Definition: mythframe.h:122
FMT_YUV420P14
@ FMT_YUV420P14
Definition: mythframe.h:26
FMT_DRMPRIME
@ FMT_DRMPRIME
Definition: mythframe.h:62
FMT_YUV444P10
@ FMT_YUV444P10
Definition: mythframe.h:44
format_is_420
static bool format_is_420(VideoFrameType Type)
Definition: mythframe.h:80
FMT_YUV422P14
@ FMT_YUV422P14
Definition: mythframe.h:39
framecopy
void MTV_PUBLIC framecopy(VideoFrame *dst, const VideoFrame *src, bool useSSE=true)
Definition: mythframe.cpp:330
mythtvexp.h
Frame
Definition: zmdefines.h:94
VideoFrame::timecode
long long timecode
Definition: mythframe.h:147
operator|
MythDeintType operator|(MythDeintType a, MythDeintType b)
Definition: mythframe.h:127
FMT_P010
@ FMT_P010
Definition: mythframe.h:52
VideoFrame::stereo3D
uint stereo3D
Definition: mythframe.h:171
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:117
operator~
MythDeintType operator~(MythDeintType a)
Definition: mythframe.h:129
FramePitches
std::array< int, 3 > FramePitches
Definition: mythframe.h:131
MythDate::Format
Format
Definition: mythdate.h:13
FMT_YUV422P
@ FMT_YUV422P
Definition: mythframe.h:35
VideoFrame::buf
unsigned char * buf
Definition: mythframe.h:137
DEINT_ALL
@ DEINT_ALL
Definition: mythframe.h:124
VideoFrame
Definition: mythframe.h:135
FrameOffsets
std::array< int, 3 > FrameOffsets
Definition: mythframe.h:132
VideoFrame::interlaced_reversed
bool interlaced_reversed
Definition: mythframe.h:152
VideoFrame::new_gop
bool new_gop
true for user override of scan
Definition: mythframe.h:153
VideoFrame::pitches
FramePitches pitches
Y, U, & V pitches.
Definition: mythframe.h:158
VideoFrame::deinterlace_single
MythDeintType deinterlace_single
Definition: mythframe.h:172
pitch_for_plane
static int pitch_for_plane(VideoFrameType Type, int Width, uint Plane)
Definition: mythframe.h:349
MythUSWCCopy
Definition: mythframe.h:194
format_is_hwframes
static bool format_is_hwframes(VideoFrameType Type)
Definition: mythframe.h:75
MYTH_HEIGHT_ALIGNMENT
#define MYTH_HEIGHT_ALIGNMENT
Definition: mythframe.h:17
FMT_YUV444P14
@ FMT_YUV444P14
Definition: mythframe.h:46
FMT_YUV444P
@ FMT_YUV444P
Definition: mythframe.h:42
VideoFrame::codec
VideoFrameType codec
Definition: mythframe.h:136
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:20
VideoFrame::colorrange
int colorrange
Definition: mythframe.h:164
bitsperpixel
static int bitsperpixel(VideoFrameType type)
Definition: mythframe.h:618
DEINT_CPU
@ DEINT_CPU
Definition: mythframe.h:121
format_description
const char * format_description(VideoFrameType Type)
Definition: mythframe.cpp:33
VideoFrame::repeat_pict
bool repeat_pict
used to unlock the scan type
Definition: mythframe.h:154
VideoFrame::offsets
FrameOffsets offsets
Y, U, & V offsets.
Definition: mythframe.h:159
format_is_hw
static bool format_is_hw(VideoFrameType Type)
Definition: mythframe.h:67
VideoFrame::rotation
int rotation
Definition: mythframe.h:170
copy
static void copy(VideoFrame *dst, const VideoFrame *src)
copy: copy one frame into another copy only works with the following assumptions: frames are of the s...
Definition: mythframe.h:569
VideoFrame::dummy
bool dummy
Definition: mythframe.h:156
VideoFrame::interlaced_frame
int interlaced_frame
1 if interlaced. 0 if not interlaced. -1 if unknown.
Definition: mythframe.h:150
VideoFrame::deinterlace_inuse2x
bool deinterlace_inuse2x
Definition: mythframe.h:176
format_is_packed
static bool format_is_packed(VideoFrameType Type)
Definition: mythframe.h:104
VideoFrame::deinterlace_inuse
MythDeintType deinterlace_inuse
Definition: mythframe.h:175
hardwareprofile.config.p
p
Definition: config.py:33
FMT_YUV444P9
@ FMT_YUV444P9
Definition: mythframe.h:43
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:22
FMT_YUV422P10
@ FMT_YUV422P10
Definition: mythframe.h:37
FMT_YUV444P16
@ FMT_YUV444P16
Definition: mythframe.h:47
copyplane
static void copyplane(uint8_t *dst, int dst_pitch, const uint8_t *src, int src_pitch, int width, int height)
Definition: mythframe.h:544
VideoFrame::colorprimaries
int colorprimaries
Definition: mythframe.h:165
format_is_yuv
static bool format_is_yuv(VideoFrameType Type)
Definition: mythframe.h:109
FMT_BGRA
@ FMT_BGRA
Definition: mythframe.h:30
VideoFrame::pause_frame
bool pause_frame
Definition: mythframe.h:157
format_is_nv12
static bool format_is_nv12(VideoFrameType Type)
Definition: mythframe.h:99
VideoFrame::aspect
float aspect
Definition: mythframe.h:141
FMT_YUV420P12
@ FMT_YUV420P12
Definition: mythframe.h:25
VideoFrame::priv
std::array< uint8_t *, 4 > priv
random empty storage
Definition: mythframe.h:149
MYTH_WIDTH_ALIGNMENT
#define MYTH_WIDTH_ALIGNMENT
Definition: mythframe.h:16
VideoFrame::top_field_first
bool top_field_first
true if top field is first.
Definition: mythframe.h:151
VideoFrame::deinterlace_allowed
MythDeintType deinterlace_allowed
Definition: mythframe.h:174
VideoFrame::colortransfer
int colortransfer
Definition: mythframe.h:166
VideoFrame::sw_pix_fmt
int sw_pix_fmt
Definition: mythframe.h:161
uswcState
uswcState
Definition: mythframe.h:187
uint
unsigned int uint
Definition: compat.h:140
VideoFrame::pix_fmt
int pix_fmt
Definition: mythframe.h:160
VideoFrame::colorshifted
bool colorshifted
false for software decoded 10/12/16bit frames. true for hardware decoders.
Definition: mythframe.h:168
operator&
MythDeintType operator&(MythDeintType a, MythDeintType b)
Definition: mythframe.h:128
VideoFrame::chromalocation
int chromalocation
Definition: mythframe.h:167
FMT_YUV444P12
@ FMT_YUV444P12
Definition: mythframe.h:45
FMT_ARGB32
@ FMT_ARGB32
Definition: mythframe.h:32
VideoFrame::disp_timecode
int64_t disp_timecode
Definition: mythframe.h:148
VideoFrame::colorspace
int colorspace
Definition: mythframe.h:163
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
FMT_NVDEC
@ FMT_NVDEC
Definition: mythframe.h:61
FMT_YUV422P9
@ FMT_YUV422P9
Definition: mythframe.h:36
mavtripletptr
mavtriplet::const_pointer mavtripletptr
Definition: mythframe.h:220
MythDeintType
MythDeintType
Definition: mythframe.h:116
FMT_YUV420P9
@ FMT_YUV420P9
Definition: mythframe.h:23
planes
static uint planes(VideoFrameType Type)
Definition: mythframe.h:574
width_for_plane
static int width_for_plane(VideoFrameType Type, int Width, uint Plane)
Definition: mythframe.h:399
FMT_VDPAU
@ FMT_VDPAU
Definition: mythframe.h:55
FMT_YUV422P16
@ FMT_YUV422P16
Definition: mythframe.h:40
FMT_YUY2
@ FMT_YUY2
Definition: mythframe.h:49
clear
static void clear(VideoFrame *vf)
Definition: mythframe.h:489
VideoFrame::frame_rate
double frame_rate
Definition: mythframe.h:142
FMT_DXVA2
@ FMT_DXVA2
Definition: mythframe.h:57
FMT_RGB24
@ FMT_RGB24
Definition: mythframe.h:29
FMT_YUV422P12
@ FMT_YUV422P12
Definition: mythframe.h:38
DEINT_HIGH
@ DEINT_HIGH
Definition: mythframe.h:120
height_for_plane
static int height_for_plane(VideoFrameType Type, int Height, uint Plane)
Definition: mythframe.h:444
uswcState::Detect
@ Detect
VideoFrame::height
int height
Definition: mythframe.h:140
VideoFrame::frameNumber
long long frameNumber
Definition: mythframe.h:145
VideoFrame::already_deinterlaced
bool already_deinterlaced
temporary? TODO move scan detection/tracking into decoder
Definition: mythframe.h:169
CreateBuffer
static unsigned char * CreateBuffer(VideoFrameType Type, int Width, int Height)
Definition: mythframe.h:693
FMT_RGB32
@ FMT_RGB32
endian dependent format, ARGB or BGRA
Definition: mythframe.h:31
FMT_MMAL
@ FMT_MMAL
Definition: mythframe.h:58
format_is_422
static bool format_is_422(VideoFrameType Type)
Definition: mythframe.h:86
VideoFrameType
VideoFrameType
Definition: mythframe.h:19
FMT_VAAPI
@ FMT_VAAPI
Definition: mythframe.h:56
GetDoubleRateOption
MythDeintType MTV_PUBLIC GetDoubleRateOption(const VideoFrame *Frame, MythDeintType Type, MythDeintType Override=DEINT_NONE)
Definition: mythframe.cpp:855
VideoFrame::frameCounter
long long frameCounter
raw frame counter/ticker for discontinuity checks
Definition: mythframe.h:146
init
static void init(VideoFrame *vf, VideoFrameType _codec, unsigned char *_buf, int _width, int _height, int _size, const FramePitches p, const FrameOffsets o, bool arrays_valid=true, float _aspect=-1.0F, double _rate=-1.0F, int _aligned=MYTH_WIDTH_ALIGNMENT)
Definition: mythframe.h:222
FMT_NV12
@ FMT_NV12
Definition: mythframe.h:51
DEINT_BASIC
@ DEINT_BASIC
Definition: mythframe.h:118
VideoFrame::size
int size
Definition: mythframe.h:144
FMT_P016
@ FMT_P016
Definition: mythframe.h:53
GetAlignedBufferZero
static unsigned char * GetAlignedBufferZero(size_t Size)
Definition: mythframe.h:688
VideoFrame::deinterlace_double
MythDeintType deinterlace_double
Definition: mythframe.h:173
GetAlignedBuffer
static unsigned char * GetAlignedBuffer(size_t Size)
Definition: mythframe.h:683
ColorDepth
int MTV_PUBLIC ColorDepth(int Format)
Return the color depth for the given MythTV frame format.
Definition: mythframe.cpp:816
mythaverror.h
VideoFrame::width
int width
Definition: mythframe.h:139
VideoFrame::directrendering
bool directrendering
true if managed by FFmpeg
Definition: mythframe.h:162
FMT_RGBA32
@ FMT_RGBA32
Definition: mythframe.h:33
GetDeinterlacer
MythDeintType MTV_PUBLIC GetDeinterlacer(MythDeintType Option)
Definition: mythframe.cpp:868
VideoFrameTypeVec
std::vector< VideoFrameType > VideoFrameTypeVec
Definition: mythframe.h:179