[MppFrame]: define new frame type bit definition and fix mpeg2/mpeg4 frame type output error

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@1017 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2016-07-13 10:32:13 +00:00
parent 668393735f
commit b8d2409710
4 changed files with 40 additions and 15 deletions

View File

@@ -24,12 +24,21 @@ typedef void* MppFrame;
/* /*
* bit definition for mode flag in MppFrame * bit definition for mode flag in MppFrame
*/ */
/* progressive frame */
#define MPP_FRAME_FLAG_FRAME (0x00000000) #define MPP_FRAME_FLAG_FRAME (0x00000000)
/* top field only */
#define MPP_FRAME_FLAG_TOP_FIELD (0x00000001) #define MPP_FRAME_FLAG_TOP_FIELD (0x00000001)
/* bottom field only */
#define MPP_FRAME_FLAG_BOT_FIELD (0x00000002) #define MPP_FRAME_FLAG_BOT_FIELD (0x00000002)
/* paired field */
#define MPP_FRAME_FLAG_PAIRED_FIELD (MPP_FRAME_FLAG_TOP_FIELD|MPP_FRAME_FLAG_BOT_FIELD) #define MPP_FRAME_FLAG_PAIRED_FIELD (MPP_FRAME_FLAG_TOP_FIELD|MPP_FRAME_FLAG_BOT_FIELD)
#define MPP_FRAME_FLAG_DEINTERLACED (0x00000004) /* paired field with field order of top first */
#define MPP_FRAME_FLAG_TOP_FIRST (0x00000008) #define MPP_FRAME_FLAG_TOP_FIRST (0x00000004)
/* paired field with field order of bottom first */
#define MPP_FRAME_FLAG_BOT_FIRST (0x00000008)
/* paired field with unknown field order (MBAFF) */
#define MPP_FRAME_FLAG_DEINTERLACED (MPP_FRAME_FLAG_TOP_FIRST|MPP_FRAME_FLAG_BOT_FIRST)
#define MPP_FRAME_FLAG_FIELD_ORDER_MASK (0x0000000C)
// for multiview stream // for multiview stream
#define MPP_FRAME_FLAG_VIEW_ID_MASK (0x000000f0) #define MPP_FRAME_FLAG_VIEW_ID_MASK (0x000000f0)
@@ -203,8 +212,8 @@ MppFrameColorSpace mpp_frame_get_colorspace(const MppFrame frame);
void mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace); void mpp_frame_set_colorspace(MppFrame frame, MppFrameColorSpace colorspace);
MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame); MppFrameChromaLocation mpp_frame_get_chroma_location(const MppFrame frame);
void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location); void mpp_frame_set_chroma_location(MppFrame frame, MppFrameChromaLocation chroma_location);
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
MppFrameFormat mpp_frame_get_fmt(MppFrame frame); MppFrameFormat mpp_frame_get_fmt(MppFrame frame);
void mpp_frame_set_fmt(MppFrame frame, MppFrameFormat fmt);
/* /*

View File

@@ -1084,7 +1084,7 @@ MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx)
ctx->seq_head.decode_height = (ctx->seq_head.decode_height + 15) & (~15); ctx->seq_head.decode_height = (ctx->seq_head.decode_height + 15) & (~15);
ctx->seq_head.decode_width = (ctx->seq_head.decode_width + 15) & (~15); ctx->seq_head.decode_width = (ctx->seq_head.decode_width + 15) & (~15);
if (ctx->frame_cur->slot_index == 0xff) { if (ctx->frame_cur->slot_index == 0xff) {
RK_S32 frametype = 0; RK_U32 frametype = 0;
mpp_frame_set_width(ctx->frame_cur->f, ctx->display_width); mpp_frame_set_width(ctx->frame_cur->f, ctx->display_width);
mpp_frame_set_height(ctx->frame_cur->f, ctx->display_height); mpp_frame_set_height(ctx->frame_cur->f, ctx->display_height);
mpp_frame_set_hor_stride(ctx->frame_cur->f, ctx->display_width); mpp_frame_set_hor_stride(ctx->frame_cur->f, ctx->display_width);
@@ -1095,15 +1095,17 @@ MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx)
mpp_buf_slot_set_prop(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_FRAME, ctx->frame_cur->f); mpp_buf_slot_set_prop(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_FRAME, ctx->frame_cur->f);
mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_CODEC_USE); mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_CODEC_USE);
mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_HAL_OUTPUT); mpp_buf_slot_set_flag(ctx->frame_slots, ctx->frame_cur->slot_index, SLOT_HAL_OUTPUT);
mpp_frame_set_mode(ctx->frame_cur->f, 0);
ctx->frame_cur->flags = M2V_OUT_FLAG; ctx->frame_cur->flags = M2V_OUT_FLAG;
frametype = 1 - ctx->seq_ext_head.progressive_sequence; if (ctx->seq_ext_head.progressive_sequence) {
if (frametype) { frametype = MPP_FRAME_FLAG_FRAME;
if (!ctx->pic_code_ext_head.top_field_first) { } else {
frametype = 2; frametype = MPP_FRAME_FLAG_PAIRED_FIELD;
mpp_frame_set_mode(ctx->frame_cur->f, (RK_U32)frametype); if (ctx->pic_code_ext_head.top_field_first)
} frametype |= MPP_FRAME_FLAG_TOP_FIRST;
else
frametype |= MPP_FRAME_FLAG_BOT_FIRST;
} }
mpp_frame_set_mode(ctx->frame_cur->f, frametype);
} }
} }
//alloc frame space //alloc frame space

View File

@@ -1458,9 +1458,11 @@ MPP_RET mpp_mpg4_parser_setup_hal_output(Mpg4dParser ctx, RK_S32 *output)
mpp_frame_set_pts(frame, p->pts); mpp_frame_set_pts(frame, p->pts);
if (hdr_curr->vol.interlacing) { if (hdr_curr->vol.interlacing) {
frame_mode = (hdr_curr->vop.top_field_first) ? frame_mode = MPP_FRAME_FLAG_PAIRED_FIELD;
(MPP_FRAME_FLAG_TOP_FIELD) : if (hdr_curr->vop.top_field_first)
(MPP_FRAME_FLAG_BOT_FIELD); frame_mode |= MPP_FRAME_FLAG_TOP_FIRST;
else
frame_mode |= MPP_FRAME_FLAG_BOT_FIRST;
} }
mpp_frame_set_mode(frame, frame_mode); mpp_frame_set_mode(frame, frame_mode);

View File

@@ -178,13 +178,25 @@ RK_S32 VpuApiLegacy:: decode_getoutframe(DecoderOut_t *aDecOut)
MppBuffer buf = NULL; MppBuffer buf = NULL;
RK_U64 pts = 0; RK_U64 pts = 0;
RK_U32 fd = 0; RK_U32 fd = 0;
RK_U32 mode = 0;
void* ptr = NULL; void* ptr = NULL;
aDecOut->size = sizeof(VPU_FRAME); aDecOut->size = sizeof(VPU_FRAME);
vframe->DisplayWidth = mpp_frame_get_width(mframe); vframe->DisplayWidth = mpp_frame_get_width(mframe);
vframe->DisplayHeight = mpp_frame_get_height(mframe); vframe->DisplayHeight = mpp_frame_get_height(mframe);
vframe->FrameWidth = mpp_frame_get_hor_stride(mframe); vframe->FrameWidth = mpp_frame_get_hor_stride(mframe);
vframe->FrameHeight = mpp_frame_get_ver_stride(mframe); vframe->FrameHeight = mpp_frame_get_ver_stride(mframe);
vframe->FrameType = mpp_frame_get_mode(mframe); mode = mpp_frame_get_mode(mframe);
if (mode == MPP_FRAME_FLAG_FRAME)
vframe->FrameType = 0;
else {
RK_U32 field_order = mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK;
if (field_order == MPP_FRAME_FLAG_TOP_FIRST)
vframe->FrameType = 1;
else if (field_order == MPP_FRAME_FLAG_BOT_FIRST)
vframe->FrameType = 2;
else if (field_order == MPP_FRAME_FLAG_DEINTERLACED)
vframe->FrameType = 4;
}
vframe->ErrorInfo = mpp_frame_get_errinfo(mframe) | mpp_frame_get_discard(mframe); vframe->ErrorInfo = mpp_frame_get_errinfo(mframe) | mpp_frame_get_discard(mframe);
pts = mpp_frame_get_pts(mframe); pts = mpp_frame_get_pts(mframe);
aDecOut->timeUs = pts; aDecOut->timeUs = pts;