[mpp_base]: Add more to_str function

Change-Id: Ic45acd7cb304fa16908e43ec497d9ead8ba477d6
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2020-11-06 14:06:06 +08:00
parent a75c5edcb7
commit b60b40c62d
2 changed files with 74 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
#define __MPP_2STR_H__
#include "rk_type.h"
#include "rk_venc_rc.h"
#ifdef __cplusplus
extern "C" {
@@ -26,6 +27,8 @@ extern "C" {
const char *strof_ctx_type(MppCtxType type);
const char *strof_coding_type(MppCodingType coding);
const char *strof_rc_mode(MppEncRcMode rc_mode);
const char *strof_profle(MppCodingType coding, RK_U32 profile);
#ifdef __cplusplus
}

View File

@@ -16,6 +16,8 @@
*/
#include "mpp_2str.h"
#include "h264_syntax.h"
#include "h265_syntax.h"
const char *strof_ctx_type(MppCtxType type)
{
@@ -60,3 +62,72 @@ const char *strof_coding_type(MppCodingType coding)
return NULL;
}
const char *strof_rc_mode(MppEncRcMode rc_mode)
{
static const char *rc_mode_str[] = {
"vbr",
"cbr",
"fixqp",
"avbr",
};
if (rc_mode >= MPP_ENC_RC_MODE_VBR && rc_mode < MPP_ENC_RC_MODE_BUTT)
return rc_mode_str[rc_mode];
return NULL;
}
const char *strof_profle(MppCodingType coding, RK_U32 profile)
{
static const char *h264_profile_str[] = {
"baseline",
"main",
"high",
"high10",
};
static const char *h265_profile_str[] = {
"main",
"main10",
};
static const char *jpeg_profile_str[] = {
"base",
};
static const char *vp8_profile_str[] = {
"base",
};
static const char *unknown_str[] = {
"unknown",
};
switch (coding) {
case MPP_VIDEO_CodingAVC : {
if (profile == H264_PROFILE_BASELINE)
return h264_profile_str[0];
else if (profile == H264_PROFILE_MAIN)
return h264_profile_str[1];
else if (profile == H264_PROFILE_HIGH)
return h264_profile_str[2];
else if (profile == H264_PROFILE_HIGH10)
return h264_profile_str[3];
else
return unknown_str[0];
} break;
case MPP_VIDEO_CodingHEVC : {
if (profile < 2)
return h265_profile_str[0];
else
return unknown_str[0];
} break;
case MPP_VIDEO_CodingMJPEG : {
return jpeg_profile_str[0];
} break;
case MPP_VIDEO_CodingVP8 : {
return vp8_profile_str[0];
} break;
default : {
} break;
}
return NULL;
}