[FFmpeg-devel] [PATCH] libavutil: AVEncodeInfo data structures
Nicolas George
george at nsup.org
Sat Aug 10 12:22:14 EEST 2019
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190810/6a6fcf3d/attachment.sig>
More information about the ffmpeg-devel
mailing list