MythTV  master
Classes | Macros | Enumerations | Functions
mythframe.h File Reference
#include <cstdint>
#include <cstring>
#include "mythtvexp.h"
#include "libavcodec/avcodec.h"
Include dependency graph for mythframe.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  VideoFrame
 
class  MythUSWCCopy
 

Macros

#define MYTH_WIDTH_ALIGNMENT   64
 
#define MYTH_HEIGHT_ALIGNMENT   16
 

Enumerations

enum  VideoFrameType {
  FMT_NONE = -1, FMT_YV12 = 0, FMT_YUV420P9, FMT_YUV420P10,
  FMT_YUV420P12, FMT_YUV420P14, FMT_YUV420P16, FMT_RGB24,
  FMT_BGRA, FMT_RGB32, FMT_ARGB32, FMT_RGBA32,
  FMT_YUV422P, FMT_YUV422P9, FMT_YUV422P10, FMT_YUV422P12,
  FMT_YUV422P14, FMT_YUV422P16, FMT_YUV444P, FMT_YUV444P9,
  FMT_YUV444P10, FMT_YUV444P12, FMT_YUV444P14, FMT_YUV444P16,
  FMT_YUY2, FMT_NV12, FMT_P010, FMT_P016,
  FMT_VDPAU, FMT_VAAPI, FMT_DXVA2, FMT_MMAL,
  FMT_MEDIACODEC, FMT_VTB, FMT_NVDEC, FMT_DRMPRIME
}
 
enum  MythDeintType {
  DEINT_NONE = 0x0000, DEINT_BASIC = 0x0001, DEINT_MEDIUM = 0x0002, DEINT_HIGH = 0x0004,
  DEINT_CPU = 0x0010, DEINT_SHADER = 0x0020, DEINT_DRIVER = 0x0040, DEINT_ALL = 0x0077
}
 
enum  uswcState { uswcState::Detect, uswcState::Use_SSE, uswcState::Use_SW }
 

Functions

const char * format_description (VideoFrameType Type)
 
static int format_is_hw (VideoFrameType Type)
 
static int format_is_hwframes (VideoFrameType Type)
 
static int format_is_420 (VideoFrameType Type)
 
static int format_is_422 (VideoFrameType Type)
 
static int format_is_444 (VideoFrameType Type)
 
static int format_is_nv12 (VideoFrameType Type)
 
static int format_is_packed (VideoFrameType Type)
 
static int format_is_yuv (VideoFrameType Type)
 
MythDeintType operator| (MythDeintType a, MythDeintType b)
 
MythDeintType operator& (MythDeintType a, MythDeintType b)
 
MythDeintType operator~ (MythDeintType a)
 
int MTV_PUBLIC ColorDepth (int Format)
 Return the color depth for the given MythTV frame format. More...
 
MythDeintType MTV_PUBLIC GetSingleRateOption (const VideoFrame *Frame, MythDeintType Type, MythDeintType Override=DEINT_NONE)
 
MythDeintType MTV_PUBLIC GetDoubleRateOption (const VideoFrame *Frame, MythDeintType Type, MythDeintType Override=DEINT_NONE)
 
MythDeintType MTV_PUBLIC GetDeinterlacer (MythDeintType Option)
 
void MTV_PUBLIC framecopy (VideoFrame *dst, const VideoFrame *src, bool useSSE=true)
 
static void init (VideoFrame *vf, VideoFrameType _codec, unsigned char *_buf, int _width, int _height, int _size, const int *p=nullptr, const int *o=nullptr, float _aspect=-1.0F, double _rate=-1.0F, int _aligned=MYTH_WIDTH_ALIGNMENT)
 
static void clear (VideoFrame *vf)
 
static int bitsperpixel (VideoFrameType type)
 
static int pitch_for_plane (VideoFrameType Type, int Width, uint Plane)
 
static int height_for_plane (VideoFrameType Type, int Height, uint Plane)
 
static int width_for_plane (VideoFrameType Type, int Width, uint Plane)
 
static void copyplane (uint8_t *dst, int dst_pitch, const uint8_t *src, int src_pitch, int width, int height)
 
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 same resolution destination frame is in YV12 format source frame is either YV12 or NV12 format More...
 
static uint planes (VideoFrameType Type)
 
static size_t GetBufferSize (VideoFrameType Type, int Width, int Height, int Aligned=MYTH_WIDTH_ALIGNMENT)
 
static unsigned char * GetAlignedBuffer (size_t Size)
 
static unsigned char * GetAlignedBufferZero (size_t Size)
 
static unsigned char * CreateBuffer (VideoFrameType Type, int Width, int Height)
 
static unsigned char * CreateBufferZero (VideoFrameType Type, int Width, int Height)
 
static void copybuffer (VideoFrame *dst, uint8_t *buffer, int pitch, VideoFrameType type=FMT_YV12)
 
static void copybuffer (uint8_t *dstbuffer, const VideoFrame *src, int pitch=0, VideoFrameType type=FMT_YV12)
 

Macro Definition Documentation

◆ MYTH_WIDTH_ALIGNMENT

#define MYTH_WIDTH_ALIGNMENT   64

Definition at line 21 of file mythframe.h.

◆ MYTH_HEIGHT_ALIGNMENT

#define MYTH_HEIGHT_ALIGNMENT   16

Definition at line 22 of file mythframe.h.

Enumeration Type Documentation

◆ VideoFrameType

Enumerator
FMT_NONE 
FMT_YV12 
FMT_YUV420P9 
FMT_YUV420P10 
FMT_YUV420P12 
FMT_YUV420P14 
FMT_YUV420P16 
FMT_RGB24 
FMT_BGRA 
FMT_RGB32 

endian dependent format, ARGB or BGRA

FMT_ARGB32 
FMT_RGBA32 
FMT_YUV422P 
FMT_YUV422P9 
FMT_YUV422P10 
FMT_YUV422P12 
FMT_YUV422P14 
FMT_YUV422P16 
FMT_YUV444P 
FMT_YUV444P9 
FMT_YUV444P10 
FMT_YUV444P12 
FMT_YUV444P14 
FMT_YUV444P16 
FMT_YUY2 
FMT_NV12 
FMT_P010 
FMT_P016 
FMT_VDPAU 
FMT_VAAPI 
FMT_DXVA2 
FMT_MMAL 
FMT_MEDIACODEC 
FMT_VTB 
FMT_NVDEC 
FMT_DRMPRIME 

Definition at line 23 of file mythframe.h.

◆ MythDeintType

Enumerator
DEINT_NONE 
DEINT_BASIC 
DEINT_MEDIUM 
DEINT_HIGH 
DEINT_CPU 
DEINT_SHADER 
DEINT_DRIVER 
DEINT_ALL 

Definition at line 120 of file mythframe.h.

◆ uswcState

enum uswcState
strong
Enumerator
Detect 
Use_SSE 
Use_SW 

Definition at line 191 of file mythframe.h.

Function Documentation

◆ format_description()

const char* format_description ( VideoFrameType  Type)

◆ format_is_hw()

static int format_is_hw ( VideoFrameType  Type)
inlinestatic

◆ format_is_hwframes()

static int format_is_hwframes ( VideoFrameType  Type)
inlinestatic

◆ format_is_420()

static int format_is_420 ( VideoFrameType  Type)
inlinestatic

◆ format_is_422()

static int format_is_422 ( VideoFrameType  Type)
inlinestatic

◆ format_is_444()

static int format_is_444 ( VideoFrameType  Type)
inlinestatic

◆ format_is_nv12()

static int format_is_nv12 ( VideoFrameType  Type)
inlinestatic

◆ format_is_packed()

static int format_is_packed ( VideoFrameType  Type)
inlinestatic

Definition at line 109 of file mythframe.h.

Referenced by format_is_yuv().

◆ format_is_yuv()

static int format_is_yuv ( VideoFrameType  Type)
inlinestatic

◆ operator|()

MythDeintType operator| ( MythDeintType  a,
MythDeintType  b 
)
inline

Definition at line 132 of file mythframe.h.

◆ operator&()

MythDeintType operator& ( MythDeintType  a,
MythDeintType  b 
)
inline

Definition at line 133 of file mythframe.h.

◆ operator~()

MythDeintType operator~ ( MythDeintType  a)
inline

Definition at line 134 of file mythframe.h.

◆ ColorDepth()

int MTV_PUBLIC ColorDepth ( int  Format)

◆ GetSingleRateOption()

MythDeintType MTV_PUBLIC GetSingleRateOption ( const VideoFrame Frame,
MythDeintType  Type,
MythDeintType  Override = DEINT_NONE 
)

◆ GetDoubleRateOption()

MythDeintType MTV_PUBLIC GetDoubleRateOption ( const VideoFrame Frame,
MythDeintType  Type,
MythDeintType  Override = DEINT_NONE 
)

◆ GetDeinterlacer()

MythDeintType MTV_PUBLIC GetDeinterlacer ( MythDeintType  Option)

Definition at line 867 of file mythframe.cpp.

Referenced by DeinterlacerName(), GetDoubleRateOption(), and GetSingleRateOption().

◆ framecopy()

void MTV_PUBLIC framecopy ( VideoFrame dst,
const VideoFrame src,
bool  useSSE = true 
)

Definition at line 329 of file mythframe.cpp.

Referenced by copy().

◆ init()

static void init ( VideoFrame vf,
VideoFrameType  _codec,
unsigned char *  _buf,
int  _width,
int  _height,
int  _size,
const int *  p = nullptr,
const int *  o = nullptr,
float  _aspect = -1.0F,
double  _rate = -1.0F,
int  _aligned = MYTH_WIDTH_ALIGNMENT 
)
inlinestatic

◆ clear()

static void clear ( VideoFrame vf)
inlinestatic

Definition at line 482 of file mythframe.h.

◆ bitsperpixel()

static int bitsperpixel ( VideoFrameType  type)
inlinestatic

Definition at line 611 of file mythframe.h.

Referenced by GetBufferSize(), init(), and pitch_for_plane().

◆ pitch_for_plane()

static int pitch_for_plane ( VideoFrameType  Type,
int  Width,
uint  Plane 
)
inlinestatic

◆ height_for_plane()

static int height_for_plane ( VideoFrameType  Type,
int  Height,
uint  Plane 
)
inlinestatic

◆ width_for_plane()

static int width_for_plane ( VideoFrameType  Type,
int  Width,
uint  Plane 
)
inlinestatic

Definition at line 392 of file mythframe.h.

Referenced by MythMMALInterop::Acquire().

◆ copyplane()

static void copyplane ( uint8_t *  dst,
int  dst_pitch,
const uint8_t *  src,
int  src_pitch,
int  width,
int  height 
)
inlinestatic

◆ copy()

static void copy ( VideoFrame dst,
const VideoFrame src 
)
inlinestatic

copy: copy one frame into another copy only works with the following assumptions: frames are of the same resolution destination frame is in YV12 format source frame is either YV12 or NV12 format

Definition at line 562 of file mythframe.h.

Referenced by copybuffer().

◆ planes()

static uint planes ( VideoFrameType  Type)
inlinestatic

◆ GetBufferSize()

static size_t GetBufferSize ( VideoFrameType  Type,
int  Width,
int  Height,
int  Aligned = MYTH_WIDTH_ALIGNMENT 
)
inlinestatic

◆ GetAlignedBuffer()

static unsigned char* GetAlignedBuffer ( size_t  Size)
inlinestatic

◆ GetAlignedBufferZero()

static unsigned char* GetAlignedBufferZero ( size_t  Size)
inlinestatic

Definition at line 681 of file mythframe.h.

Referenced by MythVideoTexture::CreateBuffer(), and CreateBufferZero().

◆ CreateBuffer()

static unsigned char* CreateBuffer ( VideoFrameType  Type,
int  Width,
int  Height 
)
inlinestatic

Definition at line 686 of file mythframe.h.

Referenced by MythAVCopy::Copy(), and MythPlayer::GetScreenGrabAtFrame().

◆ CreateBufferZero()

static unsigned char* CreateBufferZero ( VideoFrameType  Type,
int  Width,
int  Height 
)
inlinestatic

Definition at line 692 of file mythframe.h.

◆ copybuffer() [1/2]

static void copybuffer ( VideoFrame dst,
uint8_t *  buffer,
int  pitch,
VideoFrameType  type = FMT_YV12 
)
inlinestatic

Definition at line 698 of file mythframe.h.

Referenced by CopyToVideo(), and VideoOutputD3D::UpdateFrame().

◆ copybuffer() [2/2]

static void copybuffer ( uint8_t *  dstbuffer,
const VideoFrame src,
int  pitch = 0,
VideoFrameType  type = FMT_YV12 
)
inlinestatic

Definition at line 728 of file mythframe.h.