static int dxva2_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->f.hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; // Wait for an I-frame before start decoding. Workaround for ATI UVD and UVD+ GPUs if (!h->got_first_iframe) { if (!(ctx_pic->pp.wBitFields & (1 << 15))) return -1; h->got_first_iframe = 1; } ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), commit_bitstream_and_slice_buffer); if (!ret) ff_h264_draw_horiz_band(h, 0, h->avctx->height); return ret; }
static int vdpau_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; H264Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; val = ff_vdpau_common_end_frame(avctx, &pic->f, pic_ctx); if (val < 0) return val; ff_h264_draw_horiz_band(h, 0, h->avctx->height); return 0; }
static int vdpau_h264_end_frame(AVCodecContext *avctx) { AVVDPAUContext *hwctx = avctx->hwaccel_context; H264Context *h = avctx->priv_data; VdpVideoSurface surf = ff_vdpau_get_surface_id(h->cur_pic_ptr); hwctx->render(hwctx->decoder, surf, (void *)&hwctx->info, hwctx->bitstream_buffers_used, hwctx->bitstream_buffers); ff_h264_draw_horiz_band(h, 0, h->avctx->height); hwctx->bitstream_buffers_used = 0; return 0; }
static int vdpau_h264_end_frame(AVCodecContext *avctx) { AVVDPAUContext *hwctx = avctx->hwaccel_context; H264Context *h = avctx->priv_data; Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpVideoSurface surf = ff_vdpau_get_surface_id(pic); hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); ff_h264_draw_horiz_band(h, 0, h->avctx->height); av_freep(&pic_ctx->bitstream_buffers); return 0; }
static int dxva2_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), commit_bitstream_and_slice_buffer); if (!ret) ff_h264_draw_horiz_band(h, 0, h->avctx->height); return ret; }
void ff_vdpau_h264_picture_complete(H264Context *h) { struct vdpau_render_state *render; render = (struct vdpau_render_state *)h->cur_pic_ptr->f.data[0]; assert(render); render->info.h264.slice_count = h->slice_num; if (render->info.h264.slice_count < 1) return; render->info.h264.is_reference = (h->cur_pic_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE; render->info.h264.field_pic_flag = h->picture_structure != PICT_FRAME; render->info.h264.bottom_field_flag = h->picture_structure == PICT_BOTTOM_FIELD; render->info.h264.num_ref_frames = h->sps.ref_frame_count; render->info.h264.mb_adaptive_frame_field_flag = h->sps.mb_aff && !render->info.h264.field_pic_flag; render->info.h264.constrained_intra_pred_flag = h->pps.constrained_intra_pred; render->info.h264.weighted_pred_flag = h->pps.weighted_pred; render->info.h264.weighted_bipred_idc = h->pps.weighted_bipred_idc; render->info.h264.frame_mbs_only_flag = h->sps.frame_mbs_only_flag; render->info.h264.transform_8x8_mode_flag = h->pps.transform_8x8_mode; render->info.h264.chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; render->info.h264.second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; render->info.h264.pic_init_qp_minus26 = h->pps.init_qp - 26; render->info.h264.num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1; render->info.h264.num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1; render->info.h264.log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; render->info.h264.pic_order_cnt_type = h->sps.poc_type; render->info.h264.log2_max_pic_order_cnt_lsb_minus4 = h->sps.poc_type ? 0 : h->sps.log2_max_poc_lsb - 4; render->info.h264.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; render->info.h264.direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; render->info.h264.entropy_coding_mode_flag = h->pps.cabac; render->info.h264.pic_order_present_flag = h->pps.pic_order_present; render->info.h264.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; render->info.h264.redundant_pic_cnt_present_flag = h->pps.redundant_pic_cnt_present; memcpy(render->info.h264.scaling_lists_4x4, h->pps.scaling_matrix4, sizeof(render->info.h264.scaling_lists_4x4)); memcpy(render->info.h264.scaling_lists_8x8[0], h->pps.scaling_matrix8[0], sizeof(render->info.h264.scaling_lists_8x8[0])); memcpy(render->info.h264.scaling_lists_8x8[1], h->pps.scaling_matrix8[3], sizeof(render->info.h264.scaling_lists_8x8[0])); ff_h264_draw_horiz_band(h, 0, h->avctx->height); render->bitstream_buffers_used = 0; }
/** End a hardware decoding based frame. */ static int vaapi_h264_end_frame(AVCodecContext *avctx) { struct vaapi_context * const vactx = avctx->hwaccel_context; H264Context * const h = avctx->priv_data; int ret; av_dlog(avctx, "vaapi_h264_end_frame()\n"); ret = ff_vaapi_commit_slices(vactx); if (ret < 0) goto finish; ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(h->cur_pic_ptr)); if (ret < 0) goto finish; ff_h264_draw_horiz_band(h, 0, h->avctx->height); finish: ff_vaapi_common_end_frame(avctx); return ret; }
/** End a hardware decoding based frame. */ static int vaapi_h264_end_frame(AVCodecContext *avctx) { FFVAContext * const vactx = ff_vaapi_get_context(avctx); H264Context * const h = avctx->priv_data; H264SliceContext *sl = &h->slice_ctx[0]; int ret; ret = ff_vaapi_commit_slices(vactx); if (ret < 0) goto finish; ret = ff_vaapi_render_picture(vactx, ff_vaapi_get_surface_id(h->cur_pic_ptr->f)); if (ret < 0) goto finish; ff_h264_draw_horiz_band(h, sl, 0, h->avctx->height); finish: ff_vaapi_common_end_frame(avctx); return ret; }
static int vdpau_h264_end_frame(AVCodecContext *avctx) { int res = 0; AVVDPAUContext *hwctx = avctx->hwaccel_context; H264Context *h = avctx->priv_data; H264Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f); #if FF_API_BUFS_VDPAU FF_DISABLE_DEPRECATION_WARNINGS hwctx->info = pic_ctx->info; hwctx->bitstream_buffers = pic_ctx->bitstream_buffers; hwctx->bitstream_buffers_used = pic_ctx->bitstream_buffers_used; hwctx->bitstream_buffers_allocated = pic_ctx->bitstream_buffers_allocated; FF_ENABLE_DEPRECATION_WARNINGS #endif if (!hwctx->render) { res = hwctx->render2(avctx, &pic->f, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); } else hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info, pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers); ff_h264_draw_horiz_band(h, 0, h->avctx->height); av_freep(&pic_ctx->bitstream_buffers); #if FF_API_BUFS_VDPAU FF_DISABLE_DEPRECATION_WARNINGS hwctx->bitstream_buffers = NULL; hwctx->bitstream_buffers_used = 0; hwctx->bitstream_buffers_allocated = 0; FF_ENABLE_DEPRECATION_WARNINGS #endif return res; }