Пример #1
0
void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
{
   VAPictureParameterBufferVC1 * vc1 = buf->data;

   assert(buf->size >= sizeof(VAPictureParameterBufferVC1) && buf->num_elements == 1);
   context->desc.vc1.slice_count = 0;
   vlVaGetReferenceFrame(drv, vc1->forward_reference_picture, &context->desc.vc1.ref[0]);
   vlVaGetReferenceFrame(drv, vc1->backward_reference_picture, &context->desc.vc1.ref[1]);
   context->desc.vc1.picture_type = vc1->picture_fields.bits.picture_type;
   context->desc.vc1.frame_coding_mode = vc1->picture_fields.bits.frame_coding_mode;
   context->desc.vc1.postprocflag = vc1->post_processing != 0;
   context->desc.vc1.pulldown = vc1->sequence_fields.bits.pulldown;
   context->desc.vc1.interlace = vc1->sequence_fields.bits.interlace;
   context->desc.vc1.tfcntrflag = vc1->sequence_fields.bits.tfcntrflag;
   context->desc.vc1.finterpflag = vc1->sequence_fields.bits.finterpflag;
   context->desc.vc1.psf = vc1->sequence_fields.bits.psf;
   context->desc.vc1.dquant = vc1->pic_quantizer_fields.bits.dquant;
   context->desc.vc1.panscan_flag = vc1->entrypoint_fields.bits.panscan_flag;
   context->desc.vc1.refdist_flag =
      vc1->reference_fields.bits.reference_distance_flag;
   context->desc.vc1.quantizer = vc1->pic_quantizer_fields.bits.quantizer;
   context->desc.vc1.extended_mv = vc1->mv_fields.bits.extended_mv_flag;
   context->desc.vc1.extended_dmv = vc1->mv_fields.bits.extended_dmv_flag;
   context->desc.vc1.overlap = vc1->sequence_fields.bits.overlap;
   context->desc.vc1.vstransform =
      vc1->transform_fields.bits.variable_sized_transform_flag;
   context->desc.vc1.loopfilter = vc1->entrypoint_fields.bits.loopfilter;
   context->desc.vc1.fastuvmc = vc1->fast_uvmc_flag;
   context->desc.vc1.range_mapy_flag = vc1->range_mapping_fields.bits.luma_flag;
   context->desc.vc1.range_mapy = vc1->range_mapping_fields.bits.luma;
   context->desc.vc1.range_mapuv_flag = vc1->range_mapping_fields.bits.chroma_flag;
   context->desc.vc1.range_mapuv = vc1->range_mapping_fields.bits.chroma;
   context->desc.vc1.multires = vc1->sequence_fields.bits.multires;
   context->desc.vc1.syncmarker = vc1->sequence_fields.bits.syncmarker;
   context->desc.vc1.rangered = vc1->sequence_fields.bits.rangered;
   context->desc.vc1.maxbframes = vc1->sequence_fields.bits.max_b_frames;
   context->desc.vc1.deblockEnable = vc1->post_processing != 0;
   context->desc.vc1.pquant = vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
}
Пример #2
0
void vlVaHandlePictureParameterBufferHEVC(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
{
   VAPictureParameterBufferHEVC *hevc = buf->data;
   unsigned i;

   assert(buf->size >= sizeof(VAPictureParameterBufferHEVC) && buf->num_elements == 1);
   context->desc.h265.pps->sps->chroma_format_idc = hevc->pic_fields.bits.chroma_format_idc;
   context->desc.h265.pps->sps->separate_colour_plane_flag =
      hevc->pic_fields.bits.separate_colour_plane_flag;
   context->desc.h265.pps->sps->pic_width_in_luma_samples = hevc->pic_width_in_luma_samples;
   context->desc.h265.pps->sps->pic_height_in_luma_samples = hevc->pic_height_in_luma_samples;
   context->desc.h265.pps->sps->bit_depth_luma_minus8 = hevc->bit_depth_luma_minus8;
   context->desc.h265.pps->sps->bit_depth_chroma_minus8 = hevc->bit_depth_chroma_minus8;
   context->desc.h265.pps->sps->log2_max_pic_order_cnt_lsb_minus4 =
      hevc->log2_max_pic_order_cnt_lsb_minus4;
   context->desc.h265.pps->sps->sps_max_dec_pic_buffering_minus1 =
      hevc->sps_max_dec_pic_buffering_minus1;
   context->desc.h265.pps->sps->log2_min_luma_coding_block_size_minus3 =
      hevc->log2_min_luma_coding_block_size_minus3;
   context->desc.h265.pps->sps->log2_diff_max_min_luma_coding_block_size =
      hevc->log2_diff_max_min_luma_coding_block_size;
   context->desc.h265.pps->sps->log2_min_transform_block_size_minus2 =
      hevc->log2_min_transform_block_size_minus2;
   context->desc.h265.pps->sps->log2_diff_max_min_transform_block_size =
      hevc->log2_diff_max_min_transform_block_size;
   context->desc.h265.pps->sps->max_transform_hierarchy_depth_inter =
      hevc->max_transform_hierarchy_depth_inter;
   context->desc.h265.pps->sps->max_transform_hierarchy_depth_intra =
      hevc->max_transform_hierarchy_depth_intra;
   context->desc.h265.pps->sps->scaling_list_enabled_flag =
      hevc->pic_fields.bits.scaling_list_enabled_flag;
   context->desc.h265.pps->sps->amp_enabled_flag = hevc->pic_fields.bits.amp_enabled_flag;
   context->desc.h265.pps->sps->sample_adaptive_offset_enabled_flag =
      hevc->slice_parsing_fields.bits.sample_adaptive_offset_enabled_flag;
   context->desc.h265.pps->sps->pcm_enabled_flag = hevc->pic_fields.bits.pcm_enabled_flag;
   if (hevc->pic_fields.bits.pcm_enabled_flag == 1) {
      context->desc.h265.pps->sps->pcm_sample_bit_depth_luma_minus1 =
         hevc->pcm_sample_bit_depth_luma_minus1;
      context->desc.h265.pps->sps->pcm_sample_bit_depth_chroma_minus1 =
         hevc->pcm_sample_bit_depth_chroma_minus1;
      context->desc.h265.pps->sps->log2_min_pcm_luma_coding_block_size_minus3 =
         hevc->log2_min_pcm_luma_coding_block_size_minus3;
      context->desc.h265.pps->sps->log2_diff_max_min_pcm_luma_coding_block_size =
         hevc->log2_diff_max_min_pcm_luma_coding_block_size;
      context->desc.h265.pps->sps->pcm_loop_filter_disabled_flag =
         hevc->pic_fields.bits.pcm_loop_filter_disabled_flag;
   }
   context->desc.h265.pps->sps->num_short_term_ref_pic_sets = hevc->num_short_term_ref_pic_sets;
   context->desc.h265.pps->sps->long_term_ref_pics_present_flag =
      hevc->slice_parsing_fields.bits.long_term_ref_pics_present_flag;
   context->desc.h265.pps->sps->num_long_term_ref_pics_sps = hevc->num_long_term_ref_pic_sps;
   context->desc.h265.pps->sps->sps_temporal_mvp_enabled_flag =
      hevc->slice_parsing_fields.bits.sps_temporal_mvp_enabled_flag;
   context->desc.h265.pps->sps->strong_intra_smoothing_enabled_flag =
      hevc->pic_fields.bits.strong_intra_smoothing_enabled_flag;

   context->desc.h265.pps->dependent_slice_segments_enabled_flag =
      hevc->slice_parsing_fields.bits.dependent_slice_segments_enabled_flag;
   context->desc.h265.pps->output_flag_present_flag =
      hevc->slice_parsing_fields.bits.output_flag_present_flag;
   context->desc.h265.pps->num_extra_slice_header_bits = hevc->num_extra_slice_header_bits;
   context->desc.h265.pps->sign_data_hiding_enabled_flag =
      hevc->pic_fields.bits.sign_data_hiding_enabled_flag;
   context->desc.h265.pps->cabac_init_present_flag =
      hevc->slice_parsing_fields.bits.cabac_init_present_flag;
   context->desc.h265.pps->num_ref_idx_l0_default_active_minus1 =
      hevc->num_ref_idx_l0_default_active_minus1;
   context->desc.h265.pps->num_ref_idx_l1_default_active_minus1 =
      hevc->num_ref_idx_l1_default_active_minus1;
   context->desc.h265.pps->init_qp_minus26 = hevc->init_qp_minus26;
   context->desc.h265.pps->constrained_intra_pred_flag =
      hevc->pic_fields.bits.constrained_intra_pred_flag;
   context->desc.h265.pps->transform_skip_enabled_flag =
      hevc->pic_fields.bits.transform_skip_enabled_flag;
   context->desc.h265.pps->cu_qp_delta_enabled_flag =
      hevc->pic_fields.bits.cu_qp_delta_enabled_flag;
   context->desc.h265.pps->diff_cu_qp_delta_depth = hevc->diff_cu_qp_delta_depth;
   context->desc.h265.pps->pps_cb_qp_offset = hevc->pps_cb_qp_offset;
   context->desc.h265.pps->pps_cr_qp_offset = hevc->pps_cr_qp_offset;
   context->desc.h265.pps->pps_slice_chroma_qp_offsets_present_flag =
      hevc->slice_parsing_fields.bits.pps_slice_chroma_qp_offsets_present_flag;
   context->desc.h265.pps->weighted_pred_flag = hevc->pic_fields.bits.weighted_pred_flag;
   context->desc.h265.pps->weighted_bipred_flag = hevc->pic_fields.bits.weighted_bipred_flag;
   context->desc.h265.pps->transquant_bypass_enabled_flag =
      hevc->pic_fields.bits.transquant_bypass_enabled_flag;
   context->desc.h265.pps->tiles_enabled_flag = hevc->pic_fields.bits.tiles_enabled_flag;
   context->desc.h265.pps->entropy_coding_sync_enabled_flag =
      hevc->pic_fields.bits.entropy_coding_sync_enabled_flag;
   if (hevc->pic_fields.bits.tiles_enabled_flag == 1) {
      context->desc.h265.pps->num_tile_columns_minus1 = hevc->num_tile_columns_minus1;
      context->desc.h265.pps->num_tile_rows_minus1 = hevc->num_tile_rows_minus1;
      for (i = 0 ; i < 19 ; i++)
         context->desc.h265.pps->column_width_minus1[i] = hevc->column_width_minus1[i];
      for (i = 0 ; i < 21 ; i++)
         context->desc.h265.pps->row_height_minus1[i] = hevc->row_height_minus1[i];
      context->desc.h265.pps->loop_filter_across_tiles_enabled_flag =
         hevc->pic_fields.bits.loop_filter_across_tiles_enabled_flag;
   }
   context->desc.h265.pps->pps_loop_filter_across_slices_enabled_flag =
      hevc->pic_fields.bits.pps_loop_filter_across_slices_enabled_flag;
   context->desc.h265.pps->deblocking_filter_override_enabled_flag =
      hevc->slice_parsing_fields.bits.deblocking_filter_override_enabled_flag;
   context->desc.h265.pps->pps_deblocking_filter_disabled_flag =
      hevc->slice_parsing_fields.bits.pps_disable_deblocking_filter_flag;
   context->desc.h265.pps->pps_beta_offset_div2 = hevc->pps_beta_offset_div2;
   context->desc.h265.pps->pps_tc_offset_div2 = hevc->pps_tc_offset_div2;
   context->desc.h265.pps->lists_modification_present_flag =
      hevc->slice_parsing_fields.bits.lists_modification_present_flag;
   context->desc.h265.pps->log2_parallel_merge_level_minus2 =
      hevc->log2_parallel_merge_level_minus2;
   context->desc.h265.pps->slice_segment_header_extension_present_flag =
      hevc->slice_parsing_fields.bits.slice_segment_header_extension_present_flag;

   context->desc.h265.IDRPicFlag = hevc->slice_parsing_fields.bits.IdrPicFlag;
   context->desc.h265.RAPPicFlag = hevc->slice_parsing_fields.bits.RapPicFlag;

   context->desc.h265.CurrPicOrderCntVal = hevc->CurrPic.pic_order_cnt;

   for (i = 0 ; i < 8 ; i++) {
      context->desc.h265.RefPicSetStCurrBefore[i] = 0xFF;
      context->desc.h265.RefPicSetStCurrAfter[i] = 0xFF;
      context->desc.h265.RefPicSetLtCurr[i] = 0xFF;
   }
   context->desc.h265.NumPocStCurrBefore = 0;
   context->desc.h265.NumPocStCurrAfter = 0;
   context->desc.h265.NumPocLtCurr = 0;
   unsigned int iBefore = 0;
   unsigned int iAfter = 0;
   unsigned int iCurr = 0;
   for (i = 0 ; i < 15 ; i++) {
      context->desc.h265.PicOrderCntVal[i] = hevc->ReferenceFrames[i].pic_order_cnt;

      vlVaGetReferenceFrame(drv, hevc->ReferenceFrames[i].picture_id, &context->desc.h265.ref[i]);

      if ((hevc->ReferenceFrames[i].flags & VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE) && (iBefore < 8)) {
         context->desc.h265.RefPicSetStCurrBefore[iBefore++] = i;
         context->desc.h265.NumPocStCurrBefore++;
      }
      if ((hevc->ReferenceFrames[i].flags & VA_PICTURE_HEVC_RPS_ST_CURR_AFTER) && (iAfter < 8)) {
         context->desc.h265.RefPicSetStCurrAfter[iAfter++] = i;
         context->desc.h265.NumPocStCurrAfter++;
      }
      if ((hevc->ReferenceFrames[i].flags & VA_PICTURE_HEVC_RPS_LT_CURR) && (iCurr < 8)) {
         context->desc.h265.RefPicSetLtCurr[iCurr++] = i;
         context->desc.h265.NumPocLtCurr++;
      }
   }
}
Пример #3
0
void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
{
   VAPictureParameterBufferH264 *h264 = buf->data;
   unsigned int top_or_bottom_field;
   unsigned i;

   assert(buf->size >= sizeof(VAPictureParameterBufferH264) && buf->num_elements == 1);
   /*CurrPic*/
   context->desc.h264.field_order_cnt[0] = h264->CurrPic.TopFieldOrderCnt;
   context->desc.h264.field_order_cnt[1] = h264->CurrPic.BottomFieldOrderCnt;
   /*ReferenceFrames[16]*/
   /*picture_width_in_mbs_minus1*/
   /*picture_height_in_mbs_minus1*/
   /*bit_depth_luma_minus8*/
   /*bit_depth_chroma_minus8*/
   context->desc.h264.num_ref_frames = h264->num_ref_frames;
   /*chroma_format_idc*/
   /*residual_colour_transform_flag*/
   /*gaps_in_frame_num_value_allowed_flag*/
   context->desc.h264.pps->sps->frame_mbs_only_flag =
      h264->seq_fields.bits.frame_mbs_only_flag;
   context->desc.h264.pps->sps->mb_adaptive_frame_field_flag =
      h264->seq_fields.bits.mb_adaptive_frame_field_flag;
   context->desc.h264.pps->sps->direct_8x8_inference_flag =
      h264->seq_fields.bits.direct_8x8_inference_flag;
   /*MinLumaBiPredSize8x8*/
   context->desc.h264.pps->sps->log2_max_frame_num_minus4 =
      h264->seq_fields.bits.log2_max_frame_num_minus4;
   context->desc.h264.pps->sps->pic_order_cnt_type =
      h264->seq_fields.bits.pic_order_cnt_type;
   context->desc.h264.pps->sps->log2_max_pic_order_cnt_lsb_minus4 =
      h264->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4;
   context->desc.h264.pps->sps->delta_pic_order_always_zero_flag =
      h264->seq_fields.bits.delta_pic_order_always_zero_flag;
   /*num_slice_groups_minus1*/
   /*slice_group_map_type*/
   /*slice_group_change_rate_minus1*/
   context->desc.h264.pps->pic_init_qp_minus26 =
      h264->pic_init_qp_minus26;
   /*pic_init_qs_minus26*/
   context->desc.h264.pps->chroma_qp_index_offset =
      h264->chroma_qp_index_offset;
   context->desc.h264.pps->second_chroma_qp_index_offset =
      h264->second_chroma_qp_index_offset;
   context->desc.h264.pps->entropy_coding_mode_flag =
      h264->pic_fields.bits.entropy_coding_mode_flag;
   context->desc.h264.pps->weighted_pred_flag =
      h264->pic_fields.bits.weighted_pred_flag;
   context->desc.h264.pps->weighted_bipred_idc =
      h264->pic_fields.bits.weighted_bipred_idc;
   context->desc.h264.pps->transform_8x8_mode_flag =
      h264->pic_fields.bits.transform_8x8_mode_flag;
   context->desc.h264.field_pic_flag =
      h264->pic_fields.bits.field_pic_flag;
   context->desc.h264.pps->constrained_intra_pred_flag =
      h264->pic_fields.bits.constrained_intra_pred_flag;
   context->desc.h264.pps->bottom_field_pic_order_in_frame_present_flag =
      h264->pic_fields.bits.pic_order_present_flag;
   context->desc.h264.pps->deblocking_filter_control_present_flag =
      h264->pic_fields.bits.deblocking_filter_control_present_flag;
   context->desc.h264.pps->redundant_pic_cnt_present_flag =
      h264->pic_fields.bits.redundant_pic_cnt_present_flag;
   /*reference_pic_flag*/
   context->desc.h264.frame_num = h264->frame_num;
   context->desc.h264.is_reference = h264->pic_fields.bits.reference_pic_flag;
   context->desc.h264.bottom_field_flag =
      h264->pic_fields.bits.field_pic_flag &&
      (h264->CurrPic.flags & VA_PICTURE_H264_BOTTOM_FIELD) != 0;

   if (!context->decoder && context->desc.h264.num_ref_frames > 0)
      context->templat.max_references = MIN2(context->desc.h264.num_ref_frames, 16);

   for (i = 0; i < context->templat.max_references; ++i) {
      if ((h264->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) ||
          (h264->ReferenceFrames[i].picture_id == VA_INVALID_SURFACE)) {
         resetReferencePictureDesc(&context->desc.h264, i);
         break;
      }

      vlVaGetReferenceFrame(drv, h264->ReferenceFrames[i].picture_id, &context->desc.h264.ref[i]);
      context->desc.h264.frame_num_list[i] = h264->ReferenceFrames[i].frame_idx;

      top_or_bottom_field = h264->ReferenceFrames[i].flags &
         (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
      context->desc.h264.is_long_term[i] = (h264->ReferenceFrames[i].flags &
         (VA_PICTURE_H264_SHORT_TERM_REFERENCE |
         VA_PICTURE_H264_LONG_TERM_REFERENCE)) !=
         VA_PICTURE_H264_SHORT_TERM_REFERENCE;
      context->desc.h264.top_is_reference[i] =
         !context->desc.h264.is_long_term[i] ||
         !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_TOP_FIELD);
      context->desc.h264.bottom_is_reference[i] =
         !context->desc.h264.is_long_term[i] ||
         !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_BOTTOM_FIELD);
      context->desc.h264.field_order_cnt_list[i][0] =
         top_or_bottom_field != VA_PICTURE_H264_BOTTOM_FIELD ?
         h264->ReferenceFrames[i].TopFieldOrderCnt: INT_MAX;
      context->desc.h264.field_order_cnt_list[i][1] =
         top_or_bottom_field != VA_PICTURE_H264_TOP_FIELD ?
         h264->ReferenceFrames[i].BottomFieldOrderCnt: INT_MAX;
   }

   /* Make sure remaining elements are clean */
   for (; i < 16; ++i)
      resetReferencePictureDesc(&context->desc.h264, i);
}