mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-30 04:02:07 +08:00
[vpu_api]: add vpuCodecContext parameters
a) mpp_mode: if have rkv, can set it 1 to use rkv decoder b) bit_depth: for calculate stride c) yuv_format: for setting multiplication coefficient when malloc Change-Id: Id7c32c7cac17d3c9007a0674979c2b73769ae44f Signed-off-by: leo.ding <leo.ding@rock-chips.com>
This commit is contained in:
@@ -211,7 +211,7 @@ typedef enum OMX_RK_VIDEO_CODINGTYPE {
|
||||
} OMX_RK_VIDEO_CODINGTYPE;
|
||||
|
||||
typedef enum VPU_VIDEO_PIXEL_FMT {
|
||||
VPU_VIDEO_PIXEL_FMT_NV12
|
||||
VPU_VIDEO_PIXEL_FMT_NV12,
|
||||
} VPU_VIDEO_PIXEL_FMT;
|
||||
|
||||
typedef enum CODEC_TYPE {
|
||||
@@ -274,7 +274,13 @@ typedef struct EXtraCfg {
|
||||
RK_S32 vc1extra_size;
|
||||
RK_S32 vp6codeid;
|
||||
RK_S32 tsformat;
|
||||
RK_U32 reserved[20];
|
||||
RK_U32 ori_vpu; /* use origin vpu framework */
|
||||
/* below used in decode */
|
||||
RK_U32 mpp_mode; /* use mpp framework */
|
||||
RK_U32 bit_depth; /* 8 or 10 bit */
|
||||
RK_U32 yuv_format; /* 0:420 1:422 2:444 */
|
||||
RK_U32 reserved[16];
|
||||
|
||||
} EXtraCfg_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -300,6 +300,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
||||
RK_U32 height = 0;
|
||||
void *extradata = NULL;
|
||||
RK_S32 extradata_size = 0;
|
||||
EXtraCfg_t extra_cfg;
|
||||
|
||||
vpu_api_dbg_func("enter\n");
|
||||
|
||||
@@ -338,7 +339,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
||||
} else {
|
||||
if (s->videoCoding == OMX_RK_VIDEO_CodingAVC
|
||||
&& s->codecType == CODEC_DECODER && s->width <= 1920
|
||||
&& s->height <= 1088) {
|
||||
&& s->height <= 1088 && !s->extra_cfg.mpp_mode) {
|
||||
/* H.264 smaller than 1080p use original vpuapi library for better error process */
|
||||
use_mpp = 0;
|
||||
} else {
|
||||
@@ -368,6 +369,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
||||
height = s->height;
|
||||
extradata = s->extradata;
|
||||
extradata_size = s->extradata_size;
|
||||
extra_cfg = s->extra_cfg;
|
||||
|
||||
free(s);
|
||||
s = NULL;
|
||||
@@ -418,6 +420,7 @@ RK_S32 vpu_open_context(VpuCodecContext **ctx)
|
||||
s->height = height;
|
||||
s->extradata = extradata;
|
||||
s->extradata_size = extradata_size;
|
||||
s->extra_cfg = extra_cfg;
|
||||
}
|
||||
*ctx = s;
|
||||
|
||||
@@ -435,7 +438,7 @@ RK_S32 vpu_close_context(VpuCodecContext **ctx)
|
||||
mpp_env_get_u32("force_original", &force_original, 0);
|
||||
|
||||
if (s) {
|
||||
if (s->extra_cfg.reserved[0]) {
|
||||
if (s->extra_cfg.ori_vpu) {
|
||||
ret = close_orign_vpu(ctx);
|
||||
mpp_log("org vpu_close_context ok");
|
||||
} else {
|
||||
|
||||
@@ -1341,16 +1341,26 @@ RK_S32 VpuApiLegacy::control(VpuCodecContext *ctx, VPU_API_CMD cmd, void *param)
|
||||
MppFrame frame = NULL;
|
||||
|
||||
mpicmd = MPP_DEC_SET_FRAME_INFO;
|
||||
|
||||
/**hightest of p->ImgWidth bit show current dec bitdepth
|
||||
* 0 - 8bit
|
||||
* 1 - 10bit
|
||||
**/
|
||||
if (p->ImgWidth & 0x80000000)
|
||||
p->CodecType = (p->ImgWidth & 0x40000000) ? MPP_FMT_YUV422SP_10BIT : MPP_FMT_YUV420SP_10BIT;
|
||||
else
|
||||
p->CodecType = (p->ImgWidth & 0x40000000) ? MPP_FMT_YUV422SP : MPP_FMT_YUV420SP;
|
||||
|
||||
if (ctx->extra_cfg.bit_depth
|
||||
|| ctx->extra_cfg.yuv_format) {
|
||||
if (ctx->extra_cfg.bit_depth == 10)
|
||||
p->CodecType = (ctx->extra_cfg.yuv_format == 1)
|
||||
? MPP_FMT_YUV422SP_10BIT : MPP_FMT_YUV420SP_10BIT;
|
||||
else
|
||||
p->CodecType = (ctx->extra_cfg.yuv_format == 1)
|
||||
? MPP_FMT_YUV422SP : MPP_FMT_YUV420SP;
|
||||
} else {
|
||||
/**hightest of p->ImgWidth bit show current dec bitdepth
|
||||
* 0 - 8bit
|
||||
* 1 - 10bit
|
||||
**/
|
||||
if (p->ImgWidth & 0x80000000)
|
||||
p->CodecType = (p->ImgWidth & 0x40000000)
|
||||
? MPP_FMT_YUV422SP_10BIT : MPP_FMT_YUV420SP_10BIT;
|
||||
else
|
||||
p->CodecType = (p->ImgWidth & 0x40000000)
|
||||
? MPP_FMT_YUV422SP : MPP_FMT_YUV420SP;
|
||||
}
|
||||
p->ImgWidth = (p->ImgWidth & 0xFFFF);
|
||||
|
||||
mpp_frame_init(&frame);
|
||||
|
||||
Reference in New Issue
Block a user