media: uapi: h264: Drop SLICE_PARAMS 'size' field
[linux-2.6-microblaze.git] / drivers / staging / media / sunxi / cedrus / cedrus_h264.c
index 54ee2aa..7d9bd58 100644 (file)
@@ -166,8 +166,8 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
 
 static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
                                   struct cedrus_run *run,
-                                  const u8 *ref_list, u8 num_ref,
-                                  enum cedrus_h264_sram_off sram)
+                                  const struct v4l2_h264_reference *ref_list,
+                                  u8 num_ref, enum cedrus_h264_sram_off sram)
 {
        const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params;
        struct vb2_queue *cap_q;
@@ -188,7 +188,7 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
                int buf_idx;
                u8 dpb_idx;
 
-               dpb_idx = ref_list[i];
+               dpb_idx = ref_list[i].index;
                dpb = &decode->dpb[dpb_idx];
 
                if (!(dpb->flags & V4L2_H264_DPB_ENTRY_FLAG_ACTIVE))
@@ -256,10 +256,8 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx,
 static void cedrus_write_pred_weight_table(struct cedrus_ctx *ctx,
                                           struct cedrus_run *run)
 {
-       const struct v4l2_ctrl_h264_slice_params *slice =
-               run->h264.slice_params;
-       const struct v4l2_h264_pred_weight_table *pred_weight =
-               &slice->pred_weight_table;
+       const struct v4l2_ctrl_h264_pred_weights *pred_weight =
+               run->h264.pred_weights;
        struct cedrus_dev *dev = ctx->dev;
        int i, j, k;
 
@@ -326,17 +324,16 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
        struct vb2_buffer *src_buf = &run->src->vb2_buf;
        struct cedrus_dev *dev = ctx->dev;
        dma_addr_t src_buf_addr;
-       u32 len = slice->size * 8;
+       size_t slice_bytes = vb2_get_plane_payload(src_buf, 0);
        unsigned int pic_width_in_mbs;
        bool mbaff_pic;
        u32 reg;
 
-       cedrus_write(dev, VE_H264_VLD_LEN, len);
+       cedrus_write(dev, VE_H264_VLD_LEN, slice_bytes * 8);
        cedrus_write(dev, VE_H264_VLD_OFFSET, 0);
 
        src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
-       cedrus_write(dev, VE_H264_VLD_END,
-                    src_buf_addr + vb2_get_plane_payload(src_buf, 0));
+       cedrus_write(dev, VE_H264_VLD_END, src_buf_addr + slice_bytes);
        cedrus_write(dev, VE_H264_VLD_ADDR,
                     VE_H264_VLD_ADDR_VAL(src_buf_addr) |
                     VE_H264_VLD_ADDR_FIRST | VE_H264_VLD_ADDR_VALID |
@@ -367,11 +364,7 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
 
        cedrus_skip_bits(dev, slice->header_bit_size);
 
-       if (((pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) &&
-            (slice->slice_type == V4L2_H264_SLICE_TYPE_P ||
-             slice->slice_type == V4L2_H264_SLICE_TYPE_SP)) ||
-           (pps->weighted_bipred_idc == 1 &&
-            slice->slice_type == V4L2_H264_SLICE_TYPE_B))
+       if (V4L2_H264_CTRL_PRED_WEIGHTS_REQUIRED(pps, slice))
                cedrus_write_pred_weight_table(ctx, run);
 
        if ((slice->slice_type == V4L2_H264_SLICE_TYPE_P) ||