develop/projects/rocdecode/utils/rocvideodecode/roc_video_dec.h File Reference

develop/projects/rocdecode/utils/rocvideodecode/roc_video_dec.h File Reference#

rocDecode: develop/projects/rocdecode/utils/rocvideodecode/roc_video_dec.h File Reference
roc_video_dec.h File Reference

The AMD Video Decode Library. More...

#include <stdint.h>
#include <mutex>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string.h>
#include <queue>
#include <stdexcept>
#include <exception>
#include <cstring>
#include <unordered_map>
#include <chrono>
#include <thread>
#include <ctime>
#include <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <hip/hip_runtime.h>
#include "rocdecode/rocdecode.h"
#include "rocdecode/rocparser.h"

Go to the source code of this file.

Data Structures

class  RocVideoDecodeException
 
struct  Rect
 
struct  Dim
 
struct  DecFrameBuffer_
 
struct  OutputSurfaceInfoType
 
struct  ReconfigParams_t
 
class  RocVideoDecoder
 

Macros

#define ROCVIDEODEC_TOSTR(X)   std::to_string(X)
 
#define ROCVIDEODEC_STR(X)   std::string(X)
 
#define RocVideoDecCriticalLog(msg)
 
#define MAX_FRAME_NUM   16
 
#define ROCDEC_THROW(X, CODE)   throw RocVideoDecodeException(" { " + std::string(__func__) + " } " + X , CODE);
 
#define ROCDEC_API_CALL(rocDecAPI)
 
#define HIP_API_CALL(call)
 
#define CHECK_ZERO(str, value)
 

Typedefs

typedef int(ROCDECAPI * PFNRECONFIGUEFLUSHCALLBACK) (void *, uint32_t, void *)
 
typedef enum SeiAvcHevcPayloadType_enum SeiAvcHevcPayloadType
 
typedef enum OutputSurfaceMemoryType_enum OutputSurfaceMemoryType
 
typedef struct DecFrameBuffer_ DecFrameBuffer
 
typedef struct OutputSurfaceInfoType OutputSurfaceInfo
 
typedef struct ReconfigParams_t ReconfigParams
 

Enumerations

enum  SeiAvcHevcPayloadType_enum { SEI_TYPE_TIME_CODE = 136 , SEI_TYPE_USER_DATA_UNREGISTERED = 5 }
 
enum  OutputSurfaceMemoryType_enum { OUT_SURFACE_MEM_DEV_INTERNAL = 0 , OUT_SURFACE_MEM_DEV_COPIED = 1 , OUT_SURFACE_MEM_HOST_COPIED = 2 , OUT_SURFACE_MEM_NOT_MAPPED = 3 }
 

Functions

int GetChromaPlaneCount (rocDecVideoSurfaceFormat surface_format)
 
float GetChromaHeightFactor (rocDecVideoSurfaceFormat surface_format)
 

Detailed Description

The AMD Video Decode Library.

Macro Definition Documentation

◆ CHECK_ZERO

#define CHECK_ZERO (   str,
  value 
)
Value:
do { \
if (value == 0) { \
RocVideoDecCriticalLog(ROCVIDEODEC_STR(str) + " is 0."); \
} \
} while (0)

◆ HIP_API_CALL

#define HIP_API_CALL (   call)
Value:
do { \
hipError_t hip_status = call; \
if (hip_status != hipSuccess) { \
const char *sz_err_name = NULL; \
sz_err_name = hipGetErrorName(hip_status); \
std::ostringstream error_log; \
error_log << "hip API error " << sz_err_name ; \
ROCDEC_THROW(error_log.str(), hip_status); \
} \
} \
while (0)

◆ ROCDEC_API_CALL

#define ROCDEC_API_CALL (   rocDecAPI)
Value:
do { \
rocDecStatus error_code = rocDecAPI; \
if( error_code != ROCDEC_SUCCESS) { \
std::ostringstream error_log; \
error_log << #rocDecAPI << " returned " << rocDecGetErrorName(error_code) << " at " <<__FILE__ <<":" << __LINE__;\
ROCDEC_THROW(error_log.str(), error_code); \
} \
} while (0)
const char *ROCDECAPI rocDecGetErrorName(rocDecStatus rocdec_status)

◆ RocVideoDecCriticalLog

#define RocVideoDecCriticalLog (   msg)
Value:
do { \
struct timespec _ts_; \
clock_gettime(CLOCK_MONOTONIC, &_ts_); \
uint64_t _us_ = static_cast<uint64_t>(_ts_.tv_sec) * 1000000ULL + _ts_.tv_nsec / 1000ULL; \
const char *_f_ = strrchr(__FILE__, '/'); \
pid_t _tid_ = static_cast<pid_t>(syscall(SYS_gettid)); \
std::ostringstream _htid_oss_; \
_htid_oss_ << "0x" << std::hex << std::setw(5) << std::setfill('0') \
<< (std::hash<std::thread::id>{}(std::this_thread::get_id()) & 0xFFFFF); \
std::cerr << "[0, Critical] " << (_f_ ? _f_ + 1 : __FILE__) \
<< ":" << __LINE__ << ": " << _us_ << " us: [pid:" \
<< getpid() << " tid:" << _tid_ << " hashid:" << _htid_oss_.str() << "] " \
<< __func__ << "(): " << (msg) << std::endl; \
} while (0)

Enumeration Type Documentation

◆ OutputSurfaceMemoryType_enum

Enumerator
OUT_SURFACE_MEM_DEV_INTERNAL 

Internal interopped decoded surface memory(original mapped decoded surface)

OUT_SURFACE_MEM_DEV_COPIED 

decoded output will be copied to a separate device memory (the user doesn't need to call release)

OUT_SURFACE_MEM_HOST_COPIED 

decoded output will be copied to a separate host memory (the user doesn't need to call release)

OUT_SURFACE_MEM_NOT_MAPPED 

< decoded output is not available (interop won't be used): useful for decode only performance app