[FFmpeg-devel] [PATCH 1/3] avutil/frame: add use_last_roi

Guo, Yejun yejun.guo at intel.com
Tue Feb 18 05:06:28 EET 2020



> -----Original Message-----
> From: Guo, Yejun
> Sent: Tuesday, February 18, 2020 10:35 AM
> To: Guo, Yejun <yejun.guo at intel.com>
> Subject: RE: [FFmpeg-devel] [PATCH 1/3] avutil/frame: add use_last_roi
> 
> 
> 
> From: Ronald S. Bultje [mailto:rsbultje at gmail.com]
> Sent: Friday, February 14, 2020 11:02 PM
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Cc: Guo, Yejun <yejun.guo at intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH 1/3] avutil/frame: add use_last_roi
> 
> Hi,
> 
>> On Thu, Feb 13, 2020 at 10:41 PM Guo, Yejun <yejun.guo at intel.com> wrote:
>> For some cases, the regions of interest do not change, it is not
>> convenient to always prepare the roi data for every frame.
> 
> Since side-data is refcounted, can't you just keep the "last" one in memory and
> refcount it? That way, if you wanted to know if it's the same, you can compare
> pointers, or if you want to access the ROI data directly, you can do that, but it
> doesn't require a copy.
> 
> Ronald

Thanks Ronald, yes, the application developers can 'cache' the last 'AVBufferRef *' of
the roi side-data, so they don't need to prepare the same side-data for every frame, just
pass 'AVBufferRef*' to side-data. So, we don't need to add use_last_roi in AVFrame.

The only difference is that we need to re-calculate rois for encoders within ffmpeg, we
can optimize it with your method if it is found to be a bottle neck.


More information about the ffmpeg-devel mailing list