Currently there is only one place in the code checking whether given
context is decoding or encoding. However as a prerequisite for further
patch adding more such checks, this patch adds a common helper function
which returns appropriate enum value depending on operating mode of
given context.
BUG=chrome-os-partner:41585
TEST=AppRTC loopback
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288661
Reviewed-by: Pawel Osciak <posciak@chromium.org>
Change-Id: Ide145770ca77897ada3cb878c4b9c9787824a827
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
return container_of(vb, struct rk3288_vpu_buf, b);
}
+static inline bool rk3288_vpu_ctx_is_encoder(struct rk3288_vpu_ctx *ctx)
+{
+ return ctx->vpu_dst_fmt->codec_mode != RK_VPU_CODEC_NONE;
+}
+
int rk3288_vpu_ctrls_setup(struct rk3288_vpu_ctx *ctx,
const struct v4l2_ctrl_ops *ctrl_ops,
struct rk3288_vpu_control *controls,
{
enum rk3288_vpu_codec_mode codec_mode;
- if (ctx->vpu_dst_fmt->codec_mode != RK_VPU_CODEC_NONE)
+ if (rk3288_vpu_ctx_is_encoder(ctx))
codec_mode = ctx->vpu_dst_fmt->codec_mode; /* Encoder */
else
codec_mode = ctx->vpu_src_fmt->codec_mode; /* Decoder */