[FFmpeg-devel] [PATCH 2/4 v6] avformat: add a Tile Grid stream group type

James Almer jamrial at gmail.com
Wed Jan 31 20:21:20 EET 2024


On 1/31/2024 3:08 PM, Andreas Rheinhardt wrote:
> James Almer:
>> This will be used to support tiled image formats like HEIF.
>>
>> Signed-off-by: James Almer<jamrial at gmail.com>
>> ---
>>   libavformat/avformat.c |   5 +++
>>   libavformat/avformat.h | 100 +++++++++++++++++++++++++++++++++++++++++
>>   libavformat/dump.c     |  29 ++++++++++++
>>   libavformat/options.c  |  32 +++++++++++++
>>   4 files changed, 166 insertions(+)
>>
>> diff --git a/libavformat/avformat.c b/libavformat/avformat.c
>> index 8e8c6fbe55..32ef440207 100644
>> --- a/libavformat/avformat.c
>> +++ b/libavformat/avformat.c
>> @@ -100,6 +100,11 @@ void ff_free_stream_group(AVStreamGroup **pstg)
>>           av_iamf_mix_presentation_free(&stg->params.iamf_mix_presentation);
>>           break;
>>       }
>> +    case AV_STREAM_GROUP_PARAMS_TILE_GRID:
>> +        av_opt_free(stg->params.tile_grid);
>> +        av_freep(&stg->params.tile_grid->offsets);
>> +        av_freep(&stg->params.tile_grid);
>> +        break;
>>       default:
>>           break;
>>       }
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index 5d0fe82250..6577f13ef1 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -1018,10 +1018,109 @@ typedef struct AVStream {
>>       int pts_wrap_bits;
>>   } AVStream;
>>   
>> +/**
>> + * AVStreamGroupTileGrid holds information on how to combine several
>> + * independent images on a single grid for presentation. None of the tiles may
>> + * overlap inside the grid.
>> + *
>> + * The following is an example of a simple grid with 3 rows and 4 columns:
>> + *
>> + * +---+---+---+---+
>> + * | 0 | 1 | 2 | 3 |
>> + * +---+---+---+---+
>> + * | 4 | 5 | 6 | 7 |
>> + * +---+---+---+---+
>> + * | 8 | 9 |10 |11 |
>> + * +---+---+---+---+
>> + *
>> + * Assuming all tiles have a dimension of 512x512, the
>> + * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
>> + * the first @ref AVStreamGroup.streams "stream" in the group is "0,0", the
>> + * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
>> + * the second @ref AVStreamGroup.streams "stream" in the group is "512,0", the
>> + * @ref AVStreamGroupTileGrid.offsets "offset" of the topleft pixel of
>> + * the fifth @ref AVStreamGroup.streams "stream" in the group is "0,512", the
>> + * @ref AVStreamGroupTileGrid.offsets "offset", of the topleft pixel of
>> + * the sixth @ref AVStreamGroup.streams "stream" in the group is "512,512",
>> + * etc.
>> + *
>> + * sizeof(AVStreamGroupTileGrid) is not a part of the ABI. No new fields may be
>> + * added to this struct without a major version bump.
> This is inconsistent. I think you mean that sizeof is part of the ABI.

No? It's not a part of the ABI because AVStreamGroupTileGrid must not be 
ever used on stack, or allocated by anything other than AVStreamGroup.
That way we can add fields to it without waiting for a major bump.


More information about the ffmpeg-devel mailing list