On 2017/8/1 17:25, Luca Barbato wrote:
On 01/08/2017 08:10, Huang, Zhengxu wrote:
On 2017/7/31 19:41, Luca Barbato wrote:
On 31/07/2017 03:25, Huang, Zhengxu wrote:
After a first quick read I couldn't spot any specific problem, but I'm
wondering if at least some of that code couldn't avoided using the
device_derive functionality in hwcontext.
Thanks so much for your review, Luca.
Can you explain in more detail about the "using the device_derive" issue
? , ^_^ .
So I can check and modify the code much better. Thanks.
Basically I was wondering if using av_hwdevice_ctx_create_derived would
work for your purpose and shorten init_vpp_session.
In order to support not only video memory/opaque mode but also system
mode(in case inserting sw filter in the pipeline )
So the init_vpp_session function code is much longer.
If we use the *av_hwframe_ctx_create_derived* to replace the follow code
in init_vpp_session(If I correctly understand your meaning
because I can't find where to use the *av_hwdevice_ctx_create_derived*)
/ AVHWFramesContext *out_frames_ctx;
AVBufferRef *out_frames_ref = av_hwframe_ctx_alloc(device_ref);
if (!out_frames_ref)
return AVERROR(ENOMEM);
out_frames_ctx = (AVHWFramesContext*)out_frames_ref->data;
out_frames_hwctx = out_frames_ctx->hwctx;
out_frames_ctx->format = AV_PIX_FMT_QSV;
out_frames_ctx->width = FFALIGN(outlink->w, 32);
out_frames_ctx->height = FFALIGN(outlink->h, 32);
out_frames_ctx->sw_format = s->out_sw_format;
out_frames_ctx->initial_pool_size = 64;
out_frames_hwctx->frame_type = in_frames_hwctx->frame_type;
s->out_mem_mode = s->in_mem_mode;
ret = av_hwframe_ctx_init(out_frames_ref);
if (ret < 0) {
av_buffer_unref(&out_frames_ref);
av_log(avctx, AV_LOG_ERROR, "Error creating frames_ctx for
output pad.\n");
return ret;
}/
It maybe will have some problem. Because the derived hwctx must have the
same width and height with the src. But
there maybe scale or crop in the vpp.
lu
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel