[h264d] add support 10bit

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@477 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
DingWei
2015-11-20 23:03:49 +00:00
parent d7fbbe4402
commit c849fde844
6 changed files with 41 additions and 12 deletions

View File

@@ -946,6 +946,8 @@ typedef struct h264d_video_ctx_t {
RK_U32 PicWidthInMbs;
RK_U32 FrameHeightInMbs;
RK_S32 yuv_format;
RK_U32 bit_depth_chroma;
RK_U32 bit_depth_luma;
RK_S32 width;
RK_S32 height;
RK_U32 width_after_crop;

View File

@@ -381,7 +381,7 @@ __FAILED:
static void dpb_mark_malloc(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK_U8 combine_flag, RK_S32 layer_id)
{
RK_U8 idx = 1;
H264_DpbMark_t *cur_mark = NULL;
H264_DpbMark_t *cur_mark = NULL;
H264_DecCtx_t *p_Dec = p_Vid->p_Dec;
H264_DpbMark_t *p_mark = p_Vid->p_Dec->dpb_mark;
@@ -403,12 +403,21 @@ static void dpb_mark_malloc(H264dVideoCtx_t *p_Vid, RK_S32 structure, RK_U8 comb
//mpp_print_slot_flag_info(g_debug_file1, p_Dec->frame_slots, cur_mark->slot_idx);
//mpp_log("[Malloc] lay_id=%d, g_framecnt=%d, mark_idx=%d, slot_idx=%d, pts=%lld \n", layer_id,
// p_Vid->g_framecnt, cur_mark->mark_idx, cur_mark->slot_idx, p_Vid->p_Inp->in_pts);
if((YUV420 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP);
} else if ((YUV420 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV420SP_10BIT);
mpp_log_f(" alloc_picture ----- MPP_FMT_YUV420SP_10BIT ------ \n");
} else if ((YUV422 == p_Vid->yuv_format) && (8 == p_Vid->bit_depth_luma)) {
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP);
} else if ((YUV422 == p_Vid->yuv_format) && (10 == p_Vid->bit_depth_luma)) {
mpp_frame_set_fmt(cur_mark->frame, MPP_FMT_YUV422SP_10BIT);
}
mpp_frame_set_hor_stride(cur_mark->frame, ((p_Vid->width * p_Vid->bit_depth_luma) >> 3)); // before crop
mpp_frame_set_width(cur_mark->frame, ((p_Vid->width_after_crop * p_Vid->bit_depth_luma)>>3)); // after crop
mpp_frame_set_hor_stride(cur_mark->frame, p_Vid->width); // before crop
mpp_frame_set_ver_stride(cur_mark->frame, p_Vid->height);
mpp_frame_set_width(cur_mark->frame, p_Vid->width_after_crop); // after crop
mpp_frame_set_height(cur_mark->frame, p_Vid->height_after_crop);
mpp_frame_set_ver_stride(cur_mark->frame, p_Vid->height);
mpp_frame_set_height(cur_mark->frame, p_Vid->height_after_crop);
mpp_frame_set_pts(cur_mark->frame, p_Vid->p_Cur->last_pts);
mpp_frame_set_dts(cur_mark->frame, p_Vid->p_Cur->last_dts);

View File

@@ -356,6 +356,8 @@ static void update_video_pars(H264dVideoCtx_t *p_Vid, H264_SPS_t *sps)
p_Vid->width = p_Vid->PicWidthInMbs * 16;
p_Vid->height = p_Vid->FrameHeightInMbs * 16;
p_Vid->bit_depth_luma = sps->bit_depth_luma_minus8 + 8;
p_Vid->bit_depth_chroma = sps->bit_depth_chroma_minus8 + 8;
if (p_Vid->yuv_format == YUV420) {
p_Vid->width_cr = (p_Vid->width >> 1);

View File

@@ -562,7 +562,12 @@ void *mpp_dec_hal_thread(void *data)
HalTaskHnd task = NULL;
HalTaskInfo task_info;
HalDecTask *task_dec = &task_info.dec;
#ifdef ANDROID
RK_S32 cur_deat = 0;
RK_U64 dec_no = 0, total_time = 0;
static struct timeval tv1, tv2;
gettimeofday(&tv1, NULL);
#endif
while (MPP_THREAD_RUNNING == hal->get_status()) {
/*
* hal thread wait for dxva interface intput firt
@@ -594,6 +599,14 @@ void *mpp_dec_hal_thread(void *data)
mpp->mThreadCodec->signal();
}
mpp_hal_hw_wait(dec->hal, &task_info);
#ifdef ANDROID
gettimeofday(&tv2, NULL);
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
total_time += cur_deat;
//mpp_log("[Cal_time] dec_no=%lld, time=%d ms, av_time=%lld ms. \n", dec_no, cur_deat, total_time/(dec_no + 1));
dec_no++;
tv1 = tv2;
#endif
/*
* when hardware decoding is done:
* 1. clear decoding flag (mark buffer is ready)

View File

@@ -52,8 +52,8 @@ typedef struct h264d_hal_ctx_t {
MppBufferGroup buf_group;
MppBuffer cabac_buf;
RK_S32 vpu_socket;
RK_S64 total_time;
RK_S64 iDecodedNum;
RK_U64 total_time;
RK_U64 iDecodedNum;
} H264dHalCtx_t;

View File

@@ -394,10 +394,13 @@ MPP_RET rkv_h264d_wait(void *hal, HalTaskInfo *task)
static struct timeval tv1, tv2;
gettimeofday(&tv1, NULL);
wait_ret = VPUClientWaitResult(p_hal->vpu_socket, (RK_U32 *)p_hal->regs, DEC_RKV_REGISTERS, &ret_cmd, &ret_len);
//mpp_log("H264 RKV FlushRegs success, g_grame_no=%d. \n", p_hal->iDecodedNum);
gettimeofday(&tv2, NULL);
cur_deat = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
p_hal->total_time += cur_deat;
//mpp_log("H264 RKV FlushRegs success, dec_no=%lld, time=%d ms, av_time=%lld ms. \n",
// p_hal->iDecodedNum, cur_deat, p_hal->total_time/(p_hal->iDecodedNum + 1));
//ALOGI("dec %lld frame time %d ms,average time %lld ms",decNum,deat,total/decNum);
p_hal->iDecodedNum++;
(void)wait_ret;
#endif