static unsigned int mfc_handle_frame_field(struct s5p_mfc_ctx *ctx)
{
struct s5p_mfc_dev *dev = ctx->dev;
- unsigned int interlace_type = 0, is_interlace = 0;
+ unsigned int interlace_type = 0, is_interlace = 0, is_mbaff = 0;
unsigned int field;
if (CODEC_INTERLACED(ctx))
is_interlace = s5p_mfc_is_interlace_picture();
+ if (CODEC_MBAFF(ctx))
+ is_mbaff = s5p_mfc_is_mbaff_picture();
+
if (is_interlace) {
interlace_type = s5p_mfc_get_interlace_type();
if (interlace_type)
field = V4L2_FIELD_INTERLACED_TB;
else
field = V4L2_FIELD_INTERLACED_BT;
+ } else if (is_mbaff) {
+ field = V4L2_FIELD_INTERLACED_TB;
} else {
field = V4L2_FIELD_NONE;
}
- mfc_debug(2, "is_interlace : %d interlace_type : %d, field: 0x%#x\n",
- is_interlace, interlace_type, field);
+ mfc_debug(2, "is_interlace : %d interlace_type : %d, is_mbaff: %d, field: 0x%#x\n",
+ is_interlace, interlace_type, is_mbaff, field);
return field;
}
{
struct s5p_mfc_dev *dev = ctx->dev;
struct s5p_mfc_dec *dec = ctx->dec_priv;
- int i;
+ int i, is_interlace, is_mbaff;
if (ctx->src_fmt->fourcc != V4L2_PIX_FMT_FIMV1) {
ctx->img_width = s5p_mfc_get_img_width();
else
s5p_mfc_change_state(ctx, MFCINST_HEAD_PARSED);
- if (ctx->state == MFCINST_HEAD_PARSED)
- dec->is_interlaced =
- s5p_mfc_is_interlace_picture();
+ if (ctx->state == MFCINST_HEAD_PARSED) {
+ is_interlace = s5p_mfc_is_interlace_picture();
+ is_mbaff = s5p_mfc_is_mbaff_picture();
+ if (is_interlace || is_mbaff)
+ dec->is_interlaced = 1;
+ mfc_debug(3, "interlace: %d, mbaff: %d\n", is_interlace, is_mbaff);
+ }
if (IS_H264_DEC(ctx) || IS_H264_MVC_DEC(ctx) || IS_HEVC_DEC(ctx)) {
struct s5p_mfc_buf *src_mb = s5p_mfc_get_buf(&ctx->buf_queue_lock, &ctx->src_buf_queue, MFC_BUF_NO_TOUCH_USED);
#define s5p_mfc_is_interlace_picture() ((MFC_READL(S5P_FIMV_D_DISPLAY_STATUS) \
>> S5P_FIMV_DISP_STATUS_INTERLACE_SHIFT)\
& S5P_FIMV_DISP_STATUS_INTERLACE_MASK)
+#define s5p_mfc_is_mbaff_picture() ((MFC_READL(S5P_FIMV_D_H264_INFO) \
+ >> S5P_FIMV_D_H264_INFO_MBAFF_FRAME_FLAG_SHIFT)\
+ & S5P_FIMV_D_H264_INFO_MBAFF_FRAME_FLAG_MASK)
#define s5p_mfc_get_img_width() MFC_READL(S5P_FIMV_D_DISPLAY_FRAME_WIDTH)
#define s5p_mfc_get_img_height() MFC_READL(S5P_FIMV_D_DISPLAY_FRAME_HEIGHT)
#define s5p_mfc_get_disp_y_addr() MFC_READL(S5P_FIMV_D_DISPLAY_LUMA_ADDR)