[FFmpeg-devel] [PATCH] libavutil: AVEncodeInfo data structures
Juan De León
juandl at google.com
Mon Aug 12 21:25:59 EEST 2019
Pinging,
Any other opinions?
On Sat, Aug 10, 2019 at 2:22 AM Nicolas George <george at nsup.org> wrote:
> Lynne (12019-08-10):
> > >> +typedef struct AVEncodeInfoBlock{
> > >> + /**
> > >> + * Distance in luma pixels from the top-left corner of the
> visible frame
> > >> + * to the top-left corner of the block.
> > >> + * Can be negative if top/right padding is present on the coded
> frame.
> > >> + */
> > >> + int src_x, src_y;
> > >> + /**
> > >> + * Width and height of the block in luma pixels
> > >> + */
> > >> + int w, h;
> > >> + /**
> > >> + * Delta quantization index for the block
> > >> + */
> > >> + int delta_q;
> > >> +
> > >>
> > >> + uint8_t reserved[128];
> > >>
> > > What are these (this one and the one below) reserved fields for?
> >
> > For future extensions without breaking the API. Things like block type,
> prediction type, motion vectors, references, etc.
>
> I suspected as much. But remember that setting the size of reserved
> after fields are added will be very tricky: it requires taking into
> account alignment and padding in the structure.
>
> I think something like that might be easier to manage (and also use less
> memory right now):
>
> typedef struct AVEncodeInfoFrame {
> ...
> size_t blocks_offset;
> size_t block_size;
> }
>
> static inline AVEncodeInfoBlock *
> av_encode_info_block(AVEncodeInfoFrame *info, unsigned idx)
> {
> return (AVEncodeInfoBlock *)
> ((char *)info + info->blocks_offset +
> idx * info->block_size);
> }
>
> static inline AVEncodeInfoBlock *
> av_encode_info_block_next(AVEncodeInfoFrame *info, AVEncodeInfoBlock
> *block)
> {
> return (AVEncodeInfoBlock *)
> ((char *)block + info->block_size);
> }
>
> Regards,
>
> --
> Nicolas George
> _______________________________________________
> 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".
More information about the ffmpeg-devel
mailing list