[FFmpeg-devel] [PATCH] Optimization: support for libx264's mb_info

Carotti, Elias eliascrt at amazon.it
Mon May 29 20:56:55 EEST 2023


Hi Stefano, hi all,
please find the updated patch according to the suggestions. Now it is
possible to specify whether the rectangles refer to the part we want to
hint as P_SKIP or to the rest portion of the frame.
Best,
Elias
 


On Mon, 2023-05-22 at 09:19 +0000, Carotti, Elias wrote:
> Hi Stefano,
> thanks for checking the patch.
> Please find it attached in the required format.
> Best,
> Elias
> 
> 
> On Mon, 2023-05-22 at 01:17 +0200, Stefano Sabatini 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.
> > 
> > 
> > 
> > On date Friday 2023-05-19 10:19:03 +0000, Carotti, Elias wrote:
> > > 
> > > Hi again,
> > > I am sending this patch again (I had missed a check for NULL),
> > > could
> > > somebody please have a look at it?
> > > 
> > > It is mainly an optimization when the encoder knows in advance
> > > that
> > > only portions of the whole frame changed and which areas actually
> > > did.
> > > 
> > > The patch allows a user to pass down information to libx264
> > > information
> > > about which parts of a frame changed (with respect to the
> > > preceding
> > > one) to be exploited as a hint for P_SKIP-ing macroblocks which
> > > didn't
> > > change.
> > > This information is encoded in the mb_info field of the
> > > x264_param_t
> > > much like the quant_offsets which are already used for the
> > > AV_FRAME_DATA_REGIONS_OF_INTEREST side information.
> > 
> > Please send a git format-patch (complete with commit log
> > information)
> > to simplify integration.
> > 
> > [...]
> > > diff --git a/libavutil/mb_info.h b/libavutil/mb_info.h
> > > new file mode 100644
> > > index 0000000000..918cf167aa
> > > --- /dev/null
> > > +++ b/libavutil/mb_info.h
> > > @@ -0,0 +1,46 @@
> > [...]
> > > +#ifndef AVUTIL_MB_INFO_H
> > > +#define AVUTIL_MB_INFO_H
> > > +
> > > +#include <stddef.h>
> > > +#include <stdint.h>
> > > +#include "libavutil/avassert.h"
> > > +#include "libavutil/frame.h"
> > > +
> > 
> > > +typedef struct _AVMBInfoRect {
> > 
> > nit: strip the _ before the struct name
> > 
> > > +    uint32_t x, y;
> > > +    uint32_t width, height;
> > > +} AVMBInfoRect;
> > > +
> > > +/**
> > > + * Allocate memory for a vector of AVMBInfoRect in the given
> > > AVFrame
> > > + * {@code frame} as AVFrameSideData of type
> > > AV_FRAME_DATA_MB_INFO.
> > 
> > > + * The side data contains a list of rectangles for the portions
> > > of
> > > the frame
> > > + * which changed from the last encoded one. The rest will be
> > > hinted to be
> > > + * P_SKIP-ped.  Portions of the rects which are not on
> > > macroblock
> > > boundaries
> > > + * are not handled as P_SKIPS.
> > > + */
> > 
> > > +AVMBInfoRect *av_mb_info_create_side_data(AVFrame *frame,
> > > +                                          AVMBInfoRect *rects,
> > > +                                          size_t num_rects);
> > 
> > Probably this can be generalized with a flag defining the hinting
> > type
> > (you might want either to specify the constant or non-constant
> > rects),
> > in fact this data is pretty macro-block agnostic.
> > 
> > What about AVVideoHintInfo containing a hint (CONSTANT, VARIANT)
> > and
> > a
> > list of rects?
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 
> 
> 
> 
> 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
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".




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-Add-support-for-libx264-s-MB_INFO.patch
Type: text/x-patch
Size: 15021 bytes
Desc: 0001-Add-support-for-libx264-s-MB_INFO.patch
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230529/e39c8885/attachment.bin>


More information about the ffmpeg-devel mailing list