[Mesa-dev] [PATCH 3/7] vl/h264: split fields into SPS/PPS

Christian König deathsimple at vodafone.de
Thu Oct 24 19:55:10 CEST 2013


Am 24.10.2013 19:18, schrieb Ilia Mirkin:
> On Thu, Oct 24, 2013 at 9:14 AM, Christian König
> <deathsimple at vodafone.de> wrote:
>> From: Christian König <christian.koenig at amd.com>
>>
>> Add alot of missing fields as well.
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>>   .../drivers/nouveau/nouveau_vp3_video_bsp.c        | 30 ++++----
>>   src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c | 24 +++---
>>   src/gallium/drivers/nouveau/nv50/nv84_video_bsp.c  | 38 +++++-----
>>   src/gallium/drivers/nouveau/nv50/nv84_video_vp.c   |  8 +-
>>   src/gallium/drivers/radeon/radeon_uvd.c            | 59 +++++++--------
>>   src/gallium/include/pipe/p_video_state.h           | 88 ++++++++++++++++------
>>   src/gallium/state_trackers/vdpau/decode.c          | 47 ++++++------
>>   7 files changed, 169 insertions(+), 125 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
>> index ba2a917..6d968c1 100644
>> --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
>> +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_bsp.c
>> @@ -204,25 +204,25 @@ nouveau_vp3_fill_picparm_h264_bsp(struct nouveau_vp3_decoder *dec,
>>      h->unk00 = 1;
>>      h->pad1 = h->pad2 = 0;
>>      h->unk = 0;
>> -   h->log2_max_frame_num_minus4 = d->log2_max_frame_num_minus4;
>> -   h->frame_mbs_only_flag = d->frame_mbs_only_flag;
>> -   h->direct_8x8_inference_flag = d->direct_8x8_inference_flag;
>> +   h->log2_max_frame_num_minus4 = d->pps->sps->log2_max_frame_num_minus4;
>> +   h->frame_mbs_only_flag = d->pps->sps->frame_mbs_only_flag;
>> +   h->direct_8x8_inference_flag = d->pps->sps->direct_8x8_inference_flag;
>>      h->width_mb = mb(dec->base.width);
>>      h->height_mb = mb(dec->base.height);
>> -   h->entropy_coding_mode_flag = d->entropy_coding_mode_flag;
>> -   h->pic_order_present_flag = d->pic_order_present_flag;
>> -   h->pic_order_cnt_type = d->pic_order_cnt_type;
>> -   h->log2_max_pic_order_cnt_lsb_minus4 = d->log2_max_pic_order_cnt_lsb_minus4;
>> -   h->delta_pic_order_always_zero_flag = d->delta_pic_order_always_zero_flag;
>> +   h->entropy_coding_mode_flag = d->pps->entropy_coding_mode_flag;
>> +   h->pic_order_present_flag = d->pps->bottom_field_pic_order_in_frame_present_flag;
>> +   h->pic_order_cnt_type = d->pps->sps->pic_order_cnt_type;
>> +   h->log2_max_pic_order_cnt_lsb_minus4 = d->pps->sps->log2_max_pic_order_cnt_lsb_minus4;
>> +   h->delta_pic_order_always_zero_flag = d->pps->sps->delta_pic_order_always_zero_flag;
>>      h->num_ref_idx_l0_active_minus1 = d->num_ref_idx_l0_active_minus1;
>>      h->num_ref_idx_l1_active_minus1 = d->num_ref_idx_l1_active_minus1;
>> -   h->weighted_pred_flag = d->weighted_pred_flag;
>> -   h->weighted_bipred_idc = d->weighted_bipred_idc;
>> -   h->pic_init_qp_minus26 = d->pic_init_qp_minus26;
>> -   h->deblocking_filter_control_present_flag = d->deblocking_filter_control_present_flag;
>> -   h->redundant_pic_cnt_present_flag = d->redundant_pic_cnt_present_flag;
>> -   h->transform_8x8_mode_flag = d->transform_8x8_mode_flag;
>> -   h->mb_adaptive_frame_field_flag = d->mb_adaptive_frame_field_flag;
>> +   h->weighted_pred_flag = d->pps->weighted_pred_flag;
>> +   h->weighted_bipred_idc = d->pps->weighted_bipred_idc;
>> +   h->pic_init_qp_minus26 = d->pps->pic_init_qp_minus26;
>> +   h->deblocking_filter_control_present_flag = d->pps->deblocking_filter_control_present_flag;
>> +   h->redundant_pic_cnt_present_flag = d->pps->redundant_pic_cnt_present_flag;
>> +   h->transform_8x8_mode_flag = d->pps->transform_8x8_mode_flag;
>> +   h->mb_adaptive_frame_field_flag = d->pps->sps->mb_adaptive_frame_field_flag;
>>      h->field_pic_flag = d->field_pic_flag;
>>      h->bottom_field_flag = d->bottom_field_flag;
>>      memset(h->real_pad, 0, sizeof(h->real_pad));
>> diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c b/src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c
>> index add998d..a0f5332 100644
>> --- a/src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c
>> +++ b/src/gallium/drivers/nouveau/nouveau_vp3_video_vp.c
>> @@ -340,22 +340,22 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
>>      nouveau_vp3_inter_sizes(dec, 1, &ring, &h->bucket_size, &h->inter_ring_data_size);
>>
>>      h->u220 = 0;
>> -   h->f0 = d->mb_adaptive_frame_field_flag;
>> -   h->f1 = d->direct_8x8_inference_flag;
>> -   h->weighted_pred_flag = d->weighted_pred_flag;
>> -   h->f3 = d->constrained_intra_pred_flag;
>> +   h->f0 = d->pps->sps->mb_adaptive_frame_field_flag;
>> +   h->f1 = d->pps->sps->direct_8x8_inference_flag;
>> +   h->weighted_pred_flag = d->pps->weighted_pred_flag;
>> +   h->f3 = d->pps->constrained_intra_pred_flag;
>>      h->is_reference = d->is_reference;
>>      h->interlace = d->field_pic_flag;
>>      h->bottom_field_flag = d->bottom_field_flag;
>>      h->f7 = 0; // TODO: figure out when set..
>> -   h->log2_max_frame_num_minus4 = d->log2_max_frame_num_minus4;
>> +   h->log2_max_frame_num_minus4 = d->pps->sps->log2_max_frame_num_minus4;
>>      h->u31_45 = 1;
>>
>> -   h->pic_order_cnt_type = d->pic_order_cnt_type;
>> -   h->pic_init_qp_minus26 = d->pic_init_qp_minus26;
>> -   h->chroma_qp_index_offset = d->chroma_qp_index_offset;
>> -   h->second_chroma_qp_index_offset = d->second_chroma_qp_index_offset;
>> -   h->weighted_bipred_idc = d->weighted_bipred_idc;
>> +   h->pic_order_cnt_type = d->pps->sps->pic_order_cnt_type;
>> +   h->pic_init_qp_minus26 = d->pps->pic_init_qp_minus26;
>> +   h->chroma_qp_index_offset = d->pps->chroma_qp_index_offset;
>> +   h->second_chroma_qp_index_offset = d->pps->second_chroma_qp_index_offset;
>> +   h->weighted_bipred_idc = d->pps->weighted_bipred_idc;
>>      h->tmp_idx = 0; // set in h264_vp_refs below
>>      h->fifo_dec_index = 0; // always set to 0 to be fifo compatible with other codecs
>>      h->frame_number = d->frame_num;
>> @@ -363,8 +363,8 @@ nouveau_vp3_fill_picparm_h264_vp(struct nouveau_vp3_decoder *dec,
>>      h->field_order_cnt[0] = d->field_order_cnt[0];
>>      h->field_order_cnt[1] = d->field_order_cnt[1];
>>      memset(h->refs, 0, sizeof(h->refs));
>> -   memcpy(h->m4x4, d->scaling_lists_4x4, sizeof(h->m4x4));
>> -   memcpy(h->m8x8, d->scaling_lists_8x8, sizeof(h->m8x8));
>> +   memcpy(h->m4x4, d->pps->ScalingList4x4, sizeof(h->m4x4));
>> +   memcpy(h->m8x8, d->pps->ScalingList8x8, sizeof(h->m8x8));
>>      h->u220 = 0;
>>      for (i = 0; i < d->num_ref_frames; ++i) {
>>         if (!d->ref[i])
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video_bsp.c b/src/gallium/drivers/nouveau/nv50/nv84_video_bsp.c
>> index 86047b5..de923e4 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv84_video_bsp.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv84_video_bsp.c
>> @@ -136,7 +136,7 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
>>      params.iseqparm.chroma_format_idc = 1;
>>
>>      params.iseqparm.pic_width_in_mbs_minus1 = mb(dec->base.width) - 1;
>> -   if (desc->field_pic_flag || desc->mb_adaptive_frame_field_flag)
>> +   if (desc->field_pic_flag || desc->pps->sps->mb_adaptive_frame_field_flag)
>>         params.iseqparm.pic_height_in_map_units_minus1 = mb_half(dec->base.height) - 1;
>>      else
>>         params.iseqparm.pic_height_in_map_units_minus1 = mb(dec->base.height) - 1;
>> @@ -162,26 +162,26 @@ nv84_decoder_bsp(struct nv84_decoder *dec,
>>      }
>>
>>      params.iseqparm.num_ref_frames = desc->num_ref_frames;
>> -   params.iseqparm.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
>> -   params.ipicparm.constrained_intra_pred_flag = desc->constrained_intra_pred_flag;
>> -   params.ipicparm.weighted_pred_flag = desc->weighted_pred_flag;
>> -   params.ipicparm.weighted_bipred_idc = desc->weighted_bipred_idc;
>> -   params.iseqparm.frame_mbs_only_flag = desc->frame_mbs_only_flag;
>> -   params.ipicparm.transform_8x8_mode_flag = desc->transform_8x8_mode_flag;
>> -   params.ipicparm.chroma_qp_index_offset = desc->chroma_qp_index_offset;
>> -   params.ipicparm.second_chroma_qp_index_offset = desc->second_chroma_qp_index_offset;
>> -   params.ipicparm.pic_init_qp_minus26 = desc->pic_init_qp_minus26;
>> +   params.iseqparm.mb_adaptive_frame_field_flag = desc->pps->sps->mb_adaptive_frame_field_flag;
>> +   params.ipicparm.constrained_intra_pred_flag = desc->pps->constrained_intra_pred_flag;
>> +   params.ipicparm.weighted_pred_flag = desc->pps->weighted_pred_flag;
>> +   params.ipicparm.weighted_bipred_idc = desc->pps->weighted_bipred_idc;
>> +   params.iseqparm.frame_mbs_only_flag = desc->pps->sps->frame_mbs_only_flag;
>> +   params.ipicparm.transform_8x8_mode_flag = desc->pps->transform_8x8_mode_flag;
>> +   params.ipicparm.chroma_qp_index_offset = desc->pps->chroma_qp_index_offset;
>> +   params.ipicparm.second_chroma_qp_index_offset = desc->pps->second_chroma_qp_index_offset;
>> +   params.ipicparm.pic_init_qp_minus26 = desc->pps->pic_init_qp_minus26;
>>      params.ipicparm.num_ref_idx_l0_active_minus1 = desc->num_ref_idx_l0_active_minus1;
>>      params.ipicparm.num_ref_idx_l1_active_minus1 = desc->num_ref_idx_l1_active_minus1;
>> -   params.iseqparm.log2_max_frame_num_minus4 = desc->log2_max_frame_num_minus4;
>> -   params.iseqparm.pic_order_cnt_type = desc->pic_order_cnt_type;
>> -   params.iseqparm.log2_max_pic_order_cnt_lsb_minus4 = desc->log2_max_pic_order_cnt_lsb_minus4;
>> -   params.iseqparm.delta_pic_order_always_zero_flag = desc->delta_pic_order_always_zero_flag;
>> -   params.iseqparm.direct_8x8_inference_flag = desc->direct_8x8_inference_flag;
>> -   params.ipicparm.entropy_coding_mode_flag = desc->entropy_coding_mode_flag;
>> -   params.ipicparm.pic_order_present_flag = desc->pic_order_present_flag;
>> -   params.ipicparm.deblocking_filter_control_present_flag = desc->deblocking_filter_control_present_flag;
>> -   params.ipicparm.redundant_pic_cnt_present_flag = desc->redundant_pic_cnt_present_flag;
>> +   params.iseqparm.log2_max_frame_num_minus4 = desc->pps->sps->log2_max_frame_num_minus4;
>> +   params.iseqparm.pic_order_cnt_type = desc->pps->sps->pic_order_cnt_type;
>> +   params.iseqparm.log2_max_pic_order_cnt_lsb_minus4 = desc->pps->sps->log2_max_pic_order_cnt_lsb_minus4;
>> +   params.iseqparm.delta_pic_order_always_zero_flag = desc->pps->sps->delta_pic_order_always_zero_flag;
>> +   params.iseqparm.direct_8x8_inference_flag = desc->pps->sps->direct_8x8_inference_flag;
>> +   params.ipicparm.entropy_coding_mode_flag = desc->pps->entropy_coding_mode_flag;
>> +   params.ipicparm.pic_order_present_flag = desc->pps->bottom_field_pic_order_in_frame_present_flag;
>> +   params.ipicparm.deblocking_filter_control_present_flag = desc->pps->deblocking_filter_control_present_flag;
>> +   params.ipicparm.redundant_pic_cnt_present_flag = desc->pps->redundant_pic_cnt_present_flag;
>>
>>      memcpy(dec->bitstream->map, &params, sizeof(params));
>>      for (i = 0; i < num_buffers; i++) {
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
>> index 619aa4e..f3480b2 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c
>> @@ -90,9 +90,9 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
>>      memset(&param1, 0, sizeof(param1));
>>      memset(&param2, 0, sizeof(param2));
>>
>> -   memcpy(&param1.scaling_lists_4x4, desc->scaling_lists_4x4,
>> +   memcpy(&param1.scaling_lists_4x4, desc->pps->ScalingList4x4,
>>             sizeof(param1.scaling_lists_4x4));
>> -   memcpy(&param1.scaling_lists_8x8, desc->scaling_lists_8x8,
>> +   memcpy(&param1.scaling_lists_8x8, desc->pps->ScalingList8x8,
>>             sizeof(param1.scaling_lists_8x8));
>>
>>      param1.width = width;
>> @@ -100,7 +100,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
>>      param1.height = param1.h2 = height;
>>      param1.h1 = param1.h3 = align(height, 32);
>>      param1.format = 0x3231564e; /* 'NV12' */
>> -   param1.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
>> +   param1.mb_adaptive_frame_field_flag = desc->pps->sps->mb_adaptive_frame_field_flag;
>>      param1.field_pic_flag = desc->field_pic_flag;
>>
>>      param2.width = width;
>> @@ -116,7 +116,7 @@ nv84_decoder_vp_h264(struct nv84_decoder *dec,
>>         param2.top = desc->bottom_field_flag ? 2 : 1;
>>         param2.bottom = desc->bottom_field_flag;
>>      }
>> -   param2.mb_adaptive_frame_field_flag = desc->mb_adaptive_frame_field_flag;
>> +   param2.mb_adaptive_frame_field_flag = desc->pps->sps->mb_adaptive_frame_field_flag;
>>      param2.is_reference = desc->is_reference;
>>
>>      PUSH_SPACE(push, 5 + 16 + 3 + 2 + 6 + (is_ref ? 2 : 0) + 3 + 2 + 4 + 2);
>> diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
>> index 6d87841..95757e3 100644
>> --- a/src/gallium/drivers/radeon/radeon_uvd.c
>> +++ b/src/gallium/drivers/radeon/radeon_uvd.c
>> @@ -380,10 +380,16 @@ static struct ruvd_h264 get_h264_msg(struct ruvd_decoder *dec, struct pipe_h264_
>>                  result.level = 41;
>>
>>          result.sps_info_flags = 0;
>> -       result.sps_info_flags |= pic->direct_8x8_inference_flag << 0;
>> -       result.sps_info_flags |= pic->mb_adaptive_frame_field_flag << 1;
>> -       result.sps_info_flags |= pic->frame_mbs_only_flag << 2;
>> -       result.sps_info_flags |= pic->delta_pic_order_always_zero_flag << 3;
>> +       result.sps_info_flags |= pic->pps->sps->direct_8x8_inference_flag << 0;
>> +       result.sps_info_flags |= pic->pps->sps->mb_adaptive_frame_field_flag << 1;
>> +       result.sps_info_flags |= pic->pps->sps->frame_mbs_only_flag << 2;
>> +       result.sps_info_flags |= pic->pps->sps->delta_pic_order_always_zero_flag << 3;
>> +
>> +       result.bit_depth_luma_minus8 = pic->pps->sps->bit_depth_luma_minus8;
>> +       result.bit_depth_chroma_minus8 = pic->pps->sps->bit_depth_chroma_minus8;
>> +       result.log2_max_frame_num_minus4 = pic->pps->sps->log2_max_frame_num_minus4;
>> +       result.pic_order_cnt_type = pic->pps->sps->pic_order_cnt_type;
>> +       result.log2_max_pic_order_cnt_lsb_minus4 = pic->pps->sps->log2_max_pic_order_cnt_lsb_minus4;
>>
>>          switch (dec->base.chroma_format) {
>>          case PIPE_VIDEO_CHROMA_FORMAT_400:
>> @@ -401,37 +407,30 @@ static struct ruvd_h264 get_h264_msg(struct ruvd_decoder *dec, struct pipe_h264_
>>          }
>>
>>          result.pps_info_flags = 0;
>> -       result.pps_info_flags |= pic->transform_8x8_mode_flag << 0;
>> -       result.pps_info_flags |= pic->redundant_pic_cnt_present_flag << 1;
>> -       result.pps_info_flags |= pic->constrained_intra_pred_flag << 2;
>> -       result.pps_info_flags |= pic->deblocking_filter_control_present_flag << 3;
>> -       result.pps_info_flags |= pic->weighted_bipred_idc << 4;
>> -       result.pps_info_flags |= pic->weighted_pred_flag << 6;
>> -       result.pps_info_flags |= pic->pic_order_present_flag << 7;
>> -       result.pps_info_flags |= pic->entropy_coding_mode_flag << 8;
>> -
>> -       result.bit_depth_luma_minus8 = 0;
>> -       result.bit_depth_chroma_minus8 = 0;
>> -
>> -       result.log2_max_frame_num_minus4 = pic->log2_max_frame_num_minus4;
>> -       result.pic_order_cnt_type = pic->pic_order_cnt_type;
>> -       result.log2_max_pic_order_cnt_lsb_minus4 = pic->log2_max_pic_order_cnt_lsb_minus4;
>> -       result.num_ref_frames = pic->num_ref_frames;
>> -       result.pic_init_qp_minus26 = pic->pic_init_qp_minus26;
>> -       result.chroma_qp_index_offset = pic->chroma_qp_index_offset;
>> -       result.second_chroma_qp_index_offset = pic->second_chroma_qp_index_offset;
>> +       result.pps_info_flags |= pic->pps->transform_8x8_mode_flag << 0;
>> +       result.pps_info_flags |= pic->pps->redundant_pic_cnt_present_flag << 1;
>> +       result.pps_info_flags |= pic->pps->constrained_intra_pred_flag << 2;
>> +       result.pps_info_flags |= pic->pps->deblocking_filter_control_present_flag << 3;
>> +       result.pps_info_flags |= pic->pps->weighted_bipred_idc << 4;
>> +       result.pps_info_flags |= pic->pps->weighted_pred_flag << 6;
>> +       result.pps_info_flags |= pic->pps->bottom_field_pic_order_in_frame_present_flag << 7;
>> +       result.pps_info_flags |= pic->pps->entropy_coding_mode_flag << 8;
>> +
>> +       result.num_slice_groups_minus1 = pic->pps->num_slice_groups_minus1;
>> +       result.slice_group_map_type = pic->pps->slice_group_map_type;
>> +       result.slice_group_change_rate_minus1 = pic->pps->slice_group_change_rate_minus1;
>> +       result.pic_init_qp_minus26 = pic->pps->pic_init_qp_minus26;
>> +       result.chroma_qp_index_offset = pic->pps->chroma_qp_index_offset;
>> +       result.second_chroma_qp_index_offset = pic->pps->second_chroma_qp_index_offset;
>> +
>> +       memcpy(result.scaling_list_4x4, pic->pps->ScalingList4x4, 6*16);
>> +       memcpy(result.scaling_list_8x8, pic->pps->ScalingList8x8, 2*64);
>>
>> -       result.num_slice_groups_minus1 = 0;
>> -       result.slice_group_map_type = 0;
>> +       result.num_ref_frames = pic->num_ref_frames;
>>
>>          result.num_ref_idx_l0_active_minus1 = pic->num_ref_idx_l0_active_minus1;
>>          result.num_ref_idx_l1_active_minus1 = pic->num_ref_idx_l1_active_minus1;
>>
>> -       result.slice_group_change_rate_minus1 = 0;
>> -
>> -       memcpy(result.scaling_list_4x4, pic->scaling_lists_4x4, 6*64);
>> -       memcpy(result.scaling_list_8x8, pic->scaling_lists_8x8, 2*64);
>> -
>>          result.frame_num = pic->frame_num;
>>          memcpy(result.frame_num_list, pic->frame_num_list, 4*16);
>>          result.curr_field_order_cnt_list[0] = pic->field_order_cnt[0];
>> diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h
>> index 1fb6ff2..c84a418 100644
>> --- a/src/gallium/include/pipe/p_video_state.h
>> +++ b/src/gallium/include/pipe/p_video_state.h
>> @@ -101,6 +101,15 @@ enum pipe_mpeg12_field_select
>>      PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
>>   };
>>
>> +enum pipe_h264_slice_type
>> +{
>> +   PIPE_H264_SLICE_TYPE_P = 0x0,
>> +   PIPE_H264_SLICE_TYPE_B = 0x1,
>> +   PIPE_H264_SLICE_TYPE_I = 0x2,
>> +   PIPE_H264_SLICE_TYPE_SP = 0x3,
>> +   PIPE_H264_SLICE_TYPE_SI = 0x4
>> +};
>> +
>>   struct pipe_picture_desc
>>   {
>>      enum pipe_video_profile profile;
>> @@ -242,39 +251,70 @@ struct pipe_vc1_picture_desc
>>      struct pipe_video_buffer *ref[2];
>>   };
>>
>> -struct pipe_h264_picture_desc
>> +struct pipe_h264_sps
>>   {
>> -   struct pipe_picture_desc base;
>> -
>> -   uint32_t slice_count;
>> -   int32_t  field_order_cnt[2];
>> -   bool     is_reference;
>> -   uint32_t frame_num;
>> -   uint8_t  field_pic_flag;
>> -   uint8_t  bottom_field_flag;
>> -   uint8_t  num_ref_frames;
>> -   uint8_t  mb_adaptive_frame_field_flag;
>> -   uint8_t  constrained_intra_pred_flag;
>> -   uint8_t  weighted_pred_flag;
>> -   uint8_t  weighted_bipred_idc;
>> -   uint8_t  frame_mbs_only_flag;
>> -   uint8_t  transform_8x8_mode_flag;
>> -   int8_t   chroma_qp_index_offset;
>> -   int8_t   second_chroma_qp_index_offset;
>> -   int8_t   pic_init_qp_minus26;
>> -   uint8_t  num_ref_idx_l0_active_minus1;
>> -   uint8_t  num_ref_idx_l1_active_minus1;
>> +   uint8_t  chroma_format_idc;
>> +   uint8_t  separate_colour_plane_flag;
>> +   uint8_t  bit_depth_luma_minus8;
>> +   uint8_t  bit_depth_chroma_minus8;
>> +   uint8_t  seq_scaling_matrix_present_flag;
>> +   uint8_t  ScalingList4x4[6][16];
>> +   uint8_t  ScalingList8x8[6][64];
> You appear to have added the ScalingList into both sps and pps, but I
> only see it used from pps. Was this an oversight? Also, why the
> different variable naming convention from all the other vars?

Yes that's correct. Both the SPS and the PPS can contain a separate 
scaling list. For slice level decode (that's what the hardware is doing) 
you only need the resulting PPS list, but to create this list you need 
the SPS list as well. I used the names directly from the spec, no idea 
why they doesn't use a consistent naming convention.

Do the changes to nouveau look ok to you?

Thanks for the comments,
Christian.

>
>>      uint8_t  log2_max_frame_num_minus4;
>>      uint8_t  pic_order_cnt_type;
>>      uint8_t  log2_max_pic_order_cnt_lsb_minus4;
>>      uint8_t  delta_pic_order_always_zero_flag;
>> +   int32_t  offset_for_non_ref_pic;
>> +   int32_t  offset_for_top_to_bottom_field;
>> +   uint8_t  num_ref_frames_in_pic_order_cnt_cycle;
>> +   int32_t  offset_for_ref_frame[256];
>> +   uint8_t  max_num_ref_frames;
>> +   uint8_t  frame_mbs_only_flag;
>> +   uint8_t  mb_adaptive_frame_field_flag;
>>      uint8_t  direct_8x8_inference_flag;
>> +};
>> +
>> +struct pipe_h264_pps
>> +{
>> +   struct pipe_h264_sps *sps;
>> +
>>      uint8_t  entropy_coding_mode_flag;
>> -   uint8_t  pic_order_present_flag;
>> +   uint8_t  bottom_field_pic_order_in_frame_present_flag;
>> +   uint8_t  num_slice_groups_minus1;
>> +   uint8_t  slice_group_map_type;
>> +   uint8_t  slice_group_change_rate_minus1;
>> +   uint8_t  num_ref_idx_l0_default_active_minus1;
>> +   uint8_t  num_ref_idx_l1_default_active_minus1;
>> +   uint8_t  weighted_pred_flag;
>> +   uint8_t  weighted_bipred_idc;
>> +   int8_t   pic_init_qp_minus26;
>> +   int8_t   chroma_qp_index_offset;
>>      uint8_t  deblocking_filter_control_present_flag;
>> +   uint8_t  constrained_intra_pred_flag;
>>      uint8_t  redundant_pic_cnt_present_flag;
>> -   uint8_t  scaling_lists_4x4[6][16];
>> -   uint8_t  scaling_lists_8x8[2][64];
>> +   uint8_t  ScalingList4x4[6][16];
>> +   uint8_t  ScalingList8x8[6][64];
>> +   uint8_t  transform_8x8_mode_flag;
>> +   int8_t   second_chroma_qp_index_offset;
>> +};
>> +
>> +struct pipe_h264_picture_desc
>> +{
>> +   struct pipe_picture_desc base;
>> +
>> +   struct pipe_h264_pps *pps;
>> +
>> +   /* slice header */
>> +   uint32_t frame_num;
>> +   uint8_t  field_pic_flag;
>> +   uint8_t  bottom_field_flag;
>> +   uint8_t  num_ref_idx_l0_active_minus1;
>> +   uint8_t  num_ref_idx_l1_active_minus1;
>> +
>> +   uint32_t slice_count;
>> +   int32_t  field_order_cnt[2];
>> +   bool     is_reference;
>> +   uint8_t  num_ref_frames;
>>
>>      bool     is_long_term[16];
>>      bool     top_is_reference[16];
>> diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
>> index d741c79..f62deb1 100644
>> --- a/src/gallium/state_trackers/vdpau/decode.c
>> +++ b/src/gallium/state_trackers/vdpau/decode.c
>> @@ -352,6 +352,28 @@ vlVdpDecoderRenderH264(struct pipe_h264_picture_desc *picture,
>>
>>      VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding H264\n");
>>
>> +   picture->pps->sps->mb_adaptive_frame_field_flag = picture_info->mb_adaptive_frame_field_flag;
>> +   picture->pps->sps->frame_mbs_only_flag = picture_info->frame_mbs_only_flag;
>> +   picture->pps->sps->log2_max_frame_num_minus4 = picture_info->log2_max_frame_num_minus4;
>> +   picture->pps->sps->pic_order_cnt_type = picture_info->pic_order_cnt_type;
>> +   picture->pps->sps->log2_max_pic_order_cnt_lsb_minus4 = picture_info->log2_max_pic_order_cnt_lsb_minus4;
>> +   picture->pps->sps->delta_pic_order_always_zero_flag = picture_info->delta_pic_order_always_zero_flag;
>> +   picture->pps->sps->direct_8x8_inference_flag = picture_info->direct_8x8_inference_flag;
>> +
>> +   picture->pps->transform_8x8_mode_flag = picture_info->transform_8x8_mode_flag;
>> +   picture->pps->chroma_qp_index_offset = picture_info->chroma_qp_index_offset;
>> +   picture->pps->second_chroma_qp_index_offset = picture_info->second_chroma_qp_index_offset;
>> +   picture->pps->pic_init_qp_minus26 = picture_info->pic_init_qp_minus26;
>> +   picture->pps->entropy_coding_mode_flag = picture_info->entropy_coding_mode_flag;
>> +   picture->pps->deblocking_filter_control_present_flag = picture_info->deblocking_filter_control_present_flag;
>> +   picture->pps->redundant_pic_cnt_present_flag = picture_info->redundant_pic_cnt_present_flag;
>> +   picture->pps->constrained_intra_pred_flag = picture_info->constrained_intra_pred_flag;
>> +   picture->pps->weighted_pred_flag = picture_info->weighted_pred_flag;
>> +   picture->pps->weighted_bipred_idc = picture_info->weighted_bipred_idc;
>> +   picture->pps->bottom_field_pic_order_in_frame_present_flag = picture_info->pic_order_present_flag;
>> +   memcpy(picture->pps->ScalingList4x4, picture_info->scaling_lists_4x4, 6*16);
>> +   memcpy(picture->pps->ScalingList8x8, picture_info->scaling_lists_8x8, 2*64);
>> +
>>      picture->slice_count = picture_info->slice_count;
>>      picture->field_order_cnt[0] = picture_info->field_order_cnt[0];
>>      picture->field_order_cnt[1] = picture_info->field_order_cnt[1];
>> @@ -360,29 +382,9 @@ vlVdpDecoderRenderH264(struct pipe_h264_picture_desc *picture,
>>      picture->field_pic_flag = picture_info->field_pic_flag;
>>      picture->bottom_field_flag = picture_info->bottom_field_flag;
>>      picture->num_ref_frames = picture_info->num_ref_frames;
>> -   picture->mb_adaptive_frame_field_flag = picture_info->mb_adaptive_frame_field_flag;
>> -   picture->constrained_intra_pred_flag = picture_info->constrained_intra_pred_flag;
>> -   picture->weighted_pred_flag = picture_info->weighted_pred_flag;
>> -   picture->weighted_bipred_idc = picture_info->weighted_bipred_idc;
>> -   picture->frame_mbs_only_flag = picture_info->frame_mbs_only_flag;
>> -   picture->transform_8x8_mode_flag = picture_info->transform_8x8_mode_flag;
>> -   picture->chroma_qp_index_offset = picture_info->chroma_qp_index_offset;
>> -   picture->second_chroma_qp_index_offset = picture_info->second_chroma_qp_index_offset;
>> -   picture->pic_init_qp_minus26 = picture_info->pic_init_qp_minus26;
>> +
>>      picture->num_ref_idx_l0_active_minus1 = picture_info->num_ref_idx_l0_active_minus1;
>>      picture->num_ref_idx_l1_active_minus1 = picture_info->num_ref_idx_l1_active_minus1;
>> -   picture->log2_max_frame_num_minus4 = picture_info->log2_max_frame_num_minus4;
>> -   picture->pic_order_cnt_type = picture_info->pic_order_cnt_type;
>> -   picture->log2_max_pic_order_cnt_lsb_minus4 = picture_info->log2_max_pic_order_cnt_lsb_minus4;
>> -   picture->delta_pic_order_always_zero_flag = picture_info->delta_pic_order_always_zero_flag;
>> -   picture->direct_8x8_inference_flag = picture_info->direct_8x8_inference_flag;
>> -   picture->entropy_coding_mode_flag = picture_info->entropy_coding_mode_flag;
>> -   picture->pic_order_present_flag = picture_info->pic_order_present_flag;
>> -   picture->deblocking_filter_control_present_flag = picture_info->deblocking_filter_control_present_flag;
>> -   picture->redundant_pic_cnt_present_flag = picture_info->redundant_pic_cnt_present_flag;
>> -
>> -   memcpy(picture->scaling_lists_4x4, picture_info->scaling_lists_4x4, 6*16);
>> -   memcpy(picture->scaling_lists_8x8, picture_info->scaling_lists_8x8, 2*64);
>>
>>      for (i = 0; i < 16; ++i) {
>>         VdpStatus ret = vlVdpGetReferenceFrame
>> @@ -452,6 +454,8 @@ vlVdpDecoderRender(VdpDecoder decoder,
>>      struct pipe_video_codec *dec;
>>      bool buffer_support[2];
>>      unsigned i;
>> +   struct pipe_h264_sps sps = {};
>> +   struct pipe_h264_pps pps = { &sps };
>>      union {
>>         struct pipe_picture_desc base;
>>         struct pipe_mpeg12_picture_desc mpeg12;
>> @@ -536,6 +540,7 @@ vlVdpDecoderRender(VdpDecoder decoder,
>>         ret = vlVdpDecoderRenderVC1(&desc.vc1, (VdpPictureInfoVC1 *)picture_info);
>>         break;
>>      case PIPE_VIDEO_FORMAT_MPEG4_AVC:
>> +      desc.h264.pps = &pps;
>>         ret = vlVdpDecoderRenderH264(&desc.h264, (VdpPictureInfoH264 *)picture_info);
>>         break;
>>      default:
>> --
>> 1.8.1.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list