1 /* 2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved. 3 * 4 * This source code is subject to the terms of the BSD 2 Clause License and 5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License 6 * was not distributed with this source code in the LICENSE file, you can 7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open 8 * Media Patent License 1.0 was not distributed with this source code in the 9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent. 10 */ 11 12 #ifndef AOM_AV1_COMMON_TILE_COMMON_H_ 13 #define AOM_AV1_COMMON_TILE_COMMON_H_ 14 15 #include <stdbool.h> 16 17 #include "config/aom_config.h" 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 struct AV1Common; 24 struct SequenceHeader; 25 struct CommonTileParams; 26 27 #define DEFAULT_MAX_NUM_TG 1 28 29 typedef struct TileInfo { 30 int mi_row_start, mi_row_end; 31 int mi_col_start, mi_col_end; 32 int tile_row; 33 int tile_col; 34 } TileInfo; 35 36 // initializes 'tile->mi_(row|col)_(start|end)' for (row, col) based on 37 // 'cm->log2_tile_(rows|cols)' & 'cm->mi_(rows|cols)' 38 void av1_tile_init(TileInfo *tile, const struct AV1Common *cm, int row, 39 int col); 40 41 void av1_tile_set_row(TileInfo *tile, const struct AV1Common *cm, int row); 42 void av1_tile_set_col(TileInfo *tile, const struct AV1Common *cm, int col); 43 44 int av1_get_sb_rows_in_tile(const struct AV1Common *cm, const TileInfo *tile); 45 int av1_get_sb_cols_in_tile(const struct AV1Common *cm, const TileInfo *tile); 46 47 // Define tile maximum width and area 48 // There is no maximum height since height is limited by area and width limits 49 // The minimum tile width or height is fixed at one superblock 50 #define MAX_TILE_WIDTH (4096) // Max Tile width in pixels 51 #define MAX_TILE_AREA (4096 * 2304) // Maximum tile area in pixels 52 #if CONFIG_CWG_C013 53 #define MAX_TILE_AREA_LEVEL_7_AND_ABOVE (4096 * 4608) 54 #endif 55 56 // Gets the width and height (in units of MI_SIZE) of the tiles in a tile list. 57 // Returns true on success, false on failure. 58 bool av1_get_uniform_tile_size(const struct AV1Common *cm, int *w, int *h); 59 void av1_get_tile_limits(struct AV1Common *const cm); 60 void av1_calculate_tile_cols(const struct SequenceHeader *const seq_params, 61 int cm_mi_rows, int cm_mi_cols, 62 struct CommonTileParams *const tiles); 63 void av1_calculate_tile_rows(const struct SequenceHeader *const seq_params, 64 int cm_mi_rows, 65 struct CommonTileParams *const tiles); 66 67 // Checks if the minimum tile_width requirement is satisfied 68 int av1_is_min_tile_width_satisfied(const struct AV1Common *cm); 69 70 #ifdef __cplusplus 71 } // extern "C" 72 #endif 73 74 #endif // AOM_AV1_COMMON_TILE_COMMON_H_ 75