On 8/24/2020 5:39 AM, Wang, Fei W wrote:
>>> +static int get_tiles_info(AVCodecContext *avctx,
>>> +                          AV1RawTileGroup *tile_group,
>>> +                          uint32_t tile_group_offset) {
>>> +    AV1DecContext *s = avctx->priv_data;
>>> +    GetBitContext gb;
>>> +    uint16_t tile_num, tile_row, tile_col;
>>> +    uint16_t mi_cols, mi_rows, sb_cols, sb_rows, tile_width_sb, 
>>> tile_height_sb;
>>> +    uint32_t size = 0, size_bytes = 0, offset = 0;
>>> +    int ret = 0;
>>> +
>>> +    if ((ret = init_get_bits8(&gb,
>>> +                              tile_group->tile_data.data,
>>> +                              tile_group->tile_data.data_size)) < 0) {
>>> +        av_log(avctx, AV_LOG_ERROR, "Fail to initialize bitstream 
>>> reader.\n");
>>> +        return ret;
>>> +    }
>>> +
>>> +    s->tg_start = tile_group->tg_start;
>>> +    s->tg_end = tile_group->tg_end;
>>> +
>>> +    if (s->raw_frame_header.uniform_tile_spacing_flag) {
>>> +        mi_cols = 2 * ((s->raw_seq.max_frame_width_minus_1 + 8) >> 3);
>>> +        mi_rows = 2 * ((s->raw_seq.max_frame_height_minus_1 + 8) >> 3);
>>> +        sb_cols = s->raw_seq.use_128x128_superblock ? ((mi_cols + 31) >> 5)
>>> +                                                    : ((mi_cols + 15) >> 
>>> 4);
>>> +        sb_rows = s->raw_seq.use_128x128_superblock ? ((mi_rows + 31) >> 5)
>>> +                                                    : ((mi_rows + 15) >> 
>>> 4);
>>> +        tile_width_sb = (sb_cols + (1 << 
>>> s->raw_frame_header.tile_cols_log2)
>>> +                         -1) >> s->raw_frame_header.tile_cols_log2;
>>> +        tile_height_sb = (sb_rows + (1 << 
>>> s->raw_frame_header.tile_rows_log2)
>>> +                         -1) >> s->raw_frame_header.tile_rows_log2;
>> Maybe cbs read should always fill the width/height_in_sbs arrays so that all 
>> the
>> special casing for uniform_spacing_flag in this function isn't needed?  It 
>> would
>> be trivial to add it there.
> @James Almer, how do you think of this? Currently, cbs_av1 read 
> width/height_in_sbs_minus_1 directly from bitstream. But if 
> uniform_spacing_flag is 1,
> the 2 values may need some calculation like here does.

Mark suggested a solution in the form of a patch as a reply to his own
email in this same thread.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to