MLK-22420 VPU Decoder: change AVS eos padding data, correct chroma size
authorShijie Qin <shijie.qin@nxp.com>
Mon, 12 Aug 2019 01:59:42 +0000 (09:59 +0800)
committerShijie Qin <shijie.qin@nxp.com>
Fri, 16 Aug 2019 01:00:30 +0000 (09:00 +0800)
1. Change AVS format EOS_PADDING_TYPE to EOS_GENERIC_MPEG to align with
firmware
2. chroma size shall also be 1/2 luma size for interlaced clips

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
drivers/mxc/vpu_malone/vpu_b0.c
drivers/mxc/vpu_malone/vpu_b0.h

index 8bcb04c..5f98f85 100644 (file)
@@ -787,22 +787,18 @@ static void calculate_frame_size(struct vpu_ctx *ctx)
        u_int32 luma_size;
        u_int32 chroma_size;
        u_int32 chroma_height;
-       u_int32 uVertAlign = 512-1;
        bool b10BitFormat = is_10bit_format(ctx);
-
        struct queue_data *q_data;
 
        q_data = &ctx->q_data[V4L2_DST];
 
        width = b10BitFormat?(width + ((width + 3) >> 2)):width;
-       width = ((width + uVertAlign) & ~uVertAlign);
+       width = ALIGN(width, V4L2_NXP_FRAME_HORIZONTAL_ALIGN);
        q_data->stride = width;
 
-       height = ((height + uVertAlign) & ~uVertAlign);
-       if (ctx->seqinfo.uProgressive)
-               chroma_height = height >> 1;
-       else
-               chroma_height = height;
+       height = ALIGN(height, V4L2_NXP_FRAME_VERTICAL_ALIGN);
+       chroma_height = height >> 1;
+
        luma_size = width * height;
        chroma_size = width * chroma_height;
        ctx->q_data[V4L2_DST].sizeimage[0] = luma_size;
@@ -2472,10 +2468,10 @@ static int add_scode_vpu(struct vpu_ctx *ctx, u_int32 uStrBufIdx, VPU_PADDING_SC
                        last = 0x0a010000;
                        break;
                case VPU_VIDEO_MPEG2:
+               case VPU_VIDEO_AVS:
                        last = EOS_GENERIC_MPEG;
                        break;
                case VPU_VIDEO_ASP:
-               case VPU_VIDEO_AVS:
                        last = 0xb1010000;
                        break;
                case VPU_VIDEO_SPK:
index 4804dda..1e47240 100644 (file)
@@ -440,6 +440,9 @@ struct vpu_ctx {
 #define VPU_DECODED_EVENT_PERF_MASK            (1 << 0)
 #define VPU_READY_EVENT_PERF_MASK              (1 << 1)
 
+#define V4L2_NXP_FRAME_VERTICAL_ALIGN          512
+#define V4L2_NXP_FRAME_HORIZONTAL_ALIGN                512
+
 pSTREAM_BUFFER_DESCRIPTOR_TYPE get_str_buffer_desc(struct vpu_ctx *ctx);
 u_int32 got_free_space(u_int32 wptr, u_int32 rptr, u_int32 start, u_int32 end);
 int copy_buffer_to_stream(struct vpu_ctx *ctx, void *buffer, uint32_t length);