本文整理汇总了C++中PicturePtr::editPicture方法的典型用法代码示例。如果您正苦于以下问题:C++ PicturePtr::editPicture方法的具体用法?C++ PicturePtr::editPicture怎么用?C++ PicturePtr::editPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PicturePtr
的用法示例。
在下文中一共展示了PicturePtr::editPicture方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
bool VaapiDecoderVP9::ensurePicture(const PicturePtr& picture, const Vp9FrameHdr* hdr)
{
VADecPictureParameterBufferVP9* param;
if (!picture->editPicture(param))
return false;
param->frame_width = hdr->width;
param->frame_height = hdr->height;
if (!fillReference(param, hdr))
return false;
#define FILL_PIC_FIELD(field) param->pic_fields.bits.field = hdr->field;
FILL_PIC_FIELD(subsampling_x)
FILL_PIC_FIELD(subsampling_y)
FILL_PIC_FIELD(frame_type)
FILL_PIC_FIELD(show_frame)
FILL_PIC_FIELD(error_resilient_mode)
FILL_PIC_FIELD(intra_only)
FILL_PIC_FIELD(allow_high_precision_mv)
FILL_PIC_FIELD(mcomp_filter_type)
FILL_PIC_FIELD(frame_parallel_decoding_mode)
FILL_PIC_FIELD(reset_frame_context)
FILL_PIC_FIELD(refresh_frame_context)
FILL_PIC_FIELD(frame_context_idx)
#undef FILL_PIC_FIELD
param->pic_fields.bits.segmentation_enabled = hdr->segmentation.enabled;
param->pic_fields.bits.segmentation_temporal_update = hdr->segmentation.temporal_update;
param->pic_fields.bits.segmentation_update_map = hdr->segmentation.update_map;
param->pic_fields.bits.lossless_flag = m_parser->lossless_flag;
param->filter_level = hdr->loopfilter.filter_level;
param->sharpness_level = hdr->loopfilter.sharpness_level;
#define FILL_FIELD(field) param->field = hdr->field;
FILL_FIELD(log2_tile_rows);
FILL_FIELD(log2_tile_columns);
FILL_FIELD(frame_header_length_in_bytes)
FILL_FIELD(first_partition_size)
#undef FILL_FIELD
assert(sizeof(param->mb_segment_tree_probs) == sizeof(m_parser->mb_segment_tree_probs));
assert(sizeof(param->segment_pred_probs) == sizeof(m_parser->segment_pred_probs));
memcpy(param->mb_segment_tree_probs, m_parser->mb_segment_tree_probs, sizeof(m_parser->mb_segment_tree_probs));
memcpy(param->segment_pred_probs, m_parser->segment_pred_probs, sizeof(m_parser->segment_pred_probs));
return true;
}
示例2: ERROR
bool VaapiEncoderH264::ensurePicture (const PicturePtr& picture, const SurfacePtr& surface)
{
VAEncPictureParameterBufferH264 *picParam;
if (!pictureReferenceListSet(picture)) {
ERROR ("reference list reorder failed");
return false;
}
if (!picture->editPicture(picParam) || !fill(picParam, picture, surface)) {
ERROR("failed to create picture parameter buffer (PPS)");
return false;
}
if (picture->isIdr() && !ensurePictureHeader (picture, picParam)) {
ERROR ("set picture packed header failed");
return false;
}
return true;
}
示例3: fillReference
bool VaapiDecoderH265::fillPicture(const PicturePtr& picture, const H265SliceHdr* const slice)
{
VAPictureParameterBufferHEVC* param;
if (!picture->editPicture(param))
return false;
param->CurrPic.picture_id = picture->getSurfaceID();
param->CurrPic.pic_order_cnt = picture->m_poc;
fillReference(param->ReferenceFrames, N_ELEMENTS(param->ReferenceFrames));
H265PPS* pps = slice->pps;
H265SPS* sps = pps->sps;
#define FILL(h, f) param->f = h->f
FILL(sps, pic_width_in_luma_samples);
FILL(sps, pic_height_in_luma_samples);
#define FILL_PIC(h, f) param->pic_fields.bits.f = h->f
FILL_PIC(sps, chroma_format_idc);
FILL_PIC(sps, separate_colour_plane_flag);
FILL_PIC(sps, pcm_enabled_flag);
FILL_PIC(sps, scaling_list_enabled_flag);
FILL_PIC(pps, transform_skip_enabled_flag);
FILL_PIC(sps, amp_enabled_flag);
FILL_PIC(sps, strong_intra_smoothing_enabled_flag);
FILL_PIC(pps, sign_data_hiding_enabled_flag);
FILL_PIC(pps, constrained_intra_pred_flag);
FILL_PIC(pps, cu_qp_delta_enabled_flag);
FILL_PIC(pps, weighted_pred_flag);
FILL_PIC(pps, weighted_bipred_flag);
FILL_PIC(pps, transquant_bypass_enabled_flag);
FILL_PIC(pps, tiles_enabled_flag);
FILL_PIC(pps, entropy_coding_sync_enabled_flag);
param->pic_fields.bits.pps_loop_filter_across_slices_enabled_flag
= pps->loop_filter_across_slices_enabled_flag;
FILL_PIC(pps, loop_filter_across_tiles_enabled_flag);
FILL_PIC(sps, pcm_loop_filter_disabled_flag);
//how to fill this?
//NoPicReorderingFlag
//NoBiPredFlag
param->sps_max_dec_pic_buffering_minus1 =
sps->max_dec_pic_buffering_minus1[0];
FILL(sps, bit_depth_luma_minus8);
FILL(sps, bit_depth_chroma_minus8);
FILL(sps, pcm_sample_bit_depth_luma_minus1);
FILL(sps, pcm_sample_bit_depth_chroma_minus1);
FILL(sps, log2_min_luma_coding_block_size_minus3);
FILL(sps, log2_diff_max_min_luma_coding_block_size);
FILL(sps, log2_min_transform_block_size_minus2);
FILL(sps, log2_diff_max_min_transform_block_size);
FILL(sps, log2_min_pcm_luma_coding_block_size_minus3);
FILL(sps, log2_diff_max_min_pcm_luma_coding_block_size);
FILL(sps, max_transform_hierarchy_depth_intra);
FILL(sps, max_transform_hierarchy_depth_inter);
FILL(pps, init_qp_minus26);
FILL(pps, diff_cu_qp_delta_depth);
param->pps_cb_qp_offset = pps->cb_qp_offset;
param->pps_cr_qp_offset = pps->cr_qp_offset;
FILL(pps, log2_parallel_merge_level_minus2);
FILL(pps, num_tile_columns_minus1);
FILL(pps, num_tile_rows_minus1);
for (int i = 0; i <= pps->num_tile_columns_minus1; i++) {
param->column_width_minus1[i] = pps->column_width_minus1[i];
}
for (int i = 0; i <= pps->num_tile_rows_minus1; i++) {
param->row_height_minus1[i] = pps->row_height_minus1[i];
}
#define FILL_SLICE(h, f) param->slice_parsing_fields.bits.f = h->f
#define FILL_SLICE_1(h, f) param->slice_parsing_fields.bits.h##_##f = h->f
FILL_SLICE(pps, lists_modification_present_flag);
FILL_SLICE(sps, long_term_ref_pics_present_flag);
FILL_SLICE_1(sps, temporal_mvp_enabled_flag);
FILL_SLICE(pps, cabac_init_present_flag);
FILL_SLICE(pps, output_flag_present_flag);
FILL_SLICE(pps, dependent_slice_segments_enabled_flag);
FILL_SLICE_1(pps, slice_chroma_qp_offsets_present_flag);
FILL_SLICE(sps, sample_adaptive_offset_enabled_flag);
FILL_SLICE(pps, deblocking_filter_override_enabled_flag);
param->slice_parsing_fields.bits.pps_disable_deblocking_filter_flag =
pps->deblocking_filter_disabled_flag;
FILL_SLICE(pps, slice_segment_header_extension_present_flag);
/* how to fill following fields
RapPicFlag
IdrPicFlag
IntraPicFlag */
FILL(sps, log2_max_pic_order_cnt_lsb_minus4);
FILL(sps, num_short_term_ref_pic_sets);
param->num_long_term_ref_pic_sps = sps->num_long_term_ref_pics_sps;
FILL(pps, num_ref_idx_l0_default_active_minus1);
FILL(pps, num_ref_idx_l1_default_active_minus1);
param->pps_beta_offset_div2 = pps->beta_offset_div2;
param->pps_tc_offset_div2 = pps->tc_offset_div2;
FILL(pps, num_extra_slice_header_bits);
/* how to fill this
st_rps_bits*/
//.........这里部分代码省略.........
示例4: CLAMP
bool VaapiDecoderVP8::fillPictureParam(const PicturePtr& picture)
{
int32_t i;
VAPictureParameterBufferVP8 *picParam = NULL;
if (!picture->editPicture(picParam))
return false;
/* Fill in VAPictureParameterBufferVP8 */
Vp8Segmentation *seg = &m_parser.segmentation;
/* Fill in VAPictureParameterBufferVP8 */
if (m_frameHdr.key_frame) {
if (m_frameHdr.horiz_scale_code || m_frameHdr.vert_scale_code)
WARNING
("horizontal_scale or vertical_scale in VP8 isn't supported yet");
}
picParam->frame_width = m_frameWidth;
picParam->frame_height = m_frameHeight;
if (m_frameHdr.key_frame) {
picParam->last_ref_frame = VA_INVALID_SURFACE;
picParam->golden_ref_frame = VA_INVALID_SURFACE;
picParam->alt_ref_frame = VA_INVALID_SURFACE;
} else {
picParam->last_ref_frame =
m_lastPicture ? m_lastPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->golden_ref_frame =
m_goldenRefPicture ? m_goldenRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->alt_ref_frame =
m_altRefPicture ? m_altRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
}
picParam->out_of_loop_frame = VA_INVALID_SURFACE; // not used currently
picParam->pic_fields.bits.key_frame = !m_frameHdr.key_frame;
picParam->pic_fields.bits.version = m_frameHdr.version;
picParam->pic_fields.bits.segmentation_enabled =
seg->segmentation_enabled;
picParam->pic_fields.bits.update_mb_segmentation_map =
seg->update_mb_segmentation_map;
picParam->pic_fields.bits.update_segment_feature_data =
seg->update_segment_feature_data;
picParam->pic_fields.bits.filter_type = m_frameHdr.filter_type;
picParam->pic_fields.bits.sharpness_level = m_frameHdr.sharpness_level;
picParam->pic_fields.bits.loop_filter_adj_enable =
m_parser.mb_lf_adjust.loop_filter_adj_enable;
picParam->pic_fields.bits.mode_ref_lf_delta_update =
m_parser.mb_lf_adjust.mode_ref_lf_delta_update;
picParam->pic_fields.bits.sign_bias_golden =
m_frameHdr.sign_bias_golden;
picParam->pic_fields.bits.sign_bias_alternate =
m_frameHdr.sign_bias_alternate;
picParam->pic_fields.bits.mb_no_coeff_skip =
m_frameHdr.mb_no_skip_coeff;
for (i = 0; i < 3; i++) {
picParam->mb_segment_tree_probs[i] = seg->segment_prob[i];
}
for (i = 0; i < 4; i++) {
int8_t level;
if (seg->segmentation_enabled) {
level = seg->lf_update_value[i];
if (!seg->segment_feature_mode)
level += m_frameHdr.loop_filter_level;
} else {
level = m_frameHdr.loop_filter_level;
}
picParam->loop_filter_level[i] = CLAMP(level, 0, 63);
picParam->loop_filter_deltas_ref_frame[i] =
m_parser.mb_lf_adjust.ref_frame_delta[i];
picParam->loop_filter_deltas_mode[i] =
m_parser.mb_lf_adjust.mb_mode_delta[i];
}
picParam->pic_fields.bits.loop_filter_disable =
m_frameHdr.loop_filter_level == 0;
picParam->prob_skip_false = m_frameHdr.prob_skip_false;
picParam->prob_intra = m_frameHdr.prob_intra;
picParam->prob_last = m_frameHdr.prob_last;
picParam->prob_gf = m_frameHdr.prob_gf;
memcpy (picParam->y_mode_probs, m_frameHdr.mode_probs.y_prob,
sizeof (m_frameHdr.mode_probs.y_prob));
memcpy (picParam->uv_mode_probs, m_frameHdr.mode_probs.uv_prob,
sizeof (m_frameHdr.mode_probs.uv_prob));
memcpy (picParam->mv_probs, m_frameHdr.mv_probs.prob,
sizeof (m_frameHdr.mv_probs));
picParam->bool_coder_ctx.range = m_frameHdr.rd_range;
picParam->bool_coder_ctx.value = m_frameHdr.rd_value;
picParam->bool_coder_ctx.count = m_frameHdr.rd_count;
return true;
}
示例5: CLAMP
bool VaapiDecoderVP8::fillPictureParam(const PicturePtr& picture)
{
int32_t i, n;
VAPictureParameterBufferVP8 *picParam = NULL;
if (!picture->editPicture(picParam))
return false;
/* Fill in VAPictureParameterBufferVP8 */
Vp8Segmentation *seg = &m_frameHdr.multi_frame_data->segmentation;
/* Fill in VAPictureParameterBufferVP8 */
if (m_frameHdr.key_frame == VP8_KEY_FRAME) {
if (m_frameHdr.horizontal_scale || m_frameHdr.vertical_scale)
WARNING
("horizontal_scale or vertical_scale in VP8 isn't supported yet");
}
picParam->frame_width = m_frameWidth;
picParam->frame_height = m_frameHeight;
if (m_frameHdr.key_frame == VP8_KEY_FRAME) {
picParam->last_ref_frame = VA_INVALID_SURFACE;
picParam->golden_ref_frame = VA_INVALID_SURFACE;
picParam->alt_ref_frame = VA_INVALID_SURFACE;
} else {
picParam->last_ref_frame =
m_lastPicture ? m_lastPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->golden_ref_frame =
m_goldenRefPicture ? m_goldenRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->alt_ref_frame =
m_altRefPicture ? m_altRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
}
picParam->out_of_loop_frame = VA_INVALID_SURFACE; // not used currently
picParam->pic_fields.bits.key_frame = m_frameHdr.key_frame;
picParam->pic_fields.bits.version = m_frameHdr.version;
picParam->pic_fields.bits.segmentation_enabled =
seg->segmentation_enabled;
picParam->pic_fields.bits.update_mb_segmentation_map =
seg->update_mb_segmentation_map;
picParam->pic_fields.bits.update_segment_feature_data =
seg->update_segment_feature_data;
picParam->pic_fields.bits.filter_type = m_frameHdr.filter_type;
picParam->pic_fields.bits.sharpness_level = m_frameHdr.sharpness_level;
picParam->pic_fields.bits.loop_filter_adj_enable =
m_frameHdr.multi_frame_data->mb_lf_adjust.loop_filter_adj_enable;
picParam->pic_fields.bits.mode_ref_lf_delta_update =
m_frameHdr.multi_frame_data->mb_lf_adjust.mode_ref_lf_delta_update;
picParam->pic_fields.bits.sign_bias_golden =
m_frameHdr.sign_bias_golden;
picParam->pic_fields.bits.sign_bias_alternate =
m_frameHdr.sign_bias_alternate;
picParam->pic_fields.bits.mb_no_coeff_skip =
m_frameHdr.mb_no_skip_coeff;
for (i = 0; i < 3; i++) {
picParam->mb_segment_tree_probs[i] = seg->segment_prob[i];
}
for (i = 0; i < 4; i++) {
if (seg->segmentation_enabled) {
picParam->loop_filter_level[i] = seg->lf_update_value[i];
if (!seg->segment_feature_mode) {
picParam->loop_filter_level[i] +=
m_frameHdr.loop_filter_level;
picParam->loop_filter_level[i] =
CLAMP(picParam->loop_filter_level[i], 0, 63);
}
} else
picParam->loop_filter_level[i] = m_frameHdr.loop_filter_level;
picParam->loop_filter_deltas_ref_frame[i] =
m_frameHdr.multi_frame_data->mb_lf_adjust.ref_frame_delta[i];
picParam->loop_filter_deltas_mode[i] =
m_frameHdr.multi_frame_data->mb_lf_adjust.mb_mode_delta[i];
}
picParam->pic_fields.bits.loop_filter_disable =
m_frameHdr.loop_filter_level == 0;
picParam->prob_skip_false = m_frameHdr.prob_skip_false;
picParam->prob_intra = m_frameHdr.prob_intra;
picParam->prob_last = m_frameHdr.prob_last;
picParam->prob_gf = m_frameHdr.prob_gf;
if (m_frameHdr.key_frame == VP8_KEY_FRAME) {
// key frame use fixed prob table
memcpy(picParam->y_mode_probs, keyFrameYModeProbs, 4);
memcpy(picParam->uv_mode_probs, keyFrameUVModeProbs, 3);
// prepare for next frame which may be not a key frame
memcpy(m_yModeProbs, nonKeyFrameDefaultYModeProbs, 4);
memcpy(m_uvModeProbs, nonKeyFrameDefaultUVModeProbs, 3);
} else {
if (m_frameHdr.intra_16x16_prob_update_flag) {
memcpy(picParam->y_mode_probs, m_frameHdr.intra_16x16_prob, 4);
} else {
memcpy(picParam->y_mode_probs, m_yModeProbs, 4);
//.........这里部分代码省略.........
示例6: CLAMP
bool VaapiDecoderVP8::fillPictureParam(const PicturePtr& picture)
{
uint32_t i;
VAPictureParameterBufferVP8 *picParam = NULL;
if (!picture->editPicture(picParam))
return false;
/* Fill in VAPictureParameterBufferVP8 */
Vp8SegmentationHeader *seg = &m_frameHdr.segmentation_hdr;
/* Fill in VAPictureParameterBufferVP8 */
if (m_frameHdr.key_frame == Vp8FrameHeader::KEYFRAME) {
if (m_frameHdr.horizontal_scale || m_frameHdr.vertical_scale)
WARNING
("horizontal_scale or vertical_scale in VP8 isn't supported yet");
}
picParam->frame_width = m_frameWidth;
picParam->frame_height = m_frameHeight;
if (m_frameHdr.key_frame == Vp8FrameHeader::KEYFRAME) {
picParam->last_ref_frame = VA_INVALID_SURFACE;
picParam->golden_ref_frame = VA_INVALID_SURFACE;
picParam->alt_ref_frame = VA_INVALID_SURFACE;
} else {
picParam->last_ref_frame =
m_lastPicture ? m_lastPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->golden_ref_frame =
m_goldenRefPicture ? m_goldenRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
picParam->alt_ref_frame =
m_altRefPicture ? m_altRefPicture->getSurfaceID() :
VA_INVALID_SURFACE;
}
picParam->out_of_loop_frame = VA_INVALID_SURFACE; // not used currently
picParam->pic_fields.bits.key_frame = (m_frameHdr.key_frame != Vp8FrameHeader::KEYFRAME);
picParam->pic_fields.bits.version = m_frameHdr.version;
picParam->pic_fields.bits.segmentation_enabled =
seg->segmentation_enabled;
picParam->pic_fields.bits.update_mb_segmentation_map =
seg->update_mb_segmentation_map;
picParam->pic_fields.bits.update_segment_feature_data =
seg->update_segment_feature_data;
picParam->pic_fields.bits.filter_type = m_frameHdr.loopfilter_hdr.type;
picParam->pic_fields.bits.sharpness_level = m_frameHdr.loopfilter_hdr.sharpness_level;
picParam->pic_fields.bits.loop_filter_adj_enable =
m_frameHdr.loopfilter_hdr.loop_filter_adj_enable;
picParam->pic_fields.bits.mode_ref_lf_delta_update =
m_frameHdr.loopfilter_hdr.mode_ref_lf_delta_update;
picParam->pic_fields.bits.sign_bias_golden =
m_frameHdr.sign_bias_golden;
picParam->pic_fields.bits.sign_bias_alternate =
m_frameHdr.sign_bias_alternate;
picParam->pic_fields.bits.mb_no_coeff_skip =
m_frameHdr.mb_no_skip_coeff;
//using arraysize as the real limit
for (i = 0; i < arraysize(seg->segment_prob); i++) {
picParam->mb_segment_tree_probs[i] = seg->segment_prob[i];
}
for (i = 0; i < arraysize(seg->lf_update_value); ++i) {
if (seg->segmentation_enabled) {
if (seg->segment_feature_mode !=
Vp8SegmentationHeader::FEATURE_MODE_ABSOLUTE){
seg->lf_update_value[i] +=
m_frameHdr.loopfilter_hdr.level;
}
picParam->loop_filter_level[i] = CLAMP(seg->lf_update_value[i], 0, 63);
} else
picParam->loop_filter_level[i] = CLAMP(m_frameHdr.loopfilter_hdr.level, 0, 63);
picParam->loop_filter_deltas_ref_frame[i] =
m_frameHdr.loopfilter_hdr.ref_frame_delta[i];
picParam->loop_filter_deltas_mode[i] =
m_frameHdr.loopfilter_hdr.mb_mode_delta[i];
}
picParam->pic_fields.bits.loop_filter_disable =
m_frameHdr.loopfilter_hdr.level == 0;
picParam->prob_skip_false = m_frameHdr.prob_skip_false;
picParam->prob_intra = m_frameHdr.prob_intra;
picParam->prob_last = m_frameHdr.prob_last;
picParam->prob_gf = m_frameHdr.prob_gf;
memcpy (picParam->y_mode_probs, m_frameHdr.entropy_hdr.y_mode_probs,
sizeof (m_frameHdr.entropy_hdr.y_mode_probs));
memcpy (picParam->uv_mode_probs, m_frameHdr.entropy_hdr.uv_mode_probs,
sizeof (m_frameHdr.entropy_hdr.uv_mode_probs));
memcpy (picParam->mv_probs, m_frameHdr.entropy_hdr.mv_probs,
sizeof (m_frameHdr.entropy_hdr.mv_probs));
picParam->bool_coder_ctx.range = m_frameHdr.bool_dec_range;
picParam->bool_coder_ctx.value = m_frameHdr.bool_dec_value;
picParam->bool_coder_ctx.count = m_frameHdr.bool_dec_count;
return true;
//.........这里部分代码省略.........