CHROMIUM: [media] rk3288-vpu: Add VP8 decoder to V4L2 API implementation

This patch extends existing implementation of required V4L2 API calls
with code required for VP8 decoder.

BUG=chrome-os-partner:33728
TEST=video_encode_accelerator_unittest;video_decode_accelerator_unittest

Signed-off-by: ZhiChao Yu <zhichao.yu@rock-chips.com>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/239814
Reviewed-by: Pawel Osciak <posciak@chromium.org>

Change-Id: I633687b7223c25f46d2373b964ceb1fe29f02b2f
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
This commit is contained in:
Tomasz Figa 2015-01-09 20:35:16 +09:00 committed by Huang, Tao
parent 9e52aaeedb
commit 3a60790ea0
2 changed files with 38 additions and 5 deletions

View File

@ -197,6 +197,15 @@ struct rk3288_vpu_vp8e_run {
const struct rk3288_vp8e_reg_params *reg_params;
};
/**
* struct rk3288_vpu_vp8d_run - per-run data specific to VP8 decoding.
* @frame_hdr: Pointer to a buffer containing per-run frame data which
* is needed by setting vpu register.
*/
struct rk3288_vpu_vp8d_run {
const struct v4l2_ctrl_vp8_frame_hdr *frame_hdr;
};
/**
* struct rk3288_vpu_h264d_run - per-run data specific to H264 decoding.
* @sps: Pointer to a buffer containing H264 SPS.
@ -231,6 +240,7 @@ struct rk3288_vpu_run {
/* Specific for particular operating modes. */
union {
struct rk3288_vpu_vp8e_run vp8e;
struct rk3288_vpu_vp8d_run vp8d;
struct rk3288_vpu_h264d_run h264d;
/* Other modes will need different data. */
};

View File

@ -54,6 +54,12 @@ static struct rk3288_vpu_fmt formats[] = {
.codec_mode = RK_VPU_CODEC_H264D,
.num_planes = 1,
},
{
.name = "Frames of VP8 Encoded Stream",
.fourcc = V4L2_PIX_FMT_VP8_FRAME,
.codec_mode = RK_VPU_CODEC_VP8D,
.num_planes = 1,
},
};
static struct rk3288_vpu_fmt *find_format(struct v4l2_format *f, bool bitstream)
@ -78,6 +84,7 @@ enum {
RK3288_VPU_DEC_CTRL_H264_SCALING_MATRIX,
RK3288_VPU_DEC_CTRL_H264_SLICE_PARAM,
RK3288_VPU_DEC_CTRL_H264_DECODE_PARAM,
RK3288_VPU_DEC_CTRL_VP8_FRAME_HDR,
};
static struct rk3288_vpu_control controls[] = {
@ -123,6 +130,14 @@ static struct rk3288_vpu_control controls[] = {
.elem_size = sizeof(struct v4l2_ctrl_h264_decode_param),
.can_store = true,
},
[RK3288_VPU_DEC_CTRL_VP8_FRAME_HDR] = {
.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HDR,
.type = V4L2_CTRL_TYPE_PRIVATE,
.name = "VP8 Frame Header Parameters",
.max_stores = VIDEO_MAX_FRAME,
.elem_size = sizeof(struct v4l2_ctrl_vp8_frame_hdr),
.can_store = true,
},
};
static inline const void *get_ctrl_ptr(struct rk3288_vpu_ctx *ctx, unsigned id)
@ -626,6 +641,7 @@ static int rk3288_vpu_dec_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX:
case V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAM:
case V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAM:
case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HDR:
/* These controls are used directly. */
break;
@ -942,14 +958,21 @@ static void rk3288_vpu_dec_prepare_run(struct rk3288_vpu_ctx *ctx)
v4l2_ctrl_apply_store(&ctx->ctrl_handler, src->config_store);
ctx->run.h264d.sps = get_ctrl_ptr(ctx, RK3288_VPU_DEC_CTRL_H264_SPS);
ctx->run.h264d.pps = get_ctrl_ptr(ctx, RK3288_VPU_DEC_CTRL_H264_PPS);
ctx->run.h264d.scaling_matrix = get_ctrl_ptr(ctx,
if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE) {
ctx->run.h264d.sps = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_H264_SPS);
ctx->run.h264d.pps = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_H264_PPS);
ctx->run.h264d.scaling_matrix = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_H264_SCALING_MATRIX);
ctx->run.h264d.slice_param = get_ctrl_ptr(ctx,
ctx->run.h264d.slice_param = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_H264_SLICE_PARAM);
ctx->run.h264d.decode_param = get_ctrl_ptr(ctx,
ctx->run.h264d.decode_param = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_H264_DECODE_PARAM);
} else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_VP8_FRAME) {
ctx->run.vp8d.frame_hdr = get_ctrl_ptr(ctx,
RK3288_VPU_DEC_CTRL_VP8_FRAME_HDR);
}
}
static void rk3288_vpu_dec_run_done(struct rk3288_vpu_ctx *ctx,