[FFmpeg-devel] [PATCH v2 2/2] avfilter: add vf_overlay_cuda

Timo Rothenpieler timo at rothenpieler.org
Thu Mar 19 16:41:01 EET 2020


On 19.03.2020 15:11, Yaroslav Pogrebnyak wrote:
> On 19.03.20 21:40, Timo Rothenpieler wrote:
> 
>> For what I'm aware, make_writable does not work on hardware frames.
>> And the nvdec hwaccel returns frames that are mapped device memory, 
>> and thus hard read-only.
>>
>> You will need to manually allocate output frames from the hw_frames_ctx.
> 
> Yes I see. So it seems we can safely remove this call.
> 
> Also, I was thinking that output frame allocation is not needed because 
> we can safely operate on input frame in-place saving extra memory 
> allocation and copy. It seems works well. Is it ok, or should we always 
> allocate output frame?
> 
> If removing call to av_frame_make_writable would be enough, I could send 
> updated patch then.
> 
> P.S. Also it just strange why it worked well with h264_cuvid.

h264_cuvid copies frames back to normal VRAM, and does not pass around 
mapped nvdec surfaces, like nvdec does.
Writing around in these is documented as disallowed.

You can call av_frame_is_writable() on the frame. If it returns true, 
it's safe to write into it. If it returns false, you have to allocate a 
new output frame.


More information about the ffmpeg-devel mailing list