[FFmpeg-devel] [PATCH] Optimization: support for libx264's mb_info
Carotti, Elias
eliascrt at amazon.it
Fri Jun 30 20:40:51 EEST 2023
On Wed, 2023-06-28 at 14:55 +0200, Anton Khirnov wrote:
> CAUTION: This email originated from outside of the organization. Do
> not click links or open attachments unless you can confirm the sender
> and know the content is safe.
>
>
>
> Quoting Carotti, Elias (2023-06-26 11:50:59)
> > We can do whatever you want. However I am not clear on how that<br>
> > would work.
> >
> > We could have a side data creation api with the standard parameters
> > and
> > another method to allocate memory so that ownership is kept by
> > libavutil returns a pointer to the rectangles (with bounds checking
> > and
> > so on on the caller):
> >
> >
> >
> > av_video_hint_create_side_data(AVFrame *frame, AVVideoHintType
> > type);
> >
> > AVVideoRect* av_video_hint_set_number_of_rectangles(
> > AVVideoHint *video_hint,
> > size_t n_rects,
> > AVVideoHintType
> > changed_flag);
> > (Names can change I just want to convey a possible api).
> >
> > Would that work for you?
> >
> > Or, do you prefer a creation api which already allocates memory and
> > sets the number of rectangles but doesn't copy them and that's
> > responsibility on the caller?
> > What I'd like in this latter case is that (like now) memory would
> > be
> > flat with no need for specific custom deallocators.
> > Something along the lines:
> >
> >
> > AVVideoHint *av_video_hint_create_side_data(AVFrame *frame,
> > size_t n_rects,
> > AVVideoHintType type);
> >
> > AVVideoRect *av_video_hint_get_rects(AVVideoHint *video_hint);
> >
> >
> > Third option: side information creation api and the caller has to
> > alloc/realloc the rectangle buffer and hand out ownership to
> > libavutil,
> > but I guess this is the worst one for various reasons.
> >
> > I do not see any further option.
>
> What I'm proposing is this:
> AVVideoHint *av_video_hint_create_side_data(AVFrame *frame, size_t
> num_rects);
> AVVideoHint *av_video_hint_alloc(size_t nb_rects, size_t *out_size);
>
> The caller filles the type and the rectangles manually.
>
I implemented the changes, I hope it is better now. The libavcodec part
remains unchanged and only this part was affected by the change.
Best,
Elias
> > > AVVideoEncParams describes the block-level parameters of an
> > > encoded
<snip>
> > code.
>
> Ok, I see your point and drop my objection.
NICE SRL, viale Monte Grappa 3/5, 20124 Milano, Italia, Registro delle Imprese di Milano Monza Brianza Lodi REA n. 2096882, Capitale Sociale: 10.329,14 EUR i.v., Cod. Fisc. e P.IVA 01133050052, Societa con Socio Unico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-add-AVVideoHint-API.patch
Type: text/x-patch
Size: 9727 bytes
Desc: 0001-lavu-add-AVVideoHint-API.patch
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230630/1ee949b5/attachment.bin>
More information about the ffmpeg-devel
mailing list