rename some macros so it doesn't clash with others (#510)

* rename macros so not to clash with others

* modified macro in all samples
This commit is contained in:
Rajy Rawther authored and GitHub committed 2025-02-18 08:40:58 -05:00
1 parent 2af7bbf4e7
commit c4fe8f5258
7 files changed
+24 -28

No files matched your search

+4 -4
View File
@@ -92,7 +92,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(int device_id, OutputSurfaceMemoryType ou
RocVideoDecoder(device_id, out_mem_type, codec, force_zero_latency, p_crop_rect, extract_user_sei_Message, disp_delay, max_width, max_height, clk_rate), no_multithreading_(no_multithreading) {
if ((out_mem_type_ == OUT_SURFACE_MEM_DEV_INTERNAL) || (out_mem_type_ == OUT_SURFACE_MEM_NOT_MAPPED)) {
THROW("Output Memory Type is not supported");
ROCDEC_THROW("Output Memory Type is not supported", ROCDEC_INVALID_PARAMETER);
}
if (rocdec_parser_) {
rocDecDestroyVideoParser(rocdec_parser_); // need to do this here since it was already created in the base class
@@ -113,7 +113,7 @@ FFMpegVideoDecoder::FFMpegVideoDecoder(int device_id, OutputSurfaceMemoryType ou
// start the FFMpeg decoding thread
ffmpeg_decoder_thread_ = new std::thread(&FFMpegVideoDecoder::DecodeThread, this);
if (!ffmpeg_decoder_thread_) {
THROW("FFMpegVideoDecoder create thread failed");
ROCDEC_THROW("FFMpegVideoDecoder create thread failed", -1);
}
}
}
@@ -192,7 +192,7 @@ int FFMpegVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
if (!dec_context_) {
dec_context_ = avcodec_alloc_context3(decoder_); //alloc dec_context_
if (!dec_context_) {
THROW("Could not allocate video codec context");
ROCDEC_THROW("Could not allocate video codec context", ROCDEC_RUNTIME_ERROR);
}
// set codec to automatically determine how many threads suits best for the decoding job
dec_context_->thread_count = 0;
@@ -206,7 +206,7 @@ int FFMpegVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
// open the codec
if (avcodec_open2(dec_context_, decoder_, NULL) < 0) {
THROW("Could not open codec");
ROCDEC_THROW("Could not open codec", ROCDEC_RUNTIME_ERROR);
}
// get the output pixel format from dec_context_
decoder_pixel_format_ = (dec_context_->pix_fmt == AV_PIX_FMT_NONE) ? AV_PIX_FMT_YUV420P : dec_context_->pix_fmt;
+5 -5
View File
@@ -27,7 +27,7 @@ RocVideoDecoder::RocVideoDecoder(int device_id, OutputSurfaceMemoryType out_mem_
device_id_{device_id}, out_mem_type_(out_mem_type), codec_id_(codec), b_force_zero_latency_(force_zero_latency),
b_extract_sei_message_(extract_user_sei_Message), disp_delay_(disp_delay), max_width_ (max_width), max_height_(max_height) {
if (!InitHIP(device_id_)) {
THROW("Failed to initilize the HIP");
ROCDEC_THROW("Failed to initilize the HIP", ROCDEC_DEVICE_INVALID);
}
if (p_crop_rect) crop_rect_ = *p_crop_rect;
if (b_extract_sei_message_) {
@@ -624,7 +624,7 @@ int RocVideoDecoder::ReconfigureDecoder(RocdecVideoFormat *p_video_format) {
*/
int RocVideoDecoder::HandlePictureDecode(RocdecPicParams *pPicParams) {
if (!roc_decoder_) {
THROW("RocDecoder not initialized: failed with ErrCode: " + TOSTR(ROCDEC_NOT_INITIALIZED));
ROCDEC_THROW("RocDecoder not initialized: failed with ErrCode: " + TOSTR(ROCDEC_NOT_INITIALIZED), ROCDEC_NOT_INITIALIZED);
}
pic_num_in_dec_order_[pPicParams->curr_pic_idx] = decode_poc_++;
ROCDEC_API_CALL(rocDecDecodeFrame(roc_decoder_, pPicParams));
@@ -789,19 +789,19 @@ int RocVideoDecoder::GetSEIMessage(RocdecSeiMessageInfo *pSEIMessageInfo) {
RocdecSeiMessage *p_sei_msg_info = pSEIMessageInfo->sei_message;
size_t total_SEI_buff_size = 0;
if ((pSEIMessageInfo->picIdx < 0) || (pSEIMessageInfo->picIdx >= MAX_FRAME_NUM)) {
ERR("Invalid picture index for SEI message: " + TOSTR(pSEIMessageInfo->picIdx));
ROCDEC_ERR("Invalid picture index for SEI message: " + TOSTR(pSEIMessageInfo->picIdx));
return 0;
}
for (uint32_t i = 0; i < sei_num_mesages; i++) {
total_SEI_buff_size += p_sei_msg_info[i].sei_message_size;
}
if (!curr_sei_message_ptr_) {
ERR("Out of Memory, Allocation failed for m_pCurrSEIMessage");
ROCDEC_ERR("Out of Memory, Allocation failed for m_pCurrSEIMessage");
return 0;
}
curr_sei_message_ptr_->sei_data = malloc(total_SEI_buff_size);
if (!curr_sei_message_ptr_->sei_data) {
ERR("Out of Memory, Allocation failed for SEI Buffer");
ROCDEC_ERR("Out of Memory, Allocation failed for SEI Buffer");
return 0;
}
memcpy(curr_sei_message_ptr_->sei_data, pSEIMessageInfo->sei_data, total_SEI_buff_size);
+3 -4
View File
@@ -68,11 +68,11 @@ typedef enum OutputSurfaceMemoryType_enum {
#define STR(X) std::string(X)
#if DBGINFO
#define INFO(X) std::clog << "[INF] " << " {" << __func__ <<"} " << " " << X << std::endl;
#define ROCDEC_INFO(X) std::clog << "[INF] " << " {" << __func__ <<"} " << " " << X << std::endl;
#else
#define INFO(X) ;
#define ROCDEC_INFO(X) ;
#endif
#define ERR(X) std::cerr << "[ERR] " << " {" << __func__ <<"} " << " " << X << std::endl;
#define ROCDEC_ERR(X) std::cerr << "[ERR] " << " {" << __func__ <<"} " << " " << X << std::endl;
inline int GetChromaPlaneCount(rocDecVideoSurfaceFormat surface_format) {
int num_planes = 1;
@@ -128,7 +128,6 @@ private:
};
#define ROCDEC_THROW(X, CODE) throw RocVideoDecodeException(" { " + std::string(__func__) + " } " + X , CODE);
#define THROW(X) throw RocVideoDecodeException(" { " + std::string(__func__) + " } " + X);
#define ROCDEC_API_CALL( rocDecAPI ) \
do { \